Completed
Push — master ( 54c225...de7e29 )
by Yannick
06:07
created
index.php 1 patch
Indentation   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -36,12 +36,12 @@  discard block
 block discarded – undo
36 36
 <div id="showdetails" class="showdetails"></div>
37 37
 <div id="infobox" class="infobox"><h4><?php echo _("Aircrafts detected"); ?></h4><br /><i class="fa fa-spinner fa-pulse fa-fw"></i></div>
38 38
 <?php
39
-    if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
39
+	if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
40 40
 
41 41
 ?>
42 42
 <script src="<?php echo $globalURL; ?>/js/map.3d.js.php"></script>
43 43
 <?php
44
-    }
44
+	}
45 45
 ?>
46 46
 <div id="dialog" title="<?php echo _("Session has timed-out"); ?>">
47 47
   <p><?php echo _("In order to save data consumption web page times out after 30 minutes. Close this dialog to continue."); ?></p>
@@ -55,34 +55,34 @@  discard block
 block discarded – undo
55 55
 	<li><a href="#" onclick="getUserLocation(); return false;" title="<?php echo _("Plot your Location"); ?>"><i class="fa fa-map-marker"></i></a></li>
56 56
 	<li><a href="#" onclick="getCompassDirection(); return false;" title="<?php echo _("Compass Mode"); ?>"><i class="fa fa-compass"></i></a></li>
57 57
 <?php
58
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
58
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
59 59
 	if (isset($globalArchive) && $globalArchive == TRUE) {
60 60
 ?>
61 61
 	<li><a href="#archive" role="tab" title="<?php echo _("Archive"); ?>"><i class="fa fa-archive"></i></a></li>
62 62
 <?php
63 63
 	}
64
-    }
64
+	}
65 65
 ?>
66 66
 	<li><a href="#home" role="tab" title="<?php echo _("Layers"); ?>"><i class="fa fa-map"></i></a></li>
67 67
 	<li><a href="#filters" role="tab" title="<?php echo _("Filters"); ?>"><i class="fa fa-filter"></i></a></li>
68 68
 	<li><a href="#settings" role="tab" title="<?php echo _("Settings"); ?>"><i class="fa fa-gears"></i></a></li>
69 69
 <?php
70
-    if (isset($globalMap3D) && $globalMap3D) {
70
+	if (isset($globalMap3D) && $globalMap3D) {
71 71
 	if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
72 72
 ?>
73 73
 	<li><a href="#" onclick="show3D(); return false;" role="tab" title="3D"><b>3D</b></a></li>
74 74
 <?php
75
-        } else {
76
-    	    if (isset($globalMapSatellites) && $globalMapSatellites) {
75
+		} else {
76
+			if (isset($globalMapSatellites) && $globalMapSatellites) {
77 77
 ?>
78 78
 	<li><a href="#satellites" role="tab" title="<?php echo _("Satellites"); ?>"><i class="satellite"></i></a></li>
79 79
 <?php
80
-	    }
80
+		}
81 81
 ?>
82 82
 	<li><a href="#" onclick="show2D(); return false;" role="tab" title="2D"><b>2D</b></a></li>
83 83
 <?php
84 84
 	}
85
-    }
85
+	}
86 86
 ?>
87 87
     </ul>
88 88
 
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 ?>
157 157
         </div>
158 158
 <?php
159
-    if (isset($globalArchive) && $globalArchive == TRUE) {
159
+	if (isset($globalArchive) && $globalArchive == TRUE) {
160 160
 ?>
161 161
         <div class="sidebar-pane" id="archive">
162 162
 	    <h1 class="sidebar-header"><?php echo _("Playback"); ?> <i>Bêta</i><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 	    </form>
217 217
 	</div>
218 218
 <?php
219
-    }
219
+	}
220 220
 ?>
221 221
         <div class="sidebar-pane" id="settings">
222 222
 	    <h1 class="sidebar-header"><?php echo _("Settings"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
@@ -227,56 +227,56 @@  discard block
 block discarded – undo
227 227
 			    <?php
228 228
 				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider;
229 229
 				else $MapType = $_COOKIE['MapType'];
230
-			    ?>
230
+				?>
231 231
 			    <?php
232 232
 				if (isset($globalBingMapKey) && $globalBingMapKey != '') {
233
-			    ?>
233
+				?>
234 234
 			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option>
235 235
 			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option>
236 236
 			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option>
237 237
 			    <?php
238 238
 				}
239
-			    ?>
239
+				?>
240 240
 			    <?php
241
-			        if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
242
-			    ?>
241
+					if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
242
+				?>
243 243
 			    <?php
244
-				    if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
245
-			    ?>
244
+					if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
245
+				?>
246 246
 			    <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option>
247 247
 			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option>
248 248
 			    <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option>
249 249
 			    <?php
250
-				    }
251
-			    ?>
250
+					}
251
+				?>
252 252
 			    <?php
253
-				    if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
254
-			    ?>
253
+					if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
254
+				?>
255 255
 			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option>
256 256
 			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option>
257 257
 			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option>
258 258
 			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option>
259 259
 			    <?php
260
-				    }
261
-			    ?>
260
+					}
261
+				?>
262 262
 			    <?php
263
-				    if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
264
-			    ?>
263
+					if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
264
+				?>
265 265
 			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option>
266 266
 			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option>
267 267
 			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option>
268 268
 			    <?php
269
-				    }
270
-			    ?>
269
+					}
270
+				?>
271 271
 			    <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option>
272 272
 			    <?php
273 273
 				}
274
-			    ?>
274
+				?>
275 275
 			    <?php
276
-				    if (isset($globalMapboxToken) && $globalMapboxToken != '') {
276
+					if (isset($globalMapboxToken) && $globalMapboxToken != '') {
277 277
 					if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default';
278 278
 					else $MapBoxId = $_COOKIE['MapTypeId'];
279
-			    ?>
279
+				?>
280 280
 			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option>
281 281
 			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option>
282 282
 			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option>
@@ -290,13 +290,13 @@  discard block
 block discarded – undo
290 290
 			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option>
291 291
 			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option>
292 292
 			    <?php
293
-				    }
294
-			    ?>
293
+					}
294
+				?>
295 295
 			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option>
296 296
 			</select>
297 297
 		    </li>
298 298
 <?php
299
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
299
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
300 300
 ?>
301 301
 		    <li><?php echo _("Type of Terrain:"); ?>
302 302
 			<select  class="selectpicker" onchange="terrainType(this);">
@@ -306,10 +306,10 @@  discard block
 block discarded – undo
306 306
 			</select>
307 307
 		    </li>
308 308
 <?php
309
-    }
309
+	}
310 310
 ?>
311 311
 <?php
312
-    if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
312
+	if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
313 313
 ?>
314 314
 		    
315 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>
@@ -317,54 +317,54 @@  discard block
 block discarded – undo
317 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 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>
319 319
 <?php
320
-    }
320
+	}
321 321
 ?>
322 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>
323 323
 <?php
324
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
324
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
325 325
 ?>
326 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>
327 327
 <?php
328
-    }
328
+	}
329 329
 ?>
330 330
 
331 331
 		    <?php
332 332
 			if (function_exists('array_column')) {
333
-			    if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
334
-		    ?>
333
+				if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
334
+			?>
335 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>
336 336
 		    <?php
337
-			    }
337
+				}
338 338
 			} elseif (isset($globalSources)) {
339
-			    $dispolar = false;
340
-			    foreach ($globalSources as $testsource) {
341
-			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
342
-			    }
343
-			    if ($dispolar) {
344
-		    ?>
339
+				$dispolar = false;
340
+				foreach ($globalSources as $testsource) {
341
+					if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
342
+				}
343
+				if ($dispolar) {
344
+			?>
345 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>
346 346
 		    <?php
347
-			    }
348
-		        }
349
-		    ?>
347
+				}
348
+				}
349
+			?>
350 350
 <?php
351
-    if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
351
+	if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
352 352
 ?>
353 353
 
354 354
 		    <?php
355
-		        if (extension_loaded('gd') && function_exists('gd_info')) {
356
-		    ?>
355
+				if (extension_loaded('gd') && function_exists('gd_info')) {
356
+			?>
357 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>
358 358
 		    <?php 
359 359
 			if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') {
360
-		    ?>
360
+			?>
361 361
 		    <li><?php echo _("Aircraft icon color:"); ?>
362 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'; ?>">
363 363
 		    </li>
364 364
 		    <?php
365
-			    }
366
-		        }
367
-		    ?>
365
+				}
366
+				}
367
+			?>
368 368
 		    <li><?php echo _("Show airport icon at zoom level:"); ?>
369 369
 			<div class="range">
370 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'; ?>">
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
 			</div>
373 373
 		    </li>
374 374
 <?php
375
-    }
375
+	}
376 376
 ?>
377 377
 		    <li><?php echo _("Distance unit:"); ?>
378 378
 			<select class="selectpicker" onchange="unitdistance(this);">
@@ -405,16 +405,16 @@  discard block
 block discarded – undo
405 405
 		    <ul>
406 406
 		    <?php
407 407
 			if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) {
408
-		    ?>
408
+			?>
409 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 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 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 } ?>
412 412
 		    <?php
413 413
 			}
414
-		    ?>
414
+			?>
415 415
 		    <?php
416 416
 			if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) {
417
-		    ?>
417
+			?>
418 418
 			<?php if (isset($globalSBS1) && $globalSBS1) { ?>
419 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>
420 420
 			<?php } ?>
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
 			<?php } ?>
424 424
 		    <?php
425 425
 			}
426
-		    ?>
426
+			?>
427 427
 		    <li><?php echo _("Display airlines:"); ?>
428 428
 		    <br/>
429 429
 			<select class="selectpicker" multiple onchange="airlines(this);" id="display_airlines">
@@ -438,12 +438,12 @@  discard block
 block discarded – undo
438 438
 						echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>';
439 439
 					}
440 440
 				}
441
-			    ?>
441
+				?>
442 442
 			</select>
443 443
 		    </li>
444 444
 		    <?php
445 445
 			if (isset($globalAPRS) && $globalAPRS) {
446
-		    ?>
446
+			?>
447 447
 		    <li><?php echo _("Display APRS sources name:"); ?>
448 448
 			<select class="selectpicker" multiple onchange="sources(this);">
449 449
 			    <?php
@@ -455,15 +455,15 @@  discard block
 block discarded – undo
455 455
 						echo '<option value="'.$source['source_name'].'">'.$source['source_name'].'</option>';
456 456
 					}
457 457
 				}
458
-			    ?>
458
+				?>
459 459
 			</select>
460 460
 		    </li>
461 461
 		    <?php
462 462
 			}
463
-		    ?>
463
+			?>
464 464
 		    <?php
465 465
 			if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS)) {
466
-		    ?>
466
+			?>
467 467
 		    <li><?php echo _("Display airlines of type:"); ?><br/>
468 468
 			<select class="selectpicker" onchange="airlinestype(this);">
469 469
 			    <option value="all"<?php if (!isset($_COOKIE['airlinestype']) || $_COOKIE['airlinestype'] == 'all' || $_COOKIE['airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
 		    </li>
475 475
 		    <?php
476 476
 			}
477
-		    ?>
477
+			?>
478 478
 		    <li>
479 479
 			<?php echo _("Display flight with ident:"); ?>
480 480
 			<input type="text" name="identfilter" id="identfilter" value="<?php if (isset($_COOKIE['identfilter'])) print $_COOKIE['identfilter']; ?>" />
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
 	    </form>
488 488
     	</div>
489 489
 <?php
490
-    if (isset($globalMapSatellites) && $globalMapSatellites && isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
490
+	if (isset($globalMapSatellites) && $globalMapSatellites && isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
491 491
 ?>
492 492
         <div class="sidebar-pane" id="satellites">
493 493
 	    <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
@@ -527,14 +527,14 @@  discard block
 block discarded – undo
527 527
 						print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>';
528 528
 					}
529 529
 				}
530
-			    ?>
530
+				?>
531 531
 			</select>
532 532
 		    </li>
533 533
 		</ul>
534 534
 	    </form>
535 535
 	</div>
536 536
 <?php
537
-    }
537
+	}
538 538
 ?>
539 539
     </div>
540 540
 </div>
Please login to merge, or discard this patch.
require/class.METAR.php 1 patch
Indentation   +263 added lines, -263 removed lines patch added patch discarded remove patch
@@ -7,109 +7,109 @@  discard block
 block discarded – undo
7 7
 	public $db;
8 8
 	
9 9
 	protected $texts = Array(
10
-	    'MI' => 'Shallow',
11
-	    'PR' => 'Partial',
12
-	    'BC' => 'Low drifting',
13
-	    'BL' => 'Blowing',
14
-	    'SH' => 'Showers',
15
-	    'TS' => 'Thunderstorm',
16
-	    'FZ' => 'Freezing',
17
-	    'DZ' => 'Drizzle',
18
-	    'RA' => 'Rain',
19
-	    'SN' => 'Snow',
20
-	    'SG' => 'Snow Grains',
21
-	    'IC' => 'Ice crystals',
22
-	    'PL' => 'Ice pellets',
23
-	    'GR' => 'Hail',
24
-	    'GS' => 'Small hail',
25
-	    'UP' => 'Unknown',
26
-	    'BR' => 'Mist',
27
-	    'FG' => 'Fog',
28
-	    'FU' => 'Smoke',
29
-	    'VA' => 'Volcanic ash',
30
-	    'DU' => 'Widespread dust',
31
-	    'SA' => 'Sand',
32
-	    'HZ' => 'Haze',
33
-	    'PY' => 'Spray',
34
-	    'PO' => 'Well developed dust / sand whirls',
35
-	    'SQ' => 'Squalls',
36
-	    'FC' => 'Funnel clouds inc tornadoes or waterspouts',
37
-	    'SS' => 'Sandstorm',
38
-	    'DS' => 'Duststorm'
10
+		'MI' => 'Shallow',
11
+		'PR' => 'Partial',
12
+		'BC' => 'Low drifting',
13
+		'BL' => 'Blowing',
14
+		'SH' => 'Showers',
15
+		'TS' => 'Thunderstorm',
16
+		'FZ' => 'Freezing',
17
+		'DZ' => 'Drizzle',
18
+		'RA' => 'Rain',
19
+		'SN' => 'Snow',
20
+		'SG' => 'Snow Grains',
21
+		'IC' => 'Ice crystals',
22
+		'PL' => 'Ice pellets',
23
+		'GR' => 'Hail',
24
+		'GS' => 'Small hail',
25
+		'UP' => 'Unknown',
26
+		'BR' => 'Mist',
27
+		'FG' => 'Fog',
28
+		'FU' => 'Smoke',
29
+		'VA' => 'Volcanic ash',
30
+		'DU' => 'Widespread dust',
31
+		'SA' => 'Sand',
32
+		'HZ' => 'Haze',
33
+		'PY' => 'Spray',
34
+		'PO' => 'Well developed dust / sand whirls',
35
+		'SQ' => 'Squalls',
36
+		'FC' => 'Funnel clouds inc tornadoes or waterspouts',
37
+		'SS' => 'Sandstorm',
38
+		'DS' => 'Duststorm'
39 39
 	);
40 40
 	
41 41
 	public function __construct($dbc = null) {
42
-                $Connection = new Connection($dbc);
43
-                $this->db = $Connection->db;
44
-        }
42
+				$Connection = new Connection($dbc);
43
+				$this->db = $Connection->db;
44
+		}
45 45
 
46
-       public static function check_last_update() {
47
-    		global $globalDBdriver;
48
-    		if ($globalDBdriver == 'mysql') {
46
+	   public static function check_last_update() {
47
+			global $globalDBdriver;
48
+			if ($globalDBdriver == 'mysql') {
49 49
 			$query = "SELECT COUNT(*) as nb FROM config WHERE name = 'last_update_metar' AND value > DATE_SUB(NOW(), INTERVAL 20 MINUTE)";
50 50
 		} else {
51 51
 			$query = "SELECT COUNT(*) as nb FROM config WHERE name = 'last_update_metar' AND value::timestamp > CURRENT_TIMESTAMP - INTERVAL '20 MINUTES'";
52 52
 		}
53
-                try {
54
-                        $Connection = new Connection();
55
-                        $sth = $Connection->db->prepare($query);
56
-                        $sth->execute();
57
-                } catch(PDOException $e) {
58
-                        return "error : ".$e->getMessage();
59
-                }
60
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
61
-                $sth->closeCursor();
62
-                if ($row['nb'] > 0) return false;
63
-                else return true;
64
-        }
53
+				try {
54
+						$Connection = new Connection();
55
+						$sth = $Connection->db->prepare($query);
56
+						$sth->execute();
57
+				} catch(PDOException $e) {
58
+						return "error : ".$e->getMessage();
59
+				}
60
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
61
+				$sth->closeCursor();
62
+				if ($row['nb'] > 0) return false;
63
+				else return true;
64
+		}
65 65
 
66
-        public static function insert_last_update() {
67
-                $query = "DELETE FROM config WHERE name = 'last_update_metar';
66
+		public static function insert_last_update() {
67
+				$query = "DELETE FROM config WHERE name = 'last_update_metar';
68 68
                         INSERT INTO config (name,value) VALUES ('last_update_metar',NOW());";
69
-                try {
70
-                        $Connection = new Connection();
71
-                        $sth = $Connection->db->prepare($query);
72
-                        $sth->execute();
73
-                } catch(PDOException $e) {
74
-                        return "error : ".$e->getMessage();
75
-                }
76
-        }
69
+				try {
70
+						$Connection = new Connection();
71
+						$sth = $Connection->db->prepare($query);
72
+						$sth->execute();
73
+				} catch(PDOException $e) {
74
+						return "error : ".$e->getMessage();
75
+				}
76
+		}
77 77
 
78 78
 
79 79
         
80
-        public function parse($data) {
81
-    		//$data = str_replace(array('\n','\r','\r','\n'),'',$data);
82
-    		$codes = implode('|', array_keys($this->texts));
83
-    		$regWeather = '#^(\+|\-|VC)?(' . $codes . ')(' . $codes . ')?$#';
84
-    		//$pieces = explode(' ',$data);
85
-    		$pieces = preg_split('/\s/',$data);
86
-    		$pos = 0;
87
-    		if ($pieces[0] == 'METAR') $pos++;
88
-    		elseif ($pieces[0] == 'SPECI') $pos++;
89
-    		if (strlen($pieces[$pos]) != 4) $pos++;
90
-    		$result = array();
91
-    		$result['location'] = $pieces[$pos];
92
-    		$pos++;
93
-    		$result['dayofmonth'] = substr($pieces[$pos],0,2);
94
-    		$result['time'] = substr($pieces[$pos],2,4);
95
-    		$c = count($pieces);
96
-    		for($pos++; $pos < $c; $pos++) {
97
-    			$piece = $pieces[$pos];
98
-    			if ($piece == 'RMK') break;
99
-    			if ($piece == 'AUTO') $result['auto'] = true;
100
-    			if ($piece == 'COR') $result['correction'] = true;
101
-    			// Wind Speed
102
-    			if (preg_match('#(VRB|\d\d\d)(\d\d)(?:G(\d\d))?(KT|MPS|KPH)(?: (\d{1,3})V(\d{1,3}))?$#', $piece, $matches)) {
103
-    				$result['wind']['direction'] = (float)$matches[1];
80
+		public function parse($data) {
81
+			//$data = str_replace(array('\n','\r','\r','\n'),'',$data);
82
+			$codes = implode('|', array_keys($this->texts));
83
+			$regWeather = '#^(\+|\-|VC)?(' . $codes . ')(' . $codes . ')?$#';
84
+			//$pieces = explode(' ',$data);
85
+			$pieces = preg_split('/\s/',$data);
86
+			$pos = 0;
87
+			if ($pieces[0] == 'METAR') $pos++;
88
+			elseif ($pieces[0] == 'SPECI') $pos++;
89
+			if (strlen($pieces[$pos]) != 4) $pos++;
90
+			$result = array();
91
+			$result['location'] = $pieces[$pos];
92
+			$pos++;
93
+			$result['dayofmonth'] = substr($pieces[$pos],0,2);
94
+			$result['time'] = substr($pieces[$pos],2,4);
95
+			$c = count($pieces);
96
+			for($pos++; $pos < $c; $pos++) {
97
+				$piece = $pieces[$pos];
98
+				if ($piece == 'RMK') break;
99
+				if ($piece == 'AUTO') $result['auto'] = true;
100
+				if ($piece == 'COR') $result['correction'] = true;
101
+				// Wind Speed
102
+				if (preg_match('#(VRB|\d\d\d)(\d\d)(?:G(\d\d))?(KT|MPS|KPH)(?: (\d{1,3})V(\d{1,3}))?$#', $piece, $matches)) {
103
+					$result['wind']['direction'] = (float)$matches[1];
104 104
 				$result['wind']['unit'] = $matches[4];
105
-    				if ($result['wind']['unit'] == 'KT') $result['wind']['speed'] = round(((float)$matches[2])*0.51444444444,2);
106
-    				elseif ($result['wind']['unit'] == 'KPH') $result['wind']['speed'] = round(((float)$matches[2])*1000,2);
107
-    				elseif ($result['wind']['unit'] == 'MPS') $result['wind']['speed'] = round(((float)$matches[2]),2);
105
+					if ($result['wind']['unit'] == 'KT') $result['wind']['speed'] = round(((float)$matches[2])*0.51444444444,2);
106
+					elseif ($result['wind']['unit'] == 'KPH') $result['wind']['speed'] = round(((float)$matches[2])*1000,2);
107
+					elseif ($result['wind']['unit'] == 'MPS') $result['wind']['speed'] = round(((float)$matches[2]),2);
108 108
 				$result['wind']['gust'] = (float)$matches[3];
109 109
 				$result['wind']['unit'] = $matches[4];
110 110
 				$result['wind']['min_variation'] = array_key_exists(5,$matches) ? $matches[5] : 0;
111 111
 				$result['wind']['max_variation'] = array_key_exists(6,$matches) ? $matches[6] : 0;
112
-    			}
112
+				}
113 113
 
114 114
 /*    			if (preg_match('#^([0-9]{3})([0-9]{2})(G([0-9]{2}))?(KT|MPS)$#', $piece, $matches)) {
115 115
     				$result['wind_direction'] = (float)$matches[1];
@@ -126,35 +126,35 @@  discard block
 block discarded – undo
126 126
     				}
127 127
     			}
128 128
     			*/
129
-    			// Temperature
130
-    			if (preg_match('#^(M?[0-9]{2,})/(M?[0-9]{2,})$#', $piece, $matches)) {
131
-    				$temp = (float)$matches[1];
129
+				// Temperature
130
+				if (preg_match('#^(M?[0-9]{2,})/(M?[0-9]{2,})$#', $piece, $matches)) {
131
+					$temp = (float)$matches[1];
132 132
 				if ($matches[1]{0} == 'M') {
133 133
 					$temp = ((float)substr($matches[1], 1)) * -1;
134 134
 				}
135
-    				$result['temperature'] = $temp;
136
-    				$dew = (float)$matches[2];
135
+					$result['temperature'] = $temp;
136
+					$dew = (float)$matches[2];
137 137
 				if ($matches[2]{0} == 'M') {
138 138
 					$dew = ((float)substr($matches[2], 1)) * -1;
139 139
 				}
140 140
 				$result['dew'] = $dew;
141
-    			}
142
-    			// QNH
143
-    			if (preg_match('#^(A|Q)([0-9]{4})$#', $piece, $matches)) {
144
-    			// #^(Q|A)(////|[0-9]{4})( )#
145
-    				if ($matches[1] == 'Q') {
146
-    					// hPa
147
-    					$result['QNH'] = $matches[2];
148
-    				} else {
149
-    					// inHg
150
-    					$result['QNH'] = round(($matches[2] / 100)*33.86389,2);
151 141
 				}
152
-    				/*
142
+				// QNH
143
+				if (preg_match('#^(A|Q)([0-9]{4})$#', $piece, $matches)) {
144
+				// #^(Q|A)(////|[0-9]{4})( )#
145
+					if ($matches[1] == 'Q') {
146
+						// hPa
147
+						$result['QNH'] = $matches[2];
148
+					} else {
149
+						// inHg
150
+						$result['QNH'] = round(($matches[2] / 100)*33.86389,2);
151
+				}
152
+					/*
153 153
     				$result['QNH'] = $matches[1] == 'Q' ? $matches[2] : ($matches[2] / 100);
154 154
     				$result['QNH_format'] = $matches[1] == 'Q' ? 'hPa' : 'inHg';
155 155
     				*/
156
-    			}
157
-                     /*
156
+				}
157
+					 /*
158 158
     			// Wind Direction
159 159
     			if (preg_match('#^([0-9]{3})V([0-9]{3})$#', $piece, $matches)) {
160 160
     				$result['wind_direction'] = $matches[1];
@@ -165,9 +165,9 @@  discard block
 block discarded – undo
165 165
     				$result['speed_variable'] = $matches[1];
166 166
     			}
167 167
     			*/
168
-    			// Visibility
169
-    			if (preg_match('#^([0-9]{4})|(([0-9]{1,4})SM)$#', $piece, $matches)) {
170
-    				if (isset($matches[3]) && strlen($matches[3]) > 0) {
168
+				// Visibility
169
+				if (preg_match('#^([0-9]{4})|(([0-9]{1,4})SM)$#', $piece, $matches)) {
170
+					if (isset($matches[3]) && strlen($matches[3]) > 0) {
171 171
 					$result['visibility'] = (float)$matches[3] * 1609.34;
172 172
 				} else {
173 173
 					if ($matches[1] == '9999') {
@@ -180,28 +180,28 @@  discard block
 block discarded – undo
180 180
 					$result['visibility'] = '> 10000';
181 181
 					$result['weather'] = "CAVOK";
182 182
 				}
183
-    			}
184
-    			// Cloud Coverage
185
-    			if (preg_match('#^(SKC|CLR|FEW|SCT|BKN|OVC|VV)([0-9]{3})(CB|TCU|CU|CI)?$#', $piece, $matches)) {
186
-    				//$this->addCloudCover($matches[1], ((float)$matches[2]) * 100, isset($matches[3]) ? $matches[3] : '');
187
-    				$type = $matches[1];
188
-    				$cloud = array();
189
-    				if ($type == 'SKC') $cloud['type'] = 'No cloud/Sky clear';
190
-    				elseif ($type == 'CLR') $cloud['type'] = 'No cloud below 12,000ft (3700m)';
191
-    				elseif ($type == 'NSC') $cloud['type'] = 'No significant cloud';
192
-    				elseif ($type == 'FEW') $cloud['type'] = 'Few';
193
-    				elseif ($type == 'SCT') $cloud['type'] = 'Scattered';
194
-    				elseif ($type == 'BKN') $cloud['type'] = 'Broken';
195
-    				elseif ($type == 'OVC') $cloud['type'] = 'Overcast/Full cloud coverage';
196
-    				elseif ($type == 'VV') $cloud['type'] = 'Vertical visibility';
197
-    				$cloud['type_code'] = $type;
198
-    				$cloud['level'] = round(((float)$matches[2]) * 100 * 0.3048);
199
-    				$cloud['significant'] = isset($matches[3]) ? $matches[3] : '';
200
-    				$result['cloud'][] = $cloud;
201
-    			}
202
-    			// RVR
203
-    			 if (preg_match('#^(R.+)/([M|P])?(\d{4})(?:V(\d+)|[UDN])?(FT)?$#', $piece, $matches)) {
204
-    				$rvr = array();
183
+				}
184
+				// Cloud Coverage
185
+				if (preg_match('#^(SKC|CLR|FEW|SCT|BKN|OVC|VV)([0-9]{3})(CB|TCU|CU|CI)?$#', $piece, $matches)) {
186
+					//$this->addCloudCover($matches[1], ((float)$matches[2]) * 100, isset($matches[3]) ? $matches[3] : '');
187
+					$type = $matches[1];
188
+					$cloud = array();
189
+					if ($type == 'SKC') $cloud['type'] = 'No cloud/Sky clear';
190
+					elseif ($type == 'CLR') $cloud['type'] = 'No cloud below 12,000ft (3700m)';
191
+					elseif ($type == 'NSC') $cloud['type'] = 'No significant cloud';
192
+					elseif ($type == 'FEW') $cloud['type'] = 'Few';
193
+					elseif ($type == 'SCT') $cloud['type'] = 'Scattered';
194
+					elseif ($type == 'BKN') $cloud['type'] = 'Broken';
195
+					elseif ($type == 'OVC') $cloud['type'] = 'Overcast/Full cloud coverage';
196
+					elseif ($type == 'VV') $cloud['type'] = 'Vertical visibility';
197
+					$cloud['type_code'] = $type;
198
+					$cloud['level'] = round(((float)$matches[2]) * 100 * 0.3048);
199
+					$cloud['significant'] = isset($matches[3]) ? $matches[3] : '';
200
+					$result['cloud'][] = $cloud;
201
+				}
202
+				// RVR
203
+				 if (preg_match('#^(R.+)/([M|P])?(\d{4})(?:V(\d+)|[UDN])?(FT)?$#', $piece, $matches)) {
204
+					$rvr = array();
205 205
 				$rvr['runway'] = $matches[1];
206 206
 				$rvr['assessment'] = $matches[2];
207 207
 				$rvr['rvr'] = $matches[3];
@@ -210,33 +210,33 @@  discard block
 block discarded – undo
210 210
 				$result['RVR'] = $rvr;
211 211
 			}
212 212
     			
213
-    			//if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) {
214
-    			if (preg_match('#^R(\d{2}[LRC]?)/([\d/])([\d/])([\d/]{2})([\d/]{2})$#', $piece, $matches)) {
215
-    				//print_r($matches);
216
-    				// https://github.com/davidmegginson/metar-taf/blob/master/Metar.php
217
-    				$result['RVR']['runway'] = $matches[1];
218
-        			$result['RVR']['deposits'] = $matches[2];
219
-        			$result['RVR']['extent'] = $matches[3];
220
-        			$result['RVR']['depth'] = $matches[4];
221
-        			$result['RVR']['friction'] = $matches[5];
222
-    			}
223
-    			if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) {
224
-    				//echo $piece;
225
-    				//print_r($matches);
226
-    				if (isset($matches[5])) $range = array('exact' => (float)$matches[2], 'unit' => $matches[5] ? 'FT' : 'M');
227
-    				else $range = array('exact' => (float)$matches[2], 'unit' => 'M');
213
+				//if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) {
214
+				if (preg_match('#^R(\d{2}[LRC]?)/([\d/])([\d/])([\d/]{2})([\d/]{2})$#', $piece, $matches)) {
215
+					//print_r($matches);
216
+					// https://github.com/davidmegginson/metar-taf/blob/master/Metar.php
217
+					$result['RVR']['runway'] = $matches[1];
218
+					$result['RVR']['deposits'] = $matches[2];
219
+					$result['RVR']['extent'] = $matches[3];
220
+					$result['RVR']['depth'] = $matches[4];
221
+					$result['RVR']['friction'] = $matches[5];
222
+				}
223
+				if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) {
224
+					//echo $piece;
225
+					//print_r($matches);
226
+					if (isset($matches[5])) $range = array('exact' => (float)$matches[2], 'unit' => $matches[5] ? 'FT' : 'M');
227
+					else $range = array('exact' => (float)$matches[2], 'unit' => 'M');
228 228
 				if (isset($matches[3])) {
229 229
 					$range = Array(
230
-					    'from' => (float)$matches[2],
231
-					    'to'   => (float)$matches[4],
232
-					    'unit' => $matches[5] ? 'FT' : 'M'
230
+						'from' => (float)$matches[2],
231
+						'to'   => (float)$matches[4],
232
+						'unit' => $matches[5] ? 'FT' : 'M'
233 233
 					);
234 234
 				}
235 235
 				$result['RVR'] = $matches[1];
236 236
 				$result['RVR_range'] = $range;
237
-    			}
238
-    			// Weather
239
-    			if (preg_match($regWeather, $piece, $matches)) {
237
+				}
238
+				// Weather
239
+				if (preg_match($regWeather, $piece, $matches)) {
240 240
 				$text = Array();
241 241
 				switch ($matches[1]) {
242 242
 					case '+':
@@ -259,35 +259,35 @@  discard block
 block discarded – undo
259 259
 				}
260 260
 				if (!isset($result['weather'])) $result['weather'] = implode(' ', $text);
261 261
 				else $result['weather'] = $result['weather'].' / '.implode(' ', $text);
262
-    			}
263
-    		}
264
-    		return $result;
262
+				}
263
+			}
264
+			return $result;
265 265
         
266
-        }
266
+		}
267 267
         
268 268
 	public function getMETAR($icao) {
269
-    		global $globalMETARcycle, $globalDBdriver;
270
-    		if (isset($globalMETARcycle) && $globalMETARcycle) {
271
-            		$query = "SELECT * FROM metar WHERE metar_location = :icao";
272
-                } else {
273
-            		if ($globalDBdriver == 'mysql') $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 10 HOUR) LIMIT 1";
274
-            		else $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= now() AT TIMEZONE 'UTC' - '10 HOUR'->INTERVAL LIMIT 0,1";
275
-                }
276
-                $query_values = array(':icao' => $icao);
277
-                 try {
278
-                        $sth = $this->db->prepare($query);
279
-                        $sth->execute($query_values);
280
-                } catch(PDOException $e) {
281
-                        return "error : ".$e->getMessage();
282
-                }
283
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
284
-                if ((!isset($globalMETARcycle) || $globalMETARcycle === false) && count($all) == 0) {
285
-            		$all = $this->downloadMETAR($icao);
286
-                }
287
-                return $all;
288
-        }
269
+			global $globalMETARcycle, $globalDBdriver;
270
+			if (isset($globalMETARcycle) && $globalMETARcycle) {
271
+					$query = "SELECT * FROM metar WHERE metar_location = :icao";
272
+				} else {
273
+					if ($globalDBdriver == 'mysql') $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 10 HOUR) LIMIT 1";
274
+					else $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= now() AT TIMEZONE 'UTC' - '10 HOUR'->INTERVAL LIMIT 0,1";
275
+				}
276
+				$query_values = array(':icao' => $icao);
277
+				 try {
278
+						$sth = $this->db->prepare($query);
279
+						$sth->execute($query_values);
280
+				} catch(PDOException $e) {
281
+						return "error : ".$e->getMessage();
282
+				}
283
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
284
+				if ((!isset($globalMETARcycle) || $globalMETARcycle === false) && count($all) == 0) {
285
+					$all = $this->downloadMETAR($icao);
286
+				}
287
+				return $all;
288
+		}
289 289
 
290
-       public function addMETAR($location,$metar,$date) {
290
+	   public function addMETAR($location,$metar,$date) {
291 291
 		global $globalDBdriver;
292 292
 		$date = date('Y-m-d H:i:s',strtotime($date));
293 293
 		if ($globalDBdriver == 'mysql') {
@@ -295,100 +295,100 @@  discard block
 block discarded – undo
295 295
 		} else {
296 296
 			$query = "UPDATE metar SET metar_date = :date, metar = metar WHERE metar_location = :location;INSERT INTO metar (metar_location,metar_date,metar) SELECT :location,:date,:metar WHERE NOT EXISTS (SELECT 1 FROM metar WHERE metar_location = :location);";
297 297
 		}
298
-                $query_values = array(':location' => $location,':date' => $date,':metar' => utf8_encode($metar));
299
-                 try {
300
-                        $sth = $this->db->prepare($query);
301
-                        $sth->execute($query_values);
302
-                } catch(PDOException $e) {
303
-                        return "error : ".$e->getMessage();
304
-                }
305
-        }
298
+				$query_values = array(':location' => $location,':date' => $date,':metar' => utf8_encode($metar));
299
+				 try {
300
+						$sth = $this->db->prepare($query);
301
+						$sth->execute($query_values);
302
+				} catch(PDOException $e) {
303
+						return "error : ".$e->getMessage();
304
+				}
305
+		}
306 306
 
307
-       public function deleteMETAR($id) {
308
-                $query = "DELETE FROM metar WHERE id = :id";
309
-                $query_values = array(':id' => $id);
310
-                 try {
311
-                        $sth = $this->db->prepare($query);
312
-                        $sth->execute($query_values);
313
-                } catch(PDOException $e) {
314
-                        return "error : ".$e->getMessage();
315
-                }
316
-        }
317
-       public function deleteAllMETARLocation() {
318
-                $query = "DELETE FROM metar";
319
-                 try {
320
-                        $sth = $this->db->prepare($query);
321
-                        $sth->execute();
322
-                } catch(PDOException $e) {
323
-                        return "error : ".$e->getMessage();
324
-                }
325
-        }
307
+	   public function deleteMETAR($id) {
308
+				$query = "DELETE FROM metar WHERE id = :id";
309
+				$query_values = array(':id' => $id);
310
+				 try {
311
+						$sth = $this->db->prepare($query);
312
+						$sth->execute($query_values);
313
+				} catch(PDOException $e) {
314
+						return "error : ".$e->getMessage();
315
+				}
316
+		}
317
+	   public function deleteAllMETARLocation() {
318
+				$query = "DELETE FROM metar";
319
+				 try {
320
+						$sth = $this->db->prepare($query);
321
+						$sth->execute();
322
+				} catch(PDOException $e) {
323
+						return "error : ".$e->getMessage();
324
+				}
325
+		}
326 326
         
327
-        public function addMETARCycle() {
328
-    		global $globalDebug, $globalIVAO;
329
-    		if (isset($globalDebug) && $globalDebug) echo "Downloading METAR cycle...";
330
-    		date_default_timezone_set("UTC");
331
-    		$Common = new Common();
332
-    		if (isset($globalIVAO) && $globalIVAO) {
333
-        		$cycle = $Common->getData('http://wx.ivao.aero/metar.php');
334
-    		} else {
327
+		public function addMETARCycle() {
328
+			global $globalDebug, $globalIVAO;
329
+			if (isset($globalDebug) && $globalDebug) echo "Downloading METAR cycle...";
330
+			date_default_timezone_set("UTC");
331
+			$Common = new Common();
332
+			if (isset($globalIVAO) && $globalIVAO) {
333
+				$cycle = $Common->getData('http://wx.ivao.aero/metar.php');
334
+			} else {
335 335
 			$cycle = $Common->getData('http://tgftp.nws.noaa.gov/data/observations/metar/cycles/'.date('H').'Z.TXT');
336
-    		}
337
-    		if (isset($globalDebug) && $globalDebug) echo "Done - Updating DB...";
338
-    		$date = '';
339
-    		foreach(explode("\n",$cycle) as $line) {
340
-    			if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) {
341
-    				//echo "date : ".$line."\n";
342
-    				$date = $line;
343
-    			} 
344
-    			if ($line != '') {
345
-    			    //$this->parse($line);
346
-    			    //echo $line;
347
-    			    if ($date == '') $date = date('Y/m/d H:m');
348
-    			    $pos = 0;
349
-    			    $pieces = preg_split('/\s/',$line);
350
-    			    if ($pieces[0] == 'METAR') $pos++;
351
-    			    if (strlen($pieces[$pos]) != 4) $pos++;
352
-	        	    $location = $pieces[$pos];
353
-	        	    echo $this->addMETAR($location,$line,$date);
354
-    			}
355
-    			//echo $line."\n";
356
-    		}
357
-    		if (isset($globalDebug) && $globalDebug) echo "Done\n";
336
+			}
337
+			if (isset($globalDebug) && $globalDebug) echo "Done - Updating DB...";
338
+			$date = '';
339
+			foreach(explode("\n",$cycle) as $line) {
340
+				if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) {
341
+					//echo "date : ".$line."\n";
342
+					$date = $line;
343
+				} 
344
+				if ($line != '') {
345
+					//$this->parse($line);
346
+					//echo $line;
347
+					if ($date == '') $date = date('Y/m/d H:m');
348
+					$pos = 0;
349
+					$pieces = preg_split('/\s/',$line);
350
+					if ($pieces[0] == 'METAR') $pos++;
351
+					if (strlen($pieces[$pos]) != 4) $pos++;
352
+					$location = $pieces[$pos];
353
+					echo $this->addMETAR($location,$line,$date);
354
+				}
355
+				//echo $line."\n";
356
+			}
357
+			if (isset($globalDebug) && $globalDebug) echo "Done\n";
358 358
         
359
-        }
360
-        public function downloadMETAR($icao) {
361
-    		global $globalMETARurl;
362
-    		if ($globalMETARurl == '') return array();
363
-    		date_default_timezone_set("UTC");
364
-    		$Common = new Common();
365
-    		$url = str_replace('{icao}',$icao,$globalMETARurl);
366
-    		$cycle = $Common->getData($url);
367
-    		$date = '';
368
-    		foreach(explode("\n",$cycle) as $line) {
369
-    			if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) {
370
-    				//echo "date : ".$line."\n";
371
-    				$date = $line;
372
-    			} 
373
-    			if ($line != '') {
374
-    			    //$this->parse($line);
375
-    			    //echo $line;
376
-    			    if ($date == '') $date = date('Y/m/d H:m');
377
-    			    $pos = 0;
378
-    			    $pieces = preg_split('/\s/',$line);
379
-    			    if ($pieces[0] == 'METAR') $pos++;
380
-    			    if (strlen($pieces[$pos]) != 4) $pos++;
381
-	        	    $location = $pieces[$pos];
382
-	        	    if (strlen($location == 4)) {
383
-	        		$this->addMETAR($location,$line,$date);
384
-	        		return array('0' => array('metar_date' => $date, 'metar_location' => $location, 'metar' => $line));
385
-	        	    } else return array();
386
-    			}
387
-    			//echo $line."\n";
388
-    		}
389
-    		return array();
359
+		}
360
+		public function downloadMETAR($icao) {
361
+			global $globalMETARurl;
362
+			if ($globalMETARurl == '') return array();
363
+			date_default_timezone_set("UTC");
364
+			$Common = new Common();
365
+			$url = str_replace('{icao}',$icao,$globalMETARurl);
366
+			$cycle = $Common->getData($url);
367
+			$date = '';
368
+			foreach(explode("\n",$cycle) as $line) {
369
+				if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) {
370
+					//echo "date : ".$line."\n";
371
+					$date = $line;
372
+				} 
373
+				if ($line != '') {
374
+					//$this->parse($line);
375
+					//echo $line;
376
+					if ($date == '') $date = date('Y/m/d H:m');
377
+					$pos = 0;
378
+					$pieces = preg_split('/\s/',$line);
379
+					if ($pieces[0] == 'METAR') $pos++;
380
+					if (strlen($pieces[$pos]) != 4) $pos++;
381
+					$location = $pieces[$pos];
382
+					if (strlen($location == 4)) {
383
+					$this->addMETAR($location,$line,$date);
384
+					return array('0' => array('metar_date' => $date, 'metar_location' => $location, 'metar' => $line));
385
+					} else return array();
386
+				}
387
+				//echo $line."\n";
388
+			}
389
+			return array();
390 390
         
391
-        }
391
+		}
392 392
 }
393 393
 /*
394 394
 $METAR = new METAR();
Please login to merge, or discard this patch.
require/class.SpotterImport.php 1 patch
Indentation   +351 added lines, -351 removed lines patch added patch discarded remove patch
@@ -9,16 +9,16 @@  discard block
 block discarded – undo
9 9
 require_once(dirname(__FILE__).'/class.Source.php');
10 10
 
11 11
 class SpotterImport {
12
-    private $all_flights = array();
13
-    private $last_delete_hourly = 0;
14
-    private $last_delete = 0;
15
-    private $stats = array();
16
-    private $tmd = 0;
17
-    private $source_location = array();
18
-    public $db = null;
19
-    public $nb = 0;
20
-
21
-    public function __construct($dbc = null) {
12
+	private $all_flights = array();
13
+	private $last_delete_hourly = 0;
14
+	private $last_delete = 0;
15
+	private $stats = array();
16
+	private $tmd = 0;
17
+	private $source_location = array();
18
+	public $db = null;
19
+	public $nb = 0;
20
+
21
+	public function __construct($dbc = null) {
22 22
 	global $globalBeta;
23 23
 	$Connection = new Connection($dbc);
24 24
 	$this->db = $Connection->db();
@@ -29,18 +29,18 @@  discard block
 block discarded – undo
29 29
 	$currentdate = date('Y-m-d');
30 30
 	$sourcestat = $Stats->getStatsSource($currentdate);
31 31
 	if (!empty($sourcestat)) {
32
-	    foreach($sourcestat as $srcst) {
33
-	    	$type = $srcst['stats_type'];
32
+		foreach($sourcestat as $srcst) {
33
+			$type = $srcst['stats_type'];
34 34
 		if ($type == 'polar' || $type == 'hist') {
35
-		    $source = $srcst['source_name'];
36
-		    $data = $srcst['source_data'];
37
-		    $this->stats[$currentdate][$source][$type] = json_decode($data,true);
38
-	        }
39
-	    }
35
+			$source = $srcst['source_name'];
36
+			$data = $srcst['source_data'];
37
+			$this->stats[$currentdate][$source][$type] = json_decode($data,true);
38
+			}
39
+		}
40
+	}
40 41
 	}
41
-    }
42 42
 
43
-    public function get_Schedule($id,$ident) {
43
+	public function get_Schedule($id,$ident) {
44 44
 	global $globalDebug, $globalFork, $globalSchedulesFetch;
45 45
 	// Get schedule here, so it's done only one time
46 46
 	
@@ -59,35 +59,35 @@  discard block
 block discarded – undo
59 59
 	$Translation = new Translation($dbc);
60 60
 	$operator = $Spotter->getOperator($ident);
61 61
 	if ($Schedule->checkSchedule($operator) == 0) {
62
-	    $operator = $Translation->checkTranslation($ident);
63
-	    if ($Schedule->checkSchedule($operator) == 0) {
62
+		$operator = $Translation->checkTranslation($ident);
63
+		if ($Schedule->checkSchedule($operator) == 0) {
64 64
 		$schedule = $Schedule->fetchSchedule($operator);
65 65
 		if (count($schedule) > 0 && isset($schedule['DepartureTime']) && isset($schedule['ArrivalTime'])) {
66
-		    if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n";
67
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime']));
68
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime']));
69
-		    // Should also check if route schedule = route from DB
70
-		    if ($schedule['DepartureAirportIATA'] != '') {
66
+			if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n";
67
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime']));
68
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime']));
69
+			// Should also check if route schedule = route from DB
70
+			if ($schedule['DepartureAirportIATA'] != '') {
71 71
 			if ($this->all_flights[$id]['departure_airport'] != $Spotter->getAirportIcao($schedule['DepartureAirportIATA'])) {
72
-			    $airport_icao = $Spotter->getAirportIcao($schedule['DepartureAirportIATA']);
73
-			    if ($airport_icao != '') {
72
+				$airport_icao = $Spotter->getAirportIcao($schedule['DepartureAirportIATA']);
73
+				if ($airport_icao != '') {
74 74
 				$this->all_flights[$id]['departure_airport'] = $airport_icao;
75 75
 				if ($globalDebug) echo "-> Change departure airport to ".$airport_icao." for ".$ident."\n";
76
-			    }
76
+				}
77
+			}
77 78
 			}
78
-		    }
79
-		    if ($schedule['ArrivalAirportIATA'] != '') {
79
+			if ($schedule['ArrivalAirportIATA'] != '') {
80 80
 			if ($this->all_flights[$id]['arrival_airport'] != $Spotter->getAirportIcao($schedule['ArrivalAirportIATA'])) {
81
-			    $airport_icao = $Spotter->getAirportIcao($schedule['ArrivalAirportIATA']);
82
-			    if ($airport_icao != '') {
81
+				$airport_icao = $Spotter->getAirportIcao($schedule['ArrivalAirportIATA']);
82
+				if ($airport_icao != '') {
83 83
 				$this->all_flights[$id]['arrival_airport'] = $airport_icao;
84 84
 				if ($globalDebug) echo "-> Change arrival airport to ".$airport_icao." for ".$ident."\n";
85
-			    }
85
+				}
86
+			}
86 87
 			}
87
-		    }
88
-		    $Schedule->addSchedule($operator,$this->all_flights[$id]['departure_airport'],$this->all_flights[$id]['departure_airport_time'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time'],$schedule['Source']);
88
+			$Schedule->addSchedule($operator,$this->all_flights[$id]['departure_airport'],$this->all_flights[$id]['departure_airport_time'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time'],$schedule['Source']);
89
+		}
89 90
 		}
90
-	    }
91 91
 	}
92 92
 	// close connection, at least one way will work ?
93 93
        
@@ -105,92 +105,92 @@  discard block
 block discarded – undo
105 105
 	}
106 106
 	  */
107 107
 	}
108
-    }
108
+	}
109 109
 
110
-    public function checkAll() {
110
+	public function checkAll() {
111 111
 	global $globalDebug;
112 112
 	if ($globalDebug) echo "Update last seen flights data...\n";
113 113
 	foreach ($this->all_flights as $key => $flight) {
114
-	    if (isset($this->all_flights[$key]['id'])) {
114
+		if (isset($this->all_flights[$key]['id'])) {
115 115
 		//echo $this->all_flights[$key]['id'].' - '.$this->all_flights[$key]['latitude'].'  '.$this->all_flights[$key]['longitude']."\n";
116
-    		$Spotter = new Spotter($this->db);
117
-        	$real_arrival = $this->arrival($key);
118
-        	$Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']);
119
-            }
116
+			$Spotter = new Spotter($this->db);
117
+			$real_arrival = $this->arrival($key);
118
+			$Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']);
119
+			}
120
+	}
120 121
 	}
121
-    }
122 122
 
123
-    public function arrival($key) {
123
+	public function arrival($key) {
124 124
 	global $globalClosestMinDist, $globalDebug;
125 125
 	if ($globalDebug) echo 'Update arrival...'."\n";
126 126
 	$Spotter = new Spotter($this->db);
127
-        $airport_icao = '';
128
-        $airport_time = '';
129
-        if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50;
127
+		$airport_icao = '';
128
+		$airport_time = '';
129
+		if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50;
130 130
 	if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') {
131
-	    $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist);
132
-    	    if (isset($closestAirports[0])) {
133
-        	if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) {
134
-        	    $airport_icao = $closestAirports[0]['icao'];
135
-        	    $airport_time = $this->all_flights[$key]['datetime'];
136
-        	    if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
137
-        	} elseif (count($closestAirports > 1) && isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] != '') {
138
-        	    foreach ($closestAirports as $airport) {
139
-        		if ($this->all_flights[$key]['arrival_airport'] == $airport['icao']) {
140
-        		    $airport_icao = $airport['icao'];
141
-        		    $airport_time = $this->all_flights[$key]['datetime'];
142
-        		    if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
143
-        		    break;
144
-        		}
145
-        	    }
146
-        	} elseif ($this->all_flights[$key]['altitude'] == 0 || ($this->all_flights[$key]['altitude_real'] != '' && ($closestAirports[0]['altitude'] < $this->all_flights[$key]['altitude_real'] && $this->all_flights[$key]['altitude_real'] < $closestAirports[0]['altitude']+5000))) {
147
-        		$airport_icao = $closestAirports[0]['icao'];
148
-        		$airport_time = $this->all_flights[$key]['datetime'];
149
-        	} else {
150
-        		if ($globalDebug) echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n";
151
-        	}
152
-    	    } else {
153
-    		    if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n";
154
-    	    }
155
-
156
-        } else {
157
-        	if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n";
158
-        }
159
-        return array('airport_icao' => $airport_icao,'airport_time' => $airport_time);
160
-    }
161
-
162
-
163
-
164
-    public function del() {
131
+		$closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist);
132
+			if (isset($closestAirports[0])) {
133
+			if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) {
134
+				$airport_icao = $closestAirports[0]['icao'];
135
+				$airport_time = $this->all_flights[$key]['datetime'];
136
+				if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
137
+			} elseif (count($closestAirports > 1) && isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] != '') {
138
+				foreach ($closestAirports as $airport) {
139
+				if ($this->all_flights[$key]['arrival_airport'] == $airport['icao']) {
140
+					$airport_icao = $airport['icao'];
141
+					$airport_time = $this->all_flights[$key]['datetime'];
142
+					if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
143
+					break;
144
+				}
145
+				}
146
+			} elseif ($this->all_flights[$key]['altitude'] == 0 || ($this->all_flights[$key]['altitude_real'] != '' && ($closestAirports[0]['altitude'] < $this->all_flights[$key]['altitude_real'] && $this->all_flights[$key]['altitude_real'] < $closestAirports[0]['altitude']+5000))) {
147
+				$airport_icao = $closestAirports[0]['icao'];
148
+				$airport_time = $this->all_flights[$key]['datetime'];
149
+			} else {
150
+				if ($globalDebug) echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n";
151
+			}
152
+			} else {
153
+				if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n";
154
+			}
155
+
156
+		} else {
157
+			if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n";
158
+		}
159
+		return array('airport_icao' => $airport_icao,'airport_time' => $airport_time);
160
+	}
161
+
162
+
163
+
164
+	public function del() {
165 165
 	global $globalDebug;
166 166
 	// Delete old infos
167 167
 	if ($globalDebug) echo 'Delete old values and update latest data...'."\n";
168 168
 	foreach ($this->all_flights as $key => $flight) {
169
-    	    if (isset($flight['lastupdate'])) {
170
-        	if ($flight['lastupdate'] < (time()-3000)) {
171
-            	    if (isset($this->all_flights[$key]['id'])) {
172
-            		if ($globalDebug) echo "--- Delete old values with id ".$this->all_flights[$key]['id']."\n";
169
+			if (isset($flight['lastupdate'])) {
170
+			if ($flight['lastupdate'] < (time()-3000)) {
171
+					if (isset($this->all_flights[$key]['id'])) {
172
+					if ($globalDebug) echo "--- Delete old values with id ".$this->all_flights[$key]['id']."\n";
173 173
 			/*
174 174
 			$SpotterLive = new SpotterLive();
175 175
             		$SpotterLive->deleteLiveSpotterDataById($this->all_flights[$key]['id']);
176 176
 			$SpotterLive->db = null;
177 177
 			*/
178
-            		$real_arrival = $this->arrival($key);
179
-            		$Spotter = new Spotter($this->db);
180
-            		if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') {
178
+					$real_arrival = $this->arrival($key);
179
+					$Spotter = new Spotter($this->db);
180
+					if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') {
181 181
 				$result = $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']);
182 182
 				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
183 183
 			}
184 184
 			// Put in archive
185 185
 //			$Spotter->db = null;
186
-            	    }
187
-            	    unset($this->all_flights[$key]);
188
-    	        }
189
-	    }
190
-        }
191
-    }
192
-
193
-    public function add($line) {
186
+					}
187
+					unset($this->all_flights[$key]);
188
+				}
189
+		}
190
+		}
191
+	}
192
+
193
+	public function add($line) {
194 194
 	global $globalPilotIdAccept, $globalAirportAccept, $globalAirlineAccept, $globalAirlineIgnore, $globalAirportIgnore, $globalFork, $globalDistanceIgnore, $globalDaemon, $globalSBS1update, $globalDebug, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAirlinesSource, $globalVAM, $globalAllFlights;
195 195
 	//if (!isset($globalDebugTimeElapsed) || $globalDebugTimeElapsed == '') $globalDebugTimeElapsed = FALSE;
196 196
 	if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02';
@@ -215,18 +215,18 @@  discard block
 block discarded – undo
215 215
 	
216 216
 	// SBS format is CSV format
217 217
 	if(is_array($line) && isset($line['hex'])) {
218
-	    //print_r($line);
219
-  	    if ($line['hex'] != '' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6) {
218
+		//print_r($line);
219
+  		if ($line['hex'] != '' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6) {
220 220
 
221 221
 		// Increment message number
222 222
 		if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE) {
223
-		    $current_date = date('Y-m-d');
224
-		    $source = $line['source_name'];
225
-		    if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source'];
226
-		    if (!isset($this->stats[$current_date][$source]['msg'])) {
227
-		    	$this->stats[$current_date][$source]['msg']['date'] = time();
228
-		    	$this->stats[$current_date][$source]['msg']['nb'] = 1;
229
-		    } else $this->stats[$current_date][$source]['msg']['nb'] += 1;
223
+			$current_date = date('Y-m-d');
224
+			$source = $line['source_name'];
225
+			if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source'];
226
+			if (!isset($this->stats[$current_date][$source]['msg'])) {
227
+				$this->stats[$current_date][$source]['msg']['date'] = time();
228
+				$this->stats[$current_date][$source]['msg']['nb'] = 1;
229
+			} else $this->stats[$current_date][$source]['msg']['nb'] += 1;
230 230
 		}
231 231
 		
232 232
 		/*
@@ -242,17 +242,17 @@  discard block
 block discarded – undo
242 242
 		//$this->db = $dbc;
243 243
 
244 244
 		$hex = trim($line['hex']);
245
-	        if (!isset($line['id'])) $id = trim($line['hex']);
246
-	        else $id = trim($line['id']);
245
+			if (!isset($line['id'])) $id = trim($line['hex']);
246
+			else $id = trim($line['id']);
247 247
 		
248 248
 		//print_r($this->all_flights);
249 249
 		if (!isset($this->all_flights[$id]['hex']) && ctype_xdigit($hex)) {
250
-		    $this->all_flights[$id] = array('hex' => $hex);
251
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0));
252
-		    //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) {
250
+			$this->all_flights[$id] = array('hex' => $hex);
251
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0));
252
+			//if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) {
253 253
 			//$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime']));
254
-		    //} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s')));
255
-		    if (!isset($line['aircraft_name']) && (!isset($line['aircraft_icao']) || $line['aircraft_icao'] == '????')) {
254
+			//} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s')));
255
+			if (!isset($line['aircraft_name']) && (!isset($line['aircraft_icao']) || $line['aircraft_icao'] == '????')) {
256 256
 
257 257
 			$timeelapsed = microtime(true);
258 258
 			$Spotter = new Spotter($this->db);
@@ -261,38 +261,38 @@  discard block
 block discarded – undo
261 261
 			if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
262 262
 
263 263
 			if ($aircraft_icao == '' && isset($line['aircraft_type'])) {
264
-			    if ($line['aircraft_type'] == 'PARA_GLIDER') $aircraft_icao = 'GLID';
265
-			    elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') $aircraft_icao = 'UHEL';
266
-			    elseif ($line['aircraft_type'] == 'TOW_PLANE') $aircraft_icao = 'TOWPLANE';
267
-			    elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') $aircraft_icao = 'POWAIRC';
264
+				if ($line['aircraft_type'] == 'PARA_GLIDER') $aircraft_icao = 'GLID';
265
+				elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') $aircraft_icao = 'UHEL';
266
+				elseif ($line['aircraft_type'] == 'TOW_PLANE') $aircraft_icao = 'TOWPLANE';
267
+				elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') $aircraft_icao = 'POWAIRC';
268 268
 			}
269 269
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao));
270
-		    } else if (isset($line['aircraft_name'])) {
270
+			} else if (isset($line['aircraft_name'])) {
271 271
 			// Get aircraft ICAO from aircraft name
272 272
 			$Spotter = new Spotter($this->db);
273 273
 			$aircraft_icao = $Spotter->getAircraftIcao($line['aircraft_name']);
274 274
 			$Spotter->db = null;
275 275
 			if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao));
276 276
 			else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => 'NA'));
277
-		    } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $line['aircraft_icao']));
278
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => '','departure_airport' => '', 'arrival_airport' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '','altitude_real' => '', 'heading' => '','departure_airport_time' => '','arrival_airport_time' => '','squawk' => '','route_stop' => '','registration' => '','pilot_id' => '','pilot_name' => '','waypoints' => '','ground' => '0', 'format_source' => '','source_name' => '','over_country' => '','verticalrate' => '','noarchive' => false,'putinarchive' => true));
279
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time()));
280
-		    if (!isset($line['id'])) {
277
+			} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $line['aircraft_icao']));
278
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => '','departure_airport' => '', 'arrival_airport' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '','altitude_real' => '', 'heading' => '','departure_airport_time' => '','arrival_airport_time' => '','squawk' => '','route_stop' => '','registration' => '','pilot_id' => '','pilot_name' => '','waypoints' => '','ground' => '0', 'format_source' => '','source_name' => '','over_country' => '','verticalrate' => '','noarchive' => false,'putinarchive' => true));
279
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time()));
280
+			if (!isset($line['id'])) {
281 281
 			if (!isset($globalDaemon)) $globalDaemon = TRUE;
282 282
 //			if (isset($line['format_source']) && ($line['format_source'] == 'sbs' || $line['format_source'] == 'tsv' || $line['format_source'] == 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'].'-'.date('YmdGi')));
283 283
 //			if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi')));
284 284
 			if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi')));
285
-		        //else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
286
-		     } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
285
+				//else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
286
+			 } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
287 287
 
288
-		    if ($globalDebug) echo "*********** New aircraft hex : ".$hex." ***********\n";
289
-		    if ($globalAllFlights !== FALSE) $dataFound = true;
288
+			if ($globalDebug) echo "*********** New aircraft hex : ".$hex." ***********\n";
289
+			if ($globalAllFlights !== FALSE) $dataFound = true;
290 290
 		}
291 291
 		
292 292
 		if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) {
293
-		    if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) {
293
+			if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) {
294 294
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime']));
295
-		    } else {
295
+			} else {
296 296
 				if (strtotime($line['datetime']) == strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n";
297 297
 				elseif (strtotime($line['datetime']) > strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_flights[$id]['datetime'].") !!! for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n";
298 298
 				/*
@@ -301,38 +301,38 @@  discard block
 block discarded – undo
301 301
 				print_r($line);
302 302
 				*/
303 303
 				return '';
304
-		    }
304
+			}
305 305
 		} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s')));
306 306
 
307 307
 		if (isset($line['registration']) && $line['registration'] != '' && $line['registration'] != 'z.NO-REG') {
308
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('registration' => $line['registration']));
308
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('registration' => $line['registration']));
309 309
 		}
310 310
 		if (isset($line['waypoints']) && $line['waypoints'] != '') {
311
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('waypoints' => $line['waypoints']));
311
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('waypoints' => $line['waypoints']));
312 312
 		}
313 313
 		if (isset($line['pilot_id']) && $line['pilot_id'] != '') {
314
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_id' => $line['pilot_id']));
314
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_id' => $line['pilot_id']));
315 315
 		}
316 316
 		if (isset($line['pilot_name']) && $line['pilot_name'] != '') {
317
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_name' => $line['pilot_name']));
317
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_name' => $line['pilot_name']));
318 318
 		}
319 319
  
320 320
 		if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_flights[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9]+$/', $line['ident'])) {
321
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident'])));
322
-		    if ($this->all_flights[$id]['addedSpotter'] == 1) {
321
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident'])));
322
+			if ($this->all_flights[$id]['addedSpotter'] == 1) {
323 323
 			$timeelapsed = microtime(true);
324
-            		$Spotter = new Spotter($this->db);
325
-            		$fromsource = NULL;
326
-            		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
327
-            		elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
324
+					$Spotter = new Spotter($this->db);
325
+					$fromsource = NULL;
326
+					if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
327
+					elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
328 328
 			elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') $fromsource = 'ivao';
329 329
 			elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
330 330
 			elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
331
-            		$result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource);
331
+					$result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource);
332 332
 			if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
333 333
 			$Spotter->db = null;
334 334
 			if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
335
-		    }
335
+			}
336 336
 
337 337
 /*
338 338
 		    if (!isset($line['id'])) {
@@ -342,26 +342,26 @@  discard block
 block discarded – undo
342 342
 		        else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
343 343
 		     } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
344 344
   */
345
-		    if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
345
+			if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
346 346
 
347
-		    //$putinarchive = true;
348
-		    if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) {
347
+			//$putinarchive = true;
348
+			if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) {
349 349
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $line['departure_airport_time']));
350
-		    }
351
-		    if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) {
350
+			}
351
+			if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) {
352 352
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $line['arrival_airport_time']));
353
-		    }
354
-		    if (isset($line['departure_airport_icao']) && isset($line['arrival_airport_icao'])) {
355
-		    		$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => ''));
356
-		    } elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) {
353
+			}
354
+			if (isset($line['departure_airport_icao']) && isset($line['arrival_airport_icao'])) {
355
+					$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => ''));
356
+			} elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) {
357 357
 				$timeelapsed = microtime(true);
358 358
 				$Spotter = new Spotter($this->db);
359 359
 				$line['departure_airport_icao'] = $Spotter->getAirportIcao($line['departure_airport_iata']);
360 360
 				$line['arrival_airport_icao'] = $Spotter->getAirportIcao($line['arrival_airport_iata']);
361
-		    		$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => ''));
361
+					$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => ''));
362 362
 				if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
363 363
 
364
-		    } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') {
364
+			} elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') {
365 365
 			$timeelapsed = microtime(true);
366 366
 			$Spotter = new Spotter($this->db);
367 367
 			$route = $Spotter->getRouteInfo(trim($line['ident']));
@@ -375,43 +375,43 @@  discard block
 block discarded – undo
375 375
 			if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
376 376
 
377 377
 			if (isset($route['fromairport_icao']) && isset($route['toairport_icao'])) {
378
-			    //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) {
379
-			    if ($route['fromairport_icao'] != $route['toairport_icao']) {
378
+				//if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) {
379
+				if ($route['fromairport_icao'] != $route['toairport_icao']) {
380 380
 				//    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['FromAirport_ICAO'],'arrival_airport' => $route['ToAirport_ICAO'],'route_stop' => $route['RouteStop']));
381
-		    		$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['fromairport_icao'],'arrival_airport' => $route['toairport_icao'],'route_stop' => $route['routestop']));
382
-		    	    }
381
+					$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['fromairport_icao'],'arrival_airport' => $route['toairport_icao'],'route_stop' => $route['routestop']));
382
+					}
383 383
 			}
384 384
 			if (!isset($globalFork)) $globalFork = TRUE;
385 385
 			if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && (!isset($line['format_source']) || $line['format_source'] != 'aprs')) {
386 386
 				if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id,trim($line['ident']));
387 387
 			}
388
-		    }
388
+			}
389 389
 		}
390 390
 
391 391
 		if (isset($line['speed']) && $line['speed'] != '') {
392 392
 		//    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => $line[12]));
393
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($line['speed'])));
394
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed_fromsrc' => true));
395
-		    //$dataFound = true;
393
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($line['speed'])));
394
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed_fromsrc' => true));
395
+			//$dataFound = true;
396 396
 		} else if (!isset($this->all_flights[$id]['speed_fromsrc']) && isset($this->all_flights[$id]['time_last_coord']) && $this->all_flights[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) {
397
-		    $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m');
398
-		    if ($distance > 1000 && $distance < 10000) {
399
-		    // use datetime
397
+			$distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m');
398
+			if ($distance > 1000 && $distance < 10000) {
399
+			// use datetime
400 400
 			$speed = $distance/(time() - $this->all_flights[$id]['time_last_coord']);
401 401
 			$speed = $speed*3.6;
402 402
 			if ($speed < 1000) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($speed)));
403 403
   			if ($globalDebug) echo "ø Calculated Speed for ".$this->all_flights[$id]['hex']." : ".$speed." - distance : ".$distance."\n";
404
-		    }
404
+			}
405 405
 		}
406 406
 
407 407
 
408 408
 
409
-	        if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) {
410
-	    	    if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']);
411
-	    	    else unset($timediff);
412
-	    	    if ($this->tmd > 5 || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM) || !isset($timediff) || $timediff > 800 || ($timediff > 10 && isset($this->all_flights[$id]['latitude']) && isset($this->all_flights[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')))) {
409
+			if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) {
410
+				if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']);
411
+				else unset($timediff);
412
+				if ($this->tmd > 5 || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM) || !isset($timediff) || $timediff > 800 || ($timediff > 10 && isset($this->all_flights[$id]['latitude']) && isset($this->all_flights[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')))) {
413 413
 			if (isset($this->all_flights[$id]['archive_latitude']) && isset($this->all_flights[$id]['archive_longitude']) && isset($this->all_flights[$id]['livedb_latitude']) && isset($this->all_flights[$id]['livedb_longitude'])) {
414
-			    if (!$Common->checkLine($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['livedb_latitude'],$this->all_flights[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) {
414
+				if (!$Common->checkLine($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['livedb_latitude'],$this->all_flights[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) {
415 415
 				$this->all_flights[$id]['archive_latitude'] = $line['latitude'];
416 416
 				$this->all_flights[$id]['archive_longitude'] = $line['longitude'];
417 417
 				$this->all_flights[$id]['putinarchive'] = true;
@@ -425,16 +425,16 @@  discard block
 block discarded – undo
425 425
 				if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
426 426
 				$this->tmd = 0;
427 427
 				if ($globalDebug) echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n";
428
-			    }
428
+				}
429 429
 			}
430 430
 
431 431
 			if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) {
432
-			    //if (!isset($this->all_flights[$id]['latitude']) || $this->all_flights[$id]['latitude'] == '' || abs($this->all_flights[$id]['latitude']-$line['latitude']) < 3 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) {
432
+				//if (!isset($this->all_flights[$id]['latitude']) || $this->all_flights[$id]['latitude'] == '' || abs($this->all_flights[$id]['latitude']-$line['latitude']) < 3 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) {
433 433
 				if (!isset($this->all_flights[$id]['archive_latitude'])) $this->all_flights[$id]['archive_latitude'] = $line['latitude'];
434 434
 				if (!isset($this->all_flights[$id]['livedb_latitude']) || abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs') {
435
-				    $this->all_flights[$id]['livedb_latitude'] = $line['latitude'];
436
-				    $dataFound = true;
437
-				    $this->all_flights[$id]['time_last_coord'] = time();
435
+					$this->all_flights[$id]['livedb_latitude'] = $line['latitude'];
436
+					$dataFound = true;
437
+					$this->all_flights[$id]['time_last_coord'] = time();
438 438
 				}
439 439
 				// elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n";
440 440
 				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('latitude' => $line['latitude']));
@@ -445,20 +445,20 @@  discard block
 block discarded – undo
445 445
 				    //$putinarchive = true;
446 446
 				}
447 447
 				*/
448
-			    /*
448
+				/*
449 449
 			    } elseif (isset($this->all_flights[$id]['latitude'])) {
450 450
 				if ($globalDebug) echo '!!! Strange latitude value - diff : '.abs($this->all_flights[$id]['latitude']-$line['latitude']).'- previous lat : '.$this->all_flights[$id]['latitude'].'- new lat : '.$line['latitude']."\n";
451 451
 			    }
452 452
 			    */
453 453
 			}
454 454
 			if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) {
455
-			    if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
456
-			    //if (!isset($this->all_flights[$id]['longitude']) || $this->all_flights[$id]['longitude'] == ''  || abs($this->all_flights[$id]['longitude']-$line['longitude']) < 2 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) {
455
+				if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
456
+				//if (!isset($this->all_flights[$id]['longitude']) || $this->all_flights[$id]['longitude'] == ''  || abs($this->all_flights[$id]['longitude']-$line['longitude']) < 2 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) {
457 457
 				if (!isset($this->all_flights[$id]['archive_longitude'])) $this->all_flights[$id]['archive_longitude'] = $line['longitude'];
458 458
 				if (!isset($this->all_flights[$id]['livedb_longitude']) || abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs') {
459
-				    $this->all_flights[$id]['livedb_longitude'] = $line['longitude'];
460
-				    $dataFound = true;
461
-				    $this->all_flights[$id]['time_last_coord'] = time();
459
+					$this->all_flights[$id]['livedb_longitude'] = $line['longitude'];
460
+					$dataFound = true;
461
+					$this->all_flights[$id]['time_last_coord'] = time();
462 462
 				}
463 463
 				// elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n";
464 464
 				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('longitude' => $line['longitude']));
@@ -476,53 +476,53 @@  discard block
 block discarded – undo
476 476
 			    */
477 477
 			}
478 478
 
479
-		    } else if ($globalDebug && $timediff > 20) {
479
+			} else if ($globalDebug && $timediff > 20) {
480 480
 			$this->tmd = $this->tmd + 1;
481 481
 			echo '!!! Too much distance in short time... for '.$this->all_flights[$id]['ident']."\n";
482 482
 			echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')."m -";
483 483
 			echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')/$timediff)*3.6)." km/h - ";
484 484
 			echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_flights[$id]['latitude'].' - prev long : '.$this->all_flights[$id]['longitude']." \n";
485
-		    }
485
+			}
486 486
 		}
487 487
 		if (isset($line['last_update']) && $line['last_update'] != '') {
488
-		    if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true;
489
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update']));
488
+			if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true;
489
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update']));
490 490
 		}
491 491
 		if (isset($line['verticalrate']) && $line['verticalrate'] != '') {
492
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('verticalrate' => $line['verticalrate']));
493
-		    //$dataFound = true;
492
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('verticalrate' => $line['verticalrate']));
493
+			//$dataFound = true;
494 494
 		}
495 495
 		if (isset($line['format_source']) && $line['format_source'] != '') {
496
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('format_source' => $line['format_source']));
496
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('format_source' => $line['format_source']));
497 497
 		}
498 498
 		if (isset($line['source_name']) && $line['source_name'] != '') {
499
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_name' => $line['source_name']));
499
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_name' => $line['source_name']));
500 500
 		}
501 501
 		if (isset($line['emergency']) && $line['emergency'] != '') {
502
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('emergency' => $line['emergency']));
503
-		    //$dataFound = true;
502
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('emergency' => $line['emergency']));
503
+			//$dataFound = true;
504 504
 		}
505 505
 		if (isset($line['ground']) && $line['ground'] != '') {
506
-		    if (isset($this->all_flights[$id]['ground']) && $this->all_flights[$id]['ground'] == 1 && $line['ground'] == 0) {
506
+			if (isset($this->all_flights[$id]['ground']) && $this->all_flights[$id]['ground'] == 1 && $line['ground'] == 0) {
507 507
 			// Here we force archive of flight because after ground it's a new one (or should be)
508 508
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0));
509 509
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1));
510 510
 			if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdGi')));
511
-		        elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
511
+				elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
512 512
 			elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
513
-		    }
514
-		    if ($line['ground'] != 1) $line['ground'] = 0;
515
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground']));
516
-		    //$dataFound = true;
513
+			}
514
+			if ($line['ground'] != 1) $line['ground'] = 0;
515
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground']));
516
+			//$dataFound = true;
517 517
 		}
518 518
 		if (isset($line['squawk']) && $line['squawk'] != '') {
519
-		    if (isset($this->all_flights[$id]['squawk']) && $this->all_flights[$id]['squawk'] != '7500' && $this->all_flights[$id]['squawk'] != '7600' && $this->all_flights[$id]['squawk'] != '7700' && isset($this->all_flights[$id]['id'])) {
520
-			    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk']));
521
-			    $highlight = '';
522
-			    if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC';
523
-			    if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC';
524
-			    if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC';
525
-			    if ($highlight != '') {
519
+			if (isset($this->all_flights[$id]['squawk']) && $this->all_flights[$id]['squawk'] != '7500' && $this->all_flights[$id]['squawk'] != '7600' && $this->all_flights[$id]['squawk'] != '7700' && isset($this->all_flights[$id]['id'])) {
520
+				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk']));
521
+				$highlight = '';
522
+				if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC';
523
+				if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC';
524
+				if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC';
525
+				if ($highlight != '') {
526 526
 				$timeelapsed = microtime(true);
527 527
 				$Spotter = new Spotter($this->db);
528 528
 				$Spotter->setHighlightFlight($this->all_flights[$id]['id'],$highlight);
@@ -532,38 +532,38 @@  discard block
 block discarded – undo
532 532
 				$this->all_flights[$id]['putinarchive'] = true;
533 533
 				//$putinarchive = true;
534 534
 				//$highlight = '';
535
-			    }
535
+				}
536 536
 			    
537
-		    } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk']));
538
-		    //$dataFound = true;
537
+			} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk']));
538
+			//$dataFound = true;
539 539
 		}
540 540
 
541 541
 		if (isset($line['altitude']) && $line['altitude'] != '') {
542
-		    //if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) {
542
+			//if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) {
543 543
 			if (abs(round($line['altitude']/100)-$this->all_flights[$id]['altitude']) > 2) $this->all_flights[$id]['putinarchive'] = true;
544 544
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude' => round($line['altitude']/100)));
545 545
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_real' => $line['altitude']));
546 546
 			//$dataFound = true;
547
-		    //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n";
547
+			//} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n";
548 548
   		}
549 549
 
550 550
 		if (isset($line['noarchive']) && $line['noarchive'] === true) {
551
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('noarchive' => true));
551
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('noarchive' => true));
552 552
 		}
553 553
 		
554 554
 		if (isset($line['heading']) && $line['heading'] != '') {
555
-		    if (abs($this->all_flights[$id]['heading']-round($line['heading'])) > 2) $this->all_flights[$id]['putinarchive'] = true;
556
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading'])));
557
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true));
558
-		    //$dataFound = true;
555
+			if (abs($this->all_flights[$id]['heading']-round($line['heading'])) > 2) $this->all_flights[$id]['putinarchive'] = true;
556
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading'])));
557
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true));
558
+			//$dataFound = true;
559 559
   		} elseif (!isset($this->all_flights[$id]['heading_fromsrc']) && isset($this->all_flights[$id]['archive_latitude']) && $this->all_flights[$id]['archive_latitude'] != $this->all_flights[$id]['latitude'] && isset($this->all_flights[$id]['archive_longitude']) && $this->all_flights[$id]['archive_longitude'] != $this->all_flights[$id]['longitude']) {
560
-  		    $heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']);
561
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading)));
562
-		    if (abs($this->all_flights[$id]['heading']-round($heading)) > 2) $this->all_flights[$id]['putinarchive'] = true;
563
-  		    if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n";
560
+  			$heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']);
561
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading)));
562
+			if (abs($this->all_flights[$id]['heading']-round($heading)) > 2) $this->all_flights[$id]['putinarchive'] = true;
563
+  			if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n";
564 564
   		} elseif (isset($this->all_flights[$id]['format_source']) && $this->all_flights[$id]['format_source'] == 'ACARS') {
565
-  		    // If not enough messages and ACARS set heading to 0
566
-  		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0));
565
+  			// If not enough messages and ACARS set heading to 0
566
+  			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0));
567 567
   		}
568 568
 		if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false;
569 569
 		elseif (isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false;
@@ -574,119 +574,119 @@  discard block
 block discarded – undo
574 574
 		//if ($dataFound == true && isset($this->all_flights[$id]['hex']) && $this->all_flights[$id]['ident'] != '' && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') {
575 575
 		//if ($dataFound === true && isset($this->all_flights[$id]['hex']) && $this->all_flights[$id]['heading'] != '' && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') {
576 576
 		if ($dataFound === true && isset($this->all_flights[$id]['hex'])) {
577
-		    $this->all_flights[$id]['lastupdate'] = time();
578
-		    if ($this->all_flights[$id]['addedSpotter'] == 0) {
579
-		        if (!isset($globalDistanceIgnore['latitude']) || $this->all_flights[$id]['longitude'] == ''  || $this->all_flights[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
580
-			    //print_r($this->all_flights);
581
-			    //echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n";
582
-			    //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']);
583
-			    if (!isset($this->all_flights[$id]['forcenew']) || $this->all_flights[$id]['forcenew'] == 0) {
577
+			$this->all_flights[$id]['lastupdate'] = time();
578
+			if ($this->all_flights[$id]['addedSpotter'] == 0) {
579
+				if (!isset($globalDistanceIgnore['latitude']) || $this->all_flights[$id]['longitude'] == ''  || $this->all_flights[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
580
+				//print_r($this->all_flights);
581
+				//echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n";
582
+				//$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']);
583
+				if (!isset($this->all_flights[$id]['forcenew']) || $this->all_flights[$id]['forcenew'] == 0) {
584 584
 				if ($globalDebug) echo "Check if aircraft is already in DB...";
585 585
 				$timeelapsed = microtime(true);
586 586
 				$SpotterLive = new SpotterLive($this->db);
587 587
 				if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson')) {
588
-				    $recent_ident = $SpotterLive->checkModeSRecent($this->all_flights[$id]['hex']);
589
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
588
+					$recent_ident = $SpotterLive->checkModeSRecent($this->all_flights[$id]['hex']);
589
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
590 590
 				} elseif (isset($line['id'])) {
591
-				    $recent_ident = $SpotterLive->checkIdRecent($line['id']);
592
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
591
+					$recent_ident = $SpotterLive->checkIdRecent($line['id']);
592
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
593 593
 				} elseif (isset($this->all_flights[$id]['ident']) && $this->all_flights[$id]['ident'] != '') {
594
-				    $recent_ident = $SpotterLive->checkIdentRecent($this->all_flights[$id]['ident']);
595
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
594
+					$recent_ident = $SpotterLive->checkIdentRecent($this->all_flights[$id]['ident']);
595
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
596 596
 				} else $recent_ident = '';
597 597
 				$SpotterLive->db=null;
598 598
 
599 599
 				if ($globalDebug && $recent_ident == '') echo " Not in DB.\n";
600 600
 				elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n";
601
-			    } else {
601
+				} else {
602 602
 				$recent_ident = '';
603 603
 				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 0));
604
-			    }
605
-			    //if there was no aircraft with the same callsign within the last hour and go post it into the archive
606
-			    if($recent_ident == "")
607
-			    {
604
+				}
605
+				//if there was no aircraft with the same callsign within the last hour and go post it into the archive
606
+				if($recent_ident == "")
607
+				{
608 608
 				if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." in archive DB : ";
609 609
 				if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; }
610 610
 				if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; }
611 611
 				//adds the spotter data for the archive
612 612
 				$ignoreImport = false;
613 613
 				foreach($globalAirportIgnore as $airportIgnore) {
614
-				    if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
614
+					if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
615 615
 					$ignoreImport = true;
616
-				    }
616
+					}
617 617
 				}
618 618
 				if (count($globalAirportAccept) > 0) {
619
-				    $ignoreImport = true;
620
-				    foreach($globalAirportIgnore as $airportIgnore) {
619
+					$ignoreImport = true;
620
+					foreach($globalAirportIgnore as $airportIgnore) {
621 621
 					if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
622
-					    $ignoreImport = false;
622
+						$ignoreImport = false;
623
+					}
623 624
 					}
624
-				    }
625 625
 				}
626 626
 				if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) {
627
-				    foreach($globalAirlineIgnore as $airlineIgnore) {
627
+					foreach($globalAirlineIgnore as $airlineIgnore) {
628 628
 					if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) {
629
-					    $ignoreImport = true;
629
+						$ignoreImport = true;
630
+					}
630 631
 					}
631
-				    }
632 632
 				}
633 633
 				if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) {
634
-				    $ignoreImport = true;
635
-				    foreach($globalAirlineAccept as $airlineAccept) {
634
+					$ignoreImport = true;
635
+					foreach($globalAirlineAccept as $airlineAccept) {
636 636
 					if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) {
637
-					    $ignoreImport = false;
637
+						$ignoreImport = false;
638
+					}
638 639
 					}
639
-				    }
640 640
 				}
641 641
 				if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) {
642
-				    $ignoreImport = true;
643
-				    foreach($globalPilotIdAccept as $pilotIdAccept) {
642
+					$ignoreImport = true;
643
+					foreach($globalPilotIdAccept as $pilotIdAccept) {
644 644
 					if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) {
645
-					    $ignoreImport = false;
645
+						$ignoreImport = false;
646
+					}
646 647
 					}
647
-				    }
648 648
 				}
649 649
 				
650 650
 				if (!$ignoreImport) {
651
-				    $highlight = '';
652
-				    if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack';
653
-				    if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)';
654
-				    if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency';
655
-				    if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi')));
656
-				    $timeelapsed = microtime(true);
657
-				    $Spotter = new Spotter($this->db);
658
-				    $result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'],$this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$highlight,$this->all_flights[$id]['hex'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'],$this->all_flights[$id]['verticalrate'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name']);
659
-				    $Spotter->db = null;
660
-				    if ($globalDebug && isset($result)) echo $result."\n";
661
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
651
+					$highlight = '';
652
+					if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack';
653
+					if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)';
654
+					if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency';
655
+					if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi')));
656
+					$timeelapsed = microtime(true);
657
+					$Spotter = new Spotter($this->db);
658
+					$result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'],$this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$highlight,$this->all_flights[$id]['hex'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'],$this->all_flights[$id]['verticalrate'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name']);
659
+					$Spotter->db = null;
660
+					if ($globalDebug && isset($result)) echo $result."\n";
661
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
662 662
 				    
663
-				    // Add source stat in DB
664
-				    $Stats = new Stats($this->db);
665
-				    if (!empty($this->stats)) {
663
+					// Add source stat in DB
664
+					$Stats = new Stats($this->db);
665
+					if (!empty($this->stats)) {
666 666
 					if ($globalDebug) echo 'Add source stats : ';
667
-				        foreach($this->stats as $date => $data) {
668
-					    foreach($data as $source => $sourced) {
669
-					        //print_r($sourced);
670
-				    	        if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date);
671
-				    	        if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date);
672
-				    		if (isset($sourced['msg'])) {
673
-				    		    if (time() - $sourced['msg']['date'] > 10) {
674
-				    		        $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date']));
675
-				    		        echo $Stats->addStatSource($nbmsg,$source,'msg',$date);
676
-			    			        unset($this->stats[$date][$source]['msg']);
677
-			    			    }
678
-			    			}
679
-			    		    }
680
-			    		    if ($date != date('Y-m-d')) {
681
-			    			unset($this->stats[$date]);
682
-			    		    }
683
-				    	}
684
-				    	if ($globalDebug) echo 'Done'."\n";
685
-
686
-				    }
687
-				    $Stats->db = null;
667
+						foreach($this->stats as $date => $data) {
668
+						foreach($data as $source => $sourced) {
669
+							//print_r($sourced);
670
+								if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date);
671
+								if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date);
672
+							if (isset($sourced['msg'])) {
673
+								if (time() - $sourced['msg']['date'] > 10) {
674
+									$nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date']));
675
+									echo $Stats->addStatSource($nbmsg,$source,'msg',$date);
676
+									unset($this->stats[$date][$source]['msg']);
677
+								}
678
+							}
679
+							}
680
+							if ($date != date('Y-m-d')) {
681
+							unset($this->stats[$date]);
682
+							}
683
+						}
684
+						if ($globalDebug) echo 'Done'."\n";
685
+
686
+					}
687
+					$Stats->db = null;
688 688
 				    
689
-				    $this->del();
689
+					$this->del();
690 690
 				} elseif ($globalDebug) echo 'Ignore data'."\n";
691 691
 				//$ignoreImport = false;
692 692
 				$this->all_flights[$id]['addedSpotter'] = 1;
@@ -704,18 +704,18 @@  discard block
 block discarded – undo
704 704
 			*/
705 705
 			//SpotterLive->deleteLiveSpotterDataByIdent($this->all_flights[$id]['ident']);
706 706
 				if ($this->last_delete == 0 || time() - $this->last_delete > 1800) {
707
-				    if ($globalDebug) echo "---- Deleting Live Spotter data older than 9 hours...";
708
-				    //SpotterLive->deleteLiveSpotterDataNotUpdated();
709
-				    $SpotterLive = new SpotterLive($this->db);
710
-				    $SpotterLive->deleteLiveSpotterData();
711
-				    $SpotterLive->db=null;
712
-				    if ($globalDebug) echo " Done\n";
713
-				    $this->last_delete = time();
707
+					if ($globalDebug) echo "---- Deleting Live Spotter data older than 9 hours...";
708
+					//SpotterLive->deleteLiveSpotterDataNotUpdated();
709
+					$SpotterLive = new SpotterLive($this->db);
710
+					$SpotterLive->deleteLiveSpotterData();
711
+					$SpotterLive->db=null;
712
+					if ($globalDebug) echo " Done\n";
713
+					$this->last_delete = time();
714 714
 				}
715
-			    } else {
715
+				} else {
716 716
 				if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt'|| $line['format_source'] === 'planeupdatefaa'  || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson')) {
717
-				    $this->all_flights[$id]['id'] = $recent_ident;
718
-				    $this->all_flights[$id]['addedSpotter'] = 1;
717
+					$this->all_flights[$id]['id'] = $recent_ident;
718
+					$this->all_flights[$id]['addedSpotter'] = 1;
719 719
 				}
720 720
 				if (isset($globalDaemon) && !$globalDaemon) {
721 721
 					$Spotter = new Spotter($this->db);
@@ -723,14 +723,14 @@  discard block
 block discarded – undo
723 723
 					$Spotter->db = null;
724 724
 				}
725 725
 				
726
-			    }
726
+				}
727
+			}
727 728
 			}
728
-		    }
729
-		    //adds the spotter LIVE data
730
-		    //SpotterLive->addLiveSpotterData($flightaware_id, $ident, $aircraft_type, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed);
731
-		    //echo "\nAdd in Live !! \n";
732
-		    //echo "{$line[8]} {$line[7]} - MODES:{$line[4]}  CALLSIGN:{$line[10]}   ALT:{$line[11]}   VEL:{$line[12]}   HDG:{$line[13]}   LAT:{$line[14]}   LON:{$line[15]}   VR:{$line[16]}   SQUAWK:{$line[17]}\n";
733
-		    if ($globalDebug) {
729
+			//adds the spotter LIVE data
730
+			//SpotterLive->addLiveSpotterData($flightaware_id, $ident, $aircraft_type, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed);
731
+			//echo "\nAdd in Live !! \n";
732
+			//echo "{$line[8]} {$line[7]} - MODES:{$line[4]}  CALLSIGN:{$line[10]}   ALT:{$line[11]}   VEL:{$line[12]}   HDG:{$line[13]}   LAT:{$line[14]}   LON:{$line[15]}   VR:{$line[16]}   SQUAWK:{$line[17]}\n";
733
+			if ($globalDebug) {
734 734
 			if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM)) {
735 735
 				if (isset($this->all_flights[$id]['source_name'])) echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name'].' - Source name : '.$this->all_flights[$id]['source_name']."\n";
736 736
 				else echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name']."\n";
@@ -738,49 +738,49 @@  discard block
 block discarded – undo
738 738
 				if (isset($this->all_flights[$id]['source_name'])) echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Source Name : '.$this->all_flights[$id]['source_name']."\n";
739 739
 				else echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time']."\n";
740 740
 			}
741
-		    }
742
-		    $ignoreImport = false;
743
-		    if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; }
744
-		    if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; }
741
+			}
742
+			$ignoreImport = false;
743
+			if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; }
744
+			if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; }
745 745
 
746
-		    foreach($globalAirportIgnore as $airportIgnore) {
747
-		        if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
748
-			    $ignoreImport = true;
746
+			foreach($globalAirportIgnore as $airportIgnore) {
747
+				if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
748
+				$ignoreImport = true;
749
+			}
749 750
 			}
750
-		    }
751
-		    if (count($globalAirportAccept) > 0) {
752
-		        $ignoreImport = true;
753
-		        foreach($globalAirportIgnore as $airportIgnore) {
754
-			    if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
751
+			if (count($globalAirportAccept) > 0) {
752
+				$ignoreImport = true;
753
+				foreach($globalAirportIgnore as $airportIgnore) {
754
+				if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
755 755
 				$ignoreImport = false;
756
-			    }
756
+				}
757 757
 			}
758
-		    }
759
-		    if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) {
758
+			}
759
+			if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) {
760 760
 			foreach($globalAirlineIgnore as $airlineIgnore) {
761
-			    if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) {
761
+				if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) {
762 762
 				$ignoreImport = true;
763
-			    }
763
+				}
764 764
 			}
765
-		    }
766
-		    if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) {
765
+			}
766
+			if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) {
767 767
 			$ignoreImport = true;
768 768
 			foreach($globalAirlineAccept as $airlineAccept) {
769
-			    if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) {
769
+				if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) {
770 770
 				$ignoreImport = false;
771
-			    }
771
+				}
772 772
 			}
773
-		    }
774
-		    if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) {
773
+			}
774
+			if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) {
775 775
 			$ignoreImport = true;
776 776
 			foreach($globalPilotIdAccept as $pilotIdAccept) {
777
-			    if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) {
778
-			        $ignoreImport = false;
779
-			    }
777
+				if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) {
778
+					$ignoreImport = false;
779
+				}
780
+			}
780 781
 			}
781
-		    }
782 782
 
783
-		    if (!$ignoreImport) {
783
+			if (!$ignoreImport) {
784 784
 			if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
785 785
 				if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." from ".$this->all_flights[$id]['format_source']." in Live DB : ";
786 786
 				$timeelapsed = microtime(true);
@@ -818,7 +818,7 @@  discard block
 block discarded – undo
818 818
 					if ($stats_heading == 16) $stats_heading = 0;
819 819
 					if (!isset($this->stats[$current_date][$source]['polar'][1])) {
820 820
 						for ($i=0;$i<=15;$i++) {
821
-						    $this->stats[$current_date][$source]['polar'][$i] = 0;
821
+							$this->stats[$current_date][$source]['polar'][$i] = 0;
822 822
 						}
823 823
 						$this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance;
824 824
 					} else {
@@ -831,11 +831,11 @@  discard block
 block discarded – undo
831 831
 					//var_dump($this->stats);
832 832
 					if (!isset($this->stats[$current_date][$source]['hist'][$distance])) {
833 833
 						if (isset($this->stats[$current_date][$source]['hist'][0])) {
834
-						    end($this->stats[$current_date][$source]['hist']);
835
-						    $mini = key($this->stats[$current_date][$source]['hist'])+10;
834
+							end($this->stats[$current_date][$source]['hist']);
835
+							$mini = key($this->stats[$current_date][$source]['hist'])+10;
836 836
 						} else $mini = 0;
837 837
 						for ($i=$mini;$i<=$distance;$i+=10) {
838
-						    $this->stats[$current_date][$source]['hist'][$i] = 0;
838
+							$this->stats[$current_date][$source]['hist'][$i] = 0;
839 839
 						}
840 840
 						$this->stats[$current_date][$source]['hist'][$distance] = 1;
841 841
 					} else {
@@ -852,22 +852,22 @@  discard block
 block discarded – undo
852 852
 			
853 853
 			
854 854
 			if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) {
855
-			    if ($globalDebug) echo "---- Deleting Live Spotter data Not updated since 2 hour...";
856
-			    $SpotterLive = new SpotterLive($this->db);
857
-			    $SpotterLive->deleteLiveSpotterDataNotUpdated();
858
-			    $SpotterLive->db = null;
859
-			    //SpotterLive->deleteLiveSpotterData();
860
-			    if ($globalDebug) echo " Done\n";
861
-			    $this->last_delete_hourly = time();
855
+				if ($globalDebug) echo "---- Deleting Live Spotter data Not updated since 2 hour...";
856
+				$SpotterLive = new SpotterLive($this->db);
857
+				$SpotterLive->deleteLiveSpotterDataNotUpdated();
858
+				$SpotterLive->db = null;
859
+				//SpotterLive->deleteLiveSpotterData();
860
+				if ($globalDebug) echo " Done\n";
861
+				$this->last_delete_hourly = time();
862 862
 			}
863 863
 			
864
-		    }
865
-		    //$ignoreImport = false;
864
+			}
865
+			//$ignoreImport = false;
866 866
 		}
867 867
 		//if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN);
868 868
 		if ($send) return $this->all_flights[$id];
869
-	    }
869
+		}
870
+	}
870 871
 	}
871
-    }
872 872
 }
873 873
 ?>
Please login to merge, or discard this patch.
require/class.Spotter.php 1 patch
Indentation   +1270 added lines, -1270 removed lines patch added patch discarded remove patch
@@ -13,10 +13,10 @@  discard block
 block discarded – undo
13 13
 	}
14 14
 
15 15
 	/**
16
-	* Get SQL query part for filter used
17
-	* @param Array $filter the filter
18
-	* @return Array the SQL part
19
-	*/
16
+	 * Get SQL query part for filter used
17
+	 * @param Array $filter the filter
18
+	 * @return Array the SQL part
19
+	 */
20 20
 	public function getFilter($filter = array(),$where = false,$and = false) {
21 21
 		global $globalFilter, $globalStatsFilters, $globalFilterName;
22 22
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) $filter = array_merge($globalStatsFilters[$globalFilterName],$filter);
@@ -55,14 +55,14 @@  discard block
 block discarded – undo
55 55
 	}
56 56
 
57 57
 	/**
58
-	* Executes the SQL statements to get the spotter information
59
-	*
60
-	* @param String $query the SQL query
61
-	* @param Array $params parameter of the query
62
-	* @param String $limitQuery the limit query
63
-	* @return Array the spotter information
64
-	*
65
-	*/
58
+	 * Executes the SQL statements to get the spotter information
59
+	 *
60
+	 * @param String $query the SQL query
61
+	 * @param Array $params parameter of the query
62
+	 * @param String $limitQuery the limit query
63
+	 * @return Array the spotter information
64
+	 *
65
+	 */
66 66
 	public function getDataFromDB($query, $params = array(), $limitQuery = '')
67 67
 	{
68 68
 		global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalAirlinesSource, $globalVAM;
@@ -226,11 +226,11 @@  discard block
 block discarded – undo
226 226
 					if ($aircraft_array[0]['aircraft_shadow'] != NULL) {
227 227
 						$temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow'];
228 228
 					} else $temp_array['aircraft_shadow'] = 'default.png';
229
-                                } else {
230
-                            		$temp_array['aircraft_shadow'] = 'default.png';
229
+								} else {
230
+									$temp_array['aircraft_shadow'] = 'default.png';
231 231
 					$temp_array['aircraft_name'] = 'N/A';
232 232
 					$temp_array['aircraft_manufacturer'] = 'N/A';
233
-                            	}
233
+								}
234 234
 			}
235 235
 			$fromsource = NULL;
236 236
 			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
@@ -413,11 +413,11 @@  discard block
 block discarded – undo
413 413
 	
414 414
 	
415 415
 	/**
416
-	* Gets all the spotter information
417
-	*
418
-	* @return Array the spotter information
419
-	*
420
-	*/
416
+	 * Gets all the spotter information
417
+	 *
418
+	 * @return Array the spotter information
419
+	 *
420
+	 */
421 421
 	public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array())
422 422
 	{
423 423
 		global $globalTimezone, $globalDBdriver;
@@ -764,11 +764,11 @@  discard block
 block discarded – undo
764 764
 	
765 765
 	
766 766
 	/**
767
-	* Gets all the spotter information based on the latest data entry
768
-	*
769
-	* @return Array the spotter information
770
-	*
771
-	*/
767
+	 * Gets all the spotter information based on the latest data entry
768
+	 *
769
+	 * @return Array the spotter information
770
+	 *
771
+	 */
772 772
 	public function getLatestSpotterData($limit = '', $sort = '', $filter = array())
773 773
 	{
774 774
 		global $global_query;
@@ -807,12 +807,12 @@  discard block
 block discarded – undo
807 807
 	}
808 808
     
809 809
     
810
-    /**
811
-	* Gets all the spotter information based on a user's latitude and longitude
812
-	*
813
-	* @return Array the spotter information
814
-	*
815
-	*/
810
+	/**
811
+	 * Gets all the spotter information based on a user's latitude and longitude
812
+	 *
813
+	 * @return Array the spotter information
814
+	 *
815
+	 */
816 816
 	public function getLatestSpotterForLayar($lat, $lng, $radius, $interval)
817 817
 	{
818 818
 		date_default_timezone_set('UTC');
@@ -840,7 +840,7 @@  discard block
 block discarded – undo
840 840
 				return false;
841 841
 			}
842 842
 		}
843
-    		$additional_query = '';
843
+			$additional_query = '';
844 844
 		if ($interval != "")
845 845
 		{
846 846
 			if (!is_string($interval))
@@ -880,12 +880,12 @@  discard block
 block discarded – undo
880 880
 	}
881 881
     
882 882
     
883
-    /**
884
-	* Gets all the spotter information sorted by the newest aircraft type
885
-	*
886
-	* @return Array the spotter information
887
-	*
888
-	*/
883
+	/**
884
+	 * Gets all the spotter information sorted by the newest aircraft type
885
+	 *
886
+	 * @return Array the spotter information
887
+	 *
888
+	 */
889 889
 	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array())
890 890
 	{
891 891
 		global $global_query;
@@ -926,11 +926,11 @@  discard block
 block discarded – undo
926 926
     
927 927
     
928 928
 	/**
929
-	* Gets all the spotter information sorted by the newest aircraft registration
930
-	*
931
-	* @return Array the spotter information
932
-	*
933
-	*/
929
+	 * Gets all the spotter information sorted by the newest aircraft registration
930
+	 *
931
+	 * @return Array the spotter information
932
+	 *
933
+	 */
934 934
 	public function getNewestSpotterDataSortedByAircraftRegistration($limit = '', $sort = '', $filter = array())
935 935
 	{
936 936
 		global $global_query;
@@ -970,11 +970,11 @@  discard block
 block discarded – undo
970 970
 
971 971
 
972 972
 	/**
973
-	* Gets all the spotter information sorted by the newest airline
974
-	*
975
-	* @return Array the spotter information
976
-	*
977
-	*/
973
+	 * Gets all the spotter information sorted by the newest airline
974
+	 *
975
+	 * @return Array the spotter information
976
+	 *
977
+	 */
978 978
 	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array())
979 979
 	{
980 980
 		global $global_query;
@@ -1013,12 +1013,12 @@  discard block
 block discarded – undo
1013 1013
 	}
1014 1014
     
1015 1015
     
1016
-    /**
1017
-	* Gets all the spotter information sorted by the newest departure airport
1018
-	*
1019
-	* @return Array the spotter information
1020
-	*
1021
-	*/
1016
+	/**
1017
+	 * Gets all the spotter information sorted by the newest departure airport
1018
+	 *
1019
+	 * @return Array the spotter information
1020
+	 *
1021
+	 */
1022 1022
 	public function getNewestSpotterDataSortedByDepartureAirport($limit = '', $sort = '', $filter = array())
1023 1023
 	{
1024 1024
 		global $global_query;
@@ -1060,11 +1060,11 @@  discard block
 block discarded – undo
1060 1060
 
1061 1061
 
1062 1062
 	/**
1063
-	* Gets all the spotter information sorted by the newest arrival airport
1064
-	*
1065
-	* @return Array the spotter information
1066
-	*
1067
-	*/
1063
+	 * Gets all the spotter information sorted by the newest arrival airport
1064
+	 *
1065
+	 * @return Array the spotter information
1066
+	 *
1067
+	 */
1068 1068
 	public function getNewestSpotterDataSortedByArrivalAirport($limit = '', $sort = '', $filter = array())
1069 1069
 	{
1070 1070
 		global $global_query;
@@ -1103,11 +1103,11 @@  discard block
 block discarded – undo
1103 1103
 	
1104 1104
 
1105 1105
 	/**
1106
-	* Gets all the spotter information based on the spotter id
1107
-	*
1108
-	* @return Array the spotter information
1109
-	*
1110
-	*/
1106
+	 * Gets all the spotter information based on the spotter id
1107
+	 *
1108
+	 * @return Array the spotter information
1109
+	 *
1110
+	 */
1111 1111
 	public function getSpotterDataByID($id = '')
1112 1112
 	{
1113 1113
 		global $global_query;
@@ -1129,11 +1129,11 @@  discard block
 block discarded – undo
1129 1129
 	
1130 1130
 	
1131 1131
 	/**
1132
-	* Gets all the spotter information based on the callsign
1133
-	*
1134
-	* @return Array the spotter information
1135
-	*
1136
-	*/
1132
+	 * Gets all the spotter information based on the callsign
1133
+	 *
1134
+	 * @return Array the spotter information
1135
+	 *
1136
+	 */
1137 1137
 	public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '')
1138 1138
 	{
1139 1139
 		global $global_query;
@@ -1186,11 +1186,11 @@  discard block
 block discarded – undo
1186 1186
 	
1187 1187
 	
1188 1188
 	/**
1189
-	* Gets all the spotter information based on the aircraft type
1190
-	*
1191
-	* @return Array the spotter information
1192
-	*
1193
-	*/
1189
+	 * Gets all the spotter information based on the aircraft type
1190
+	 *
1191
+	 * @return Array the spotter information
1192
+	 *
1193
+	 */
1194 1194
 	public function getSpotterDataByAircraft($aircraft_type = '', $limit = '', $sort = '', $filter = array())
1195 1195
 	{
1196 1196
 		global $global_query;
@@ -1244,11 +1244,11 @@  discard block
 block discarded – undo
1244 1244
 	
1245 1245
 	
1246 1246
 	/**
1247
-	* Gets all the spotter information based on the aircraft registration
1248
-	*
1249
-	* @return Array the spotter information
1250
-	*
1251
-	*/
1247
+	 * Gets all the spotter information based on the aircraft registration
1248
+	 *
1249
+	 * @return Array the spotter information
1250
+	 *
1251
+	 */
1252 1252
 	public function getSpotterDataByRegistration($registration = '', $limit = '', $sort = '', $filter = array())
1253 1253
 	{
1254 1254
 		global $global_query;
@@ -1305,11 +1305,11 @@  discard block
 block discarded – undo
1305 1305
 	
1306 1306
 	
1307 1307
 	/**
1308
-	* Gets all the spotter information based on the airline
1309
-	*
1310
-	* @return Array the spotter information
1311
-	*
1312
-	*/
1308
+	 * Gets all the spotter information based on the airline
1309
+	 *
1310
+	 * @return Array the spotter information
1311
+	 *
1312
+	 */
1313 1313
 	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array())
1314 1314
 	{
1315 1315
 		global $global_query;
@@ -1362,11 +1362,11 @@  discard block
 block discarded – undo
1362 1362
 	
1363 1363
 	
1364 1364
 	/**
1365
-	* Gets all the spotter information based on the airport
1366
-	*
1367
-	* @return Array the spotter information
1368
-	*
1369
-	*/
1365
+	 * Gets all the spotter information based on the airport
1366
+	 *
1367
+	 * @return Array the spotter information
1368
+	 *
1369
+	 */
1370 1370
 	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1371 1371
 	{
1372 1372
 		global $global_query;
@@ -1420,11 +1420,11 @@  discard block
 block discarded – undo
1420 1420
 
1421 1421
 
1422 1422
 	/**
1423
-	* Gets all the spotter information based on the date
1424
-	*
1425
-	* @return Array the spotter information
1426
-	*
1427
-	*/
1423
+	 * Gets all the spotter information based on the date
1424
+	 *
1425
+	 * @return Array the spotter information
1426
+	 *
1427
+	 */
1428 1428
 	public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array())
1429 1429
 	{
1430 1430
 		global $global_query, $globalTimezone, $globalDBdriver;
@@ -1485,11 +1485,11 @@  discard block
 block discarded – undo
1485 1485
 
1486 1486
 
1487 1487
 	/**
1488
-	* Gets all the spotter information based on the country name
1489
-	*
1490
-	* @return Array the spotter information
1491
-	*
1492
-	*/
1488
+	 * Gets all the spotter information based on the country name
1489
+	 *
1490
+	 * @return Array the spotter information
1491
+	 *
1492
+	 */
1493 1493
 	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array())
1494 1494
 	{
1495 1495
 		global $global_query;
@@ -1543,11 +1543,11 @@  discard block
 block discarded – undo
1543 1543
 	
1544 1544
 	
1545 1545
 	/**
1546
-	* Gets all the spotter information based on the manufacturer name
1547
-	*
1548
-	* @return Array the spotter information
1549
-	*
1550
-	*/
1546
+	 * Gets all the spotter information based on the manufacturer name
1547
+	 *
1548
+	 * @return Array the spotter information
1549
+	 *
1550
+	 */
1551 1551
 	public function getSpotterDataByManufacturer($aircraft_manufacturer = '', $limit = '', $sort = '', $filters = array())
1552 1552
 	{
1553 1553
 		global $global_query;
@@ -1603,13 +1603,13 @@  discard block
 block discarded – undo
1603 1603
   
1604 1604
   
1605 1605
 	/**
1606
-	* Gets a list of all aircraft that take a route
1607
-	*
1608
-	* @param String $departure_airport_icao ICAO code of departure airport
1609
-	* @param String $arrival_airport_icao ICAO code of arrival airport
1610
-	* @return Array the spotter information
1611
-	*
1612
-	*/
1606
+	 * Gets a list of all aircraft that take a route
1607
+	 *
1608
+	 * @param String $departure_airport_icao ICAO code of departure airport
1609
+	 * @param String $arrival_airport_icao ICAO code of arrival airport
1610
+	 * @return Array the spotter information
1611
+	 *
1612
+	 */
1613 1613
 	public function getSpotterDataByRoute($departure_airport_icao = '', $arrival_airport_icao = '', $limit = '', $sort = '', $filters = array())
1614 1614
 	{
1615 1615
 		global $global_query;
@@ -1676,11 +1676,11 @@  discard block
 block discarded – undo
1676 1676
 	
1677 1677
 	
1678 1678
 	/**
1679
-	* Gets all the spotter information based on the special column in the table
1680
-	*
1681
-	* @return Array the spotter information
1682
-	*
1683
-	*/
1679
+	 * Gets all the spotter information based on the special column in the table
1680
+	 *
1681
+	 * @return Array the spotter information
1682
+	 *
1683
+	 */
1684 1684
 	public function getSpotterDataByHighlight($limit = '', $sort = '', $filter = array())
1685 1685
 	{
1686 1686
 		global $global_query;
@@ -1719,11 +1719,11 @@  discard block
 block discarded – undo
1719 1719
 	}
1720 1720
 
1721 1721
 	/**
1722
-	* Gets all the highlight based on a aircraft registration
1723
-	*
1724
-	* @return String the highlight text
1725
-	*
1726
-	*/
1722
+	 * Gets all the highlight based on a aircraft registration
1723
+	 *
1724
+	 * @return String the highlight text
1725
+	 *
1726
+	 */
1727 1727
 	public function getHighlightByRegistration($registration,$filter = array())
1728 1728
 	{
1729 1729
 		global $global_query;
@@ -1745,13 +1745,13 @@  discard block
 block discarded – undo
1745 1745
 
1746 1746
 	
1747 1747
 	/**
1748
-	* Gets the squawk usage from squawk code
1749
-	*
1750
-	* @param String $squawk squawk code
1751
-	* @param String $country country
1752
-	* @return String usage
1753
-	*
1754
-	*/
1748
+	 * Gets the squawk usage from squawk code
1749
+	 *
1750
+	 * @param String $squawk squawk code
1751
+	 * @param String $country country
1752
+	 * @return String usage
1753
+	 *
1754
+	 */
1755 1755
 	public function getSquawkUsage($squawk = '',$country = 'FR')
1756 1756
 	{
1757 1757
 		
@@ -1772,12 +1772,12 @@  discard block
 block discarded – undo
1772 1772
 	}
1773 1773
 
1774 1774
 	/**
1775
-	* Gets the airport icao from the iata
1776
-	*
1777
-	* @param String $airport_iata the iata code of the airport
1778
-	* @return String airport iata
1779
-	*
1780
-	*/
1775
+	 * Gets the airport icao from the iata
1776
+	 *
1777
+	 * @param String $airport_iata the iata code of the airport
1778
+	 * @return String airport iata
1779
+	 *
1780
+	 */
1781 1781
 	public function getAirportIcao($airport_iata = '')
1782 1782
 	{
1783 1783
 		
@@ -1797,14 +1797,14 @@  discard block
 block discarded – undo
1797 1797
 	}
1798 1798
 
1799 1799
 	/**
1800
-	* Gets the airport distance
1801
-	*
1802
-	* @param String $airport_icao the icao code of the airport
1803
-	* @param Float $latitude the latitude
1804
-	* @param Float $longitude the longitude
1805
-	* @return Float distance to the airport
1806
-	*
1807
-	*/
1800
+	 * Gets the airport distance
1801
+	 *
1802
+	 * @param String $airport_icao the icao code of the airport
1803
+	 * @param Float $latitude the latitude
1804
+	 * @param Float $longitude the longitude
1805
+	 * @return Float distance to the airport
1806
+	 *
1807
+	 */
1808 1808
 	public function getAirportDistance($airport_icao,$latitude,$longitude)
1809 1809
 	{
1810 1810
 		
@@ -1825,12 +1825,12 @@  discard block
 block discarded – undo
1825 1825
 	}
1826 1826
 	
1827 1827
 	/**
1828
-	* Gets the airport info based on the icao
1829
-	*
1830
-	* @param String $airport the icao code of the airport
1831
-	* @return Array airport information
1832
-	*
1833
-	*/
1828
+	 * Gets the airport info based on the icao
1829
+	 *
1830
+	 * @param String $airport the icao code of the airport
1831
+	 * @return Array airport information
1832
+	 *
1833
+	 */
1834 1834
 	public function getAllAirportInfo($airport = '')
1835 1835
 	{
1836 1836
 		
@@ -1876,12 +1876,12 @@  discard block
 block discarded – undo
1876 1876
 	}
1877 1877
 	
1878 1878
 	/**
1879
-	* Gets the airport info based on the country
1880
-	*
1881
-	* @param Array $countries Airports countries
1882
-	* @return Array airport information
1883
-	*
1884
-	*/
1879
+	 * Gets the airport info based on the country
1880
+	 *
1881
+	 * @param Array $countries Airports countries
1882
+	 * @return Array airport information
1883
+	 *
1884
+	 */
1885 1885
 	public function getAllAirportInfobyCountry($countries)
1886 1886
 	{
1887 1887
 		$lst_countries = '';
@@ -1919,12 +1919,12 @@  discard block
 block discarded – undo
1919 1919
 	}
1920 1920
 	
1921 1921
 	/**
1922
-	* Gets airports info based on the coord
1923
-	*
1924
-	* @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
1925
-	* @return Array airport information
1926
-	*
1927
-	*/
1922
+	 * Gets airports info based on the coord
1923
+	 *
1924
+	 * @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
1925
+	 * @return Array airport information
1926
+	 *
1927
+	 */
1928 1928
 	public function getAllAirportInfobyCoord($coord)
1929 1929
 	{
1930 1930
 		global $globalDBdriver;
@@ -1955,12 +1955,12 @@  discard block
 block discarded – undo
1955 1955
 	}
1956 1956
 
1957 1957
 	/**
1958
-	* Gets waypoints info based on the coord
1959
-	*
1960
-	* @param Array $coord waypoints coord
1961
-	* @return Array airport information
1962
-	*
1963
-	*/
1958
+	 * Gets waypoints info based on the coord
1959
+	 *
1960
+	 * @param Array $coord waypoints coord
1961
+	 * @return Array airport information
1962
+	 *
1963
+	 */
1964 1964
 	public function getAllWaypointsInfobyCoord($coord)
1965 1965
 	{
1966 1966
 		if (is_array($coord)) {
@@ -1994,12 +1994,12 @@  discard block
 block discarded – undo
1994 1994
 	
1995 1995
 	
1996 1996
 	/**
1997
-	* Gets the airline info based on the icao code or iata code
1998
-	*
1999
-	* @param String $airline_icao the iata code of the airport
2000
-	* @return Array airport information
2001
-	*
2002
-	*/
1997
+	 * Gets the airline info based on the icao code or iata code
1998
+	 *
1999
+	 * @param String $airline_icao the iata code of the airport
2000
+	 * @return Array airport information
2001
+	 *
2002
+	 */
2003 2003
 	public function getAllAirlineInfo($airline_icao, $fromsource = NULL)
2004 2004
 	{
2005 2005
 		global $globalUseRealAirlines;
@@ -2030,7 +2030,7 @@  discard block
 block discarded – undo
2030 2030
 			} else {
2031 2031
 				$sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource));
2032 2032
 			}
2033
-                        /*
2033
+						/*
2034 2034
 			$airline_array = array();
2035 2035
 			$temp_array = array();
2036 2036
 		
@@ -2062,12 +2062,12 @@  discard block
 block discarded – undo
2062 2062
 	
2063 2063
 	
2064 2064
 	/**
2065
-	* Gets the aircraft info based on the aircraft type
2066
-	*
2067
-	* @param String $aircraft_type the aircraft type
2068
-	* @return Array aircraft information
2069
-	*
2070
-	*/
2065
+	 * Gets the aircraft info based on the aircraft type
2066
+	 *
2067
+	 * @param String $aircraft_type the aircraft type
2068
+	 * @return Array aircraft information
2069
+	 *
2070
+	 */
2071 2071
 	public function getAllAircraftInfo($aircraft_type)
2072 2072
 	{
2073 2073
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2099,12 +2099,12 @@  discard block
 block discarded – undo
2099 2099
 	}
2100 2100
 
2101 2101
 	/**
2102
-	* Gets the aircraft icao based on the aircraft name/type
2103
-	*
2104
-	* @param String $aircraft_type the aircraft type
2105
-	* @return String aircraft information
2106
-	*
2107
-	*/
2102
+	 * Gets the aircraft icao based on the aircraft name/type
2103
+	 *
2104
+	 * @param String $aircraft_type the aircraft type
2105
+	 * @return String aircraft information
2106
+	 *
2107
+	 */
2108 2108
 	public function getAircraftIcao($aircraft_type)
2109 2109
 	{
2110 2110
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2129,12 +2129,12 @@  discard block
 block discarded – undo
2129 2129
 	}
2130 2130
 	
2131 2131
 	/**
2132
-	* Gets the aircraft info based on the aircraft ident
2133
-	*
2134
-	* @param String $aircraft_modes the aircraft ident (hex)
2135
-	* @return String aircraft type
2136
-	*
2137
-	*/
2132
+	 * Gets the aircraft info based on the aircraft ident
2133
+	 *
2134
+	 * @param String $aircraft_modes the aircraft ident (hex)
2135
+	 * @return String aircraft type
2136
+	 *
2137
+	 */
2138 2138
 	public function getAllAircraftType($aircraft_modes)
2139 2139
 	{
2140 2140
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -2152,12 +2152,12 @@  discard block
 block discarded – undo
2152 2152
 	}
2153 2153
 
2154 2154
 	/**
2155
-	* Gets correct aircraft operator corde
2156
-	*
2157
-	* @param String $operator the aircraft operator code (callsign)
2158
-	* @return String aircraft operator code
2159
-	*
2160
-	*/
2155
+	 * Gets correct aircraft operator corde
2156
+	 *
2157
+	 * @param String $operator the aircraft operator code (callsign)
2158
+	 * @return String aircraft operator code
2159
+	 *
2160
+	 */
2161 2161
 	public function getOperator($operator)
2162 2162
 	{
2163 2163
 		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
@@ -2174,16 +2174,16 @@  discard block
 block discarded – undo
2174 2174
 	}
2175 2175
 
2176 2176
 	/**
2177
-	* Gets the aircraft route based on the aircraft callsign
2178
-	*
2179
-	* @param String $callsign the aircraft callsign
2180
-	* @return Array aircraft type
2181
-	*
2182
-	*/
2177
+	 * Gets the aircraft route based on the aircraft callsign
2178
+	 *
2179
+	 * @param String $callsign the aircraft callsign
2180
+	 * @return Array aircraft type
2181
+	 *
2182
+	 */
2183 2183
 	public function getRouteInfo($callsign)
2184 2184
 	{
2185 2185
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2186
-                if ($callsign == '') return array();
2186
+				if ($callsign == '') return array();
2187 2187
 		$query  = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1";
2188 2188
 		
2189 2189
 		$sth = $this->db->prepare($query);
@@ -2197,12 +2197,12 @@  discard block
 block discarded – undo
2197 2197
 	}
2198 2198
 	
2199 2199
 	/**
2200
-	* Gets the aircraft info based on the aircraft registration
2201
-	*
2202
-	* @param String $registration the aircraft registration
2203
-	* @return Array aircraft information
2204
-	*
2205
-	*/
2200
+	 * Gets the aircraft info based on the aircraft registration
2201
+	 *
2202
+	 * @param String $registration the aircraft registration
2203
+	 * @return Array aircraft information
2204
+	 *
2205
+	 */
2206 2206
 	public function getAircraftInfoByRegistration($registration)
2207 2207
 	{
2208 2208
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2229,12 +2229,12 @@  discard block
 block discarded – undo
2229 2229
 	}
2230 2230
 	
2231 2231
 	/**
2232
-	* Gets the aircraft owner & base based on the aircraft registration
2233
-	*
2234
-	* @param String $registration the aircraft registration
2235
-	* @return Array aircraft information
2236
-	*
2237
-	*/
2232
+	 * Gets the aircraft owner & base based on the aircraft registration
2233
+	 *
2234
+	 * @param String $registration the aircraft registration
2235
+	 * @return Array aircraft information
2236
+	 *
2237
+	 */
2238 2238
 	public function getAircraftOwnerByRegistration($registration)
2239 2239
 	{
2240 2240
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2251,11 +2251,11 @@  discard block
 block discarded – undo
2251 2251
 	
2252 2252
   
2253 2253
   /**
2254
-	* Gets all flights (but with only little info)
2255
-	*
2256
-	* @return Array basic flight information
2257
-	*
2258
-	*/
2254
+   * Gets all flights (but with only little info)
2255
+   *
2256
+   * @return Array basic flight information
2257
+   *
2258
+   */
2259 2259
 	public function getAllFlightsforSitemap()
2260 2260
 	{
2261 2261
 		//$query  = "SELECT spotter_output.spotter_id, spotter_output.ident, spotter_output.airline_name, spotter_output.aircraft_name, spotter_output.aircraft_icao FROM spotter_output ORDER BY LIMIT ";
@@ -2263,7 +2263,7 @@  discard block
 block discarded – undo
2263 2263
 		
2264 2264
 		$sth = $this->db->prepare($query);
2265 2265
 		$sth->execute();
2266
-                  /*
2266
+				  /*
2267 2267
 		$flight_array = array();
2268 2268
 		$temp_array = array();
2269 2269
 		
@@ -2285,11 +2285,11 @@  discard block
 block discarded – undo
2285 2285
 	}
2286 2286
   
2287 2287
 	/**
2288
-	* Gets a list of all aircraft manufacturers
2289
-	*
2290
-	* @return Array list of aircraft types
2291
-	*
2292
-	*/
2288
+	 * Gets a list of all aircraft manufacturers
2289
+	 *
2290
+	 * @return Array list of aircraft types
2291
+	 *
2292
+	 */
2293 2293
 	public function getAllManufacturers()
2294 2294
 	{
2295 2295
 		/*
@@ -2318,11 +2318,11 @@  discard block
 block discarded – undo
2318 2318
   
2319 2319
   
2320 2320
   /**
2321
-	* Gets a list of all aircraft types
2322
-	*
2323
-	* @return Array list of aircraft types
2324
-	*
2325
-	*/
2321
+   * Gets a list of all aircraft types
2322
+   *
2323
+   * @return Array list of aircraft types
2324
+   *
2325
+   */
2326 2326
 	public function getAllAircraftTypes($filters = array())
2327 2327
 	{
2328 2328
 		/*
@@ -2355,11 +2355,11 @@  discard block
 block discarded – undo
2355 2355
 	
2356 2356
 	
2357 2357
 	/**
2358
-	* Gets a list of all aircraft registrations
2359
-	*
2360
-	* @return Array list of aircraft registrations
2361
-	*
2362
-	*/
2358
+	 * Gets a list of all aircraft registrations
2359
+	 *
2360
+	 * @return Array list of aircraft registrations
2361
+	 *
2362
+	 */
2363 2363
 	public function getAllAircraftRegistrations($filters = array())
2364 2364
 	{
2365 2365
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2384,12 +2384,12 @@  discard block
 block discarded – undo
2384 2384
 	}
2385 2385
 
2386 2386
 	/**
2387
-	* Gets all source name
2388
-	*
2389
-	* @param String type format of source
2390
-	* @return Array list of source name
2391
-	*
2392
-	*/
2387
+	 * Gets all source name
2388
+	 *
2389
+	 * @param String type format of source
2390
+	 * @return Array list of source name
2391
+	 *
2392
+	 */
2393 2393
 	public function getAllSourceName($type = '',$filters = array())
2394 2394
 	{
2395 2395
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2420,11 +2420,11 @@  discard block
 block discarded – undo
2420 2420
 
2421 2421
 
2422 2422
 	/**
2423
-	* Gets a list of all airline names
2424
-	*
2425
-	* @return Array list of airline names
2426
-	*
2427
-	*/
2423
+	 * Gets a list of all airline names
2424
+	 *
2425
+	 * @return Array list of airline names
2426
+	 *
2427
+	 */
2428 2428
 	public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array())
2429 2429
 	{
2430 2430
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
@@ -2474,11 +2474,11 @@  discard block
 block discarded – undo
2474 2474
 	
2475 2475
 	
2476 2476
 	/**
2477
-	* Gets a list of all airline countries
2478
-	*
2479
-	* @return Array list of airline countries
2480
-	*
2481
-	*/
2477
+	 * Gets a list of all airline countries
2478
+	 *
2479
+	 * @return Array list of airline countries
2480
+	 *
2481
+	 */
2482 2482
 	public function getAllAirlineCountries($filters = array())
2483 2483
 	{
2484 2484
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2506,11 +2506,11 @@  discard block
 block discarded – undo
2506 2506
 	
2507 2507
 	
2508 2508
 	/**
2509
-	* Gets a list of all departure & arrival names
2510
-	*
2511
-	* @return Array list of airport names
2512
-	*
2513
-	*/
2509
+	 * Gets a list of all departure & arrival names
2510
+	 *
2511
+	 * @return Array list of airport names
2512
+	 *
2513
+	 */
2514 2514
 	public function getAllAirportNames($filters = array())
2515 2515
 	{
2516 2516
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2559,11 +2559,11 @@  discard block
 block discarded – undo
2559 2559
 	
2560 2560
 	
2561 2561
 	/**
2562
-	* Gets a list of all departure & arrival airport countries
2563
-	*
2564
-	* @return Array list of airport countries
2565
-	*
2566
-	*/
2562
+	 * Gets a list of all departure & arrival airport countries
2563
+	 *
2564
+	 * @return Array list of airport countries
2565
+	 *
2566
+	 */
2567 2567
 	public function getAllAirportCountries($filters = array())
2568 2568
 	{
2569 2569
 		$airport_array = array();
@@ -2611,11 +2611,11 @@  discard block
 block discarded – undo
2611 2611
 	
2612 2612
 	
2613 2613
 	/**
2614
-	* Gets a list of all countries (airline, departure airport & arrival airport)
2615
-	*
2616
-	* @return Array list of countries
2617
-	*
2618
-	*/
2614
+	 * Gets a list of all countries (airline, departure airport & arrival airport)
2615
+	 *
2616
+	 * @return Array list of countries
2617
+	 *
2618
+	 */
2619 2619
 	public function getAllCountries($filters = array())
2620 2620
 	{
2621 2621
 		$Connection= new Connection($this->db);
@@ -2692,11 +2692,11 @@  discard block
 block discarded – undo
2692 2692
 	
2693 2693
 	
2694 2694
 	/**
2695
-	* Gets a list of all idents/callsigns
2696
-	*
2697
-	* @return Array list of ident/callsign names
2698
-	*
2699
-	*/
2695
+	 * Gets a list of all idents/callsigns
2696
+	 *
2697
+	 * @return Array list of ident/callsign names
2698
+	 *
2699
+	 */
2700 2700
 	public function getAllIdents($filters = array())
2701 2701
 	{
2702 2702
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2720,9 +2720,9 @@  discard block
 block discarded – undo
2720 2720
 	}
2721 2721
 
2722 2722
 	/**
2723
-	* Get a list of flights from airport since 7 days
2724
-	* @return Array number, icao, name and city of airports
2725
-	*/
2723
+	 * Get a list of flights from airport since 7 days
2724
+	 * @return Array number, icao, name and city of airports
2725
+	 */
2726 2726
 
2727 2727
 	public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) {
2728 2728
 		global $globalTimezone, $globalDBdriver;
@@ -2753,9 +2753,9 @@  discard block
 block discarded – undo
2753 2753
 	}
2754 2754
 
2755 2755
 	/**
2756
-	* Get a list of flights from airport since 7 days
2757
-	* @return Array number, icao, name and city of airports
2758
-	*/
2756
+	 * Get a list of flights from airport since 7 days
2757
+	 * @return Array number, icao, name and city of airports
2758
+	 */
2759 2759
 
2760 2760
 	public function getLast7DaysAirportsDepartureByAirlines($airport_icao = '') {
2761 2761
 		global $globalTimezone, $globalDBdriver;
@@ -2785,9 +2785,9 @@  discard block
 block discarded – undo
2785 2785
 	}
2786 2786
 
2787 2787
 	/**
2788
-	* Get a list of flights from detected airport since 7 days
2789
-	* @return Array number, icao, name and city of airports
2790
-	*/
2788
+	 * Get a list of flights from detected airport since 7 days
2789
+	 * @return Array number, icao, name and city of airports
2790
+	 */
2791 2791
 
2792 2792
 	public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) {
2793 2793
 		global $globalTimezone, $globalDBdriver;
@@ -2825,9 +2825,9 @@  discard block
 block discarded – undo
2825 2825
 	}
2826 2826
 
2827 2827
 	/**
2828
-	* Get a list of flights from detected airport since 7 days
2829
-	* @return Array number, icao, name and city of airports
2830
-	*/
2828
+	 * Get a list of flights from detected airport since 7 days
2829
+	 * @return Array number, icao, name and city of airports
2830
+	 */
2831 2831
 
2832 2832
 	public function getLast7DaysDetectedAirportsDepartureByAirlines($airport_icao = '') {
2833 2833
 		global $globalTimezone, $globalDBdriver;
@@ -2869,9 +2869,9 @@  discard block
 block discarded – undo
2869 2869
 
2870 2870
 
2871 2871
 	/**
2872
-	* Get a list of flights to airport since 7 days
2873
-	* @return Array number, icao, name and city of airports
2874
-	*/
2872
+	 * Get a list of flights to airport since 7 days
2873
+	 * @return Array number, icao, name and city of airports
2874
+	 */
2875 2875
 
2876 2876
 	public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) {
2877 2877
 		global $globalTimezone, $globalDBdriver;
@@ -2904,9 +2904,9 @@  discard block
 block discarded – undo
2904 2904
 
2905 2905
 
2906 2906
 	/**
2907
-	* Get a list of flights detected to airport since 7 days
2908
-	* @return Array number, icao, name and city of airports
2909
-	*/
2907
+	 * Get a list of flights detected to airport since 7 days
2908
+	 * @return Array number, icao, name and city of airports
2909
+	 */
2910 2910
 
2911 2911
 	public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) {
2912 2912
 		global $globalTimezone, $globalDBdriver;
@@ -2947,9 +2947,9 @@  discard block
 block discarded – undo
2947 2947
 
2948 2948
 
2949 2949
 	/**
2950
-	* Get a list of flights to airport since 7 days
2951
-	* @return Array number, icao, name and city of airports
2952
-	*/
2950
+	 * Get a list of flights to airport since 7 days
2951
+	 * @return Array number, icao, name and city of airports
2952
+	 */
2953 2953
 
2954 2954
 	public function getLast7DaysAirportsArrivalByAirlines($airport_icao = '') {
2955 2955
 		global $globalTimezone, $globalDBdriver;
@@ -2981,9 +2981,9 @@  discard block
 block discarded – undo
2981 2981
 
2982 2982
 
2983 2983
 	/**
2984
-	* Get a list of flights detected to airport since 7 days
2985
-	* @return Array number, icao, name and city of airports
2986
-	*/
2984
+	 * Get a list of flights detected to airport since 7 days
2985
+	 * @return Array number, icao, name and city of airports
2986
+	 */
2987 2987
 
2988 2988
 	public function getLast7DaysDetectedAirportsArrivalByAirlines($airport_icao = '') {
2989 2989
 		global $globalTimezone, $globalDBdriver;
@@ -3027,11 +3027,11 @@  discard block
 block discarded – undo
3027 3027
 
3028 3028
 
3029 3029
 	/**
3030
-	* Gets a list of all dates
3031
-	*
3032
-	* @return Array list of date names
3033
-	*
3034
-	*/
3030
+	 * Gets a list of all dates
3031
+	 *
3032
+	 * @return Array list of date names
3033
+	 *
3034
+	 */
3035 3035
 	public function getAllDates()
3036 3036
 	{
3037 3037
 		global $globalTimezone, $globalDBdriver;
@@ -3072,11 +3072,11 @@  discard block
 block discarded – undo
3072 3072
 	
3073 3073
 	
3074 3074
 	/**
3075
-	* Gets all route combinations
3076
-	*
3077
-	* @return Array the route list
3078
-	*
3079
-	*/
3075
+	 * Gets all route combinations
3076
+	 *
3077
+	 * @return Array the route list
3078
+	 *
3079
+	 */
3080 3080
 	public function getAllRoutes()
3081 3081
 	{
3082 3082
 		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route,  spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao 
@@ -3102,13 +3102,13 @@  discard block
 block discarded – undo
3102 3102
 	}
3103 3103
 
3104 3104
 	/**
3105
-	* Update ident spotter data
3106
-	*
3107
-	* @param String $flightaware_id the ID from flightaware
3108
-	* @param String $ident the flight ident
3109
-	* @return String success or false
3110
-	*
3111
-	*/	
3105
+	 * Update ident spotter data
3106
+	 *
3107
+	 * @param String $flightaware_id the ID from flightaware
3108
+	 * @param String $ident the flight ident
3109
+	 * @return String success or false
3110
+	 *
3111
+	 */	
3112 3112
 	public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL)
3113 3113
 	{
3114 3114
 		if (!is_numeric(substr($ident, 0, 3)))
@@ -3129,14 +3129,14 @@  discard block
 block discarded – undo
3129 3129
 		} else {
3130 3130
 			$airline_array = $this->getAllAirlineInfo("NA");
3131 3131
 		}
3132
-                $airline_name = $airline_array[0]['name'];
3133
-                $airline_icao = $airline_array[0]['icao'];
3134
-                $airline_country = $airline_array[0]['country'];
3135
-                $airline_type = $airline_array[0]['type'];
3132
+				$airline_name = $airline_array[0]['name'];
3133
+				$airline_icao = $airline_array[0]['icao'];
3134
+				$airline_country = $airline_array[0]['country'];
3135
+				$airline_type = $airline_array[0]['type'];
3136 3136
 
3137 3137
 
3138 3138
 		$query = 'UPDATE spotter_output SET ident = :ident, airline_name = :airline_name, airline_icao = :airline_icao, airline_country = :airline_country, airline_type = :airline_type WHERE flightaware_id = :flightaware_id';
3139
-                $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type);
3139
+				$query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type);
3140 3140
 
3141 3141
 		try {
3142 3142
 			$sth = $this->db->prepare($query);
@@ -3149,19 +3149,19 @@  discard block
 block discarded – undo
3149 3149
 
3150 3150
 	}
3151 3151
 	/**
3152
-	* Update latest spotter data
3153
-	*
3154
-	* @param String $flightaware_id the ID from flightaware
3155
-	* @param String $ident the flight ident
3156
-	* @param String $arrival_airport_icao the arrival airport
3157
-	* @return String success or false
3158
-	*
3159
-	*/	
3152
+	 * Update latest spotter data
3153
+	 *
3154
+	 * @param String $flightaware_id the ID from flightaware
3155
+	 * @param String $ident the flight ident
3156
+	 * @param String $arrival_airport_icao the arrival airport
3157
+	 * @return String success or false
3158
+	 *
3159
+	 */	
3160 3160
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3161 3161
 	{
3162 3162
 		if ($groundspeed == '') $groundspeed = NULL;
3163 3163
 		$query = 'UPDATE spotter_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_ground = :last_ground, last_seen = :last_seen, real_arrival_airport_icao = :real_arrival_airport_icao, real_arrival_airport_time = :real_arrival_airport_time, last_ground_speed = :last_ground_speed WHERE flightaware_id = :flightaware_id';
3164
-                $query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident);
3164
+				$query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident);
3165 3165
 
3166 3166
 		try {
3167 3167
 			$sth = $this->db->prepare($query);
@@ -3175,32 +3175,32 @@  discard block
 block discarded – undo
3175 3175
 	}
3176 3176
 
3177 3177
 	/**
3178
-	* Adds a new spotter data
3179
-	*
3180
-	* @param String $flightaware_id the ID from flightaware
3181
-	* @param String $ident the flight ident
3182
-	* @param String $aircraft_icao the aircraft type
3183
-	* @param String $departure_airport_icao the departure airport
3184
-	* @param String $arrival_airport_icao the arrival airport
3185
-	* @param String $latitude latitude of flight
3186
-	* @param String $longitude latitude of flight
3187
-	* @param String $waypoints waypoints of flight
3188
-	* @param String $altitude altitude of flight
3189
-	* @param String $heading heading of flight
3190
-	* @param String $groundspeed speed of flight
3191
-	* @param String $date date of flight
3192
-	* @param String $departure_airport_time departure time of flight
3193
-	* @param String $arrival_airport_time arrival time of flight
3194
-	* @param String $squawk squawk code of flight
3195
-	* @param String $route_stop route stop of flight
3196
-	* @param String $highlight highlight or not
3197
-	* @param String $ModeS ModesS code of flight
3198
-	* @param String $registration registration code of flight
3199
-	* @param String $pilot_id pilot id of flight (for virtual airlines)
3200
-	* @param String $pilot_name pilot name of flight (for virtual airlines)
3201
-	* @param String $verticalrate vertival rate of flight
3202
-	* @return String success or false
3203
-	*/
3178
+	 * Adds a new spotter data
3179
+	 *
3180
+	 * @param String $flightaware_id the ID from flightaware
3181
+	 * @param String $ident the flight ident
3182
+	 * @param String $aircraft_icao the aircraft type
3183
+	 * @param String $departure_airport_icao the departure airport
3184
+	 * @param String $arrival_airport_icao the arrival airport
3185
+	 * @param String $latitude latitude of flight
3186
+	 * @param String $longitude latitude of flight
3187
+	 * @param String $waypoints waypoints of flight
3188
+	 * @param String $altitude altitude of flight
3189
+	 * @param String $heading heading of flight
3190
+	 * @param String $groundspeed speed of flight
3191
+	 * @param String $date date of flight
3192
+	 * @param String $departure_airport_time departure time of flight
3193
+	 * @param String $arrival_airport_time arrival time of flight
3194
+	 * @param String $squawk squawk code of flight
3195
+	 * @param String $route_stop route stop of flight
3196
+	 * @param String $highlight highlight or not
3197
+	 * @param String $ModeS ModesS code of flight
3198
+	 * @param String $registration registration code of flight
3199
+	 * @param String $pilot_id pilot id of flight (for virtual airlines)
3200
+	 * @param String $pilot_name pilot name of flight (for virtual airlines)
3201
+	 * @param String $verticalrate vertival rate of flight
3202
+	 * @return String success or false
3203
+	 */
3204 3204
 	public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '',$squawk = '', $route_stop = '', $highlight = '', $ModeS = '', $registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $ground = false,$format_source = '', $source_name = '')
3205 3205
 	{
3206 3206
 		global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM;
@@ -3414,8 +3414,8 @@  discard block
 block discarded – undo
3414 3414
     
3415 3415
 		if ($globalIVAO && $aircraft_icao != '')
3416 3416
 		{
3417
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3418
-            		else $airline_icao = '';
3417
+					if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3418
+					else $airline_icao = '';
3419 3419
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3420 3420
 			if (!isset($image_array[0]['registration']))
3421 3421
 			{
@@ -3446,52 +3446,52 @@  discard block
 block discarded – undo
3446 3446
 	
3447 3447
 		if (count($airline_array) == 0) 
3448 3448
 		{
3449
-                        $airline_array = $this->getAllAirlineInfo('NA');
3450
-                }
3451
-                if (count($aircraft_array) == 0) 
3452
-                {
3453
-                        $aircraft_array = $this->getAllAircraftInfo('NA');
3454
-                }
3455
-                if (count($departure_airport_array) == 0) 
3456
-                {
3457
-                        $departure_airport_array = $this->getAllAirportInfo('NA');
3458
-                }
3459
-                if (count($arrival_airport_array) == 0) 
3460
-                {
3461
-                        $arrival_airport_array = $this->getAllAirportInfo('NA');
3462
-                }
3463
-                if ($registration == '') $registration = 'NA';
3464
-                if ($latitude == '' && $longitude == '') {
3465
-            		$latitude = 0;
3466
-            		$longitude = 0;
3467
-            	}
3468
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3469
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3470
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3471
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3472
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3473
-                $query  = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) 
3449
+						$airline_array = $this->getAllAirlineInfo('NA');
3450
+				}
3451
+				if (count($aircraft_array) == 0) 
3452
+				{
3453
+						$aircraft_array = $this->getAllAircraftInfo('NA');
3454
+				}
3455
+				if (count($departure_airport_array) == 0) 
3456
+				{
3457
+						$departure_airport_array = $this->getAllAirportInfo('NA');
3458
+				}
3459
+				if (count($arrival_airport_array) == 0) 
3460
+				{
3461
+						$arrival_airport_array = $this->getAllAirportInfo('NA');
3462
+				}
3463
+				if ($registration == '') $registration = 'NA';
3464
+				if ($latitude == '' && $longitude == '') {
3465
+					$latitude = 0;
3466
+					$longitude = 0;
3467
+				}
3468
+				if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3469
+				if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3470
+				if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3471
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3472
+				if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3473
+				$query  = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) 
3474 3474
                 VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name,:departure_airport_city,:departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date, :departure_airport_time, :arrival_airport_time, :squawk, :route_stop, :highlight, :ModeS, :pilot_id, :pilot_name, :verticalrate, :owner_name,:ground, :format_source, :source_name)";
3475 3475
 
3476
-                $airline_name = $airline_array[0]['name'];
3477
-                $airline_icao = $airline_array[0]['icao'];
3478
-                $airline_country = $airline_array[0]['country'];
3479
-                $airline_type = $airline_array[0]['type'];
3476
+				$airline_name = $airline_array[0]['name'];
3477
+				$airline_icao = $airline_array[0]['icao'];
3478
+				$airline_country = $airline_array[0]['country'];
3479
+				$airline_type = $airline_array[0]['type'];
3480 3480
 		if ($airline_type == '') {
3481 3481
 			$timeelapsed = microtime(true);
3482 3482
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3483 3483
 			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3484 3484
 		}
3485 3485
 		if ($airline_type == null) $airline_type = '';
3486
-                $aircraft_type = $aircraft_array[0]['type'];
3487
-                $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3488
-                $departure_airport_name = $departure_airport_array[0]['name'];
3489
-                $departure_airport_city = $departure_airport_array[0]['city'];
3490
-                $departure_airport_country = $departure_airport_array[0]['country'];
3491
-                $arrival_airport_name = $arrival_airport_array[0]['name'];
3492
-                $arrival_airport_city = $arrival_airport_array[0]['city'];
3493
-                $arrival_airport_country = $arrival_airport_array[0]['country'];
3494
-                $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date,':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name);
3486
+				$aircraft_type = $aircraft_array[0]['type'];
3487
+				$aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3488
+				$departure_airport_name = $departure_airport_array[0]['name'];
3489
+				$departure_airport_city = $departure_airport_array[0]['city'];
3490
+				$departure_airport_country = $departure_airport_array[0]['country'];
3491
+				$arrival_airport_name = $arrival_airport_array[0]['name'];
3492
+				$arrival_airport_city = $arrival_airport_array[0]['city'];
3493
+				$arrival_airport_country = $arrival_airport_array[0]['country'];
3494
+				$query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date,':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name);
3495 3495
 
3496 3496
 		try {
3497 3497
 		        
@@ -3499,7 +3499,7 @@  discard block
 block discarded – undo
3499 3499
 			$sth->execute($query_values);
3500 3500
 			$this->db = null;
3501 3501
 		} catch (PDOException $e) {
3502
-		    return "error : ".$e->getMessage();
3502
+			return "error : ".$e->getMessage();
3503 3503
 		}
3504 3504
 		
3505 3505
 		return "success";
@@ -3508,11 +3508,11 @@  discard block
 block discarded – undo
3508 3508
 	
3509 3509
   
3510 3510
 	/**
3511
-	* Gets the aircraft ident within the last hour
3512
-	*
3513
-	* @return String the ident
3514
-	*
3515
-	*/
3511
+	 * Gets the aircraft ident within the last hour
3512
+	 *
3513
+	 * @return String the ident
3514
+	 *
3515
+	 */
3516 3516
 	public function getIdentFromLastHour($ident)
3517 3517
 	{
3518 3518
 		global $globalDBdriver, $globalTimezone;
@@ -3528,11 +3528,11 @@  discard block
 block discarded – undo
3528 3528
 								AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
3529 3529
 								AND spotter_output.date < now() AT TIME ZONE 'UTC'";
3530 3530
 			$query_data = array(':ident' => $ident);
3531
-    		}
3531
+			}
3532 3532
 		
3533 3533
 		$sth = $this->db->prepare($query);
3534 3534
 		$sth->execute($query_data);
3535
-    		$ident_result='';
3535
+			$ident_result='';
3536 3536
 		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3537 3537
 		{
3538 3538
 			$ident_result = $row['ident'];
@@ -3543,11 +3543,11 @@  discard block
 block discarded – undo
3543 3543
 	
3544 3544
 	
3545 3545
 	/**
3546
-	* Gets the aircraft data from the last 20 seconds
3547
-	*
3548
-	* @return Array the spotter data
3549
-	*
3550
-	*/
3546
+	 * Gets the aircraft data from the last 20 seconds
3547
+	 *
3548
+	 * @return Array the spotter data
3549
+	 *
3550
+	 */
3551 3551
 	public function getRealTimeData($q = '')
3552 3552
 	{
3553 3553
 		global $globalDBdriver;
@@ -3591,11 +3591,11 @@  discard block
 block discarded – undo
3591 3591
 	
3592 3592
 	
3593 3593
 	 /**
3594
-	* Gets all airlines that have flown over
3595
-	*
3596
-	* @return Array the airline list
3597
-	*
3598
-	*/
3594
+	  * Gets all airlines that have flown over
3595
+	  *
3596
+	  * @return Array the airline list
3597
+	  *
3598
+	  */
3599 3599
 	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3600 3600
 	{
3601 3601
 		global $globalDBdriver;
@@ -3609,7 +3609,7 @@  discard block
 block discarded – undo
3609 3609
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3610 3610
 			}
3611 3611
 		}
3612
-                if ($sincedate != '') {
3612
+				if ($sincedate != '') {
3613 3613
 			if ($globalDBdriver == 'mysql') {
3614 3614
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3615 3615
 			} else {
@@ -3636,26 +3636,26 @@  discard block
 block discarded – undo
3636 3636
 	}
3637 3637
 
3638 3638
 	 /**
3639
-	* Gets all pilots that have flown over
3640
-	*
3641
-	* @return Array the pilots list
3642
-	*
3643
-	*/
3639
+	  * Gets all pilots that have flown over
3640
+	  *
3641
+	  * @return Array the pilots list
3642
+	  *
3643
+	  */
3644 3644
 	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3645 3645
 	{
3646 3646
 		global $globalDBdriver;
3647 3647
 		$filter_query = $this->getFilter($filters,true,true);
3648 3648
 		$query  = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count
3649 3649
 		 			FROM spotter_output".$filter_query." spotter_output.pilot_id <> '' ";
3650
-                if ($olderthanmonths > 0) {
3651
-            		if ($globalDBdriver == 'mysql') {
3650
+				if ($olderthanmonths > 0) {
3651
+					if ($globalDBdriver == 'mysql') {
3652 3652
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3653 3653
 			} else {
3654 3654
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3655 3655
 			}
3656 3656
 		}
3657
-                if ($sincedate != '') {
3658
-            		if ($globalDBdriver == 'mysql') {
3657
+				if ($sincedate != '') {
3658
+					if ($globalDBdriver == 'mysql') {
3659 3659
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3660 3660
 			} else {
3661 3661
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3682,25 +3682,25 @@  discard block
 block discarded – undo
3682 3682
 	}
3683 3683
 	
3684 3684
 		 /**
3685
-	* Gets all pilots that have flown over
3686
-	*
3687
-	* @return Array the pilots list
3688
-	*
3689
-	*/
3685
+		  * Gets all pilots that have flown over
3686
+		  *
3687
+		  * @return Array the pilots list
3688
+		  *
3689
+		  */
3690 3690
 	public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
3691 3691
 	{
3692 3692
 		global $globalDBdriver;
3693 3693
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count
3694 3694
 		 			FROM spotter_output WHERE spotter_output.pilot_id <> '' ";
3695
-                if ($olderthanmonths > 0) {
3696
-            		if ($globalDBdriver == 'mysql') {
3695
+				if ($olderthanmonths > 0) {
3696
+					if ($globalDBdriver == 'mysql') {
3697 3697
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3698 3698
 			} else {
3699 3699
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3700 3700
 			}
3701 3701
 		}
3702
-                if ($sincedate != '') {
3703
-            		if ($globalDBdriver == 'mysql') {
3702
+				if ($sincedate != '') {
3703
+					if ($globalDBdriver == 'mysql') {
3704 3704
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3705 3705
 			} else {
3706 3706
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3728,26 +3728,26 @@  discard block
 block discarded – undo
3728 3728
 	}
3729 3729
 	
3730 3730
 	 /**
3731
-	* Gets all owner that have flown over
3732
-	*
3733
-	* @return Array the pilots list
3734
-	*
3735
-	*/
3731
+	  * Gets all owner that have flown over
3732
+	  *
3733
+	  * @return Array the pilots list
3734
+	  *
3735
+	  */
3736 3736
 	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3737 3737
 	{
3738 3738
 		global $globalDBdriver;
3739 3739
 		$filter_query = $this->getFilter($filters,true,true);
3740 3740
 		$query  = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3741 3741
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3742
-                if ($olderthanmonths > 0) {
3743
-            		if ($globalDBdriver == 'mysql') {
3742
+				if ($olderthanmonths > 0) {
3743
+					if ($globalDBdriver == 'mysql') {
3744 3744
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3745 3745
 			} else {
3746 3746
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3747 3747
 			}
3748 3748
 		}
3749
-                if ($sincedate != '') {
3750
-            		if ($globalDBdriver == 'mysql') {
3749
+				if ($sincedate != '') {
3750
+					if ($globalDBdriver == 'mysql') {
3751 3751
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3752 3752
 			} else {
3753 3753
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3773,26 +3773,26 @@  discard block
 block discarded – undo
3773 3773
 	}
3774 3774
 	
3775 3775
 	 /**
3776
-	* Gets all owner that have flown over
3777
-	*
3778
-	* @return Array the pilots list
3779
-	*
3780
-	*/
3776
+	  * Gets all owner that have flown over
3777
+	  *
3778
+	  * @return Array the pilots list
3779
+	  *
3780
+	  */
3781 3781
 	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3782 3782
 	{
3783 3783
 		global $globalDBdriver;
3784 3784
 		$filter_query = $this->getFilter($filters,true,true);
3785 3785
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3786 3786
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3787
-                if ($olderthanmonths > 0) {
3788
-            		if ($globalDBdriver == 'mysql') {
3787
+				if ($olderthanmonths > 0) {
3788
+					if ($globalDBdriver == 'mysql') {
3789 3789
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3790 3790
 			} else {
3791 3791
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3792 3792
 			}
3793 3793
 		}
3794
-                if ($sincedate != '') {
3795
-            		if ($globalDBdriver == 'mysql') {
3794
+				if ($sincedate != '') {
3795
+					if ($globalDBdriver == 'mysql') {
3796 3796
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3797 3797
 			} else {
3798 3798
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3819,11 +3819,11 @@  discard block
 block discarded – undo
3819 3819
 	}
3820 3820
 
3821 3821
 	/**
3822
-	* Gets all airlines that have flown over by aircraft
3823
-	*
3824
-	* @return Array the airline list
3825
-	*
3826
-	*/
3822
+	 * Gets all airlines that have flown over by aircraft
3823
+	 *
3824
+	 * @return Array the airline list
3825
+	 *
3826
+	 */
3827 3827
 	public function countAllAirlinesByAircraft($aircraft_icao,$filters = array())
3828 3828
 	{
3829 3829
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -3855,11 +3855,11 @@  discard block
 block discarded – undo
3855 3855
 
3856 3856
 
3857 3857
 	/**
3858
-	* Gets all airline countries that have flown over by aircraft
3859
-	*
3860
-	* @return Array the airline country list
3861
-	*
3862
-	*/
3858
+	 * Gets all airline countries that have flown over by aircraft
3859
+	 *
3860
+	 * @return Array the airline country list
3861
+	 *
3862
+	 */
3863 3863
 	public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array())
3864 3864
 	{
3865 3865
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -3891,11 +3891,11 @@  discard block
 block discarded – undo
3891 3891
 	
3892 3892
 	
3893 3893
 	/**
3894
-	* Gets all airlines that have flown over by airport
3895
-	*
3896
-	* @return Array the airline list
3897
-	*
3898
-	*/
3894
+	 * Gets all airlines that have flown over by airport
3895
+	 *
3896
+	 * @return Array the airline list
3897
+	 *
3898
+	 */
3899 3899
 	public function countAllAirlinesByAirport($airport_icao,$filters = array())
3900 3900
 	{
3901 3901
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -3926,11 +3926,11 @@  discard block
 block discarded – undo
3926 3926
 
3927 3927
 
3928 3928
 	/**
3929
-	* Gets all airline countries that have flown over by airport icao
3930
-	*
3931
-	* @return Array the airline country list
3932
-	*
3933
-	*/
3929
+	 * Gets all airline countries that have flown over by airport icao
3930
+	 *
3931
+	 * @return Array the airline country list
3932
+	 *
3933
+	 */
3934 3934
 	public function countAllAirlineCountriesByAirport($airport_icao,$filters = array())
3935 3935
 	{
3936 3936
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -3960,11 +3960,11 @@  discard block
 block discarded – undo
3960 3960
 
3961 3961
 
3962 3962
 	/**
3963
-	* Gets all airlines that have flown over by aircraft manufacturer
3964
-	*
3965
-	* @return Array the airline list
3966
-	*
3967
-	*/
3963
+	 * Gets all airlines that have flown over by aircraft manufacturer
3964
+	 *
3965
+	 * @return Array the airline list
3966
+	 *
3967
+	 */
3968 3968
 	public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array())
3969 3969
 	{
3970 3970
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -3995,11 +3995,11 @@  discard block
 block discarded – undo
3995 3995
 
3996 3996
 
3997 3997
 	/**
3998
-	* Gets all airline countries that have flown over by aircraft manufacturer
3999
-	*
4000
-	* @return Array the airline country list
4001
-	*
4002
-	*/
3998
+	 * Gets all airline countries that have flown over by aircraft manufacturer
3999
+	 *
4000
+	 * @return Array the airline country list
4001
+	 *
4002
+	 */
4003 4003
 	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array())
4004 4004
 	{
4005 4005
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4028,11 +4028,11 @@  discard block
 block discarded – undo
4028 4028
 
4029 4029
 
4030 4030
 	/**
4031
-	* Gets all airlines that have flown over by date
4032
-	*
4033
-	* @return Array the airline list
4034
-	*
4035
-	*/
4031
+	 * Gets all airlines that have flown over by date
4032
+	 *
4033
+	 * @return Array the airline list
4034
+	 *
4035
+	 */
4036 4036
 	public function countAllAirlinesByDate($date,$filters = array())
4037 4037
 	{
4038 4038
 		global $globalTimezone, $globalDBdriver;
@@ -4076,11 +4076,11 @@  discard block
 block discarded – undo
4076 4076
 	
4077 4077
 	
4078 4078
 	/**
4079
-	* Gets all airline countries that have flown over by date
4080
-	*
4081
-	* @return Array the airline country list
4082
-	*
4083
-	*/
4079
+	 * Gets all airline countries that have flown over by date
4080
+	 *
4081
+	 * @return Array the airline country list
4082
+	 *
4083
+	 */
4084 4084
 	public function countAllAirlineCountriesByDate($date,$filters = array())
4085 4085
 	{
4086 4086
 		global $globalTimezone, $globalDBdriver;
@@ -4123,11 +4123,11 @@  discard block
 block discarded – undo
4123 4123
 
4124 4124
 
4125 4125
 	/**
4126
-	* Gets all airlines that have flown over by ident/callsign
4127
-	*
4128
-	* @return Array the airline list
4129
-	*
4130
-	*/
4126
+	 * Gets all airlines that have flown over by ident/callsign
4127
+	 *
4128
+	 * @return Array the airline list
4129
+	 *
4130
+	 */
4131 4131
 	public function countAllAirlinesByIdent($ident,$filters = array())
4132 4132
 	{
4133 4133
 		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
@@ -4157,11 +4157,11 @@  discard block
 block discarded – undo
4157 4157
 	}
4158 4158
 
4159 4159
 	/**
4160
-	* Gets all airlines that have flown over by route
4161
-	*
4162
-	* @return Array the airline list
4163
-	*
4164
-	*/
4160
+	 * Gets all airlines that have flown over by route
4161
+	 *
4162
+	 * @return Array the airline list
4163
+	 *
4164
+	 */
4165 4165
 	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
4166 4166
 	{
4167 4167
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4193,11 +4193,11 @@  discard block
 block discarded – undo
4193 4193
 	}
4194 4194
 
4195 4195
 	/**
4196
-	* Gets all airline countries that have flown over by route
4197
-	*
4198
-	* @return Array the airline country list
4199
-	*
4200
-	*/
4196
+	 * Gets all airline countries that have flown over by route
4197
+	 *
4198
+	 * @return Array the airline country list
4199
+	 *
4200
+	 */
4201 4201
 	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array())
4202 4202
 	{
4203 4203
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4229,11 +4229,11 @@  discard block
 block discarded – undo
4229 4229
 
4230 4230
 
4231 4231
 	/**
4232
-	* Gets all airlines that have flown over by country
4233
-	*
4234
-	* @return Array the airline list
4235
-	*
4236
-	*/
4232
+	 * Gets all airlines that have flown over by country
4233
+	 *
4234
+	 * @return Array the airline list
4235
+	 *
4236
+	 */
4237 4237
 	public function countAllAirlinesByCountry($country,$filters = array())
4238 4238
 	{
4239 4239
 		$country = filter_var($country,FILTER_SANITIZE_STRING);
@@ -4263,11 +4263,11 @@  discard block
 block discarded – undo
4263 4263
 
4264 4264
 
4265 4265
 	/**
4266
-	* Gets all airline countries that have flown over by country
4267
-	*
4268
-	* @return Array the airline country list
4269
-	*
4270
-	*/
4266
+	 * Gets all airline countries that have flown over by country
4267
+	 *
4268
+	 * @return Array the airline country list
4269
+	 *
4270
+	 */
4271 4271
 	public function countAllAirlineCountriesByCountry($country,$filters = array())
4272 4272
 	{
4273 4273
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4296,11 +4296,11 @@  discard block
 block discarded – undo
4296 4296
 
4297 4297
 
4298 4298
 	/**
4299
-	* Gets all airlines countries
4300
-	*
4301
-	* @return Array the airline country list
4302
-	*
4303
-	*/
4299
+	 * Gets all airlines countries
4300
+	 *
4301
+	 * @return Array the airline country list
4302
+	 *
4303
+	 */
4304 4304
 	public function countAllAirlineCountries($limit = true, $filters = array())
4305 4305
 	{
4306 4306
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4326,11 +4326,11 @@  discard block
 block discarded – undo
4326 4326
 	}
4327 4327
 
4328 4328
 	/**
4329
-	* Gets all number of flight over countries
4330
-	*
4331
-	* @return Array the airline country list
4332
-	*
4333
-	*/
4329
+	 * Gets all number of flight over countries
4330
+	 *
4331
+	 * @return Array the airline country list
4332
+	 *
4333
+	 */
4334 4334
 	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
4335 4335
 	{
4336 4336
 		global $globalDBdriver;
@@ -4345,15 +4345,15 @@  discard block
 block discarded – undo
4345 4345
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
4346 4346
 					FROM countries c, spotter_live s
4347 4347
 					WHERE c.iso2 = s.over_country ";
4348
-                if ($olderthanmonths > 0) {
4348
+				if ($olderthanmonths > 0) {
4349 4349
 			if ($globalDBdriver == 'mysql') {
4350 4350
 				$query .= 'AND spotter_live.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
4351 4351
 			} else {
4352 4352
 				$query .= "AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
4353 4353
 			}
4354 4354
 		}
4355
-                if ($sincedate != '') {
4356
-            		if ($globalDBdriver == 'mysql') {
4355
+				if ($sincedate != '') {
4356
+					if ($globalDBdriver == 'mysql') {
4357 4357
 				$query .= "AND spotter_live.date > '".$sincedate."' ";
4358 4358
 			} else {
4359 4359
 				$query .= "AND spotter_live.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4383,11 +4383,11 @@  discard block
 block discarded – undo
4383 4383
 	
4384 4384
 	
4385 4385
 	/**
4386
-	* Gets all aircraft types that have flown over
4387
-	*
4388
-	* @return Array the aircraft list
4389
-	*
4390
-	*/
4386
+	 * Gets all aircraft types that have flown over
4387
+	 *
4388
+	 * @return Array the aircraft list
4389
+	 *
4390
+	 */
4391 4391
 	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4392 4392
 	{
4393 4393
 		global $globalDBdriver;
@@ -4430,11 +4430,11 @@  discard block
 block discarded – undo
4430 4430
 	}
4431 4431
 
4432 4432
 	/**
4433
-	* Gets all aircraft types that have flown over by airline
4434
-	*
4435
-	* @return Array the aircraft list
4436
-	*
4437
-	*/
4433
+	 * Gets all aircraft types that have flown over by airline
4434
+	 *
4435
+	 * @return Array the aircraft list
4436
+	 *
4437
+	 */
4438 4438
 	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4439 4439
 	{
4440 4440
 		global $globalDBdriver;
@@ -4478,11 +4478,11 @@  discard block
 block discarded – undo
4478 4478
 
4479 4479
 
4480 4480
 	/**
4481
-	* Gets all aircraft registration that have flown over by aircaft icao
4482
-	*
4483
-	* @return Array the aircraft list
4484
-	*
4485
-	*/
4481
+	 * Gets all aircraft registration that have flown over by aircaft icao
4482
+	 *
4483
+	 * @return Array the aircraft list
4484
+	 *
4485
+	 */
4486 4486
 	public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array())
4487 4487
 	{
4488 4488
 		$Image = new Image($this->db);
@@ -4521,11 +4521,11 @@  discard block
 block discarded – undo
4521 4521
 
4522 4522
 
4523 4523
 	/**
4524
-	* Gets all aircraft types that have flown over by airline icao
4525
-	*
4526
-	* @return Array the aircraft list
4527
-	*
4528
-	*/
4524
+	 * Gets all aircraft types that have flown over by airline icao
4525
+	 *
4526
+	 * @return Array the aircraft list
4527
+	 *
4528
+	 */
4529 4529
 	public function countAllAircraftTypesByAirline($airline_icao,$filters = array())
4530 4530
 	{
4531 4531
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4554,11 +4554,11 @@  discard block
 block discarded – undo
4554 4554
 
4555 4555
 
4556 4556
 	/**
4557
-	* Gets all aircraft registration that have flown over by airline icao
4558
-	*
4559
-	* @return Array the aircraft list
4560
-	*
4561
-	*/
4557
+	 * Gets all aircraft registration that have flown over by airline icao
4558
+	 *
4559
+	 * @return Array the aircraft list
4560
+	 *
4561
+	 */
4562 4562
 	public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array())
4563 4563
 	{
4564 4564
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4596,11 +4596,11 @@  discard block
 block discarded – undo
4596 4596
 
4597 4597
 
4598 4598
 	/**
4599
-	* Gets all aircraft manufacturer that have flown over by airline icao
4600
-	*
4601
-	* @return Array the aircraft list
4602
-	*
4603
-	*/
4599
+	 * Gets all aircraft manufacturer that have flown over by airline icao
4600
+	 *
4601
+	 * @return Array the aircraft list
4602
+	 *
4603
+	 */
4604 4604
 	public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array())
4605 4605
 	{
4606 4606
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4628,11 +4628,11 @@  discard block
 block discarded – undo
4628 4628
 
4629 4629
 
4630 4630
 	/**
4631
-	* Gets all aircraft types that have flown over by airline icao
4632
-	*
4633
-	* @return Array the aircraft list
4634
-	*
4635
-	*/
4631
+	 * Gets all aircraft types that have flown over by airline icao
4632
+	 *
4633
+	 * @return Array the aircraft list
4634
+	 *
4635
+	 */
4636 4636
 	public function countAllAircraftTypesByAirport($airport_icao,$filters = array())
4637 4637
 	{
4638 4638
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4661,11 +4661,11 @@  discard block
 block discarded – undo
4661 4661
 
4662 4662
 
4663 4663
 	/**
4664
-	* Gets all aircraft registration that have flown over by airport icao
4665
-	*
4666
-	* @return Array the aircraft list
4667
-	*
4668
-	*/
4664
+	 * Gets all aircraft registration that have flown over by airport icao
4665
+	 *
4666
+	 * @return Array the aircraft list
4667
+	 *
4668
+	 */
4669 4669
 	public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array())
4670 4670
 	{
4671 4671
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4702,11 +4702,11 @@  discard block
 block discarded – undo
4702 4702
 	
4703 4703
 	
4704 4704
 	/**
4705
-	* Gets all aircraft manufacturer that have flown over by airport icao
4706
-	*
4707
-	* @return Array the aircraft list
4708
-	*
4709
-	*/
4705
+	 * Gets all aircraft manufacturer that have flown over by airport icao
4706
+	 *
4707
+	 * @return Array the aircraft list
4708
+	 *
4709
+	 */
4710 4710
 	public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array())
4711 4711
 	{
4712 4712
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4732,11 +4732,11 @@  discard block
 block discarded – undo
4732 4732
 	}
4733 4733
 
4734 4734
 	/**
4735
-	* Gets all aircraft types that have flown over by aircraft manufacturer
4736
-	*
4737
-	* @return Array the aircraft list
4738
-	*
4739
-	*/
4735
+	 * Gets all aircraft types that have flown over by aircraft manufacturer
4736
+	 *
4737
+	 * @return Array the aircraft list
4738
+	 *
4739
+	 */
4740 4740
 	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array())
4741 4741
 	{
4742 4742
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4763,11 +4763,11 @@  discard block
 block discarded – undo
4763 4763
 
4764 4764
 
4765 4765
 	/**
4766
-	* Gets all aircraft registration that have flown over by aircaft manufacturer
4767
-	*
4768
-	* @return Array the aircraft list
4769
-	*
4770
-	*/
4766
+	 * Gets all aircraft registration that have flown over by aircaft manufacturer
4767
+	 *
4768
+	 * @return Array the aircraft list
4769
+	 *
4770
+	 */
4771 4771
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array())
4772 4772
 	{
4773 4773
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4803,11 +4803,11 @@  discard block
 block discarded – undo
4803 4803
 	}
4804 4804
 
4805 4805
 	/**
4806
-	* Gets all aircraft types that have flown over by date
4807
-	*
4808
-	* @return Array the aircraft list
4809
-	*
4810
-	*/
4806
+	 * Gets all aircraft types that have flown over by date
4807
+	 *
4808
+	 * @return Array the aircraft list
4809
+	 *
4810
+	 */
4811 4811
 	public function countAllAircraftTypesByDate($date,$filters = array())
4812 4812
 	{
4813 4813
 		global $globalTimezone, $globalDBdriver;
@@ -4849,11 +4849,11 @@  discard block
 block discarded – undo
4849 4849
 
4850 4850
 
4851 4851
 	/**
4852
-	* Gets all aircraft registration that have flown over by date
4853
-	*
4854
-	* @return Array the aircraft list
4855
-	*
4856
-	*/
4852
+	 * Gets all aircraft registration that have flown over by date
4853
+	 *
4854
+	 * @return Array the aircraft list
4855
+	 *
4856
+	 */
4857 4857
 	public function countAllAircraftRegistrationByDate($date,$filters = array())
4858 4858
 	{
4859 4859
 		global $globalTimezone, $globalDBdriver;
@@ -4904,11 +4904,11 @@  discard block
 block discarded – undo
4904 4904
 
4905 4905
 
4906 4906
 	/**
4907
-	* Gets all aircraft manufacturer that have flown over by date
4908
-	*
4909
-	* @return Array the aircraft manufacturer list
4910
-	*
4911
-	*/
4907
+	 * Gets all aircraft manufacturer that have flown over by date
4908
+	 *
4909
+	 * @return Array the aircraft manufacturer list
4910
+	 *
4911
+	 */
4912 4912
 	public function countAllAircraftManufacturerByDate($date,$filters = array())
4913 4913
 	{
4914 4914
 		global $globalTimezone, $globalDBdriver;
@@ -4950,11 +4950,11 @@  discard block
 block discarded – undo
4950 4950
 
4951 4951
 
4952 4952
 	/**
4953
-	* Gets all aircraft types that have flown over by ident/callsign
4954
-	*
4955
-	* @return Array the aircraft list
4956
-	*
4957
-	*/
4953
+	 * Gets all aircraft types that have flown over by ident/callsign
4954
+	 *
4955
+	 * @return Array the aircraft list
4956
+	 *
4957
+	 */
4958 4958
 	public function countAllAircraftTypesByIdent($ident,$filters = array())
4959 4959
 	{
4960 4960
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4983,11 +4983,11 @@  discard block
 block discarded – undo
4983 4983
 
4984 4984
 
4985 4985
 	/**
4986
-	* Gets all aircraft registration that have flown over by ident/callsign
4987
-	*
4988
-	* @return Array the aircraft list
4989
-	*
4990
-	*/
4986
+	 * Gets all aircraft registration that have flown over by ident/callsign
4987
+	 *
4988
+	 * @return Array the aircraft list
4989
+	 *
4990
+	 */
4991 4991
 	public function countAllAircraftRegistrationByIdent($ident,$filters = array())
4992 4992
 	{
4993 4993
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5027,11 +5027,11 @@  discard block
 block discarded – undo
5027 5027
 
5028 5028
 
5029 5029
 	/**
5030
-	* Gets all aircraft manufacturer that have flown over by ident/callsign
5031
-	*
5032
-	* @return Array the aircraft manufacturer list
5033
-	*
5034
-	*/
5030
+	 * Gets all aircraft manufacturer that have flown over by ident/callsign
5031
+	 *
5032
+	 * @return Array the aircraft manufacturer list
5033
+	 *
5034
+	 */
5035 5035
 	public function countAllAircraftManufacturerByIdent($ident,$filters = array())
5036 5036
 	{
5037 5037
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5057,11 +5057,11 @@  discard block
 block discarded – undo
5057 5057
 
5058 5058
 
5059 5059
 	/**
5060
-	* Gets all aircraft types that have flown over by route
5061
-	*
5062
-	* @return Array the aircraft list
5063
-	*
5064
-	*/
5060
+	 * Gets all aircraft types that have flown over by route
5061
+	 *
5062
+	 * @return Array the aircraft list
5063
+	 *
5064
+	 */
5065 5065
 	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5066 5066
 	{
5067 5067
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5090,11 +5090,11 @@  discard block
 block discarded – undo
5090 5090
 	}
5091 5091
 
5092 5092
 	/**
5093
-	* Gets all aircraft registration that have flown over by route
5094
-	*
5095
-	* @return Array the aircraft list
5096
-	*
5097
-	*/
5093
+	 * Gets all aircraft registration that have flown over by route
5094
+	 *
5095
+	 * @return Array the aircraft list
5096
+	 *
5097
+	 */
5098 5098
 	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5099 5099
 	{
5100 5100
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5136,11 +5136,11 @@  discard block
 block discarded – undo
5136 5136
 	
5137 5137
 	
5138 5138
 	/**
5139
-	* Gets all aircraft manufacturer that have flown over by route
5140
-	*
5141
-	* @return Array the aircraft manufacturer list
5142
-	*
5143
-	*/
5139
+	 * Gets all aircraft manufacturer that have flown over by route
5140
+	 *
5141
+	 * @return Array the aircraft manufacturer list
5142
+	 *
5143
+	 */
5144 5144
 	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5145 5145
 	{
5146 5146
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5174,11 +5174,11 @@  discard block
 block discarded – undo
5174 5174
 	
5175 5175
 	
5176 5176
 	/**
5177
-	* Gets all aircraft types that have flown over by country
5178
-	*
5179
-	* @return Array the aircraft list
5180
-	*
5181
-	*/
5177
+	 * Gets all aircraft types that have flown over by country
5178
+	 *
5179
+	 * @return Array the aircraft list
5180
+	 *
5181
+	 */
5182 5182
 	public function countAllAircraftTypesByCountry($country,$filters = array())
5183 5183
 	{
5184 5184
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5209,11 +5209,11 @@  discard block
 block discarded – undo
5209 5209
 
5210 5210
 
5211 5211
 	/**
5212
-	* Gets all aircraft registration that have flown over by country
5213
-	*
5214
-	* @return Array the aircraft list
5215
-	*
5216
-	*/
5212
+	 * Gets all aircraft registration that have flown over by country
5213
+	 *
5214
+	 * @return Array the aircraft list
5215
+	 *
5216
+	 */
5217 5217
 	public function countAllAircraftRegistrationByCountry($country,$filters = array())
5218 5218
 	{
5219 5219
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5253,11 +5253,11 @@  discard block
 block discarded – undo
5253 5253
 	
5254 5254
 	
5255 5255
 	/**
5256
-	* Gets all aircraft manufacturer that have flown over by country
5257
-	*
5258
-	* @return Array the aircraft manufacturer list
5259
-	*
5260
-	*/
5256
+	 * Gets all aircraft manufacturer that have flown over by country
5257
+	 *
5258
+	 * @return Array the aircraft manufacturer list
5259
+	 *
5260
+	 */
5261 5261
 	public function countAllAircraftManufacturerByCountry($country,$filters = array())
5262 5262
 	{
5263 5263
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5288,17 +5288,17 @@  discard block
 block discarded – undo
5288 5288
 	
5289 5289
 	
5290 5290
 	/**
5291
-	* Gets all aircraft manufacturers that have flown over
5292
-	*
5293
-	* @return Array the aircraft list
5294
-	*
5295
-	*/
5291
+	 * Gets all aircraft manufacturers that have flown over
5292
+	 *
5293
+	 * @return Array the aircraft list
5294
+	 *
5295
+	 */
5296 5296
 	public function countAllAircraftManufacturers($filters = array())
5297 5297
 	{
5298 5298
 		$filter_query = $this->getFilter($filters,true,true);
5299 5299
 		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5300 5300
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
5301
-                $query .= " GROUP BY spotter_output.aircraft_manufacturer
5301
+				$query .= " GROUP BY spotter_output.aircraft_manufacturer
5302 5302
 					ORDER BY aircraft_manufacturer_count DESC
5303 5303
 					LIMIT 10";
5304 5304
       
@@ -5323,11 +5323,11 @@  discard block
 block discarded – undo
5323 5323
 	
5324 5324
 	
5325 5325
 	/**
5326
-	* Gets all aircraft registrations that have flown over
5327
-	*
5328
-	* @return Array the aircraft list
5329
-	*
5330
-	*/
5326
+	 * Gets all aircraft registrations that have flown over
5327
+	 *
5328
+	 * @return Array the aircraft list
5329
+	 *
5330
+	 */
5331 5331
 	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5332 5332
 	{
5333 5333
 		global $globalDBdriver;
@@ -5335,15 +5335,15 @@  discard block
 block discarded – undo
5335 5335
 		$filter_query = $this->getFilter($filters,true,true);
5336 5336
 		$query  = "SELECT DISTINCT spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao,  spotter_output.aircraft_name, spotter_output.airline_name    
5337 5337
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
5338
-                if ($olderthanmonths > 0) {
5339
-            		if ($globalDBdriver == 'mysql') {
5338
+				if ($olderthanmonths > 0) {
5339
+					if ($globalDBdriver == 'mysql') {
5340 5340
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
5341 5341
 			} else {
5342 5342
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5343 5343
 			}
5344 5344
 		}
5345
-                if ($sincedate != '') {
5346
-            		if ($globalDBdriver == 'mysql') {
5345
+				if ($sincedate != '') {
5346
+					if ($globalDBdriver == 'mysql') {
5347 5347
 				$query .= " AND spotter_output.date > '".$sincedate."'";
5348 5348
 			} else {
5349 5349
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -5352,7 +5352,7 @@  discard block
 block discarded – undo
5352 5352
 
5353 5353
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5354 5354
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5355
-                $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5355
+				$query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5356 5356
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5357 5357
 		
5358 5358
 		$sth = $this->db->prepare($query);
@@ -5383,11 +5383,11 @@  discard block
 block discarded – undo
5383 5383
 
5384 5384
 
5385 5385
 	/**
5386
-	* Gets all aircraft registrations that have flown over
5387
-	*
5388
-	* @return Array the aircraft list
5389
-	*
5390
-	*/
5386
+	 * Gets all aircraft registrations that have flown over
5387
+	 *
5388
+	 * @return Array the aircraft list
5389
+	 *
5390
+	 */
5391 5391
 	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5392 5392
 	{
5393 5393
 		global $globalDBdriver;
@@ -5395,15 +5395,15 @@  discard block
 block discarded – undo
5395 5395
 		$Image = new Image($this->db);
5396 5396
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao,  spotter_output.aircraft_name, spotter_output.airline_name    
5397 5397
                     FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
5398
-                if ($olderthanmonths > 0) {
5399
-            		if ($globalDBdriver == 'mysql') {
5398
+				if ($olderthanmonths > 0) {
5399
+					if ($globalDBdriver == 'mysql') {
5400 5400
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5401 5401
 			} else {
5402 5402
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5403 5403
 			}
5404 5404
 		}
5405
-                if ($sincedate != '') {
5406
-            		if ($globalDBdriver == 'mysql') {
5405
+				if ($sincedate != '') {
5406
+					if ($globalDBdriver == 'mysql') {
5407 5407
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
5408 5408
 			} else {
5409 5409
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -5412,7 +5412,7 @@  discard block
 block discarded – undo
5412 5412
 
5413 5413
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5414 5414
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5415
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5415
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5416 5416
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5417 5417
 		
5418 5418
 		$sth = $this->db->prepare($query);
@@ -5444,35 +5444,35 @@  discard block
 block discarded – undo
5444 5444
 	
5445 5445
 	
5446 5446
 	/**
5447
-	* Gets all departure airports of the airplanes that have flown over
5448
-	*
5449
-	* @return Array the airport list
5450
-	*
5451
-	*/
5447
+	 * Gets all departure airports of the airplanes that have flown over
5448
+	 *
5449
+	 * @return Array the airport list
5450
+	 *
5451
+	 */
5452 5452
 	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5453 5453
 	{
5454 5454
 		global $globalDBdriver;
5455 5455
 		$filter_query = $this->getFilter($filters,true,true);
5456 5456
 		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5457 5457
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA'";
5458
-                if ($olderthanmonths > 0) {
5459
-            		if ($globalDBdriver == 'mysql') {
5458
+				if ($olderthanmonths > 0) {
5459
+					if ($globalDBdriver == 'mysql') {
5460 5460
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
5461 5461
 			} else {
5462 5462
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5463 5463
 			}
5464
-                }
5465
-                if ($sincedate != '') {
5466
-            		if ($globalDBdriver == 'mysql') {
5464
+				}
5465
+				if ($sincedate != '') {
5466
+					if ($globalDBdriver == 'mysql') {
5467 5467
 				$query .= " AND spotter_output.date > '".$sincedate."'";
5468 5468
 			} else {
5469 5469
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
5470 5470
 			}
5471 5471
 		}
5472 5472
 
5473
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5474
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5475
-                $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5473
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5474
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5475
+				$query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5476 5476
 				ORDER BY airport_departure_icao_count DESC";
5477 5477
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5478 5478
       
@@ -5496,35 +5496,35 @@  discard block
 block discarded – undo
5496 5496
 	}
5497 5497
 
5498 5498
 	/**
5499
-	* Gets all departure airports of the airplanes that have flown over
5500
-	*
5501
-	* @return Array the airport list
5502
-	*
5503
-	*/
5499
+	 * Gets all departure airports of the airplanes that have flown over
5500
+	 *
5501
+	 * @return Array the airport list
5502
+	 *
5503
+	 */
5504 5504
 	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5505 5505
 	{
5506 5506
 		global $globalDBdriver;
5507 5507
 		$filter_query = $this->getFilter($filters,true,true);
5508 5508
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5509 5509
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' ";
5510
-                if ($olderthanmonths > 0) {
5511
-            		if ($globalDBdriver == 'mysql') {
5510
+				if ($olderthanmonths > 0) {
5511
+					if ($globalDBdriver == 'mysql') {
5512 5512
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5513 5513
 			} else {
5514 5514
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5515 5515
 			}
5516
-                }
5517
-                if ($sincedate != '') {
5518
-            		if ($globalDBdriver == 'mysql') {
5516
+				}
5517
+				if ($sincedate != '') {
5518
+					if ($globalDBdriver == 'mysql') {
5519 5519
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
5520 5520
 			} else {
5521 5521
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
5522 5522
 			}
5523 5523
 		}
5524 5524
 
5525
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5526
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5527
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5525
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5526
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5527
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5528 5528
 				ORDER BY airport_departure_icao_count DESC";
5529 5529
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5530 5530
       
@@ -5549,37 +5549,37 @@  discard block
 block discarded – undo
5549 5549
 	}
5550 5550
 
5551 5551
 	/**
5552
-	* Gets all detected departure airports of the airplanes that have flown over
5553
-	*
5554
-	* @return Array the airport list
5555
-	*
5556
-	*/
5552
+	 * Gets all detected departure airports of the airplanes that have flown over
5553
+	 *
5554
+	 * @return Array the airport list
5555
+	 *
5556
+	 */
5557 5557
 	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5558 5558
 	{
5559 5559
 		global $globalDBdriver;
5560 5560
 		$filter_query = $this->getFilter($filters,true,true);
5561 5561
 		$query  = "SELECT DISTINCT spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country
5562 5562
 				FROM airport, spotter_output".$filter_query." spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao";
5563
-                if ($olderthanmonths > 0) {
5564
-            		if ($globalDBdriver == 'mysql') {
5563
+				if ($olderthanmonths > 0) {
5564
+					if ($globalDBdriver == 'mysql') {
5565 5565
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
5566 5566
 			} else {
5567 5567
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5568 5568
 			}
5569
-                }
5570
-                if ($sincedate != '') {
5571
-            		if ($globalDBdriver == 'mysql') {
5569
+				}
5570
+				if ($sincedate != '') {
5571
+					if ($globalDBdriver == 'mysql') {
5572 5572
 				$query .= " AND spotter_output.date > '".$sincedate."'";
5573 5573
 			} else {
5574 5574
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
5575 5575
 			}
5576 5576
 		}
5577
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5578
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5579
-                $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5577
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5578
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5579
+				$query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5580 5580
 				ORDER BY airport_departure_icao_count DESC";
5581 5581
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5582
-    		//echo $query;
5582
+			//echo $query;
5583 5583
 		$sth = $this->db->prepare($query);
5584 5584
 		$sth->execute();
5585 5585
       
@@ -5600,35 +5600,35 @@  discard block
 block discarded – undo
5600 5600
 	}
5601 5601
 	
5602 5602
 	/**
5603
-	* Gets all detected departure airports of the airplanes that have flown over
5604
-	*
5605
-	* @return Array the airport list
5606
-	*
5607
-	*/
5603
+	 * Gets all detected departure airports of the airplanes that have flown over
5604
+	 *
5605
+	 * @return Array the airport list
5606
+	 *
5607
+	 */
5608 5608
 	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5609 5609
 	{
5610 5610
 		global $globalDBdriver;
5611 5611
 		$filter_query = $this->getFilter($filters,true,true);
5612 5612
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country
5613 5613
 				FROM airport, spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao ";
5614
-                if ($olderthanmonths > 0) {
5615
-            		if ($globalDBdriver == 'mysql') {
5614
+				if ($olderthanmonths > 0) {
5615
+					if ($globalDBdriver == 'mysql') {
5616 5616
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5617 5617
 			} else {
5618 5618
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5619 5619
 			}
5620
-                }
5621
-                if ($sincedate != '') {
5622
-            		if ($globalDBdriver == 'mysql') {
5620
+				}
5621
+				if ($sincedate != '') {
5622
+					if ($globalDBdriver == 'mysql') {
5623 5623
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
5624 5624
 			} else {
5625 5625
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
5626 5626
 			}
5627 5627
 		}
5628 5628
 
5629
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5630
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5631
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5629
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5630
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5631
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5632 5632
 				ORDER BY airport_departure_icao_count DESC";
5633 5633
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5634 5634
       
@@ -5653,11 +5653,11 @@  discard block
 block discarded – undo
5653 5653
 	}	
5654 5654
 	
5655 5655
 	/**
5656
-	* Gets all departure airports of the airplanes that have flown over based on an airline icao
5657
-	*
5658
-	* @return Array the airport list
5659
-	*
5660
-	*/
5656
+	 * Gets all departure airports of the airplanes that have flown over based on an airline icao
5657
+	 *
5658
+	 * @return Array the airport list
5659
+	 *
5660
+	 */
5661 5661
 	public function countAllDepartureAirportsByAirline($airline_icao,$filters = array())
5662 5662
 	{
5663 5663
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5691,11 +5691,11 @@  discard block
 block discarded – undo
5691 5691
 	
5692 5692
 	
5693 5693
 	/**
5694
-	* Gets all departure airports by country of the airplanes that have flown over based on an airline icao
5695
-	*
5696
-	* @return Array the airport list
5697
-	*
5698
-	*/
5694
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airline icao
5695
+	 *
5696
+	 * @return Array the airport list
5697
+	 *
5698
+	 */
5699 5699
 	public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array())
5700 5700
 	{
5701 5701
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5726,11 +5726,11 @@  discard block
 block discarded – undo
5726 5726
 	
5727 5727
 	
5728 5728
 	/**
5729
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft icao
5730
-	*
5731
-	* @return Array the airport list
5732
-	*
5733
-	*/
5729
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft icao
5730
+	 *
5731
+	 * @return Array the airport list
5732
+	 *
5733
+	 */
5734 5734
 	public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array())
5735 5735
 	{
5736 5736
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5763,11 +5763,11 @@  discard block
 block discarded – undo
5763 5763
 	
5764 5764
 	
5765 5765
 	/**
5766
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
5767
-	*
5768
-	* @return Array the airport list
5769
-	*
5770
-	*/
5766
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
5767
+	 *
5768
+	 * @return Array the airport list
5769
+	 *
5770
+	 */
5771 5771
 	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array())
5772 5772
 	{
5773 5773
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5797,11 +5797,11 @@  discard block
 block discarded – undo
5797 5797
 	
5798 5798
 	
5799 5799
 	/**
5800
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft registration
5801
-	*
5802
-	* @return Array the airport list
5803
-	*
5804
-	*/
5800
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft registration
5801
+	 *
5802
+	 * @return Array the airport list
5803
+	 *
5804
+	 */
5805 5805
 	public function countAllDepartureAirportsByRegistration($registration,$filters = array())
5806 5806
 	{
5807 5807
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5834,11 +5834,11 @@  discard block
 block discarded – undo
5834 5834
 	
5835 5835
 	
5836 5836
 	/**
5837
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
5838
-	*
5839
-	* @return Array the airport list
5840
-	*
5841
-	*/
5837
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
5838
+	 *
5839
+	 * @return Array the airport list
5840
+	 *
5841
+	 */
5842 5842
 	public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array())
5843 5843
 	{
5844 5844
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5868,11 +5868,11 @@  discard block
 block discarded – undo
5868 5868
 	
5869 5869
 	
5870 5870
 	/**
5871
-	* Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
5872
-	*
5873
-	* @return Array the airport list
5874
-	*
5875
-	*/
5871
+	 * Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
5872
+	 *
5873
+	 * @return Array the airport list
5874
+	 *
5875
+	 */
5876 5876
 	public function countAllDepartureAirportsByAirport($airport_icao,$filters = array())
5877 5877
 	{
5878 5878
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5905,11 +5905,11 @@  discard block
 block discarded – undo
5905 5905
 	
5906 5906
 	
5907 5907
 	/**
5908
-	* Gets all departure airports by country of the airplanes that have flown over based on an airport icao
5909
-	*
5910
-	* @return Array the airport list
5911
-	*
5912
-	*/
5908
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airport icao
5909
+	 *
5910
+	 * @return Array the airport list
5911
+	 *
5912
+	 */
5913 5913
 	public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array())
5914 5914
 	{
5915 5915
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5940,11 +5940,11 @@  discard block
 block discarded – undo
5940 5940
 	
5941 5941
 	
5942 5942
 	/**
5943
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
5944
-	*
5945
-	* @return Array the airport list
5946
-	*
5947
-	*/
5943
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
5944
+	 *
5945
+	 * @return Array the airport list
5946
+	 *
5947
+	 */
5948 5948
 	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array())
5949 5949
 	{
5950 5950
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5977,11 +5977,11 @@  discard block
 block discarded – undo
5977 5977
 	
5978 5978
 	
5979 5979
 	/**
5980
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
5981
-	*
5982
-	* @return Array the airport list
5983
-	*
5984
-	*/
5980
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
5981
+	 *
5982
+	 * @return Array the airport list
5983
+	 *
5984
+	 */
5985 5985
 	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
5986 5986
 	{
5987 5987
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6011,11 +6011,11 @@  discard block
 block discarded – undo
6011 6011
 	
6012 6012
 	
6013 6013
 	/**
6014
-	* Gets all departure airports of the airplanes that have flown over based on a date
6015
-	*
6016
-	* @return Array the airport list
6017
-	*
6018
-	*/
6014
+	 * Gets all departure airports of the airplanes that have flown over based on a date
6015
+	 *
6016
+	 * @return Array the airport list
6017
+	 *
6018
+	 */
6019 6019
 	public function countAllDepartureAirportsByDate($date,$filters = array())
6020 6020
 	{
6021 6021
 		global $globalTimezone, $globalDBdriver;
@@ -6061,11 +6061,11 @@  discard block
 block discarded – undo
6061 6061
 	
6062 6062
 	
6063 6063
 	/**
6064
-	* Gets all departure airports by country of the airplanes that have flown over based on a date
6065
-	*
6066
-	* @return Array the airport list
6067
-	*
6068
-	*/
6064
+	 * Gets all departure airports by country of the airplanes that have flown over based on a date
6065
+	 *
6066
+	 * @return Array the airport list
6067
+	 *
6068
+	 */
6069 6069
 	public function countAllDepartureAirportCountriesByDate($date,$filters = array())
6070 6070
 	{
6071 6071
 		global $globalTimezone, $globalDBdriver;
@@ -6108,11 +6108,11 @@  discard block
 block discarded – undo
6108 6108
 	
6109 6109
 	
6110 6110
 	/**
6111
-	* Gets all departure airports of the airplanes that have flown over based on a ident/callsign
6112
-	*
6113
-	* @return Array the airport list
6114
-	*
6115
-	*/
6111
+	 * Gets all departure airports of the airplanes that have flown over based on a ident/callsign
6112
+	 *
6113
+	 * @return Array the airport list
6114
+	 *
6115
+	 */
6116 6116
 	public function countAllDepartureAirportsByIdent($ident,$filters = array())
6117 6117
 	{
6118 6118
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6146,11 +6146,11 @@  discard block
 block discarded – undo
6146 6146
 	
6147 6147
 	
6148 6148
 	/**
6149
-	* Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
6150
-	*
6151
-	* @return Array the airport list
6152
-	*
6153
-	*/
6149
+	 * Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
6150
+	 *
6151
+	 * @return Array the airport list
6152
+	 *
6153
+	 */
6154 6154
 	public function countAllDepartureAirportCountriesByIdent($ident,$filters = array())
6155 6155
 	{
6156 6156
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6181,11 +6181,11 @@  discard block
 block discarded – undo
6181 6181
 	
6182 6182
 	
6183 6183
 	/**
6184
-	* Gets all departure airports of the airplanes that have flown over based on a country
6185
-	*
6186
-	* @return Array the airport list
6187
-	*
6188
-	*/
6184
+	 * Gets all departure airports of the airplanes that have flown over based on a country
6185
+	 *
6186
+	 * @return Array the airport list
6187
+	 *
6188
+	 */
6189 6189
 	public function countAllDepartureAirportsByCountry($country,$filters = array())
6190 6190
 	{
6191 6191
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6219,11 +6219,11 @@  discard block
 block discarded – undo
6219 6219
 
6220 6220
 
6221 6221
 	/**
6222
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
6223
-	*
6224
-	* @return Array the airport list
6225
-	*
6226
-	*/
6222
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
6223
+	 *
6224
+	 * @return Array the airport list
6225
+	 *
6226
+	 */
6227 6227
 	public function countAllDepartureAirportCountriesByCountry($country,$filters = array())
6228 6228
 	{
6229 6229
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6253,40 +6253,40 @@  discard block
 block discarded – undo
6253 6253
 	
6254 6254
 
6255 6255
 	/**
6256
-	* Gets all arrival airports of the airplanes that have flown over
6257
-	*
6258
-	* @return Array the airport list
6259
-	*
6260
-	*/
6256
+	 * Gets all arrival airports of the airplanes that have flown over
6257
+	 *
6258
+	 * @return Array the airport list
6259
+	 *
6260
+	 */
6261 6261
 	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6262 6262
 	{
6263 6263
 		global $globalDBdriver;
6264 6264
 		$filter_query = $this->getFilter($filters,true,true);
6265 6265
 		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6266 6266
 				FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA'";
6267
-                if ($olderthanmonths > 0) {
6268
-            		if ($globalDBdriver == 'mysql') {
6267
+				if ($olderthanmonths > 0) {
6268
+					if ($globalDBdriver == 'mysql') {
6269 6269
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6270 6270
 			} else {
6271 6271
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6272 6272
 			}
6273
-                if ($sincedate != '') {
6274
-            		if ($globalDBdriver == 'mysql') {
6273
+				if ($sincedate != '') {
6274
+					if ($globalDBdriver == 'mysql') {
6275 6275
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6276 6276
 			} else {
6277 6277
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6278 6278
 			}
6279 6279
 		}
6280
-            		if ($globalDBdriver == 'mysql') {
6280
+					if ($globalDBdriver == 'mysql') {
6281 6281
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6282 6282
 			} else {
6283 6283
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6284 6284
 			}
6285 6285
 		}
6286 6286
 
6287
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6288
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6289
-                $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6287
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6288
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6289
+				$query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6290 6290
 					ORDER BY airport_arrival_icao_count DESC";
6291 6291
 		if ($limit) $query .= " LIMIT 10";
6292 6292
       
@@ -6315,40 +6315,40 @@  discard block
 block discarded – undo
6315 6315
 	}
6316 6316
 
6317 6317
 	/**
6318
-	* Gets all arrival airports of the airplanes that have flown over
6319
-	*
6320
-	* @return Array the airport list
6321
-	*
6322
-	*/
6318
+	 * Gets all arrival airports of the airplanes that have flown over
6319
+	 *
6320
+	 * @return Array the airport list
6321
+	 *
6322
+	 */
6323 6323
 	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6324 6324
 	{
6325 6325
 		global $globalDBdriver;
6326 6326
 		$filter_query = $this->getFilter($filters,true,true);
6327 6327
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6328 6328
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' ";
6329
-                if ($olderthanmonths > 0) {
6330
-            		if ($globalDBdriver == 'mysql') {
6329
+				if ($olderthanmonths > 0) {
6330
+					if ($globalDBdriver == 'mysql') {
6331 6331
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6332 6332
 			} else {
6333 6333
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6334 6334
 			}
6335
-                if ($sincedate != '') {
6336
-            		if ($globalDBdriver == 'mysql') {
6335
+				if ($sincedate != '') {
6336
+					if ($globalDBdriver == 'mysql') {
6337 6337
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6338 6338
 			} else {
6339 6339
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6340 6340
 			}
6341 6341
 		}
6342
-            		if ($globalDBdriver == 'mysql') {
6342
+					if ($globalDBdriver == 'mysql') {
6343 6343
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6344 6344
 			} else {
6345 6345
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6346 6346
 			}
6347 6347
 		}
6348 6348
 
6349
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6350
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6351
-                $query .= "GROUP BY spotter_output.airline_icao,spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6349
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6350
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6351
+				$query .= "GROUP BY spotter_output.airline_icao,spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6352 6352
 					ORDER BY airport_arrival_icao_count DESC";
6353 6353
 		if ($limit) $query .= " LIMIT 10";
6354 6354
       
@@ -6379,39 +6379,39 @@  discard block
 block discarded – undo
6379 6379
 
6380 6380
 
6381 6381
 	/**
6382
-	* Gets all detected arrival airports of the airplanes that have flown over
6383
-	*
6384
-	* @return Array the airport list
6385
-	*
6386
-	*/
6382
+	 * Gets all detected arrival airports of the airplanes that have flown over
6383
+	 *
6384
+	 * @return Array the airport list
6385
+	 *
6386
+	 */
6387 6387
 	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6388 6388
 	{
6389 6389
 		global $globalDBdriver;
6390 6390
 		$filter_query = $this->getFilter($filters,true,true);
6391 6391
 		$query  = "SELECT DISTINCT spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country 
6392 6392
 			FROM airport,spotter_output".$filter_query." spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao";
6393
-                if ($olderthanmonths > 0) {
6394
-            		if ($globalDBdriver == 'mysql') {
6393
+				if ($olderthanmonths > 0) {
6394
+					if ($globalDBdriver == 'mysql') {
6395 6395
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6396 6396
 			} else {
6397 6397
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6398 6398
 			}
6399
-                if ($sincedate != '') {
6400
-            		if ($globalDBdriver == 'mysql') {
6399
+				if ($sincedate != '') {
6400
+					if ($globalDBdriver == 'mysql') {
6401 6401
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6402 6402
 			} else {
6403 6403
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6404 6404
 			}
6405 6405
 		}
6406
-            		if ($globalDBdriver == 'mysql') {
6406
+					if ($globalDBdriver == 'mysql') {
6407 6407
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6408 6408
 			} else {
6409 6409
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6410 6410
 			}
6411 6411
 		}
6412
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6413
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6414
-                $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6412
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6413
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6414
+				$query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6415 6415
 					ORDER BY airport_arrival_icao_count DESC";
6416 6416
 		if ($limit) $query .= " LIMIT 10";
6417 6417
       
@@ -6440,40 +6440,40 @@  discard block
 block discarded – undo
6440 6440
 	}
6441 6441
 	
6442 6442
 	/**
6443
-	* Gets all detected arrival airports of the airplanes that have flown over
6444
-	*
6445
-	* @return Array the airport list
6446
-	*
6447
-	*/
6443
+	 * Gets all detected arrival airports of the airplanes that have flown over
6444
+	 *
6445
+	 * @return Array the airport list
6446
+	 *
6447
+	 */
6448 6448
 	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6449 6449
 	{
6450 6450
 		global $globalDBdriver;
6451 6451
 		$filter_query = $this->getFilter($filters,true,true);
6452 6452
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country 
6453 6453
 			FROM airport,spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao ";
6454
-                if ($olderthanmonths > 0) {
6455
-            		if ($globalDBdriver == 'mysql') {
6454
+				if ($olderthanmonths > 0) {
6455
+					if ($globalDBdriver == 'mysql') {
6456 6456
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6457 6457
 			} else {
6458 6458
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6459 6459
 			}
6460
-                if ($sincedate != '') {
6461
-            		if ($globalDBdriver == 'mysql') {
6460
+				if ($sincedate != '') {
6461
+					if ($globalDBdriver == 'mysql') {
6462 6462
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6463 6463
 			} else {
6464 6464
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6465 6465
 			}
6466 6466
 		}
6467
-            		if ($globalDBdriver == 'mysql') {
6467
+					if ($globalDBdriver == 'mysql') {
6468 6468
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6469 6469
 			} else {
6470 6470
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6471 6471
 			}
6472 6472
 		}
6473 6473
 
6474
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6475
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6476
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6474
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6475
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6476
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6477 6477
 					ORDER BY airport_arrival_icao_count DESC";
6478 6478
 		if ($limit) $query .= " LIMIT 10";
6479 6479
       
@@ -6503,11 +6503,11 @@  discard block
 block discarded – undo
6503 6503
 	}	
6504 6504
 	
6505 6505
 	/**
6506
-	* Gets all arrival airports of the airplanes that have flown over based on an airline icao
6507
-	*
6508
-	* @return Array the airport list
6509
-	*
6510
-	*/
6506
+	 * Gets all arrival airports of the airplanes that have flown over based on an airline icao
6507
+	 *
6508
+	 * @return Array the airport list
6509
+	 *
6510
+	 */
6511 6511
 	public function countAllArrivalAirportsByAirline($airline_icao, $filters = array())
6512 6512
 	{
6513 6513
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6539,11 +6539,11 @@  discard block
 block discarded – undo
6539 6539
 	
6540 6540
 	
6541 6541
 	/**
6542
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
6543
-	*
6544
-	* @return Array the airport list
6545
-	*
6546
-	*/
6542
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
6543
+	 *
6544
+	 * @return Array the airport list
6545
+	 *
6546
+	 */
6547 6547
 	public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array())
6548 6548
 	{
6549 6549
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6574,11 +6574,11 @@  discard block
 block discarded – undo
6574 6574
 	
6575 6575
 	
6576 6576
 	/**
6577
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
6578
-	*
6579
-	* @return Array the airport list
6580
-	*
6581
-	*/
6577
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
6578
+	 *
6579
+	 * @return Array the airport list
6580
+	 *
6581
+	 */
6582 6582
 	public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array())
6583 6583
 	{
6584 6584
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6612,11 +6612,11 @@  discard block
 block discarded – undo
6612 6612
 	
6613 6613
 	
6614 6614
 	/**
6615
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
6616
-	*
6617
-	* @return Array the airport list
6618
-	*
6619
-	*/
6615
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
6616
+	 *
6617
+	 * @return Array the airport list
6618
+	 *
6619
+	 */
6620 6620
 	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array())
6621 6621
 	{
6622 6622
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6646,11 +6646,11 @@  discard block
 block discarded – undo
6646 6646
 	
6647 6647
 	
6648 6648
 	/**
6649
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
6650
-	*
6651
-	* @return Array the airport list
6652
-	*
6653
-	*/
6649
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
6650
+	 *
6651
+	 * @return Array the airport list
6652
+	 *
6653
+	 */
6654 6654
 	public function countAllArrivalAirportsByRegistration($registration,$filters = array())
6655 6655
 	{
6656 6656
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6684,11 +6684,11 @@  discard block
 block discarded – undo
6684 6684
 	
6685 6685
 	
6686 6686
 	/**
6687
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
6688
-	*
6689
-	* @return Array the airport list
6690
-	*
6691
-	*/
6687
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
6688
+	 *
6689
+	 * @return Array the airport list
6690
+	 *
6691
+	 */
6692 6692
 	public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array())
6693 6693
 	{
6694 6694
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6719,11 +6719,11 @@  discard block
 block discarded – undo
6719 6719
 	
6720 6720
 	
6721 6721
 	/**
6722
-	* Gets all arrival airports of the airplanes that have flown over based on an departure airport
6723
-	*
6724
-	* @return Array the airport list
6725
-	*
6726
-	*/
6722
+	 * Gets all arrival airports of the airplanes that have flown over based on an departure airport
6723
+	 *
6724
+	 * @return Array the airport list
6725
+	 *
6726
+	 */
6727 6727
 	public function countAllArrivalAirportsByAirport($airport_icao,$filters = array())
6728 6728
 	{
6729 6729
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6756,11 +6756,11 @@  discard block
 block discarded – undo
6756 6756
 	
6757 6757
 	
6758 6758
 	/**
6759
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
6760
-	*
6761
-	* @return Array the airport list
6762
-	*
6763
-	*/
6759
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
6760
+	 *
6761
+	 * @return Array the airport list
6762
+	 *
6763
+	 */
6764 6764
 	public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array())
6765 6765
 	{
6766 6766
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6790,11 +6790,11 @@  discard block
 block discarded – undo
6790 6790
 	
6791 6791
 	
6792 6792
 	/**
6793
-	* Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
6794
-	*
6795
-	* @return Array the airport list
6796
-	*
6797
-	*/
6793
+	 * Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
6794
+	 *
6795
+	 * @return Array the airport list
6796
+	 *
6797
+	 */
6798 6798
 	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array())
6799 6799
 	{
6800 6800
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6828,11 +6828,11 @@  discard block
 block discarded – undo
6828 6828
 	
6829 6829
 	
6830 6830
 	/**
6831
-	* Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
6832
-	*
6833
-	* @return Array the airport list
6834
-	*
6835
-	*/
6831
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
6832
+	 *
6833
+	 * @return Array the airport list
6834
+	 *
6835
+	 */
6836 6836
 	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
6837 6837
 	{
6838 6838
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6863,11 +6863,11 @@  discard block
 block discarded – undo
6863 6863
 	
6864 6864
 	
6865 6865
 	/**
6866
-	* Gets all arrival airports of the airplanes that have flown over based on a date
6867
-	*
6868
-	* @return Array the airport list
6869
-	*
6870
-	*/
6866
+	 * Gets all arrival airports of the airplanes that have flown over based on a date
6867
+	 *
6868
+	 * @return Array the airport list
6869
+	 *
6870
+	 */
6871 6871
 	public function countAllArrivalAirportsByDate($date,$filters = array())
6872 6872
 	{
6873 6873
 		global $globalTimezone, $globalDBdriver;
@@ -6913,11 +6913,11 @@  discard block
 block discarded – undo
6913 6913
 	
6914 6914
 	
6915 6915
 	/**
6916
-	* Gets all arrival airports by country of the airplanes that have flown over based on a date
6917
-	*
6918
-	* @return Array the airport list
6919
-	*
6920
-	*/
6916
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a date
6917
+	 *
6918
+	 * @return Array the airport list
6919
+	 *
6920
+	 */
6921 6921
 	public function countAllArrivalAirportCountriesByDate($date, $filters = array())
6922 6922
 	{
6923 6923
 		global $globalTimezone, $globalDBdriver;
@@ -6960,11 +6960,11 @@  discard block
 block discarded – undo
6960 6960
 	
6961 6961
 	
6962 6962
 	/**
6963
-	* Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
6964
-	*
6965
-	* @return Array the airport list
6966
-	*
6967
-	*/
6963
+	 * Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
6964
+	 *
6965
+	 * @return Array the airport list
6966
+	 *
6967
+	 */
6968 6968
 	public function countAllArrivalAirportsByIdent($ident,$filters = array())
6969 6969
 	{
6970 6970
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6997,11 +6997,11 @@  discard block
 block discarded – undo
6997 6997
 	
6998 6998
 	
6999 6999
 	/**
7000
-	* Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
7001
-	*
7002
-	* @return Array the airport list
7003
-	*
7004
-	*/
7000
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
7001
+	 *
7002
+	 * @return Array the airport list
7003
+	 *
7004
+	 */
7005 7005
 	public function countAllArrivalAirportCountriesByIdent($ident, $filters = array())
7006 7006
 	{
7007 7007
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7032,11 +7032,11 @@  discard block
 block discarded – undo
7032 7032
 	
7033 7033
 	
7034 7034
 	/**
7035
-	* Gets all arrival airports of the airplanes that have flown over based on a country
7036
-	*
7037
-	* @return Array the airport list
7038
-	*
7039
-	*/
7035
+	 * Gets all arrival airports of the airplanes that have flown over based on a country
7036
+	 *
7037
+	 * @return Array the airport list
7038
+	 *
7039
+	 */
7040 7040
 	public function countAllArrivalAirportsByCountry($country,$filters = array())
7041 7041
 	{
7042 7042
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7069,11 +7069,11 @@  discard block
 block discarded – undo
7069 7069
 	
7070 7070
 	
7071 7071
 	/**
7072
-	* Gets all arrival airports by country of the airplanes that have flown over based on a country
7073
-	*
7074
-	* @return Array the airport list
7075
-	*
7076
-	*/
7072
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a country
7073
+	 *
7074
+	 * @return Array the airport list
7075
+	 *
7076
+	 */
7077 7077
 	public function countAllArrivalAirportCountriesByCountry($country,$filters = array())
7078 7078
 	{
7079 7079
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7104,11 +7104,11 @@  discard block
 block discarded – undo
7104 7104
 
7105 7105
 
7106 7106
 	/**
7107
-	* Counts all airport departure countries
7108
-	*
7109
-	* @return Array the airport departure list
7110
-	*
7111
-	*/
7107
+	 * Counts all airport departure countries
7108
+	 *
7109
+	 * @return Array the airport departure list
7110
+	 *
7111
+	 */
7112 7112
 	public function countAllDepartureCountries($filters = array())
7113 7113
 	{
7114 7114
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7138,11 +7138,11 @@  discard block
 block discarded – undo
7138 7138
 	
7139 7139
 	
7140 7140
 	/**
7141
-	* Counts all airport arrival countries
7142
-	*
7143
-	* @return Array the airport arrival list
7144
-	*
7145
-	*/
7141
+	 * Counts all airport arrival countries
7142
+	 *
7143
+	 * @return Array the airport arrival list
7144
+	 *
7145
+	 */
7146 7146
 	public function countAllArrivalCountries($limit = true,$filters = array())
7147 7147
 	{
7148 7148
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7175,11 +7175,11 @@  discard block
 block discarded – undo
7175 7175
 
7176 7176
 
7177 7177
 	/**
7178
-	* Gets all route combinations
7179
-	*
7180
-	* @return Array the route list
7181
-	*
7182
-	*/
7178
+	 * Gets all route combinations
7179
+	 *
7180
+	 * @return Array the route list
7181
+	 *
7182
+	 */
7183 7183
 	public function countAllRoutes($filters = array())
7184 7184
 	{
7185 7185
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7218,11 +7218,11 @@  discard block
 block discarded – undo
7218 7218
 	
7219 7219
 	
7220 7220
 	/**
7221
-	* Gets all route combinations based on an aircraft
7222
-	*
7223
-	* @return Array the route list
7224
-	*
7225
-	*/
7221
+	 * Gets all route combinations based on an aircraft
7222
+	 *
7223
+	 * @return Array the route list
7224
+	 *
7225
+	 */
7226 7226
 	public function countAllRoutesByAircraft($aircraft_icao,$filters = array())
7227 7227
 	{
7228 7228
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7258,11 +7258,11 @@  discard block
 block discarded – undo
7258 7258
 	
7259 7259
 	
7260 7260
 	/**
7261
-	* Gets all route combinations based on an aircraft registration
7262
-	*
7263
-	* @return Array the route list
7264
-	*
7265
-	*/
7261
+	 * Gets all route combinations based on an aircraft registration
7262
+	 *
7263
+	 * @return Array the route list
7264
+	 *
7265
+	 */
7266 7266
 	public function countAllRoutesByRegistration($registration, $filters = array())
7267 7267
 	{
7268 7268
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7300,11 +7300,11 @@  discard block
 block discarded – undo
7300 7300
 	
7301 7301
 	
7302 7302
 	/**
7303
-	* Gets all route combinations based on an airline
7304
-	*
7305
-	* @return Array the route list
7306
-	*
7307
-	*/
7303
+	 * Gets all route combinations based on an airline
7304
+	 *
7305
+	 * @return Array the route list
7306
+	 *
7307
+	 */
7308 7308
 	public function countAllRoutesByAirline($airline_icao, $filters = array())
7309 7309
 	{
7310 7310
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7342,11 +7342,11 @@  discard block
 block discarded – undo
7342 7342
 	
7343 7343
 	
7344 7344
 	/**
7345
-	* Gets all route combinations based on an airport
7346
-	*
7347
-	* @return Array the route list
7348
-	*
7349
-	*/
7345
+	 * Gets all route combinations based on an airport
7346
+	 *
7347
+	 * @return Array the route list
7348
+	 *
7349
+	 */
7350 7350
 	public function countAllRoutesByAirport($airport_icao, $filters = array())
7351 7351
 	{
7352 7352
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7383,11 +7383,11 @@  discard block
 block discarded – undo
7383 7383
 	
7384 7384
 	
7385 7385
 	/**
7386
-	* Gets all route combinations based on an country
7387
-	*
7388
-	* @return Array the route list
7389
-	*
7390
-	*/
7386
+	 * Gets all route combinations based on an country
7387
+	 *
7388
+	 * @return Array the route list
7389
+	 *
7390
+	 */
7391 7391
 	public function countAllRoutesByCountry($country, $filters = array())
7392 7392
 	{
7393 7393
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7423,11 +7423,11 @@  discard block
 block discarded – undo
7423 7423
 
7424 7424
 
7425 7425
 	/**
7426
-	* Gets all route combinations based on an date
7427
-	*
7428
-	* @return Array the route list
7429
-	*
7430
-	*/
7426
+	 * Gets all route combinations based on an date
7427
+	 *
7428
+	 * @return Array the route list
7429
+	 *
7430
+	 */
7431 7431
 	public function countAllRoutesByDate($date, $filters = array())
7432 7432
 	{
7433 7433
 		global $globalTimezone, $globalDBdriver;
@@ -7477,11 +7477,11 @@  discard block
 block discarded – undo
7477 7477
 	
7478 7478
 	
7479 7479
 	/**
7480
-	* Gets all route combinations based on an ident/callsign
7481
-	*
7482
-	* @return Array the route list
7483
-	*
7484
-	*/
7480
+	 * Gets all route combinations based on an ident/callsign
7481
+	 *
7482
+	 * @return Array the route list
7483
+	 *
7484
+	 */
7485 7485
 	public function countAllRoutesByIdent($ident, $filters = array())
7486 7486
 	{
7487 7487
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7518,11 +7518,11 @@  discard block
 block discarded – undo
7518 7518
 	
7519 7519
 	
7520 7520
 	/**
7521
-	* Gets all route combinations based on an manufacturer
7522
-	*
7523
-	* @return Array the route list
7524
-	*
7525
-	*/
7521
+	 * Gets all route combinations based on an manufacturer
7522
+	 *
7523
+	 * @return Array the route list
7524
+	 *
7525
+	 */
7526 7526
 	public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array())
7527 7527
 	{
7528 7528
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7560,11 +7560,11 @@  discard block
 block discarded – undo
7560 7560
 	
7561 7561
 	
7562 7562
 	/**
7563
-	* Gets all route combinations with waypoints
7564
-	*
7565
-	* @return Array the route list
7566
-	*
7567
-	*/
7563
+	 * Gets all route combinations with waypoints
7564
+	 *
7565
+	 * @return Array the route list
7566
+	 *
7567
+	 */
7568 7568
 	public function countAllRoutesWithWaypoints($filters = array())
7569 7569
 	{
7570 7570
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7601,11 +7601,11 @@  discard block
 block discarded – undo
7601 7601
 	}
7602 7602
 	
7603 7603
 	/**
7604
-	* Gets all callsigns that have flown over
7605
-	*
7606
-	* @return Array the callsign list
7607
-	*
7608
-	*/
7604
+	 * Gets all callsigns that have flown over
7605
+	 *
7606
+	 * @return Array the callsign list
7607
+	 *
7608
+	 */
7609 7609
 	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
7610 7610
 	{
7611 7611
 		global $globalDBdriver;
@@ -7643,11 +7643,11 @@  discard block
 block discarded – undo
7643 7643
 	}
7644 7644
 
7645 7645
 	/**
7646
-	* Gets all callsigns that have flown over
7647
-	*
7648
-	* @return Array the callsign list
7649
-	*
7650
-	*/
7646
+	 * Gets all callsigns that have flown over
7647
+	 *
7648
+	 * @return Array the callsign list
7649
+	 *
7650
+	 */
7651 7651
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
7652 7652
 	{
7653 7653
 		global $globalDBdriver;
@@ -7688,11 +7688,11 @@  discard block
 block discarded – undo
7688 7688
 
7689 7689
 
7690 7690
 	/**
7691
-	* Counts all dates
7692
-	*
7693
-	* @return Array the date list
7694
-	*
7695
-	*/
7691
+	 * Counts all dates
7692
+	 *
7693
+	 * @return Array the date list
7694
+	 *
7695
+	 */
7696 7696
 	public function countAllDates($filters = array())
7697 7697
 	{
7698 7698
 		global $globalTimezone, $globalDBdriver;
@@ -7737,11 +7737,11 @@  discard block
 block discarded – undo
7737 7737
 	}
7738 7738
 	
7739 7739
 	/**
7740
-	* Counts all dates
7741
-	*
7742
-	* @return Array the date list
7743
-	*
7744
-	*/
7740
+	 * Counts all dates
7741
+	 *
7742
+	 * @return Array the date list
7743
+	 *
7744
+	 */
7745 7745
 	public function countAllDatesByAirlines($filters = array())
7746 7746
 	{
7747 7747
 		global $globalTimezone, $globalDBdriver;
@@ -7786,11 +7786,11 @@  discard block
 block discarded – undo
7786 7786
 	}	
7787 7787
 	
7788 7788
 	/**
7789
-	* Counts all dates during the last 7 days
7790
-	*
7791
-	* @return Array the date list
7792
-	*
7793
-	*/
7789
+	 * Counts all dates during the last 7 days
7790
+	 *
7791
+	 * @return Array the date list
7792
+	 *
7793
+	 */
7794 7794
 	public function countAllDatesLast7Days($filters = array())
7795 7795
 	{
7796 7796
 		global $globalTimezone, $globalDBdriver;
@@ -7812,7 +7812,7 @@  discard block
 block discarded – undo
7812 7812
 			$query .= " GROUP BY date_name 
7813 7813
 								ORDER BY date_name ASC";
7814 7814
 			$query_data = array(':offset' => $offset);
7815
-    		}
7815
+			}
7816 7816
 		
7817 7817
 		$sth = $this->db->prepare($query);
7818 7818
 		$sth->execute($query_data);
@@ -7832,11 +7832,11 @@  discard block
 block discarded – undo
7832 7832
 	}
7833 7833
 
7834 7834
 	/**
7835
-	* Counts all dates during the last month
7836
-	*
7837
-	* @return Array the date list
7838
-	*
7839
-	*/
7835
+	 * Counts all dates during the last month
7836
+	 *
7837
+	 * @return Array the date list
7838
+	 *
7839
+	 */
7840 7840
 	public function countAllDatesLastMonth($filters = array())
7841 7841
 	{
7842 7842
 		global $globalTimezone, $globalDBdriver;
@@ -7858,7 +7858,7 @@  discard block
 block discarded – undo
7858 7858
 			$query .= " GROUP BY date_name 
7859 7859
 								ORDER BY date_name ASC";
7860 7860
 			$query_data = array(':offset' => $offset);
7861
-    		}
7861
+			}
7862 7862
 		
7863 7863
 		$sth = $this->db->prepare($query);
7864 7864
 		$sth->execute($query_data);
@@ -7879,11 +7879,11 @@  discard block
 block discarded – undo
7879 7879
 
7880 7880
 
7881 7881
 	/**
7882
-	* Counts all dates during the last month
7883
-	*
7884
-	* @return Array the date list
7885
-	*
7886
-	*/
7882
+	 * Counts all dates during the last month
7883
+	 *
7884
+	 * @return Array the date list
7885
+	 *
7886
+	 */
7887 7887
 	public function countAllDatesLastMonthByAirlines($filters = array())
7888 7888
 	{
7889 7889
 		global $globalTimezone, $globalDBdriver;
@@ -7906,7 +7906,7 @@  discard block
 block discarded – undo
7906 7906
 								GROUP BY spotter_output.airline_icao, date_name 
7907 7907
 								ORDER BY date_name ASC";
7908 7908
 			$query_data = array(':offset' => $offset);
7909
-    		}
7909
+			}
7910 7910
 		
7911 7911
 		$sth = $this->db->prepare($query);
7912 7912
 		$sth->execute($query_data);
@@ -7928,11 +7928,11 @@  discard block
 block discarded – undo
7928 7928
 	
7929 7929
 
7930 7930
 	/**
7931
-	* Counts all month
7932
-	*
7933
-	* @return Array the month list
7934
-	*
7935
-	*/
7931
+	 * Counts all month
7932
+	 *
7933
+	 * @return Array the month list
7934
+	 *
7935
+	 */
7936 7936
 	public function countAllMonths($filters = array())
7937 7937
 	{
7938 7938
 		global $globalTimezone, $globalDBdriver;
@@ -7974,11 +7974,11 @@  discard block
 block discarded – undo
7974 7974
 	}
7975 7975
 
7976 7976
 	/**
7977
-	* Counts all month
7978
-	*
7979
-	* @return Array the month list
7980
-	*
7981
-	*/
7977
+	 * Counts all month
7978
+	 *
7979
+	 * @return Array the month list
7980
+	 *
7981
+	 */
7982 7982
 	public function countAllMonthsByAirlines($filters = array())
7983 7983
 	{
7984 7984
 		global $globalTimezone, $globalDBdriver;
@@ -8023,11 +8023,11 @@  discard block
 block discarded – undo
8023 8023
 	}
8024 8024
 
8025 8025
 	/**
8026
-	* Counts all military month
8027
-	*
8028
-	* @return Array the month list
8029
-	*
8030
-	*/
8026
+	 * Counts all military month
8027
+	 *
8028
+	 * @return Array the month list
8029
+	 *
8030
+	 */
8031 8031
 	public function countAllMilitaryMonths($filters = array())
8032 8032
 	{
8033 8033
 		global $globalTimezone, $globalDBdriver;
@@ -8068,11 +8068,11 @@  discard block
 block discarded – undo
8068 8068
 	}
8069 8069
 	
8070 8070
 	/**
8071
-	* Counts all month owners
8072
-	*
8073
-	* @return Array the month list
8074
-	*
8075
-	*/
8071
+	 * Counts all month owners
8072
+	 *
8073
+	 * @return Array the month list
8074
+	 *
8075
+	 */
8076 8076
 	public function countAllMonthsOwners($filters = array())
8077 8077
 	{
8078 8078
 		global $globalTimezone, $globalDBdriver;
@@ -8114,11 +8114,11 @@  discard block
 block discarded – undo
8114 8114
 	}
8115 8115
 	
8116 8116
 	/**
8117
-	* Counts all month owners
8118
-	*
8119
-	* @return Array the month list
8120
-	*
8121
-	*/
8117
+	 * Counts all month owners
8118
+	 *
8119
+	 * @return Array the month list
8120
+	 *
8121
+	 */
8122 8122
 	public function countAllMonthsOwnersByAirlines($filters = array())
8123 8123
 	{
8124 8124
 		global $globalTimezone, $globalDBdriver;
@@ -8161,11 +8161,11 @@  discard block
 block discarded – undo
8161 8161
 	}
8162 8162
 
8163 8163
 	/**
8164
-	* Counts all month pilot
8165
-	*
8166
-	* @return Array the month list
8167
-	*
8168
-	*/
8164
+	 * Counts all month pilot
8165
+	 *
8166
+	 * @return Array the month list
8167
+	 *
8168
+	 */
8169 8169
 	public function countAllMonthsPilots($filters = array())
8170 8170
 	{
8171 8171
 		global $globalTimezone, $globalDBdriver;
@@ -8207,11 +8207,11 @@  discard block
 block discarded – undo
8207 8207
 	}
8208 8208
 	
8209 8209
 	/**
8210
-	* Counts all month pilot
8211
-	*
8212
-	* @return Array the month list
8213
-	*
8214
-	*/
8210
+	 * Counts all month pilot
8211
+	 *
8212
+	 * @return Array the month list
8213
+	 *
8214
+	 */
8215 8215
 	public function countAllMonthsPilotsByAirlines($filters = array())
8216 8216
 	{
8217 8217
 		global $globalTimezone, $globalDBdriver;
@@ -8254,11 +8254,11 @@  discard block
 block discarded – undo
8254 8254
 	}
8255 8255
 
8256 8256
 	/**
8257
-	* Counts all month airline
8258
-	*
8259
-	* @return Array the month list
8260
-	*
8261
-	*/
8257
+	 * Counts all month airline
8258
+	 *
8259
+	 * @return Array the month list
8260
+	 *
8261
+	 */
8262 8262
 	public function countAllMonthsAirlines($filters = array())
8263 8263
 	{
8264 8264
 		global $globalTimezone, $globalDBdriver;
@@ -8300,11 +8300,11 @@  discard block
 block discarded – undo
8300 8300
 	}
8301 8301
 	
8302 8302
 	/**
8303
-	* Counts all month aircraft
8304
-	*
8305
-	* @return Array the month list
8306
-	*
8307
-	*/
8303
+	 * Counts all month aircraft
8304
+	 *
8305
+	 * @return Array the month list
8306
+	 *
8307
+	 */
8308 8308
 	public function countAllMonthsAircrafts($filters = array())
8309 8309
 	{
8310 8310
 		global $globalTimezone, $globalDBdriver;
@@ -8347,11 +8347,11 @@  discard block
 block discarded – undo
8347 8347
 	
8348 8348
 
8349 8349
 	/**
8350
-	* Counts all month aircraft
8351
-	*
8352
-	* @return Array the month list
8353
-	*
8354
-	*/
8350
+	 * Counts all month aircraft
8351
+	 *
8352
+	 * @return Array the month list
8353
+	 *
8354
+	 */
8355 8355
 	public function countAllMonthsAircraftsByAirlines($filters = array())
8356 8356
 	{
8357 8357
 		global $globalTimezone, $globalDBdriver;
@@ -8394,11 +8394,11 @@  discard block
 block discarded – undo
8394 8394
 	}
8395 8395
 
8396 8396
 	/**
8397
-	* Counts all month real arrival
8398
-	*
8399
-	* @return Array the month list
8400
-	*
8401
-	*/
8397
+	 * Counts all month real arrival
8398
+	 *
8399
+	 * @return Array the month list
8400
+	 *
8401
+	 */
8402 8402
 	public function countAllMonthsRealArrivals($filters = array())
8403 8403
 	{
8404 8404
 		global $globalTimezone, $globalDBdriver;
@@ -8441,11 +8441,11 @@  discard block
 block discarded – undo
8441 8441
 	
8442 8442
 
8443 8443
 	/**
8444
-	* Counts all month real arrival
8445
-	*
8446
-	* @return Array the month list
8447
-	*
8448
-	*/
8444
+	 * Counts all month real arrival
8445
+	 *
8446
+	 * @return Array the month list
8447
+	 *
8448
+	 */
8449 8449
 	public function countAllMonthsRealArrivalsByAirlines($filters = array())
8450 8450
 	{
8451 8451
 		global $globalTimezone, $globalDBdriver;
@@ -8489,11 +8489,11 @@  discard block
 block discarded – undo
8489 8489
 	
8490 8490
 
8491 8491
 	/**
8492
-	* Counts all dates during the last year
8493
-	*
8494
-	* @return Array the date list
8495
-	*
8496
-	*/
8492
+	 * Counts all dates during the last year
8493
+	 *
8494
+	 * @return Array the date list
8495
+	 *
8496
+	 */
8497 8497
 	public function countAllMonthsLastYear($filters)
8498 8498
 	{
8499 8499
 		global $globalTimezone, $globalDBdriver;
@@ -8515,7 +8515,7 @@  discard block
 block discarded – undo
8515 8515
 			$query .= " GROUP BY year_name, month_name
8516 8516
 								ORDER BY year_name, month_name ASC";
8517 8517
 			$query_data = array(':offset' => $offset);
8518
-    		}
8518
+			}
8519 8519
 		
8520 8520
 		$sth = $this->db->prepare($query);
8521 8521
 		$sth->execute($query_data);
@@ -8538,11 +8538,11 @@  discard block
 block discarded – undo
8538 8538
 	
8539 8539
 	
8540 8540
 	/**
8541
-	* Counts all hours
8542
-	*
8543
-	* @return Array the hour list
8544
-	*
8545
-	*/
8541
+	 * Counts all hours
8542
+	 *
8543
+	 * @return Array the hour list
8544
+	 *
8545
+	 */
8546 8546
 	public function countAllHours($orderby,$filters = array())
8547 8547
 	{
8548 8548
 		global $globalTimezone, $globalDBdriver;
@@ -8603,11 +8603,11 @@  discard block
 block discarded – undo
8603 8603
 	}
8604 8604
 	
8605 8605
 	/**
8606
-	* Counts all hours
8607
-	*
8608
-	* @return Array the hour list
8609
-	*
8610
-	*/
8606
+	 * Counts all hours
8607
+	 *
8608
+	 * @return Array the hour list
8609
+	 *
8610
+	 */
8611 8611
 	public function countAllHoursByAirlines($orderby, $filters = array())
8612 8612
 	{
8613 8613
 		global $globalTimezone, $globalDBdriver;
@@ -8670,11 +8670,11 @@  discard block
 block discarded – undo
8670 8670
 
8671 8671
 
8672 8672
 	/**
8673
-	* Counts all hours by airline
8674
-	*
8675
-	* @return Array the hour list
8676
-	*
8677
-	*/
8673
+	 * Counts all hours by airline
8674
+	 *
8675
+	 * @return Array the hour list
8676
+	 *
8677
+	 */
8678 8678
 	public function countAllHoursByAirline($airline_icao, $filters = array())
8679 8679
 	{
8680 8680
 		global $globalTimezone, $globalDBdriver;
@@ -8720,11 +8720,11 @@  discard block
 block discarded – undo
8720 8720
 	
8721 8721
 	
8722 8722
 	/**
8723
-	* Counts all hours by aircraft
8724
-	*
8725
-	* @return Array the hour list
8726
-	*
8727
-	*/
8723
+	 * Counts all hours by aircraft
8724
+	 *
8725
+	 * @return Array the hour list
8726
+	 *
8727
+	 */
8728 8728
 	public function countAllHoursByAircraft($aircraft_icao, $filters = array())
8729 8729
 	{
8730 8730
 		global $globalTimezone, $globalDBdriver;
@@ -8767,11 +8767,11 @@  discard block
 block discarded – undo
8767 8767
 	
8768 8768
 	
8769 8769
 	/**
8770
-	* Counts all hours by aircraft registration
8771
-	*
8772
-	* @return Array the hour list
8773
-	*
8774
-	*/
8770
+	 * Counts all hours by aircraft registration
8771
+	 *
8772
+	 * @return Array the hour list
8773
+	 *
8774
+	 */
8775 8775
 	public function countAllHoursByRegistration($registration, $filters = array())
8776 8776
 	{
8777 8777
 		global $globalTimezone, $globalDBdriver;
@@ -8814,11 +8814,11 @@  discard block
 block discarded – undo
8814 8814
 	
8815 8815
 	
8816 8816
 	/**
8817
-	* Counts all hours by airport
8818
-	*
8819
-	* @return Array the hour list
8820
-	*
8821
-	*/
8817
+	 * Counts all hours by airport
8818
+	 *
8819
+	 * @return Array the hour list
8820
+	 *
8821
+	 */
8822 8822
 	public function countAllHoursByAirport($airport_icao, $filters = array())
8823 8823
 	{
8824 8824
 		global $globalTimezone, $globalDBdriver;
@@ -8862,11 +8862,11 @@  discard block
 block discarded – undo
8862 8862
 	
8863 8863
 	
8864 8864
 	/**
8865
-	* Counts all hours by manufacturer
8866
-	*
8867
-	* @return Array the hour list
8868
-	*
8869
-	*/
8865
+	 * Counts all hours by manufacturer
8866
+	 *
8867
+	 * @return Array the hour list
8868
+	 *
8869
+	 */
8870 8870
 	public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array())
8871 8871
 	{
8872 8872
 		global $globalTimezone, $globalDBdriver;
@@ -8910,11 +8910,11 @@  discard block
 block discarded – undo
8910 8910
 	
8911 8911
 	
8912 8912
 	/**
8913
-	* Counts all hours by date
8914
-	*
8915
-	* @return Array the hour list
8916
-	*
8917
-	*/
8913
+	 * Counts all hours by date
8914
+	 *
8915
+	 * @return Array the hour list
8916
+	 *
8917
+	 */
8918 8918
 	public function countAllHoursByDate($date, $filters = array())
8919 8919
 	{
8920 8920
 		global $globalTimezone, $globalDBdriver;
@@ -8958,11 +8958,11 @@  discard block
 block discarded – undo
8958 8958
 	
8959 8959
 	
8960 8960
 	/**
8961
-	* Counts all hours by a ident/callsign
8962
-	*
8963
-	* @return Array the hour list
8964
-	*
8965
-	*/
8961
+	 * Counts all hours by a ident/callsign
8962
+	 *
8963
+	 * @return Array the hour list
8964
+	 *
8965
+	 */
8966 8966
 	public function countAllHoursByIdent($ident, $filters = array())
8967 8967
 	{
8968 8968
 		global $globalTimezone, $globalDBdriver;
@@ -9007,11 +9007,11 @@  discard block
 block discarded – undo
9007 9007
 	
9008 9008
 	
9009 9009
 	/**
9010
-	* Counts all hours by route
9011
-	*
9012
-	* @return Array the hour list
9013
-	*
9014
-	*/
9010
+	 * Counts all hours by route
9011
+	 *
9012
+	 * @return Array the hour list
9013
+	 *
9014
+	 */
9015 9015
 	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array())
9016 9016
 	{
9017 9017
 		global $globalTimezone, $globalDBdriver;
@@ -9055,11 +9055,11 @@  discard block
 block discarded – undo
9055 9055
 	
9056 9056
 	
9057 9057
 	/**
9058
-	* Counts all hours by country
9059
-	*
9060
-	* @return Array the hour list
9061
-	*
9062
-	*/
9058
+	 * Counts all hours by country
9059
+	 *
9060
+	 * @return Array the hour list
9061
+	 *
9062
+	 */
9063 9063
 	public function countAllHoursByCountry($country, $filters = array())
9064 9064
 	{
9065 9065
 		global $globalTimezone, $globalDBdriver;
@@ -9104,11 +9104,11 @@  discard block
 block discarded – undo
9104 9104
 
9105 9105
 
9106 9106
 	/**
9107
-	* Counts all aircraft that have flown over
9108
-	*
9109
-	* @return Integer the number of aircrafts
9110
-	*
9111
-	*/
9107
+	 * Counts all aircraft that have flown over
9108
+	 *
9109
+	 * @return Integer the number of aircrafts
9110
+	 *
9111
+	 */
9112 9112
 	public function countOverallAircrafts($filters = array())
9113 9113
 	{
9114 9114
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9120,11 +9120,11 @@  discard block
 block discarded – undo
9120 9120
 	}
9121 9121
 
9122 9122
 	/**
9123
-	* Counts all flight that really arrival
9124
-	*
9125
-	* @return Integer the number of aircrafts
9126
-	*
9127
-	*/
9123
+	 * Counts all flight that really arrival
9124
+	 *
9125
+	 * @return Integer the number of aircrafts
9126
+	 *
9127
+	 */
9128 9128
 	public function countOverallArrival($filters = array())
9129 9129
 	{
9130 9130
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9137,11 +9137,11 @@  discard block
 block discarded – undo
9137 9137
 	}
9138 9138
 
9139 9139
 	/**
9140
-	* Counts all pilots that have flown over
9141
-	*
9142
-	* @return Integer the number of pilots
9143
-	*
9144
-	*/
9140
+	 * Counts all pilots that have flown over
9141
+	 *
9142
+	 * @return Integer the number of pilots
9143
+	 *
9144
+	 */
9145 9145
 	public function countOverallPilots($filters = array())
9146 9146
 	{
9147 9147
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9153,11 +9153,11 @@  discard block
 block discarded – undo
9153 9153
 	}
9154 9154
 
9155 9155
 	/**
9156
-	* Counts all owners that have flown over
9157
-	*
9158
-	* @return Integer the number of owners
9159
-	*
9160
-	*/
9156
+	 * Counts all owners that have flown over
9157
+	 *
9158
+	 * @return Integer the number of owners
9159
+	 *
9160
+	 */
9161 9161
 	public function countOverallOwners($filters = array())
9162 9162
 	{
9163 9163
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9170,11 +9170,11 @@  discard block
 block discarded – undo
9170 9170
 	
9171 9171
 	
9172 9172
 	/**
9173
-	* Counts all flights that have flown over
9174
-	*
9175
-	* @return Integer the number of flights
9176
-	*
9177
-	*/
9173
+	 * Counts all flights that have flown over
9174
+	 *
9175
+	 * @return Integer the number of flights
9176
+	 *
9177
+	 */
9178 9178
 	public function countOverallFlights($filters = array())
9179 9179
 	{
9180 9180
 		$query  = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
@@ -9187,11 +9187,11 @@  discard block
 block discarded – undo
9187 9187
 	}
9188 9188
 	
9189 9189
 	/**
9190
-	* Counts all military flights that have flown over
9191
-	*
9192
-	* @return Integer the number of flights
9193
-	*
9194
-	*/
9190
+	 * Counts all military flights that have flown over
9191
+	 *
9192
+	 * @return Integer the number of flights
9193
+	 *
9194
+	 */
9195 9195
 	public function countOverallMilitaryFlights($filters = array())
9196 9196
 	{
9197 9197
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9206,11 +9206,11 @@  discard block
 block discarded – undo
9206 9206
 	
9207 9207
 	
9208 9208
 	/**
9209
-	* Counts all airlines that have flown over
9210
-	*
9211
-	* @return Integer the number of airlines
9212
-	*
9213
-	*/
9209
+	 * Counts all airlines that have flown over
9210
+	 *
9211
+	 * @return Integer the number of airlines
9212
+	 *
9213
+	 */
9214 9214
 	public function countOverallAirlines($filters = array())
9215 9215
 	{
9216 9216
 		$query  = "SELECT COUNT(DISTINCT spotter_output.airline_name) AS airline_count 
@@ -9224,11 +9224,11 @@  discard block
 block discarded – undo
9224 9224
 
9225 9225
   
9226 9226
 	/**
9227
-	* Counts all hours of today
9228
-	*
9229
-	* @return Array the hour list
9230
-	*
9231
-	*/
9227
+	 * Counts all hours of today
9228
+	 *
9229
+	 * @return Array the hour list
9230
+	 *
9231
+	 */
9232 9232
 	public function countAllHoursFromToday($filters = array())
9233 9233
 	{
9234 9234
 		global $globalTimezone, $globalDBdriver;
@@ -9268,11 +9268,11 @@  discard block
 block discarded – undo
9268 9268
 	}
9269 9269
     
9270 9270
 	/**
9271
-	* Gets all the spotter information based on calculated upcoming flights
9272
-	*
9273
-	* @return Array the spotter information
9274
-	*
9275
-	*/
9271
+	 * Gets all the spotter information based on calculated upcoming flights
9272
+	 *
9273
+	 * @return Array the spotter information
9274
+	 *
9275
+	 */
9276 9276
 	public function getUpcomingFlights($limit = '', $sort = '', $filters = array())
9277 9277
 	{
9278 9278
 		global $global_query, $globalDBdriver, $globalTimezone;
@@ -9347,12 +9347,12 @@  discard block
 block discarded – undo
9347 9347
 	}
9348 9348
     
9349 9349
     
9350
-     /**
9351
-	* Gets the Barrie Spotter ID based on the FlightAware ID
9352
-	*
9353
-	* @return Integer the Barrie Spotter ID
9350
+	 /**
9351
+	  * Gets the Barrie Spotter ID based on the FlightAware ID
9352
+	  *
9353
+	  * @return Integer the Barrie Spotter ID
9354 9354
 q	*
9355
-	*/
9355
+	  */
9356 9356
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
9357 9357
 	{
9358 9358
 		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
@@ -9373,13 +9373,13 @@  discard block
 block discarded – undo
9373 9373
   
9374 9374
  
9375 9375
 	/**
9376
-	* Parses a date string
9377
-	*
9378
-	* @param String $dateString the date string
9379
-	* @param String $timezone the timezone of a user
9380
-	* @return Array the time information
9381
-	*
9382
-	*/
9376
+	 * Parses a date string
9377
+	 *
9378
+	 * @param String $dateString the date string
9379
+	 * @param String $timezone the timezone of a user
9380
+	 * @return Array the time information
9381
+	 *
9382
+	 */
9383 9383
 	public function parseDateString($dateString, $timezone = '')
9384 9384
 	{
9385 9385
 		$time_array = array();
@@ -9415,12 +9415,12 @@  discard block
 block discarded – undo
9415 9415
 	
9416 9416
 	
9417 9417
 	/**
9418
-	* Parses the direction degrees to working
9419
-	*
9420
-	* @param Float $direction the direction in degrees
9421
-	* @return Array the direction information
9422
-	*
9423
-	*/
9418
+	 * Parses the direction degrees to working
9419
+	 *
9420
+	 * @param Float $direction the direction in degrees
9421
+	 * @return Array the direction information
9422
+	 *
9423
+	 */
9424 9424
 	public function parseDirection($direction = 0)
9425 9425
 	{
9426 9426
 		if ($direction == '') $direction = 0;
@@ -9499,12 +9499,12 @@  discard block
 block discarded – undo
9499 9499
 	
9500 9500
 	
9501 9501
 	/**
9502
-	* Gets the aircraft registration
9503
-	*
9504
-	* @param String $flightaware_id the flight aware id
9505
-	* @return String the aircraft registration
9506
-	*
9507
-	*/
9502
+	 * Gets the aircraft registration
9503
+	 *
9504
+	 * @param String $flightaware_id the flight aware id
9505
+	 * @return String the aircraft registration
9506
+	 *
9507
+	 */
9508 9508
 	
9509 9509
 	public function getAircraftRegistration($flightaware_id)
9510 9510
 	{
@@ -9533,12 +9533,12 @@  discard block
 block discarded – undo
9533 9533
 
9534 9534
 
9535 9535
 	/**
9536
-	* Gets the aircraft registration from ModeS
9537
-	*
9538
-	* @param String $aircraft_modes the flight ModeS in hex
9539
-	* @return String the aircraft registration
9540
-	*
9541
-	*/
9536
+	 * Gets the aircraft registration from ModeS
9537
+	 *
9538
+	 * @param String $aircraft_modes the flight ModeS in hex
9539
+	 * @return String the aircraft registration
9540
+	 *
9541
+	 */
9542 9542
 	public function getAircraftRegistrationBymodeS($aircraft_modes)
9543 9543
 	{
9544 9544
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -9551,19 +9551,19 @@  discard block
 block discarded – undo
9551 9551
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
9552 9552
 		$sth->closeCursor();
9553 9553
 		if (count($row) > 0) {
9554
-		    //return $row['Registration'];
9555
-		    return $row['registration'];
9554
+			//return $row['Registration'];
9555
+			return $row['registration'];
9556 9556
 		} else return '';
9557 9557
 	
9558 9558
 	}
9559 9559
 
9560 9560
 	/**
9561
-	* Gets the aircraft type from ModeS
9562
-	*
9563
-	* @param String $aircraft_modes the flight ModeS in hex
9564
-	* @return String the aircraft type
9565
-	*
9566
-	*/
9561
+	 * Gets the aircraft type from ModeS
9562
+	 *
9563
+	 * @param String $aircraft_modes the flight ModeS in hex
9564
+	 * @return String the aircraft type
9565
+	 *
9566
+	 */
9567 9567
 	public function getAircraftTypeBymodeS($aircraft_modes)
9568 9568
 	{
9569 9569
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -9576,19 +9576,19 @@  discard block
 block discarded – undo
9576 9576
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
9577 9577
 		$sth->closeCursor();
9578 9578
 		if (count($row) > 0) {
9579
-		    if ($row['type_flight'] == null) return '';
9580
-		    else return $row['type_flight'];
9579
+			if ($row['type_flight'] == null) return '';
9580
+			else return $row['type_flight'];
9581 9581
 		} else return '';
9582 9582
 	
9583 9583
 	}
9584 9584
 
9585 9585
 	/**
9586
-	* Gets Countrie from latitude/longitude
9587
-	*
9588
-	* @param Float $latitude latitute of the flight
9589
-	* @param Float $longitude longitute of the flight
9590
-	* @return String the countrie
9591
-	*/
9586
+	 * Gets Countrie from latitude/longitude
9587
+	 *
9588
+	 * @param Float $latitude latitute of the flight
9589
+	 * @param Float $longitude longitute of the flight
9590
+	 * @return String the countrie
9591
+	 */
9592 9592
 	public function getCountryFromLatitudeLongitude($latitude,$longitude)
9593 9593
 	{
9594 9594
 		global $globalDBdriver, $globalDebug;
@@ -9625,12 +9625,12 @@  discard block
 block discarded – undo
9625 9625
 	}
9626 9626
 
9627 9627
 	/**
9628
-	* converts the registration code using the country prefix
9629
-	*
9630
-	* @param String $registration the aircraft registration
9631
-	* @return String the aircraft registration
9632
-	*
9633
-	*/
9628
+	 * converts the registration code using the country prefix
9629
+	 *
9630
+	 * @param String $registration the aircraft registration
9631
+	 * @return String the aircraft registration
9632
+	 *
9633
+	 */
9634 9634
 	public function convertAircraftRegistration($registration)
9635 9635
 	{
9636 9636
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -9682,12 +9682,12 @@  discard block
 block discarded – undo
9682 9682
 	}
9683 9683
 
9684 9684
 	/**
9685
-	* Country from the registration code
9686
-	*
9687
-	* @param String $registration the aircraft registration
9688
-	* @return String the country
9689
-	*
9690
-	*/
9685
+	 * Country from the registration code
9686
+	 *
9687
+	 * @param String $registration the aircraft registration
9688
+	 * @return String the country
9689
+	 *
9690
+	 */
9691 9691
 	public function countryFromAircraftRegistration($registration)
9692 9692
 	{
9693 9693
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -9706,8 +9706,8 @@  discard block
 block discarded – undo
9706 9706
 				$country = $row['country'];
9707 9707
 			}
9708 9708
 		} else {
9709
-    			$registration_1 = substr($registration, 0, 1);
9710
-		        $registration_2 = substr($registration, 0, 2);
9709
+				$registration_1 = substr($registration, 0, 1);
9710
+				$registration_2 = substr($registration, 0, 2);
9711 9711
 
9712 9712
 			$country = '';
9713 9713
 			//first get the prefix based on two characters
@@ -9743,11 +9743,11 @@  discard block
 block discarded – undo
9743 9743
 	}
9744 9744
 	
9745 9745
 	/**
9746
-	* Set a new highlight value for a flight
9747
-	*
9748
-	* @param String $flightaware_id flightaware_id from spotter_output table
9749
-	* @param String $highlight New highlight value
9750
-	*/
9746
+	 * Set a new highlight value for a flight
9747
+	 *
9748
+	 * @param String $flightaware_id flightaware_id from spotter_output table
9749
+	 * @param String $highlight New highlight value
9750
+	 */
9751 9751
 	public function setHighlightFlight($flightaware_id,$highlight) {
9752 9752
 		
9753 9753
 		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
@@ -9756,12 +9756,12 @@  discard block
 block discarded – undo
9756 9756
 	}
9757 9757
 	
9758 9758
 	/**
9759
-	* Gets the short url from bit.ly
9760
-	*
9761
-	* @param String $url the full url
9762
-	* @return String the bit.ly url
9763
-	*
9764
-	*/
9759
+	 * Gets the short url from bit.ly
9760
+	 *
9761
+	 * @param String $url the full url
9762
+	 * @return String the bit.ly url
9763
+	 *
9764
+	 */
9765 9765
 	public function getBitlyURL($url)
9766 9766
 	{
9767 9767
 		global $globalBitlyAccessToken;
@@ -10050,11 +10050,11 @@  discard block
 block discarded – undo
10050 10050
 			$query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance 
10051 10051
 	                      FROM airport WHERE longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
10052 10052
 	                      AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;";
10053
-                } else {
10053
+				} else {
10054 10054
 			$query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2))) as distance 
10055 10055
 	                      FROM airport WHERE CAST(longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
10056 10056
 	                      AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;";
10057
-    		}
10057
+			}
10058 10058
 		$sth = $this->db->prepare($query);
10059 10059
 		$sth->execute();
10060 10060
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
Please login to merge, or discard this patch.
header.php 1 patch
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 // When button "Remove all filters" is clicked
29 29
 if (isset($_POST['removefilters'])) {
30 30
 	$allfilters = array_filter(array_keys($_COOKIE),function($key) {
31
-	    return strpos($key,'filter_') === 0;
31
+		return strpos($key,'filter_') === 0;
32 32
 	});
33 33
 	foreach ($allfilters as $filt) {
34 34
 		unset($_COOKIE[$filt]);
@@ -167,16 +167,16 @@  discard block
 block discarded – undo
167 167
 	}
168 168
 ?>
169 169
 <?php 
170
-    if (isset($_POST['archive'])) {
170
+	if (isset($_POST['archive'])) {
171 171
 ?>
172 172
 <?php 
173
-	    if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
173
+		if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
174 174
 ?>
175 175
 
176 176
 <script src="<?php print $globalURL; ?>/js/map.js.php?<?php print time(); ?>&archive&begindate=<?php print strtotime($_POST['start_date']); ?>&enddate=<?php print strtotime($_POST['end_date']); ?>&archivespeed=<?php print $_POST['archivespeed']; ?>"></script>
177 177
 <?php    
178
-	    }
179
-    } else {
178
+		}
179
+	} else {
180 180
 ?>
181 181
 <?php
182 182
 /*	if (isset($globalBeta) && $globalBeta) {
@@ -188,18 +188,18 @@  discard block
 block discarded – undo
188 188
 */
189 189
 ?>
190 190
 <?php 
191
-	    if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
191
+		if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
192 192
 ?>
193 193
 <script src="<?php print $globalURL; ?>/js/leaflet-playback.js"></script>
194 194
 <script src="<?php print $globalURL; ?>/js/map.js.php?<?php print time(); ?>"></script>
195 195
 <?php
196
-	    }
196
+		}
197 197
 ?>
198 198
 <?php
199 199
 //	}
200 200
 ?>
201 201
 <?php
202
-    }
202
+	}
203 203
 }
204 204
 ?>
205 205
 <?php
@@ -359,23 +359,23 @@  discard block
 block discarded – undo
359 359
             <li><a href="<?php print $globalURL; ?>/date/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Activity"); ?></a></li>
360 360
             <li><a href="<?php print $globalURL; ?>/newest"><?php echo _("Newest by Category"); ?></a></li>
361 361
             <?php
362
-        	if ($globalACARS) {
363
-        	    if (isset($globalDemo) && $globalDemo) {
364
-    	    ?>
362
+			if ($globalACARS) {
363
+				if (isset($globalDemo) && $globalDemo) {
364
+			?>
365 365
             <li><hr /></li>
366 366
             <li><i><?php echo _('ACARS data not available publicly'); ?></i></li>
367 367
             <li><a href=""><?php echo _('Latest ACARS messages'); ?></a></li>
368 368
             <li><a href=""><?php echo _('Archive ACARS messages'); ?></a></li>
369 369
             <?php
370
-        	    } else {
371
-    	    ?>
370
+				} else {
371
+			?>
372 372
             <li><hr /></li>
373 373
             <li><a href="<?php print $globalURL; ?>/acars-latest"><?php echo _("Latest ACARS messages"); ?></a></li>
374 374
             <li><a href="<?php print $globalURL; ?>/acars-archive"><?php echo _("Archive ACARS messages"); ?></a></li>
375 375
             <?php
376
-        	    }
377
-        	}
378
-    	    ?>
376
+				}
377
+			}
378
+			?>
379 379
             <li><hr /></li>
380 380
             <li><a href="<?php print $globalURL; ?>/highlights/table"><?php echo _("Special Highlights"); ?></a></li>
381 381
             <li><a href="<?php print $globalURL; ?>/upcoming"><?php echo _("Upcoming Flights"); ?></a></li>
@@ -417,14 +417,14 @@  discard block
 block discarded – undo
417 417
   	    <form>
418 418
   		<select class="selectpicker" data-width="120px" onchange="language(this);">
419 419
   		    <?php
420
-  		        $Language = new Language();
421
-  		        $alllang = $Language->getLanguages();
422
-  		        foreach ($alllang as $key => $lang) {
423
-  		            print '<option value="'.$key.'"';
424
-  		            if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected ';
425
-  		            print '>'.$lang[0].'</option>';
426
-  		        }
427
-  		    ?>
420
+  				$Language = new Language();
421
+  				$alllang = $Language->getLanguages();
422
+  				foreach ($alllang as $key => $lang) {
423
+  					print '<option value="'.$key.'"';
424
+  					if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected ';
425
+  					print '>'.$lang[0].'</option>';
426
+  				}
427
+  			?>
428 428
   		</select>
429 429
   	    </form>
430 430
   	</div>
@@ -455,18 +455,18 @@  discard block
 block discarded – undo
455 455
 ?>
456 456
     <div class="top-header clear" role="main">
457 457
 <?php
458
-    if (isset($longitude) && isset($latitude) && $longitude != 0 && $latitude != 0) {
458
+	if (isset($longitude) && isset($latitude) && $longitude != 0 && $latitude != 0) {
459 459
 ?>
460 460
     <div id="archive-map"></div>
461 461
 <?php
462
-    }
462
+	}
463 463
 ?>
464 464
     </div>
465 465
 <?php
466 466
 }
467 467
 if ((strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) || (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false))
468 468
 {
469
-    ?>
469
+	?>
470 470
     <div class="top-header clear" role="main">
471 471
         <div id="map"></div>
472 472
 	<link rel="stylesheet" href="<?php print $globalURL; ?>/css/leaflet.css" />
@@ -477,15 +477,15 @@  discard block
 block discarded – undo
477 477
         var zoom = 13;
478 478
 //create the map
479 479
 <?php
480
-    if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) {
480
+	if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) {
481 481
 ?>
482 482
   map = L.map('map', { zoomControl:true }).setView([<?php print $airport_array[0]['latitude']; ?>,<?php print $airport_array[0]['longitude']; ?>], zoom);
483 483
 <?php
484
-    } elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) {
484
+	} elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) {
485 485
 ?>
486 486
   map = L.map('map', { zoomControl:true });
487 487
 <?php
488
-    } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) {
488
+	} elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) {
489 489
 ?>
490 490
   map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['departure_airport_latitude']; ?>,<?php print $spotter_array[0]['arrival_airport_longitude']; ?>]);
491 491
     var line = L.polyline([[<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>],[<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>]]).addTo(map);
@@ -493,22 +493,22 @@  discard block
 block discarded – undo
493 493
     var departure_airport = L.marker([<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/departure_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map);
494 494
     var arrival_airport = L.marker([<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/arrival_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map);
495 495
 <?php
496
-    } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude'])) {
496
+	} elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude'])) {
497 497
 ?>
498 498
   map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['latitude']; ?>,<?php print $spotter_array[0]['longitude']; ?>]);
499 499
 <?php
500
-    } elseif (!isset($spotter_array[0]['latitude']) && !isset($spotter_array[0]['longitude'])) {
500
+	} elseif (!isset($spotter_array[0]['latitude']) && !isset($spotter_array[0]['longitude'])) {
501 501
 ?>
502 502
   map = L.map('map', { zoomControl:true });
503 503
 <?php
504
-    }
504
+	}
505 505
 ?>
506 506
   //initialize the layer group for the aircrft markers
507 507
   var layer_data = L.layerGroup();
508 508
 
509 509
   //a few title layers
510 510
 <?php
511
-    if ($globalMapProvider == 'Mapbox') {
511
+	if ($globalMapProvider == 'Mapbox') {
512 512
 ?>
513 513
   L.tileLayer('https://{s}.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={token}', {
514 514
     maxZoom: 18,
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
     token : '<?php print $globalMapboxToken; ?>'
520 520
   }).addTo(map);
521 521
 <?php
522
-    } elseif ($globalMapProvider == 'OpenStreetMap') {
522
+	} elseif ($globalMapProvider == 'OpenStreetMap') {
523 523
 ?>
524 524
   L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
525 525
     maxZoom: 18,
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
       '<a href="http://www.openstreetmap.org/copyright">Open Database Licence</a>'
528 528
   }).addTo(map);
529 529
 <?php
530
-    } elseif ($globalMapProvider == 'MapQuest-OSM') {
530
+	} elseif ($globalMapProvider == 'MapQuest-OSM') {
531 531
 ?>
532 532
   L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.png', {
533 533
     maxZoom: 18,
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
       'Tiles Courtesy of <a href="http://www.mapquest.com">MapQuest</a>'
537 537
   }).addTo(map);
538 538
 <?php
539
-    } elseif ($globalMapProvider == 'MapQuest-Aerial') {
539
+	} elseif ($globalMapProvider == 'MapQuest-Aerial') {
540 540
 ?>
541 541
   L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.png', {
542 542
     maxZoom: 18,
@@ -545,27 +545,27 @@  discard block
 block discarded – undo
545 545
       'Tiles Courtesy of <a href="http://www.mapquest.com">MapQuest</a>, Portions Courtesy NASA/JPL-Caltech and U.S. Depart. of Agriculture, Farm Service Agency"'
546 546
   }).addTo(map);
547 547
 <?php
548
-    } elseif ($globalMapProvider == 'Google-Roadmap') {
548
+	} elseif ($globalMapProvider == 'Google-Roadmap') {
549 549
 ?>
550 550
     var googleLayer = new L.Google('ROADMAP');
551 551
     map.addLayer(googleLayer);
552 552
 <?php
553
-    } elseif ($globalMapProvider == 'Google-Satellite') {
553
+	} elseif ($globalMapProvider == 'Google-Satellite') {
554 554
 ?>
555 555
     var googleLayer = new L.Google('SATELLITE');
556 556
     map.addLayer(googleLayer);
557 557
 <?php
558
-    } elseif ($globalMapProvider == 'Google-Hybrid') {
558
+	} elseif ($globalMapProvider == 'Google-Hybrid') {
559 559
 ?>
560 560
     var googleLayer = new L.Google('HYBRID');
561 561
     map.addLayer(googleLayer);
562 562
 <?php
563
-    } elseif ($globalMapProvider == 'Google-Terrain') {
563
+	} elseif ($globalMapProvider == 'Google-Terrain') {
564 564
 ?>
565 565
     var googleLayer = new L.Google('Terrain');
566 566
     map.addLayer(googleLayer);
567 567
 <?php
568
-    }
568
+	}
569 569
 ?>
570 570
         </script>
571 571
     </div>
Please login to merge, or discard this patch.
statistics.php 1 patch
Indentation   +224 added lines, -224 removed lines patch added patch discarded remove patch
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
 		if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone);
40 40
 		print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>';
41 41
 	}
42
-    ?>
42
+	?>
43 43
     </div>
44 44
     <?php    
45 45
 	// print_r($Stats->getAllAirlineNames()); 
46
-    ?>
46
+	?>
47 47
     <?php include('statistics-sub-menu.php'); ?>
48 48
     <div class="row global-stats">
49 49
         <div class="col-md-2"><span class="type"><?php echo _("Flights"); ?></span><span><?php print number_format($Stats->countOverallFlights($airline_icao,$filter_name)); ?></span></div> 
@@ -51,23 +51,23 @@  discard block
 block discarded – undo
51 51
         <div class="col-md-2"><span class="type"><?php echo _("Arrivals seen"); ?></span><span><?php print number_format($Stats->countOverallArrival($airline_icao,$filter_name)); ?></span></div> 
52 52
         <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
53 53
 	<?php
54
-	    if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
54
+		if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
55 55
 	?>
56 56
     	    <div class="col-md-2"><span class="type"><?php echo _("Pilots"); ?></span><span><?php print number_format($Stats->countOverallPilots($airline_icao,$filter_name)); ?></span></div> 
57 57
 	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
58 58
         <?php
59
-    	    } else {
60
-    	?>
59
+			} else {
60
+		?>
61 61
     	    <div class="col-md-2"><span class="type"><?php echo _("Owners"); ?></span><span><?php print number_format($Stats->countOverallOwners($airline_icao,$filter_name)); ?></span></div> 
62 62
 	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
63 63
     	<?php
64
-    	    }
65
-    	?>
64
+			}
65
+		?>
66 66
         <div class="col-md-2"><span class="type"><?php echo _("Aircrafts"); ?></span><span><?php print number_format($Stats->countOverallAircrafts($airline_icao,$filter_name)); ?></span></div> 
67 67
         <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
68 68
         <?php
69
-    		if ($airline_icao == '') {
70
-    	?>
69
+			if ($airline_icao == '') {
70
+		?>
71 71
         <div class="col-md-2"><span class="type"><?php echo _("Airlines"); ?></span><span><?php print number_format($Stats->countOverallAirlines($filter_name)); ?></span></div>
72 72
 	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
73 73
 	<?php
@@ -88,25 +88,25 @@  discard block
 block discarded – undo
88 88
             <div class="col-md-6">
89 89
                 <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2>
90 90
                  <?php
91
-                  $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name);
92
-		    if (count($aircraft_array) == 0) print _("No data available");
93
-		    else {
91
+				  $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name);
92
+			if (count($aircraft_array) == 0) print _("No data available");
93
+			else {
94 94
 
95
-                    print '<div id="chart1" class="chart" width="100%"></div>
95
+					print '<div id="chart1" class="chart" width="100%"></div>
96 96
                     <script> 
97 97
                         google.load("visualization", "1", {packages:["corechart"]});
98 98
                       google.setOnLoadCallback(drawChart1);
99 99
                       function drawChart1() {
100 100
                         var data = google.visualization.arrayToDataTable([
101 101
                             ["'._("Aircraft").'", "'._("# of times").'"], ';
102
-                            $aircraft_data = '';
103
-                          foreach($aircraft_array as $aircraft_item)
104
-                                    {
105
-                                            $aircraft_data .= '[ "'.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
106
-                                    }
107
-                                    $aircraft_data = substr($aircraft_data, 0, -1);
108
-                                    print $aircraft_data;
109
-                        print ']);
102
+							$aircraft_data = '';
103
+						  foreach($aircraft_array as $aircraft_item)
104
+									{
105
+											$aircraft_data .= '[ "'.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
106
+									}
107
+									$aircraft_data = substr($aircraft_data, 0, -1);
108
+									print $aircraft_data;
109
+						print ']);
110 110
 
111 111
                         var options = {
112 112
                             chartArea: {"width": "80%", "height": "60%"},
@@ -121,8 +121,8 @@  discard block
 block discarded – undo
121 121
                               drawChart1();
122 122
                             });
123 123
                   </script>';
124
-                  }
125
-                  ?>
124
+				  }
125
+				  ?>
126 126
                 <div class="more">
127 127
                     <a href="<?php print $globalURL; ?>/statistics/aircraft" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
128 128
                 </div>
@@ -130,30 +130,30 @@  discard block
 block discarded – undo
130 130
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
131 131
 <?php
132 132
 //    echo $airline_icao;
133
-    if ($airline_icao == '' || $airline_icao == 'all') {
133
+	if ($airline_icao == '' || $airline_icao == 'all') {
134 134
 ?>
135 135
             <div class="col-md-6">
136 136
                 <h2><?php echo _("Top 10 Most Common Airline"); ?></h2>
137 137
                  <?php
138
-                  $airline_array = $Stats->countAllAirlines(true,$filter_name);
139
-		    if (count($airline_array) == 0) print _("No data available");
140
-		    else {
138
+				  $airline_array = $Stats->countAllAirlines(true,$filter_name);
139
+			if (count($airline_array) == 0) print _("No data available");
140
+			else {
141 141
 
142
-                  print '<div id="chart2" class="chart" width="100%"></div>
142
+				  print '<div id="chart2" class="chart" width="100%"></div>
143 143
                     <script> 
144 144
                         google.load("visualization", "1", {packages:["corechart"]});
145 145
                       google.setOnLoadCallback(drawChart2);
146 146
                       function drawChart2() {
147 147
                         var data = google.visualization.arrayToDataTable([
148 148
                             ["'._("Airline").'", "'._("# of times").'"], ';
149
-                            $airline_data = '';
150
-                          foreach($airline_array as $airline_item)
151
-                                    {
152
-                                            $airline_data .= '[ "'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],';
153
-                                    }
154
-                                    $airline_data = substr($airline_data, 0, -1);
155
-                                    print $airline_data;
156
-                        print ']);
149
+							$airline_data = '';
150
+						  foreach($airline_array as $airline_item)
151
+									{
152
+											$airline_data .= '[ "'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],';
153
+									}
154
+									$airline_data = substr($airline_data, 0, -1);
155
+									print $airline_data;
156
+						print ']);
157 157
 
158 158
                         var options = {
159 159
                             chartArea: {"width": "80%", "height": "60%"},
@@ -168,8 +168,8 @@  discard block
 block discarded – undo
168 168
                               drawChart2();
169 169
                             });
170 170
                   </script>';
171
-                  }
172
-                  ?>
171
+				  }
172
+				  ?>
173 173
                 <div class="more">
174 174
                     <a href="<?php print $globalURL; ?>/statistics/airline" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
175 175
                 </div>
@@ -177,44 +177,44 @@  discard block
 block discarded – undo
177 177
         </div>
178 178
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
179 179
 <?php
180
-    }
180
+	}
181 181
 ?>
182 182
         <div class="row column">
183 183
 
184 184
 	    <?php
185
-                 $flightover_array = $Stats->countAllFlightOverCountries($airline_icao,$filter_name);
185
+				 $flightover_array = $Stats->countAllFlightOverCountries($airline_icao,$filter_name);
186 186
 		if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
187
-		    if (empty($flightover_array)) {
188
-	    ?>
187
+			if (empty($flightover_array)) {
188
+		?>
189 189
             <div class="col-md-12">
190 190
             <?php
191
-        	    } else {
192
-            ?>
191
+				} else {
192
+			?>
193 193
             <div class="col-md-6">
194 194
             <?php
195
-            	    }
196
-            ?>
195
+					}
196
+			?>
197 197
                 <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2>
198 198
                  <?php
199
-                  $pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name);
200
-		    if (count($pilot_array) == 0) print _("No data available");
201
-		    else {
199
+				  $pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name);
200
+			if (count($pilot_array) == 0) print _("No data available");
201
+			else {
202 202
 
203
-                  print '<div id="chart7" class="chart" width="100%"></div>
203
+				  print '<div id="chart7" class="chart" width="100%"></div>
204 204
                     <script> 
205 205
                         google.load("visualization", "1", {packages:["corechart"]});
206 206
                       google.setOnLoadCallback(drawChart7);
207 207
                       function drawChart7() {
208 208
                         var data = google.visualization.arrayToDataTable([
209 209
                             ["'._("Pilots").'", "'._("# of times").'"], ';
210
-                            $pilot_data = '';
211
-                          foreach($pilot_array as $pilot_item)
212
-                                    {
213
-                                            $pilot_data .= '[ "'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],';
214
-                                    }
215
-                                    $pilot_data = substr($pilot_data, 0, -1);
216
-                                    print $pilot_data;
217
-                        print ']);
210
+							$pilot_data = '';
211
+						  foreach($pilot_array as $pilot_item)
212
+									{
213
+											$pilot_data .= '[ "'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],';
214
+									}
215
+									$pilot_data = substr($pilot_data, 0, -1);
216
+									print $pilot_data;
217
+						print ']);
218 218
 
219 219
                         var options = {
220 220
                             chartArea: {"width": "80%", "height": "60%"},
@@ -229,8 +229,8 @@  discard block
 block discarded – undo
229 229
                               drawChart7();
230 230
                             });
231 231
                   </script>';
232
-                  }
233
-                  ?>
232
+				  }
233
+				  ?>
234 234
                 <div class="more">
235 235
                     <a href="<?php print $globalURL; ?>/statistics/pilot" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
236 236
                 </div>
@@ -238,30 +238,30 @@  discard block
 block discarded – undo
238 238
         
239 239
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
240 240
         <?php
241
-    	    } else {
242
-    	?>
241
+			} else {
242
+		?>
243 243
             <div class="col-md-6">
244 244
                 <h2><?php echo _("Top 10 Most Common Owners"); ?></h2>
245 245
                  <?php
246
-                  $owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name);
247
-		    if (count($owner_array) == 0) print _("No data available");
248
-		    else {
246
+				  $owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name);
247
+			if (count($owner_array) == 0) print _("No data available");
248
+			else {
249 249
 
250
-                  print '<div id="chart7" class="chart" width="100%"></div>
250
+				  print '<div id="chart7" class="chart" width="100%"></div>
251 251
                     <script> 
252 252
                         google.load("visualization", "1", {packages:["corechart"]});
253 253
                       google.setOnLoadCallback(drawChart7);
254 254
                       function drawChart7() {
255 255
                         var data = google.visualization.arrayToDataTable([
256 256
                             ["'._("Owner").'", "'._("# of times").'"], ';
257
-                            $owner_data = '';
258
-                          foreach($owner_array as $owner_item)
259
-                                    {
260
-                                            $owner_data .= '[ "'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],';
261
-                                    }
262
-                                    $owner_data = substr($owner_data, 0, -1);
263
-                                    print $owner_data;
264
-                        print ']);
257
+							$owner_data = '';
258
+						  foreach($owner_array as $owner_item)
259
+									{
260
+											$owner_data .= '[ "'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],';
261
+									}
262
+									$owner_data = substr($owner_data, 0, -1);
263
+									print $owner_data;
264
+						print ']);
265 265
 
266 266
                         var options = {
267 267
                             chartArea: {"width": "80%", "height": "60%"},
@@ -276,8 +276,8 @@  discard block
 block discarded – undo
276 276
                               drawChart7();
277 277
                             });
278 278
                   </script>';
279
-                  }
280
-                  ?>
279
+				  }
280
+				  ?>
281 281
                 <div class="more">
282 282
                     <a href="<?php print $globalURL; ?>/statistics/owner" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
283 283
                 </div>
@@ -285,32 +285,32 @@  discard block
 block discarded – undo
285 285
         
286 286
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
287 287
         <?php
288
-    	    }
289
-    	    if (!empty($flightover_array)) {
290
-    	?>
288
+			}
289
+			if (!empty($flightover_array)) {
290
+		?>
291 291
     	
292 292
             <div class="col-md-6">
293 293
                 <h2><?php echo _("Top 20 Most Common Country a Flight was Over"); ?></h2>
294 294
                  <?php
295
-                  //$flightover_array = $Stats->countAllFlightOverCountries();
296
-		    if (count($flightover_array) == 0) print _("No data available");
297
-		    else {
295
+				  //$flightover_array = $Stats->countAllFlightOverCountries();
296
+			if (count($flightover_array) == 0) print _("No data available");
297
+			else {
298 298
 
299
-                  print '<div id="chart10" class="chart" width="100%"></div>
299
+				  print '<div id="chart10" class="chart" width="100%"></div>
300 300
                     <script> 
301 301
                         google.load("visualization", "1", {packages:["corechart"]});
302 302
                       google.setOnLoadCallback(drawChart10);
303 303
                       function drawChart10() {
304 304
                         var data = google.visualization.arrayToDataTable([
305 305
                             ["'._("Country").'", "'._("# of times").'"], ';
306
-                            $flightover_data = '';
307
-                          foreach($flightover_array as $flightover_item)
308
-                                    {
309
-                                            $flightover_data .= '[ "'.$flightover_item['flight_country'].' ('.$flightover_item['flight_country_iso2'].')",'.$flightover_item['flight_count'].'],';
310
-                                    }
311
-                                    $flightover_data = substr($flightover_data, 0, -1);
312
-                                    print $flightover_data;
313
-                        print ']);
306
+							$flightover_data = '';
307
+						  foreach($flightover_array as $flightover_item)
308
+									{
309
+											$flightover_data .= '[ "'.$flightover_item['flight_country'].' ('.$flightover_item['flight_country_iso2'].')",'.$flightover_item['flight_count'].'],';
310
+									}
311
+									$flightover_data = substr($flightover_data, 0, -1);
312
+									print $flightover_data;
313
+						print ']);
314 314
 
315 315
                         var options = {
316 316
                             chartArea: {"width": "80%", "height": "60%"},
@@ -327,15 +327,15 @@  discard block
 block discarded – undo
327 327
                               drawChart10();
328 328
                             });
329 329
                   </script>';
330
-                  }
331
-                  ?>
330
+				  }
331
+				  ?>
332 332
                 <div class="more">
333 333
                     <a href="<?php print $globalURL; ?>/statistics/country" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
334 334
                 </div>
335 335
             </div>
336 336
         <?php
337
-            }
338
-        ?>
337
+			}
338
+		?>
339 339
         </div>
340 340
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
341 341
 
@@ -345,11 +345,11 @@  discard block
 block discarded – undo
345 345
             <div class="col-md-6">
346 346
                 <h2><?php echo _("Top 10 Most Common Departure Airports"); ?></h2>
347 347
                 <?php
348
-                $airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name);
349
-		    if (count($airport_airport_array) == 0) print _("No data available");
350
-		    else {
348
+				$airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name);
349
+			if (count($airport_airport_array) == 0) print _("No data available");
350
+			else {
351 351
 
352
-                 print '<div id="chart3" class="chart" width="100%"></div>
352
+				 print '<div id="chart3" class="chart" width="100%"></div>
353 353
                 <script>
354 354
                 google.load("visualization", "1", {packages:["geochart"]});
355 355
                 google.setOnLoadCallback(drawCharts3);
@@ -360,17 +360,17 @@  discard block
 block discarded – undo
360 360
 
361 361
                 var data = google.visualization.arrayToDataTable([ 
362 362
                     ["'._("Airport").'", "'._("# of times").'"],';
363
-                    $airport_data = '';
364
-                  foreach($airport_airport_array as $airport_item)
365
-                        {
366
-                            $name = $airport_item['airport_departure_city'].', '.$airport_item['airport_departure_country'].' ('.$airport_item['airport_departure_icao'].')';
367
-                            $name = str_replace("'", "", $name);
368
-                            $name = str_replace('"', "", $name);
369
-                            $airport_data .= '[ "'.$name.'",'.$airport_item['airport_departure_icao_count'].'],';
370
-                        }
371
-                        $airport_data = substr($airport_data, 0, -1);
372
-                        print $airport_data;
373
-                print ']);
363
+					$airport_data = '';
364
+				  foreach($airport_airport_array as $airport_item)
365
+						{
366
+							$name = $airport_item['airport_departure_city'].', '.$airport_item['airport_departure_country'].' ('.$airport_item['airport_departure_icao'].')';
367
+							$name = str_replace("'", "", $name);
368
+							$name = str_replace('"', "", $name);
369
+							$airport_data .= '[ "'.$name.'",'.$airport_item['airport_departure_icao_count'].'],';
370
+						}
371
+						$airport_data = substr($airport_data, 0, -1);
372
+						print $airport_data;
373
+				print ']);
374 374
 
375 375
                 var options = {
376 376
                     legend: {position: "none"},
@@ -384,8 +384,8 @@  discard block
 block discarded – undo
384 384
                 chart.draw(data, options);
385 385
               }
386 386
                 </script>';
387
-                }
388
-              ?>
387
+				}
388
+			  ?>
389 389
               <div class="more">
390 390
                 <a href="<?php print $globalURL; ?>/statistics/airport-departure" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
391 391
               </div>
@@ -395,11 +395,11 @@  discard block
 block discarded – undo
395 395
             <div class="col-md-6">
396 396
                 <h2><?php echo _("Top 10 Most Common Arrival Airports"); ?></h2>
397 397
                 <?php
398
-                $airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name);
399
-		    if (count($airport_airport_array2) == 0) print _("No data available");
400
-		    else {
398
+				$airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name);
399
+			if (count($airport_airport_array2) == 0) print _("No data available");
400
+			else {
401 401
 
402
-                print '<div id="chart4" class="chart" width="100%"></div>
402
+				print '<div id="chart4" class="chart" width="100%"></div>
403 403
                 <script>
404 404
                 google.load("visualization", "1", {packages:["geochart"]});
405 405
                 google.setOnLoadCallback(drawCharts4);
@@ -410,17 +410,17 @@  discard block
 block discarded – undo
410 410
 
411 411
                 var data = google.visualization.arrayToDataTable([ 
412 412
                     ["'._("Airport").'", "'._("# of times").'"],';
413
-                    $airport_data2 = '';
414
-                  foreach($airport_airport_array2 as $airport_item2)
415
-                        {
416
-                            $name2 = $airport_item2['airport_arrival_city'].', '.$airport_item2['airport_arrival_country'].' ('.$airport_item2['airport_arrival_icao'].')';
417
-                            $name2 = str_replace("'", "", $name2);
418
-                            $name2 = str_replace('"', "", $name2);
419
-                            $airport_data2 .= '[ "'.$name2.'",'.$airport_item2['airport_arrival_icao_count'].'],';
420
-                        }
421
-                        $airport_data2 = substr($airport_data2, 0, -1);
422
-                        print $airport_data2;
423
-                print ']);
413
+					$airport_data2 = '';
414
+				  foreach($airport_airport_array2 as $airport_item2)
415
+						{
416
+							$name2 = $airport_item2['airport_arrival_city'].', '.$airport_item2['airport_arrival_country'].' ('.$airport_item2['airport_arrival_icao'].')';
417
+							$name2 = str_replace("'", "", $name2);
418
+							$name2 = str_replace('"', "", $name2);
419
+							$airport_data2 .= '[ "'.$name2.'",'.$airport_item2['airport_arrival_icao_count'].'],';
420
+						}
421
+						$airport_data2 = substr($airport_data2, 0, -1);
422
+						print $airport_data2;
423
+				print ']);
424 424
 
425 425
                 var options = {
426 426
                     legend: {position: "none"},
@@ -434,8 +434,8 @@  discard block
 block discarded – undo
434 434
                 chart.draw(data, options);
435 435
               }
436 436
                 </script>';
437
-                }
438
-              ?>
437
+				}
438
+			  ?>
439 439
               <div class="more">
440 440
                 <a href="<?php print $globalURL; ?>/statistics/airport-arrival" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
441 441
               </div>
@@ -447,24 +447,24 @@  discard block
 block discarded – undo
447 447
             <div class="col-md-6">
448 448
                 <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2>
449 449
                 <?php
450
-                  $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name);
451
-		    if (count($year_array) == 0) print _("No data available");
452
-		    else {
453
-                  print '<div id="chart8" class="chart" width="100%"></div>
450
+				  $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name);
451
+			if (count($year_array) == 0) print _("No data available");
452
+			else {
453
+				  print '<div id="chart8" class="chart" width="100%"></div>
454 454
                     <script> 
455 455
                         google.load("visualization", "1", {packages:["corechart"]});
456 456
                       google.setOnLoadCallback(drawChart8);
457 457
                       function drawChart8() {
458 458
                         var data = google.visualization.arrayToDataTable([
459 459
                             ["'._("Month").'", "'._("# of Flights").'"], ';
460
-                            $year_data = '';
461
-                          foreach($year_array as $year_item)
462
-                                    {
463
-                                        $year_data .= '[ "'.date('F, Y',strtotime($year_item['year_name'].'-'.$year_item['month_name'].'-01')).'",'.$year_item['date_count'].'],';
464
-                                    }
465
-                                    $year_data = substr($year_data, 0, -1);
466
-                                    print $year_data;
467
-                        print ']);
460
+							$year_data = '';
461
+						  foreach($year_array as $year_item)
462
+									{
463
+										$year_data .= '[ "'.date('F, Y',strtotime($year_item['year_name'].'-'.$year_item['month_name'].'-01')).'",'.$year_item['date_count'].'],';
464
+									}
465
+									$year_data = substr($year_data, 0, -1);
466
+									print $year_data;
467
+						print ']);
468 468
 
469 469
                         var options = {
470 470
                             legend: {position: "none"},
@@ -482,8 +482,8 @@  discard block
 block discarded – undo
482 482
                               drawChart8();
483 483
                             });
484 484
                   </script>';
485
-                  }
486
-                  ?>
485
+				  }
486
+				  ?>
487 487
                 <div class="more">
488 488
                     <a href="<?php print $globalURL; ?>/statistics/year" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
489 489
                 </div>
@@ -493,24 +493,24 @@  discard block
 block discarded – undo
493 493
             <div class="col-md-6">
494 494
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
495 495
                 <?php
496
-                  $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name);
497
-		    if (count($month_array) == 0) print _("No data available");
498
-		    else {
499
-                  print '<div id="chart9" class="chart" width="100%"></div>
496
+				  $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name);
497
+			if (count($month_array) == 0) print _("No data available");
498
+			else {
499
+				  print '<div id="chart9" class="chart" width="100%"></div>
500 500
                     <script> 
501 501
                         google.load("visualization", "1", {packages:["corechart"]});
502 502
                       google.setOnLoadCallback(drawChart9);
503 503
                       function drawChart9() {
504 504
                         var data = google.visualization.arrayToDataTable([
505 505
                             ["'._("Day").'", "'._("# of Flights").'"], ';
506
-                            $month_data = '';
507
-                          foreach($month_array as $month_item)
508
-                                    {
509
-                                        $month_data .= '[ "'.date('F j, Y',strtotime($month_item['date_name'])).'",'.$month_item['date_count'].'],';
510
-                                    }
511
-                                    $month_data = substr($month_data, 0, -1);
512
-                                    print $month_data;
513
-                        print ']);
506
+							$month_data = '';
507
+						  foreach($month_array as $month_item)
508
+									{
509
+										$month_data .= '[ "'.date('F j, Y',strtotime($month_item['date_name'])).'",'.$month_item['date_count'].'],';
510
+									}
511
+									$month_data = substr($month_data, 0, -1);
512
+									print $month_data;
513
+						print ']);
514 514
 
515 515
                         var options = {
516 516
                             legend: {position: "none"},
@@ -528,8 +528,8 @@  discard block
 block discarded – undo
528 528
                               drawChart9();
529 529
                             });
530 530
                   </script>';
531
-                  }
532
-                  ?>
531
+				  }
532
+				  ?>
533 533
                 <div class="more">
534 534
                     <a href="<?php print $globalURL; ?>/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
535 535
                 </div>
@@ -539,25 +539,25 @@  discard block
 block discarded – undo
539 539
             <div class="col-md-6">
540 540
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
541 541
                 <?php
542
-                    $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name);
543
-		    if (empty($date_array)) print _("No data available");
544
-		    else {
545
-                  print '<div id="chart5" class="chart" width="100%"></div>
542
+					$date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name);
543
+			if (empty($date_array)) print _("No data available");
544
+			else {
545
+				  print '<div id="chart5" class="chart" width="100%"></div>
546 546
                     <script> 
547 547
                         google.load("visualization", "1", {packages:["corechart"]});
548 548
                       google.setOnLoadCallback(drawChart5);
549 549
                       function drawChart5() {
550 550
                         var data = google.visualization.arrayToDataTable([
551 551
                             ["'._("Date").'", "'._("# of Flights").'"], ';
552
-                            $date_data = '';
552
+							$date_data = '';
553 553
                         
554
-                          foreach($date_array as $date_item)
555
-                                    {
556
-                                        $date_data .= '[ "'.date("F j, Y", strtotime($date_item['date_name'])).'",'.$date_item['date_count'].'],';
557
-                                    }
558
-                                    $date_data = substr($date_data, 0, -1);
559
-                                    print $date_data;
560
-                        print ']);
554
+						  foreach($date_array as $date_item)
555
+									{
556
+										$date_data .= '[ "'.date("F j, Y", strtotime($date_item['date_name'])).'",'.$date_item['date_count'].'],';
557
+									}
558
+									$date_data = substr($date_data, 0, -1);
559
+									print $date_data;
560
+						print ']);
561 561
 
562 562
                         var options = {
563 563
                             legend: {position: "none"},
@@ -575,8 +575,8 @@  discard block
 block discarded – undo
575 575
                               drawChart5();
576 576
                             });
577 577
                   </script>';
578
-                  }
579
-                  ?>
578
+				  }
579
+				  ?>
580 580
                 <div class="more">
581 581
                     <a href="<?php print $globalURL; ?>/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
582 582
                 </div>
@@ -586,25 +586,25 @@  discard block
 block discarded – undo
586 586
             <div class="col-md-6">
587 587
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
588 588
                 <?php
589
-                  $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name);
590
-		    if (empty($hour_array)) print _("No data available");
591
-		    else {
589
+				  $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name);
590
+			if (empty($hour_array)) print _("No data available");
591
+			else {
592 592
 
593
-                  print '<div id="chart6" class="chart" width="100%"></div>
593
+				  print '<div id="chart6" class="chart" width="100%"></div>
594 594
                     <script> 
595 595
                         google.load("visualization", "1", {packages:["corechart"]});
596 596
                       google.setOnLoadCallback(drawChart6);
597 597
                       function drawChart6() {
598 598
                         var data = google.visualization.arrayToDataTable([
599 599
                             ["'._("Hour").'", "'._("# of Flights").'"], ';
600
-                            $hour_data = '';
601
-                          foreach($hour_array as $hour_item)
602
-                                    {
603
-                                        $hour_data .= '[ "'.$hour_item['hour_name'].':00",'.$hour_item['hour_count'].'],';
604
-                                    }
605
-                                    $hour_data = substr($hour_data, 0, -1);
606
-                                    print $hour_data;
607
-                        print ']);
600
+							$hour_data = '';
601
+						  foreach($hour_array as $hour_item)
602
+									{
603
+										$hour_data .= '[ "'.$hour_item['hour_name'].':00",'.$hour_item['hour_count'].'],';
604
+									}
605
+									$hour_data = substr($hour_data, 0, -1);
606
+									print $hour_data;
607
+						print ']);
608 608
 
609 609
                         var options = {
610 610
                             legend: {position: "none"},
@@ -622,8 +622,8 @@  discard block
 block discarded – undo
622 622
                               drawChart6();
623 623
                             });
624 624
                   </script>';
625
-                  }
626
-                ?>
625
+				  }
626
+				?>
627 627
                 <div class="more">
628 628
                     <a href="<?php print $globalURL; ?>/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
629 629
                 </div>
@@ -631,21 +631,21 @@  discard block
 block discarded – undo
631 631
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
632 632
         </div>
633 633
 <?php
634
-    if (($airline_icao == '' || $airline_icao == 'all') && $filter_name == '') {
634
+	if (($airline_icao == '' || $airline_icao == 'all') && $filter_name == '') {
635 635
 ?>
636 636
         <div class="row column">
637 637
         	<?php
638
-        	    $polar = $Stats->getStatsSource(date('Y-m-d'),'polar');
639
-        	    if (!empty($polar)) {
640
-            		print '<h2>'._("Coverage pattern").'</h2>';
641
-        		foreach ($polar as $eachpolar) {
642
-        		    unset($polar_data);
643
-	        	    $Spotter = new Spotter();
644
-        		    $data = json_decode($eachpolar['source_data']);
645
-        		    foreach($data as $value => $key) {
646
-        			$direction = $Spotter->parseDirection(($value*22.5));
647
-        			$distance = $key;
648
-        			$unit = 'km';
638
+				$polar = $Stats->getStatsSource(date('Y-m-d'),'polar');
639
+				if (!empty($polar)) {
640
+					print '<h2>'._("Coverage pattern").'</h2>';
641
+				foreach ($polar as $eachpolar) {
642
+					unset($polar_data);
643
+					$Spotter = new Spotter();
644
+					$data = json_decode($eachpolar['source_data']);
645
+					foreach($data as $value => $key) {
646
+					$direction = $Spotter->parseDirection(($value*22.5));
647
+					$distance = $key;
648
+					$unit = 'km';
649 649
 				if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
650 650
 					$distance = round($distance*0.539957);
651 651
 					$unit = 'nm';
@@ -656,10 +656,10 @@  discard block
 block discarded – undo
656 656
 					$distance = $distance;
657 657
 					$unit = 'km';
658 658
 				}
659
-        			if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
660
-        	    		else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
661
-        		    }
662
-        	?>
659
+					if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
660
+						else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
661
+					}
662
+			?>
663 663
             <div class="col-md-6">
664 664
                 <h4><?php print $eachpolar['source_name']; ?></h4>
665 665
         	<div id="polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div>
@@ -691,22 +691,22 @@  discard block
 block discarded – undo
691 691
 		</script>
692 692
             </div>
693 693
             <?php
694
-        	    }
695
-        	}
696
-            ?>
694
+				}
695
+			}
696
+			?>
697 697
         </div>
698 698
         <div class="row column">
699 699
             <div class="col-md-6">
700 700
         	<?php
701
-        	    $msg = $Stats->getStatsSource(date('Y-m-d'),'msg');
702
-        	    if (!empty($msg)) {
703
-            		print '<h2>'._("Messages received").'</h2>';
704
-        		foreach ($msg as $eachmsg) {
705
-        		    //$eachmsg = $msg[0];
706
-        		    $data = $eachmsg['source_data'];
707
-        		    if ($data > 500) $max = (round(($data+100)/100))*100;
708
-        		    else $max = 500;
709
-        	?>
701
+				$msg = $Stats->getStatsSource(date('Y-m-d'),'msg');
702
+				if (!empty($msg)) {
703
+					print '<h2>'._("Messages received").'</h2>';
704
+				foreach ($msg as $eachmsg) {
705
+					//$eachmsg = $msg[0];
706
+					$data = $eachmsg['source_data'];
707
+					if ($data > 500) $max = (round(($data+100)/100))*100;
708
+					else $max = 500;
709
+			?>
710 710
         	<div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
711 711
         	<script>
712 712
 		      var g = new JustGage({
@@ -722,9 +722,9 @@  discard block
 block discarded – undo
722 722
 			  });
723 723
 		</script>
724 724
             <?php
725
-        	   }
726
-        	}
727
-            ?>
725
+			   }
726
+			}
727
+			?>
728 728
             </div>
729 729
         </div>
730 730
         <div class="row column">
@@ -751,19 +751,19 @@  discard block
 block discarded – undo
751 751
 				$hist_data .= '[ "'.$distance.'",'.$nb.'],';
752 752
 			}
753 753
 			$hist_data = substr($hist_data, 0, -1);
754
-            ?>
754
+			?>
755 755
             <div class="col-md-6">
756 756
                 <h2><?php echo sprintf(_("Flights Distance for %s"),$source); ?></h2>
757 757
                 <?php
758
-                  print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div>
758
+				  print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div>
759 759
                     <script> 
760 760
                         google.load("visualization", "1", {packages:["corechart"]});
761 761
                       google.setOnLoadCallback(drawCharthist_'.str_replace(' ','_',strtolower($source)).');
762 762
                       function drawCharthist_'.str_replace(' ','_',strtolower($source)).'() {
763 763
                         var data = google.visualization.arrayToDataTable([
764 764
                             ["'._("Distance").'", "'._("# of Flights").'"], ';
765
-                            print $hist_data;
766
-                        print ']);
765
+							print $hist_data;
766
+						print ']);
767 767
 
768 768
                         var options = {
769 769
                             legend: {position: "none"},
@@ -781,15 +781,15 @@  discard block
 block discarded – undo
781 781
                               drawCharthist_'.str_replace(' ','_',strtolower($source)).'();
782 782
                             });
783 783
                   </script>';
784
-        	?>
784
+			?>
785 785
     	    </div>
786 786
 	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
787 787
         	<?php
788
-                  }
789
-                ?>
788
+				  }
789
+				?>
790 790
         </div>
791 791
 <?php
792
-    }
792
+	}
793 793
 ?>
794 794
     </div>
795 795
 </div>  
Please login to merge, or discard this patch.
require/class.ATC.php 1 patch
Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -9,71 +9,71 @@
 block discarded – undo
9 9
 		$this->db = $Connection->db;
10 10
 	}
11 11
 
12
-       public function getAll() {
13
-                $query = "SELECT * FROM atc";
14
-                $query_values = array();
15
-                 try {
16
-                        $sth = $this->db->prepare($query);
17
-                        $sth->execute($query_values);
18
-                } catch(PDOException $e) {
19
-                        return "error : ".$e->getMessage();
20
-                }
21
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
22
-                return $all;
23
-        }
12
+	   public function getAll() {
13
+				$query = "SELECT * FROM atc";
14
+				$query_values = array();
15
+				 try {
16
+						$sth = $this->db->prepare($query);
17
+						$sth->execute($query_values);
18
+				} catch(PDOException $e) {
19
+						return "error : ".$e->getMessage();
20
+				}
21
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
22
+				return $all;
23
+		}
24 24
 
25
-       public function add($ident,$frequency,$latitude,$longitude,$range,$info,$date,$type = '',$ivao_id = '',$ivao_name = '',$format_source = '',$source_name = '') {
26
-    		$info = preg_replace('/[^(\x20-\x7F)]*/','',$info);
27
-    		$info = str_replace('^','<br />',$info);
28
-    		$info = str_replace('&amp;sect;','',$info);
29
-    		$info = str_replace('"','',$info);
30
-    		if ($type == '') $type = NULL;
31
-                $query = "INSERT INTO atc (ident,frequency,latitude,longitude,atc_range,info,atc_lastseen,type,ivao_id,ivao_name,format_source,source_name) VALUES (:ident,:frequency,:latitude,:longitude,:range,:info,:date,:type,:ivao_id,:ivao_name,:format_source,:source_name)";
32
-                $query_values = array(':ident' => $ident,':frequency' => $frequency,':latitude' => $latitude,':longitude' => $longitude,':range' => $range,':info' => $info,':date' => $date,':ivao_id' => $ivao_id,':ivao_name' => $ivao_name, ':type' => $type,':format_source' => $format_source,':source_name' => $source_name);
33
-                 try {
34
-                        $sth = $this->db->prepare($query);
35
-                        $sth->execute($query_values);
36
-                } catch(PDOException $e) {
37
-                        return "error : ".$e->getMessage();
38
-                }
39
-        }
25
+	   public function add($ident,$frequency,$latitude,$longitude,$range,$info,$date,$type = '',$ivao_id = '',$ivao_name = '',$format_source = '',$source_name = '') {
26
+			$info = preg_replace('/[^(\x20-\x7F)]*/','',$info);
27
+			$info = str_replace('^','<br />',$info);
28
+			$info = str_replace('&amp;sect;','',$info);
29
+			$info = str_replace('"','',$info);
30
+			if ($type == '') $type = NULL;
31
+				$query = "INSERT INTO atc (ident,frequency,latitude,longitude,atc_range,info,atc_lastseen,type,ivao_id,ivao_name,format_source,source_name) VALUES (:ident,:frequency,:latitude,:longitude,:range,:info,:date,:type,:ivao_id,:ivao_name,:format_source,:source_name)";
32
+				$query_values = array(':ident' => $ident,':frequency' => $frequency,':latitude' => $latitude,':longitude' => $longitude,':range' => $range,':info' => $info,':date' => $date,':ivao_id' => $ivao_id,':ivao_name' => $ivao_name, ':type' => $type,':format_source' => $format_source,':source_name' => $source_name);
33
+				 try {
34
+						$sth = $this->db->prepare($query);
35
+						$sth->execute($query_values);
36
+				} catch(PDOException $e) {
37
+						return "error : ".$e->getMessage();
38
+				}
39
+		}
40 40
 
41
-       public function deleteById($id) {
42
-                $query = "DELETE FROM atc WHERE atc_id = :id";
43
-                $query_values = array(':id' => $id);
44
-                 try {
45
-                        $sth = $this->db->prepare($query);
46
-                        $sth->execute($query_values);
47
-                } catch(PDOException $e) {
48
-                        return "error : ".$e->getMessage();
49
-                }
50
-        }
41
+	   public function deleteById($id) {
42
+				$query = "DELETE FROM atc WHERE atc_id = :id";
43
+				$query_values = array(':id' => $id);
44
+				 try {
45
+						$sth = $this->db->prepare($query);
46
+						$sth->execute($query_values);
47
+				} catch(PDOException $e) {
48
+						return "error : ".$e->getMessage();
49
+				}
50
+		}
51 51
 
52
-       public function deleteAll() {
53
-                $query = "DELETE FROM atc";
54
-                $query_values = array();
55
-                 try {
56
-                        $sth = $this->db->prepare($query);
57
-                        $sth->execute($query_values);
58
-                } catch(PDOException $e) {
59
-                        return "error : ".$e->getMessage();
60
-                }
61
-        }
52
+	   public function deleteAll() {
53
+				$query = "DELETE FROM atc";
54
+				$query_values = array();
55
+				 try {
56
+						$sth = $this->db->prepare($query);
57
+						$sth->execute($query_values);
58
+				} catch(PDOException $e) {
59
+						return "error : ".$e->getMessage();
60
+				}
61
+		}
62 62
 
63 63
 	public function deleteOldATC() {
64
-                global $globalDBdriver;
65
-                if ($globalDBdriver == 'mysql') {
66
-                        $query  = "DELETE FROM atc WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= atc.atc_lastseen";
67
-                } else {
68
-                        $query  = "DELETE FROM atc WHERE NOW() AT TIME ZONE 'UTC' - '1 HOUR'->INTERVAL >= atc.atc_lastseen";
69
-                }
70
-                try {
71
-                        $sth = $this->db->prepare($query);
72
-                        $sth->execute();
73
-                } catch(PDOException $e) {
74
-                        return "error";
75
-                }
76
-                return "success";
77
-        }
64
+				global $globalDBdriver;
65
+				if ($globalDBdriver == 'mysql') {
66
+						$query  = "DELETE FROM atc WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= atc.atc_lastseen";
67
+				} else {
68
+						$query  = "DELETE FROM atc WHERE NOW() AT TIME ZONE 'UTC' - '1 HOUR'->INTERVAL >= atc.atc_lastseen";
69
+				}
70
+				try {
71
+						$sth = $this->db->prepare($query);
72
+						$sth->execute();
73
+				} catch(PDOException $e) {
74
+						return "error";
75
+				}
76
+				return "success";
77
+		}
78 78
 }
79 79
 ?>
80 80
\ No newline at end of file
Please login to merge, or discard this patch.
install/index.php 1 patch
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -305,17 +305,17 @@  discard block
 block discarded – undo
305 305
 				</tr>
306 306
 				<!--
307 307
 		<?php
308
-		    require_once(dirname(__FILE__).'/../require/class.Connection.php');
309
-		    $Connection = new Connection();
308
+			require_once(dirname(__FILE__).'/../require/class.Connection.php');
309
+			$Connection = new Connection();
310 310
 		?>
311 311
 				-->
312 312
 		<?php
313
-		    if ($Connection->db != NULL) {
313
+			if ($Connection->db != NULL) {
314 314
 			if ($Connection->tableExists('source_location')) {
315
-			    require_once(dirname(__FILE__).'/../require/class.Source.php');
316
-			    $Source = new Source();
317
-			    $alllocations = $Source->getAllLocationInfo();
318
-			    foreach ($alllocations as $location) {
315
+				require_once(dirname(__FILE__).'/../require/class.Source.php');
316
+				$Source = new Source();
317
+				$alllocations = $Source->getAllLocationInfo();
318
+				foreach ($alllocations as $location) {
319 319
 		?>
320 320
 				<tr>
321 321
 	    				<input type="hidden" name="source_id[]" value="<?php print $location['id']; ?>" />
@@ -329,9 +329,9 @@  discard block
 block discarded – undo
329 329
 				</tr>
330 330
 		
331 331
 		<?php
332
-			    }
332
+				}
333
+			}
333 334
 			}
334
-		    }
335 335
 		?>
336 336
 
337 337
 				<tr>
@@ -424,12 +424,12 @@  discard block
 block discarded – undo
424 424
 ?>
425 425
 							<tr>
426 426
 								<?php
427
-								    if (filter_var($source['host'],FILTER_VALIDATE_URL)) {
427
+									if (filter_var($source['host'],FILTER_VALIDATE_URL)) {
428 428
 								?>
429 429
 								<td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td>
430 430
 								<td><input type="number" name="port[]" id="port" value="<?php print $source['port']; ?>" /></td>
431 431
 								<?php
432
-								    } else {
432
+									} else {
433 433
 									$hostport = explode(':',$source['host']);
434 434
 									if (isset($hostport[1])) {
435 435
 										$host = $hostport[0];
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 								<td><input type="text" name="host[]" id="host" value="<?php print $host; ?>" /></td>
443 443
 								<td><input type="number" name="port[]" id="port" value="<?php print $port; ?>" /></td>
444 444
 								<?php
445
-								    }
445
+									}
446 446
 								?>
447 447
 								<td>
448 448
 									<select name="format[]" id="format">
@@ -758,7 +758,7 @@  discard block
 block discarded – undo
758 758
 			<br />
759 759
 			<p>
760 760
 			<?php 
761
-			    if (extension_loaded('gd') && function_exists('gd_info')) {
761
+				if (extension_loaded('gd') && function_exists('gd_info')) {
762 762
 			?>
763 763
 				<label for="aircrafticoncolor">Color of aircraft icon on map</label>
764 764
 				<input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) echo $globalAircraftIconColor; else echo '1a3151'; ?>" />
@@ -768,11 +768,11 @@  discard block
 block discarded – undo
768 768
 				<b>The directory cache is not writable, aircraft icon will not be cached</b>
769 769
 			<?php
770 770
 				}
771
-			    } else {
771
+				} else {
772 772
 			?>
773 773
 				<b>PHP GD is not installed, you can t change color of aircraft icon on map</b>
774 774
 			<?php
775
-			    }
775
+				}
776 776
 			?>
777 777
 			</p>
778 778
 			<br />
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
 	</p>
792 792
 <?php
793 793
 	require('../footer.php');
794
-        exit;
794
+		exit;
795 795
 }
796 796
 	
797 797
 $settings = array();
@@ -881,8 +881,8 @@  discard block
 block discarded – undo
881 881
 	
882 882
 	$sources = array();
883 883
 	foreach ($source_name as $keys => $name) {
884
-	    if (isset($source_id[$keys])) $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]);
885
-	    else $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]);
884
+		if (isset($source_id[$keys])) $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]);
885
+		else $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]);
886 886
 	}
887 887
 	if (count($sources) > 0) $_SESSION['sources'] = $sources;
888 888
 
@@ -1176,14 +1176,14 @@  discard block
 block discarded – undo
1176 1176
 
1177 1177
 	// Set some defaults values...
1178 1178
 	if (!isset($globalAircraftImageSources)) {
1179
-	    $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters');
1180
-	    $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources));
1179
+		$globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters');
1180
+		$settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources));
1181 1181
 	}
1182 1182
 
1183 1183
 	if (!isset($globalSchedulesSources)) {
1184
-	    $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware');
1185
-    	    $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources));
1186
-    	}
1184
+		$globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware');
1185
+			$settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources));
1186
+		}
1187 1187
 
1188 1188
 	$settings = array_merge($settings,array('globalInstalled' => 'TRUE'));
1189 1189
 
@@ -1235,21 +1235,21 @@  discard block
 block discarded – undo
1235 1235
 	$popi = false;
1236 1236
 	$popw = false;
1237 1237
 	foreach ($_SESSION['done'] as $done) {
1238
-	    print '<li>'.$done.'....<strong>SUCCESS</strong></li>';
1239
-	    if ($done == 'Create database') $pop = true;
1240
-	    if ($_SESSION['install'] == 'database_create') $pop = true;
1241
-	    if ($_SESSION['install'] == 'database_import') $popi = true;
1242
-	    if ($_SESSION['install'] == 'waypoints') $popw = true;
1238
+		print '<li>'.$done.'....<strong>SUCCESS</strong></li>';
1239
+		if ($done == 'Create database') $pop = true;
1240
+		if ($_SESSION['install'] == 'database_create') $pop = true;
1241
+		if ($_SESSION['install'] == 'database_import') $popi = true;
1242
+		if ($_SESSION['install'] == 'waypoints') $popw = true;
1243 1243
 	}
1244 1244
 	if ($pop) {
1245
-	    sleep(5);
1246
-	    print '<li>Create database....<img src="../images/loading.gif" /></li>';
1245
+		sleep(5);
1246
+		print '<li>Create database....<img src="../images/loading.gif" /></li>';
1247 1247
 	} else if ($popi) {
1248
-	    sleep(5);
1249
-	    print '<li>Create and import tables....<img src="../images/loading.gif" /></li>';
1248
+		sleep(5);
1249
+		print '<li>Create and import tables....<img src="../images/loading.gif" /></li>';
1250 1250
 	} else if ($popw) {
1251
-	    sleep(5);
1252
-	    print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>';
1251
+		sleep(5);
1252
+		print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>';
1253 1253
 	} else print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>';
1254 1254
 	print '</div></ul>';
1255 1255
 	print '<div id="error"></div>';
@@ -1312,7 +1312,7 @@  discard block
 block discarded – undo
1312 1312
 	unset($_COOKIE['install']);
1313 1313
 	print '<div class="info column"><ul>';
1314 1314
 	foreach ($_SESSION['done'] as $done) {
1315
-	    print '<li>'.$done.'....<strong>SUCCESS</strong></li>';
1315
+		print '<li>'.$done.'....<strong>SUCCESS</strong></li>';
1316 1316
 	}
1317 1317
 	print '<li>Reloading page to check all is now ok....<strong>SUCCESS</strong></li>';
1318 1318
 	print '</ul></div>';
Please login to merge, or discard this patch.
install/class.update_schema.php 1 patch
Indentation   +562 added lines, -562 removed lines patch added patch discarded remove patch
@@ -8,18 +8,18 @@  discard block
 block discarded – undo
8 8
 class update_schema {
9 9
 
10 10
 	public static function update_schedule() {
11
-	    $Connection = new Connection();
12
-	    $Schedule = new Schedule();
13
-	    $query = "SELECT * FROM schedule";
14
-            try {
15
-            	$sth = $Connection->db->prepare($query);
11
+		$Connection = new Connection();
12
+		$Schedule = new Schedule();
13
+		$query = "SELECT * FROM schedule";
14
+			try {
15
+				$sth = $Connection->db->prepare($query);
16 16
 		$sth->execute();
17
-    	    } catch(PDOException $e) {
17
+			} catch(PDOException $e) {
18 18
 		return "error : ".$e->getMessage()."\n";
19
-    	    }
20
-    	    while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
21
-    		$Schedule->addSchedule($row['ident'],$row['departure_airport_icao'],$row['departure_airport_time'],$row['arrival_airport_icao'],$row['arrival_airport_time']);
22
-    	    }
19
+			}
20
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
21
+			$Schedule->addSchedule($row['ident'],$row['departure_airport_icao'],$row['departure_airport_time'],$row['arrival_airport_icao'],$row['arrival_airport_time']);
22
+			}
23 23
 	
24 24
 	}
25 25
 /*
@@ -43,198 +43,198 @@  discard block
 block discarded – undo
43 43
     	}
44 44
 */	
45 45
 	private static function update_from_1() {
46
-    		$Connection = new Connection();
47
-    		// Add new column to routes table
48
-    		//$query = "ALTER TABLE `routes` ADD `FromAirport_Time` VARCHAR(10),`ToAirport_Time` VARCHAR(10),`Source` VARCHAR(255),`date_added` DATETIME DEFAULT CURRENT TIMESTAMP,`date_modified` DATETIME,`date_lastseen` DATETIME";
46
+			$Connection = new Connection();
47
+			// Add new column to routes table
48
+			//$query = "ALTER TABLE `routes` ADD `FromAirport_Time` VARCHAR(10),`ToAirport_Time` VARCHAR(10),`Source` VARCHAR(255),`date_added` DATETIME DEFAULT CURRENT TIMESTAMP,`date_modified` DATETIME,`date_lastseen` DATETIME";
49 49
 		$query = "ALTER TABLE `routes` ADD `FromAirport_Time` VARCHAR(10) NULL , ADD `ToAirport_Time` VARCHAR(10) NULL , ADD `Source` VARCHAR(255) NULL, ADD `date_added` timestamp DEFAULT CURRENT_TIMESTAMP, ADD `date_modified` timestamp NULL, ADD `date_lastseen` timestamp NULL";
50
-        	try {
51
-            	    $sth = $Connection->db->prepare($query);
52
-		    $sth->execute();
53
-    		} catch(PDOException $e) {
54
-		    return "error (add new columns to routes table) : ".$e->getMessage()."\n";
55
-    		}
56
-    		// Copy schedules data to routes table
57
-    		self::update_schedule();
58
-    		// Delete schedule table
50
+			try {
51
+					$sth = $Connection->db->prepare($query);
52
+			$sth->execute();
53
+			} catch(PDOException $e) {
54
+			return "error (add new columns to routes table) : ".$e->getMessage()."\n";
55
+			}
56
+			// Copy schedules data to routes table
57
+			self::update_schedule();
58
+			// Delete schedule table
59 59
 		$query = "DROP TABLE `schedule`";
60
-        	try {
61
-            	    $sth = $Connection->db->prepare($query);
62
-		    $sth->execute();
63
-    		} catch(PDOException $e) {
64
-		    return "error (delete schedule table) : ".$e->getMessage()."\n";
65
-    		}
66
-    		// Add source column
67
-    		$query = "ALTER TABLE `aircraft_modes` ADD `Source` VARCHAR(255) NULL";
68
-    		try {
69
-            	    $sth = $Connection->db->prepare($query);
70
-		    $sth->execute();
71
-    		} catch(PDOException $e) {
72
-		    return "error (add source column to aircraft_modes) : ".$e->getMessage()."\n";
73
-    		}
60
+			try {
61
+					$sth = $Connection->db->prepare($query);
62
+			$sth->execute();
63
+			} catch(PDOException $e) {
64
+			return "error (delete schedule table) : ".$e->getMessage()."\n";
65
+			}
66
+			// Add source column
67
+			$query = "ALTER TABLE `aircraft_modes` ADD `Source` VARCHAR(255) NULL";
68
+			try {
69
+					$sth = $Connection->db->prepare($query);
70
+			$sth->execute();
71
+			} catch(PDOException $e) {
72
+			return "error (add source column to aircraft_modes) : ".$e->getMessage()."\n";
73
+			}
74 74
 		// Delete unused column
75 75
 		$query = "ALTER TABLE `aircraft_modes`  DROP `SerialNo`,  DROP `OperatorFlagCode`,  DROP `Manufacturer`,  DROP `Type`,  DROP `FirstRegDate`,  DROP `CurrentRegDate`,  DROP `Country`,  DROP `PreviousID`,  DROP `DeRegDate`,  DROP `Status`,  DROP `PopularName`,  DROP `GenericName`,  DROP `AircraftClass`,  DROP `Engines`,  DROP `OwnershipStatus`,  DROP `RegisteredOwners`,  DROP `MTOW`,  DROP `TotalHours`,  DROP `YearBuilt`,  DROP `CofACategory`,  DROP `CofAExpiry`,  DROP `UserNotes`,  DROP `Interested`,  DROP `UserTag`,  DROP `InfoUrl`,  DROP `PictureUrl1`,  DROP `PictureUrl2`,  DROP `PictureUrl3`,  DROP `UserBool1`,  DROP `UserBool2`,  DROP `UserBool3`,  DROP `UserBool4`,  DROP `UserBool5`,  DROP `UserString1`,  DROP `UserString2`,  DROP `UserString3`,  DROP `UserString4`,  DROP `UserString5`,  DROP `UserInt1`,  DROP `UserInt2`,  DROP `UserInt3`,  DROP `UserInt4`,  DROP `UserInt5`";
76
-    		try {
77
-            	    $sth = $Connection->db->prepare($query);
78
-		    $sth->execute();
79
-    		} catch(PDOException $e) {
80
-		    return "error (Delete unused column of aircraft_modes) : ".$e->getMessage()."\n";
81
-    		}
76
+			try {
77
+					$sth = $Connection->db->prepare($query);
78
+			$sth->execute();
79
+			} catch(PDOException $e) {
80
+			return "error (Delete unused column of aircraft_modes) : ".$e->getMessage()."\n";
81
+			}
82 82
 		// Add ModeS column
83 83
 		$query = "ALTER TABLE `spotter_output`  ADD `ModeS` VARCHAR(255) NULL";
84
-    		try {
85
-            	    $sth = $Connection->db->prepare($query);
86
-		    $sth->execute();
87
-    		} catch(PDOException $e) {
88
-		    return "error (Add ModeS column in spotter_output) : ".$e->getMessage()."\n";
89
-    		}
84
+			try {
85
+					$sth = $Connection->db->prepare($query);
86
+			$sth->execute();
87
+			} catch(PDOException $e) {
88
+			return "error (Add ModeS column in spotter_output) : ".$e->getMessage()."\n";
89
+			}
90 90
 		$query = "ALTER TABLE `spotter_live`  ADD `ModeS` VARCHAR(255)";
91
-    		try {
92
-            	    $sth = $Connection->db->prepare($query);
93
-		    $sth->execute();
94
-    		} catch(PDOException $e) {
95
-		    return "error (Add ModeS column in spotter_live) : ".$e->getMessage()."\n";
96
-    		}
97
-    		// Add auto_increment for aircraft_modes
98
-    		$query = "ALTER TABLE `aircraft_modes` CHANGE `AircraftID` `AircraftID` INT(11) NOT NULL AUTO_INCREMENT";
99
-    		try {
100
-            	    $sth = $Connection->db->prepare($query);
101
-		    $sth->execute();
102
-    		} catch(PDOException $e) {
103
-		    return "error (Add Auto increment in aircraft_modes) : ".$e->getMessage()."\n";
104
-    		}
105
-    		$error = '';
91
+			try {
92
+					$sth = $Connection->db->prepare($query);
93
+			$sth->execute();
94
+			} catch(PDOException $e) {
95
+			return "error (Add ModeS column in spotter_live) : ".$e->getMessage()."\n";
96
+			}
97
+			// Add auto_increment for aircraft_modes
98
+			$query = "ALTER TABLE `aircraft_modes` CHANGE `AircraftID` `AircraftID` INT(11) NOT NULL AUTO_INCREMENT";
99
+			try {
100
+					$sth = $Connection->db->prepare($query);
101
+			$sth->execute();
102
+			} catch(PDOException $e) {
103
+			return "error (Add Auto increment in aircraft_modes) : ".$e->getMessage()."\n";
104
+			}
105
+			$error = '';
106 106
 		$error .= create_db::import_file('../db/acars_live.sql');
107 107
 		$error .= create_db::import_file('../db/config.sql');
108 108
 		// Update schema_version to 2
109 109
 		$query = "UPDATE `config` SET `value` = '2' WHERE `name` = 'schema_version'";
110
-        	try {
111
-            	    $sth = $Connection->db->prepare($query);
112
-		    $sth->execute();
113
-    		} catch(PDOException $e) {
114
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
115
-    		}
110
+			try {
111
+					$sth = $Connection->db->prepare($query);
112
+			$sth->execute();
113
+			} catch(PDOException $e) {
114
+			return "error (update schema_version) : ".$e->getMessage()."\n";
115
+			}
116 116
 		return $error;
117
-        }
117
+		}
118 118
 
119 119
 	private static function update_from_2() {
120
-    		$Connection = new Connection();
121
-    		// Add new column decode to acars_live table
120
+			$Connection = new Connection();
121
+			// Add new column decode to acars_live table
122 122
 		$query = "ALTER TABLE `acars_live` ADD `decode` TEXT";
123
-        	try {
124
-            	    $sth = $Connection->db->prepare($query);
125
-		    $sth->execute();
126
-    		} catch(PDOException $e) {
127
-		    return "error (add new columns to routes table) : ".$e->getMessage()."\n";
128
-    		}
129
-    		$error = '';
130
-    		// Create table acars_archive
123
+			try {
124
+					$sth = $Connection->db->prepare($query);
125
+			$sth->execute();
126
+			} catch(PDOException $e) {
127
+			return "error (add new columns to routes table) : ".$e->getMessage()."\n";
128
+			}
129
+			$error = '';
130
+			// Create table acars_archive
131 131
 		$error .= create_db::import_file('../db/acars_archive.sql');
132 132
 		// Update schema_version to 3
133 133
 		$query = "UPDATE `config` SET `value` = '3' WHERE `name` = 'schema_version'";
134
-        	try {
135
-            	    $sth = $Connection->db->prepare($query);
136
-		    $sth->execute();
137
-    		} catch(PDOException $e) {
138
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
139
-    		}
134
+			try {
135
+					$sth = $Connection->db->prepare($query);
136
+			$sth->execute();
137
+			} catch(PDOException $e) {
138
+			return "error (update schema_version) : ".$e->getMessage()."\n";
139
+			}
140 140
 		return $error;
141 141
 	}
142 142
 
143 143
 	private static function update_from_3() {
144
-    		$Connection = new Connection();
145
-    		// Add default CURRENT_TIMESTAMP to aircraft_modes column FirstCreated
144
+			$Connection = new Connection();
145
+			// Add default CURRENT_TIMESTAMP to aircraft_modes column FirstCreated
146 146
 		$query = "ALTER TABLE `aircraft_modes` CHANGE `FirstCreated` `FirstCreated` timestamp DEFAULT CURRENT_TIMESTAMP";
147
-        	try {
148
-            	    $sth = $Connection->db->prepare($query);
149
-		    $sth->execute();
150
-    		} catch(PDOException $e) {
151
-		    return "error (add new columns to aircraft_modes) : ".$e->getMessage()."\n";
152
-    		}
153
-    		// Add image_source_website column to spotter_image
147
+			try {
148
+					$sth = $Connection->db->prepare($query);
149
+			$sth->execute();
150
+			} catch(PDOException $e) {
151
+			return "error (add new columns to aircraft_modes) : ".$e->getMessage()."\n";
152
+			}
153
+			// Add image_source_website column to spotter_image
154 154
 		$query = "ALTER TABLE `spotter_image` ADD `image_source_website` VARCHAR(999) NULL";
155
-        	try {
156
-            	    $sth = $Connection->db->prepare($query);
157
-		    $sth->execute();
158
-    		} catch(PDOException $e) {
159
-		    return "error (add new columns to spotter_image) : ".$e->getMessage()."\n";
160
-    		}
161
-    		$error = '';
155
+			try {
156
+					$sth = $Connection->db->prepare($query);
157
+			$sth->execute();
158
+			} catch(PDOException $e) {
159
+			return "error (add new columns to spotter_image) : ".$e->getMessage()."\n";
160
+			}
161
+			$error = '';
162 162
 		// Update schema_version to 4
163 163
 		$query = "UPDATE `config` SET `value` = '4' WHERE `name` = 'schema_version'";
164
-        	try {
165
-            	    $sth = $Connection->db->prepare($query);
166
-		    $sth->execute();
167
-    		} catch(PDOException $e) {
168
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
169
-    		}
164
+			try {
165
+					$sth = $Connection->db->prepare($query);
166
+			$sth->execute();
167
+			} catch(PDOException $e) {
168
+			return "error (update schema_version) : ".$e->getMessage()."\n";
169
+			}
170 170
 		return $error;
171 171
 	}
172 172
 	
173 173
 	private static function update_from_4() {
174
-    		$Connection = new Connection();
174
+			$Connection = new Connection();
175 175
 	
176
-    		$error = '';
177
-    		// Create table acars_label
176
+			$error = '';
177
+			// Create table acars_label
178 178
 		$error .= create_db::import_file('../db/acars_label.sql');
179 179
 		if ($error == '') {
180
-		    // Update schema_version to 5
181
-		    $query = "UPDATE `config` SET `value` = '5' WHERE `name` = 'schema_version'";
182
-        	    try {
183
-            		$sth = $Connection->db->prepare($query);
180
+			// Update schema_version to 5
181
+			$query = "UPDATE `config` SET `value` = '5' WHERE `name` = 'schema_version'";
182
+				try {
183
+					$sth = $Connection->db->prepare($query);
184 184
 			$sth->execute();
185
-    		    } catch(PDOException $e) {
185
+				} catch(PDOException $e) {
186 186
 			return "error (update schema_version) : ".$e->getMessage()."\n";
187
-    		    }
188
-    		}
187
+				}
188
+			}
189 189
 		return $error;
190 190
 	}
191 191
 
192 192
 	private static function update_from_5() {
193
-    		$Connection = new Connection();
194
-    		// Add columns to translation
193
+			$Connection = new Connection();
194
+			// Add columns to translation
195 195
 		$query = "ALTER TABLE `translation` ADD `Source` VARCHAR(255) NULL, ADD `date_added` timestamp DEFAULT CURRENT_TIMESTAMP , ADD `date_modified` timestamp DEFAULT CURRENT_TIMESTAMP ;";
196
-        	try {
197
-            	    $sth = $Connection->db->prepare($query);
198
-		    $sth->execute();
199
-    		} catch(PDOException $e) {
200
-		    return "error (add new columns to translation) : ".$e->getMessage()."\n";
201
-    		}
202
-    		// Add aircraft_shadow column to aircraft
203
-    		$query = "ALTER TABLE `aircraft` ADD `aircraft_shadow` VARCHAR(255) NULL";
204
-        	try {
205
-            	    $sth = $Connection->db->prepare($query);
206
-		    $sth->execute();
207
-    		} catch(PDOException $e) {
208
-		    return "error (add new column to aircraft) : ".$e->getMessage()."\n";
209
-    		}
210
-    		// Add aircraft_shadow column to spotter_live
211
-    		$query = "ALTER TABLE `spotter_live` ADD `aircraft_shadow` VARCHAR(255) NULL";
212
-        	try {
213
-            	    $sth = $Connection->db->prepare($query);
214
-		    $sth->execute();
215
-    		} catch(PDOException $e) {
216
-		    return "error (add new column to spotter_live) : ".$e->getMessage()."\n";
217
-    		}
218
-    		$error = '';
219
-    		// Update table aircraft
196
+			try {
197
+					$sth = $Connection->db->prepare($query);
198
+			$sth->execute();
199
+			} catch(PDOException $e) {
200
+			return "error (add new columns to translation) : ".$e->getMessage()."\n";
201
+			}
202
+			// Add aircraft_shadow column to aircraft
203
+			$query = "ALTER TABLE `aircraft` ADD `aircraft_shadow` VARCHAR(255) NULL";
204
+			try {
205
+					$sth = $Connection->db->prepare($query);
206
+			$sth->execute();
207
+			} catch(PDOException $e) {
208
+			return "error (add new column to aircraft) : ".$e->getMessage()."\n";
209
+			}
210
+			// Add aircraft_shadow column to spotter_live
211
+			$query = "ALTER TABLE `spotter_live` ADD `aircraft_shadow` VARCHAR(255) NULL";
212
+			try {
213
+					$sth = $Connection->db->prepare($query);
214
+			$sth->execute();
215
+			} catch(PDOException $e) {
216
+			return "error (add new column to spotter_live) : ".$e->getMessage()."\n";
217
+			}
218
+			$error = '';
219
+			// Update table aircraft
220 220
 		$error .= create_db::import_file('../db/aircraft.sql');
221 221
 		$error .= create_db::import_file('../db/spotter_archive.sql');
222 222
 
223 223
 		// Update schema_version to 6
224 224
 		$query = "UPDATE `config` SET `value` = '6' WHERE `name` = 'schema_version'";
225
-        	try {
226
-            	    $sth = $Connection->db->prepare($query);
227
-		    $sth->execute();
228
-    		} catch(PDOException $e) {
229
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
230
-    		}
225
+			try {
226
+					$sth = $Connection->db->prepare($query);
227
+			$sth->execute();
228
+			} catch(PDOException $e) {
229
+			return "error (update schema_version) : ".$e->getMessage()."\n";
230
+			}
231 231
 		return $error;
232 232
 	}
233 233
 
234 234
 	private static function update_from_6() {
235
-    		$Connection = new Connection();
236
-    		if (!$Connection->indexExists('spotter_output','flightaware_id')) {
237
-    		    $query = "ALTER TABLE spotter_output ADD INDEX(flightaware_id);
235
+			$Connection = new Connection();
236
+			if (!$Connection->indexExists('spotter_output','flightaware_id')) {
237
+				$query = "ALTER TABLE spotter_output ADD INDEX(flightaware_id);
238 238
 			ALTER TABLE spotter_output ADD INDEX(date);
239 239
 			ALTER TABLE spotter_output ADD INDEX(ident);
240 240
 			ALTER TABLE spotter_live ADD INDEX(flightaware_id);
@@ -247,147 +247,147 @@  discard block
 block discarded – undo
247 247
 			ALTER TABLE aircraft ADD INDEX(icao);
248 248
 			ALTER TABLE airport ADD INDEX(icao);
249 249
 			ALTER TABLE translation ADD INDEX(Operator);";
250
-        	    try {
251
-            		$sth = $Connection->db->prepare($query);
250
+				try {
251
+					$sth = $Connection->db->prepare($query);
252 252
 			$sth->execute();
253
-    		    } catch(PDOException $e) {
253
+				} catch(PDOException $e) {
254 254
 			return "error (add some indexes) : ".$e->getMessage()."\n";
255
-    		    }
256
-    		}
257
-    		$error = '';
258
-    		// Update table countries
259
-    		if ($Connection->tableExists('airspace')) {
260
-    		    $error .= update_db::update_countries();
261
-		    if ($error != '') return $error;
255
+				}
256
+			}
257
+			$error = '';
258
+			// Update table countries
259
+			if ($Connection->tableExists('airspace')) {
260
+				$error .= update_db::update_countries();
261
+			if ($error != '') return $error;
262 262
 		}
263 263
 		// Update schema_version to 7
264 264
 		$query = "UPDATE `config` SET `value` = '7' WHERE `name` = 'schema_version'";
265
-        	try {
266
-            	    $sth = $Connection->db->prepare($query);
267
-		    $sth->execute();
268
-    		} catch(PDOException $e) {
269
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
270
-    		}
265
+			try {
266
+					$sth = $Connection->db->prepare($query);
267
+			$sth->execute();
268
+			} catch(PDOException $e) {
269
+			return "error (update schema_version) : ".$e->getMessage()."\n";
270
+			}
271 271
 		return $error;
272
-    	}
272
+		}
273 273
 
274 274
 	private static function update_from_7() {
275 275
 		global $globalDBname, $globalDBdriver;
276
-    		$Connection = new Connection();
277
-    		$query="ALTER TABLE spotter_live ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;
276
+			$Connection = new Connection();
277
+			$query="ALTER TABLE spotter_live ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;
278 278
     			ALTER TABLE spotter_output ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;";
279
-        	try {
280
-            	    $sth = $Connection->db->prepare($query);
281
-		    $sth->execute();
282
-    		} catch(PDOException $e) {
283
-		    return "error (add pilot column to spotter_live and spotter_output) : ".$e->getMessage()."\n";
284
-    		}
285
-    		if ($globalDBdriver == 'mysql') {
286
-    		    $query = "SELECT ENGINE FROM information_schema.TABLES where TABLE_SCHEMA = '".$globalDBname."' AND TABLE_NAME = 'spotter_archive'";
287
-		    try {
288
-            		$sth = $Connection->db->prepare($query);
279
+			try {
280
+					$sth = $Connection->db->prepare($query);
281
+			$sth->execute();
282
+			} catch(PDOException $e) {
283
+			return "error (add pilot column to spotter_live and spotter_output) : ".$e->getMessage()."\n";
284
+			}
285
+			if ($globalDBdriver == 'mysql') {
286
+				$query = "SELECT ENGINE FROM information_schema.TABLES where TABLE_SCHEMA = '".$globalDBname."' AND TABLE_NAME = 'spotter_archive'";
287
+			try {
288
+					$sth = $Connection->db->prepare($query);
289 289
 			$sth->execute();
290
-    		    } catch(PDOException $e) {
290
+				} catch(PDOException $e) {
291 291
 			return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n";
292
-    		    }
293
-    		    $row = $sth->fetch(PDO::FETCH_ASSOC);
294
-    		    if ($row['engine'] == 'ARCHIVE') {
292
+				}
293
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
294
+				if ($row['engine'] == 'ARCHIVE') {
295 295
 			$query = "CREATE TABLE copy LIKE spotter_archive; 
296 296
 				ALTER TABLE copy ENGINE=ARCHIVE;
297 297
 				ALTER TABLE copy ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;
298 298
 				INSERT INTO copy SELECT *, '' as pilot_name, '' as pilot_id FROM spotter_archive ORDER BY `spotter_archive_id`;
299 299
 				DROP TABLE spotter_archive;
300 300
 				RENAME TABLE copy TO spotter_archive;";
301
-            	    } else {
302
-    			$query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
303
-            	    }
304
-                } else {
305
-    		    $query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
306
-                }
307
-        	try {
308
-            	    $sth = $Connection->db->prepare($query);
309
-		    $sth->execute();
310
-    		} catch(PDOException $e) {
311
-		    return "error (add pilot column to spotter_archive) : ".$e->getMessage()."\n";
312
-    		}
301
+					} else {
302
+				$query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
303
+					}
304
+				} else {
305
+				$query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
306
+				}
307
+			try {
308
+					$sth = $Connection->db->prepare($query);
309
+			$sth->execute();
310
+			} catch(PDOException $e) {
311
+			return "error (add pilot column to spotter_archive) : ".$e->getMessage()."\n";
312
+			}
313 313
 
314
-    		$error = '';
315
-    		// Update table aircraft
314
+			$error = '';
315
+			// Update table aircraft
316 316
 		$error .= create_db::import_file('../db/source_location.sql');
317 317
 		if ($error != '') return $error;
318 318
 		// Update schema_version to 6
319 319
 		$query = "UPDATE `config` SET `value` = '8' WHERE `name` = 'schema_version'";
320
-        	try {
321
-            	    $sth = $Connection->db->prepare($query);
322
-		    $sth->execute();
323
-    		} catch(PDOException $e) {
324
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
325
-    		}
320
+			try {
321
+					$sth = $Connection->db->prepare($query);
322
+			$sth->execute();
323
+			} catch(PDOException $e) {
324
+			return "error (update schema_version) : ".$e->getMessage()."\n";
325
+			}
326 326
 		return $error;
327 327
 	}
328 328
 
329 329
 	private static function update_from_8() {
330
-    		$Connection = new Connection();
331
-    		$error = '';
332
-    		// Update table aircraft
330
+			$Connection = new Connection();
331
+			$error = '';
332
+			// Update table aircraft
333 333
 		$error .= create_db::import_file('../db/notam.sql');
334 334
 		if ($error != '') return $error;
335 335
 		$query = "DELETE FROM config WHERE name = 'last_update_db';
336 336
                         INSERT INTO config (name,value) VALUES ('last_update_db',NOW());
337 337
                         DELETE FROM config WHERE name = 'last_update_notam_db';
338 338
                         INSERT INTO config (name,value) VALUES ('last_update_notam_db',NOW());";
339
-        	try {
340
-            	    $sth = $Connection->db->prepare($query);
341
-		    $sth->execute();
342
-    		} catch(PDOException $e) {
343
-		    return "error (insert last_update values) : ".$e->getMessage()."\n";
344
-    		}
339
+			try {
340
+					$sth = $Connection->db->prepare($query);
341
+			$sth->execute();
342
+			} catch(PDOException $e) {
343
+			return "error (insert last_update values) : ".$e->getMessage()."\n";
344
+			}
345 345
 		$query = "UPDATE `config` SET `value` = '9' WHERE `name` = 'schema_version'";
346
-        	try {
347
-            	    $sth = $Connection->db->prepare($query);
348
-		    $sth->execute();
349
-    		} catch(PDOException $e) {
350
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
351
-    		}
346
+			try {
347
+					$sth = $Connection->db->prepare($query);
348
+			$sth->execute();
349
+			} catch(PDOException $e) {
350
+			return "error (update schema_version) : ".$e->getMessage()."\n";
351
+			}
352 352
 		return $error;
353 353
 	}
354 354
 
355 355
 	private static function update_from_9() {
356
-    		$Connection = new Connection();
357
-    		$query="ALTER TABLE spotter_live ADD verticalrate INT(11) NULL;
356
+			$Connection = new Connection();
357
+			$query="ALTER TABLE spotter_live ADD verticalrate INT(11) NULL;
358 358
     			ALTER TABLE spotter_output ADD verticalrate INT(11) NULL;";
359
-        	try {
360
-            	    $sth = $Connection->db->prepare($query);
361
-		    $sth->execute();
362
-    		} catch(PDOException $e) {
363
-		    return "error (add verticalrate column to spotter_live and spotter_output) : ".$e->getMessage()."\n";
364
-    		}
359
+			try {
360
+					$sth = $Connection->db->prepare($query);
361
+			$sth->execute();
362
+			} catch(PDOException $e) {
363
+			return "error (add verticalrate column to spotter_live and spotter_output) : ".$e->getMessage()."\n";
364
+			}
365 365
 		$error = '';
366
-    		// Update table atc
366
+			// Update table atc
367 367
 		$error .= create_db::import_file('../db/atc.sql');
368 368
 		if ($error != '') return $error;
369 369
 		
370 370
 		$query = "UPDATE `config` SET `value` = '10' WHERE `name` = 'schema_version'";
371
-        	try {
372
-            	    $sth = $Connection->db->prepare($query);
373
-		    $sth->execute();
374
-    		} catch(PDOException $e) {
375
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
376
-    		}
371
+			try {
372
+					$sth = $Connection->db->prepare($query);
373
+			$sth->execute();
374
+			} catch(PDOException $e) {
375
+			return "error (update schema_version) : ".$e->getMessage()."\n";
376
+			}
377 377
 		return $error;
378 378
 	}
379 379
 
380 380
 	private static function update_from_10() {
381
-    		$Connection = new Connection();
382
-    		$query="ALTER TABLE atc CHANGE `type` `type` ENUM('Observer','Flight Information','Delivery','Tower','Approach','ACC','Departure','Ground','Flight Service Station','Control Radar or Centre') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL";
383
-        	try {
384
-            	    $sth = $Connection->db->prepare($query);
385
-		    $sth->execute();
386
-    		} catch(PDOException $e) {
387
-		    return "error (add new enum to ATC table) : ".$e->getMessage()."\n";
388
-    		}
381
+			$Connection = new Connection();
382
+			$query="ALTER TABLE atc CHANGE `type` `type` ENUM('Observer','Flight Information','Delivery','Tower','Approach','ACC','Departure','Ground','Flight Service Station','Control Radar or Centre') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL";
383
+			try {
384
+					$sth = $Connection->db->prepare($query);
385
+			$sth->execute();
386
+			} catch(PDOException $e) {
387
+			return "error (add new enum to ATC table) : ".$e->getMessage()."\n";
388
+			}
389 389
 		$error = '';
390
-    		// Add tables
390
+			// Add tables
391 391
 		$error .= create_db::import_file('../db/aircraft_owner.sql');
392 392
 		if ($error != '') return $error;
393 393
 		$error .= create_db::import_file('../db/metar.sql');
@@ -398,76 +398,76 @@  discard block
 block discarded – undo
398 398
 		if ($error != '') return $error;
399 399
 		
400 400
 		$query = "UPDATE `config` SET `value` = '11' WHERE `name` = 'schema_version'";
401
-        	try {
402
-            	    $sth = $Connection->db->prepare($query);
403
-		    $sth->execute();
404
-    		} catch(PDOException $e) {
405
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
406
-    		}
401
+			try {
402
+					$sth = $Connection->db->prepare($query);
403
+			$sth->execute();
404
+			} catch(PDOException $e) {
405
+			return "error (update schema_version) : ".$e->getMessage()."\n";
406
+			}
407 407
 		return $error;
408 408
 	}
409 409
 
410 410
 	private static function update_from_11() {
411 411
 		global $globalDBdriver, $globalDBname;
412
-    		$Connection = new Connection();
413
-    		$query="ALTER TABLE spotter_output ADD owner_name VARCHAR(255) NULL DEFAULT NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_seen DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, ADD last_latitude FLOAT NULL, ADD last_longitude FLOAT NULL, ADD last_altitude INT(11) NULL, ADD last_ground_speed INT(11), ADD real_arrival_airport_icao VARCHAR(999), ADD real_arrival_airport_time VARCHAR(20),ADD real_departure_airport_icao VARCHAR(999), ADD real_departure_airport_time VARCHAR(20)";
414
-        	try {
415
-            	    $sth = $Connection->db->prepare($query);
416
-		    $sth->execute();
417
-    		} catch(PDOException $e) {
418
-		    return "error (add owner_name & format_source column to spotter_output) : ".$e->getMessage()."\n";
419
-    		}
420
-    		$query="ALTER TABLE spotter_live ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
421
-        	try {
422
-            	    $sth = $Connection->db->prepare($query);
423
-		    $sth->execute();
424
-    		} catch(PDOException $e) {
425
-		    return "error (format_source column to spotter_live) : ".$e->getMessage()."\n";
426
-    		}
427
-    		if ($globalDBdriver == 'mysql') {
428
-    		    $query = "SELECT ENGINE FROM information_schema.TABLES where TABLE_SCHEMA = '".$globalDBname."' AND TABLE_NAME = 'spotter_archive'";
429
-		    try {
430
-            		$sth = $Connection->db->prepare($query);
412
+			$Connection = new Connection();
413
+			$query="ALTER TABLE spotter_output ADD owner_name VARCHAR(255) NULL DEFAULT NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_seen DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, ADD last_latitude FLOAT NULL, ADD last_longitude FLOAT NULL, ADD last_altitude INT(11) NULL, ADD last_ground_speed INT(11), ADD real_arrival_airport_icao VARCHAR(999), ADD real_arrival_airport_time VARCHAR(20),ADD real_departure_airport_icao VARCHAR(999), ADD real_departure_airport_time VARCHAR(20)";
414
+			try {
415
+					$sth = $Connection->db->prepare($query);
416
+			$sth->execute();
417
+			} catch(PDOException $e) {
418
+			return "error (add owner_name & format_source column to spotter_output) : ".$e->getMessage()."\n";
419
+			}
420
+			$query="ALTER TABLE spotter_live ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
421
+			try {
422
+					$sth = $Connection->db->prepare($query);
423
+			$sth->execute();
424
+			} catch(PDOException $e) {
425
+			return "error (format_source column to spotter_live) : ".$e->getMessage()."\n";
426
+			}
427
+			if ($globalDBdriver == 'mysql') {
428
+				$query = "SELECT ENGINE FROM information_schema.TABLES where TABLE_SCHEMA = '".$globalDBname."' AND TABLE_NAME = 'spotter_archive'";
429
+			try {
430
+					$sth = $Connection->db->prepare($query);
431 431
 			$sth->execute();
432
-    		    } catch(PDOException $e) {
432
+				} catch(PDOException $e) {
433 433
 			return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n";
434
-    		    }
435
-    		    $row = $sth->fetch(PDO::FETCH_ASSOC);
436
-    		    if ($row['engine'] == 'ARCHIVE') {
434
+				}
435
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
436
+				if ($row['engine'] == 'ARCHIVE') {
437 437
 			$query = "CREATE TABLE copy LIKE spotter_archive; 
438 438
 				ALTER TABLE copy ENGINE=ARCHIVE;
439 439
 				ALTER TABLE copy ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE;
440 440
 				INSERT INTO copy SELECT *, '' as verticalrate, '' as format_source, '0' as ground FROM spotter_archive ORDER BY `spotter_archive_id`;
441 441
 				DROP TABLE spotter_archive;
442 442
 				RENAME TABLE copy TO spotter_archive;";
443
-            	    } else {
444
-    			$query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
445
-            	    }
446
-                } else {
447
-    		    $query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
448
-                }
449
-        	try {
450
-            	    $sth = $Connection->db->prepare($query);
451
-		    $sth->execute();
452
-    		} catch(PDOException $e) {
453
-		    return "error (add columns to spotter_archive) : ".$e->getMessage()."\n";
454
-    		}
443
+					} else {
444
+				$query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
445
+					}
446
+				} else {
447
+				$query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
448
+				}
449
+			try {
450
+					$sth = $Connection->db->prepare($query);
451
+			$sth->execute();
452
+			} catch(PDOException $e) {
453
+			return "error (add columns to spotter_archive) : ".$e->getMessage()."\n";
454
+			}
455 455
 
456 456
 		$error = '';
457 457
 		
458 458
 		$query = "UPDATE `config` SET `value` = '12' WHERE `name` = 'schema_version'";
459
-        	try {
460
-            	    $sth = $Connection->db->prepare($query);
461
-		    $sth->execute();
462
-    		} catch(PDOException $e) {
463
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
464
-    		}
459
+			try {
460
+					$sth = $Connection->db->prepare($query);
461
+			$sth->execute();
462
+			} catch(PDOException $e) {
463
+			return "error (update schema_version) : ".$e->getMessage()."\n";
464
+			}
465 465
 		return $error;
466 466
 	}
467 467
 	private static function update_from_12() {
468
-    		$Connection = new Connection();
468
+			$Connection = new Connection();
469 469
 		$error = '';
470
-    		// Add tables
470
+			// Add tables
471 471
 		$error .= create_db::import_file('../db/stats.sql');
472 472
 		if ($error != '') return $error;
473 473
 		$error .= create_db::import_file('../db/stats_aircraft.sql');
@@ -484,166 +484,166 @@  discard block
 block discarded – undo
484 484
 		if ($error != '') return $error;
485 485
 		
486 486
 		$query = "UPDATE `config` SET `value` = '13' WHERE `name` = 'schema_version'";
487
-        	try {
488
-            	    $sth = $Connection->db->prepare($query);
489
-		    $sth->execute();
490
-    		} catch(PDOException $e) {
491
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
492
-    		}
487
+			try {
488
+					$sth = $Connection->db->prepare($query);
489
+			$sth->execute();
490
+			} catch(PDOException $e) {
491
+			return "error (update schema_version) : ".$e->getMessage()."\n";
492
+			}
493 493
 		return $error;
494 494
 	}
495 495
 
496 496
 	private static function update_from_13() {
497
-    		$Connection = new Connection();
498
-    		if (!$Connection->checkColumnName('spotter_archive_output','real_departure_airport_icao')) {
499
-    			$query="ALTER TABLE spotter_archive_output ADD real_departure_airport_icao VARCHAR(20), ADD real_departure_airport_time VARCHAR(20)";
497
+			$Connection = new Connection();
498
+			if (!$Connection->checkColumnName('spotter_archive_output','real_departure_airport_icao')) {
499
+				$query="ALTER TABLE spotter_archive_output ADD real_departure_airport_icao VARCHAR(20), ADD real_departure_airport_time VARCHAR(20)";
500 500
 			try {
501 501
 				$sth = $Connection->db->prepare($query);
502 502
 				$sth->execute();
503
-	    		} catch(PDOException $e) {
503
+				} catch(PDOException $e) {
504 504
 				return "error (update spotter_archive_output) : ".$e->getMessage()."\n";
505
-    			}
505
+				}
506 506
 		}
507
-    		$error = '';
507
+			$error = '';
508 508
 		$query = "UPDATE `config` SET `value` = '14' WHERE `name` = 'schema_version'";
509
-        	try {
510
-            	    $sth = $Connection->db->prepare($query);
511
-		    $sth->execute();
512
-    		} catch(PDOException $e) {
513
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
514
-    		}
509
+			try {
510
+					$sth = $Connection->db->prepare($query);
511
+			$sth->execute();
512
+			} catch(PDOException $e) {
513
+			return "error (update schema_version) : ".$e->getMessage()."\n";
514
+			}
515 515
 		return $error;
516 516
 	}
517 517
 
518 518
 	private static function update_from_14() {
519
-    		$Connection = new Connection();
519
+			$Connection = new Connection();
520 520
 		$error = '';
521
-    		// Add tables
522
-    		if (!$Connection->tableExists('stats_flight')) {
521
+			// Add tables
522
+			if (!$Connection->tableExists('stats_flight')) {
523 523
 			$error .= create_db::import_file('../db/stats_flight.sql');
524 524
 			if ($error != '') return $error;
525 525
 		}
526 526
 		$query = "UPDATE `config` SET `value` = '15' WHERE `name` = 'schema_version'";
527
-        	try {
528
-            	    $sth = $Connection->db->prepare($query);
529
-		    $sth->execute();
530
-    		} catch(PDOException $e) {
531
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
532
-    		}
527
+			try {
528
+					$sth = $Connection->db->prepare($query);
529
+			$sth->execute();
530
+			} catch(PDOException $e) {
531
+			return "error (update schema_version) : ".$e->getMessage()."\n";
532
+			}
533 533
 		return $error;
534 534
 	}
535 535
 
536 536
 
537 537
 	private static function update_from_15() {
538
-    		$Connection = new Connection();
538
+			$Connection = new Connection();
539 539
 		$error = '';
540
-    		// Add tables
541
-    		$query="ALTER TABLE `stats` CHANGE `stats_date` `stats_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP";
542
-        	try {
543
-            	    $sth = $Connection->db->prepare($query);
544
-		    $sth->execute();
545
-    		} catch(PDOException $e) {
546
-		    return "error (update stats) : ".$e->getMessage()."\n";
547
-    		}
540
+			// Add tables
541
+			$query="ALTER TABLE `stats` CHANGE `stats_date` `stats_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP";
542
+			try {
543
+					$sth = $Connection->db->prepare($query);
544
+			$sth->execute();
545
+			} catch(PDOException $e) {
546
+			return "error (update stats) : ".$e->getMessage()."\n";
547
+			}
548 548
 		if ($error != '') return $error;
549 549
 		$query = "UPDATE `config` SET `value` = '16' WHERE `name` = 'schema_version'";
550
-        	try {
551
-            	    $sth = $Connection->db->prepare($query);
552
-		    $sth->execute();
553
-    		} catch(PDOException $e) {
554
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
555
-    		}
550
+			try {
551
+					$sth = $Connection->db->prepare($query);
552
+			$sth->execute();
553
+			} catch(PDOException $e) {
554
+			return "error (update schema_version) : ".$e->getMessage()."\n";
555
+			}
556 556
 		return $error;
557 557
 	}
558 558
 
559 559
 	private static function update_from_16() {
560
-    		$Connection = new Connection();
560
+			$Connection = new Connection();
561 561
 		$error = '';
562
-    		// Add tables
563
-    		if (!$Connection->tableExists('stats_registration')) {
562
+			// Add tables
563
+			if (!$Connection->tableExists('stats_registration')) {
564 564
 			$error .= create_db::import_file('../db/stats_registration.sql');
565 565
 		}
566
-    		if (!$Connection->tableExists('stats_callsign')) {
566
+			if (!$Connection->tableExists('stats_callsign')) {
567 567
 			$error .= create_db::import_file('../db/stats_callsign.sql');
568 568
 		}
569 569
 		if ($error != '') return $error;
570 570
 		$query = "UPDATE `config` SET `value` = '17' WHERE `name` = 'schema_version'";
571
-        	try {
572
-            	    $sth = $Connection->db->prepare($query);
573
-		    $sth->execute();
574
-    		} catch(PDOException $e) {
575
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
576
-    		}
571
+			try {
572
+					$sth = $Connection->db->prepare($query);
573
+			$sth->execute();
574
+			} catch(PDOException $e) {
575
+			return "error (update schema_version) : ".$e->getMessage()."\n";
576
+			}
577 577
 		return $error;
578 578
 	}
579 579
 
580 580
 	private static function update_from_17() {
581
-    		$Connection = new Connection();
581
+			$Connection = new Connection();
582 582
 		$error = '';
583
-    		// Add tables
584
-    		if (!$Connection->tableExists('stats_country')) {
583
+			// Add tables
584
+			if (!$Connection->tableExists('stats_country')) {
585 585
 			$error .= create_db::import_file('../db/stats_country.sql');
586 586
 		}
587 587
 		if ($error != '') return $error;
588 588
 		$query = "UPDATE `config` SET `value` = '18' WHERE `name` = 'schema_version'";
589
-        	try {
590
-            	    $sth = $Connection->db->prepare($query);
591
-		    $sth->execute();
592
-    		} catch(PDOException $e) {
593
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
594
-    		}
589
+			try {
590
+					$sth = $Connection->db->prepare($query);
591
+			$sth->execute();
592
+			} catch(PDOException $e) {
593
+			return "error (update schema_version) : ".$e->getMessage()."\n";
594
+			}
595 595
 		return $error;
596 596
 	}
597 597
 	private static function update_from_18() {
598
-    		$Connection = new Connection();
598
+			$Connection = new Connection();
599 599
 		$error = '';
600
-    		// Modify stats_airport table
601
-    		if (!$Connection->checkColumnName('stats_airport','airport_name')) {
602
-    			$query = "ALTER TABLE `stats_airport` ADD `stats_type` VARCHAR(50) NOT NULL DEFAULT 'yearly', ADD `airport_name` VARCHAR(255) NOT NULL, ADD `date` DATE NULL DEFAULT NULL, DROP INDEX `airport_icao`, ADD UNIQUE `airport_icao` (`airport_icao`, `type`, `date`)";
603
-    	        	try {
604
-	            	    $sth = $Connection->db->prepare($query);
605
-			    $sth->execute();
606
-    			} catch(PDOException $e) {
607
-			    return "error (update stats) : ".$e->getMessage()."\n";
608
-    			}
609
-    		}
600
+			// Modify stats_airport table
601
+			if (!$Connection->checkColumnName('stats_airport','airport_name')) {
602
+				$query = "ALTER TABLE `stats_airport` ADD `stats_type` VARCHAR(50) NOT NULL DEFAULT 'yearly', ADD `airport_name` VARCHAR(255) NOT NULL, ADD `date` DATE NULL DEFAULT NULL, DROP INDEX `airport_icao`, ADD UNIQUE `airport_icao` (`airport_icao`, `type`, `date`)";
603
+					try {
604
+						$sth = $Connection->db->prepare($query);
605
+				$sth->execute();
606
+				} catch(PDOException $e) {
607
+				return "error (update stats) : ".$e->getMessage()."\n";
608
+				}
609
+			}
610 610
 		if ($error != '') return $error;
611 611
 		$query = "UPDATE `config` SET `value` = '19' WHERE `name` = 'schema_version'";
612
-        	try {
613
-            	    $sth = $Connection->db->prepare($query);
614
-		    $sth->execute();
615
-    		} catch(PDOException $e) {
616
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
617
-    		}
612
+			try {
613
+					$sth = $Connection->db->prepare($query);
614
+			$sth->execute();
615
+			} catch(PDOException $e) {
616
+			return "error (update schema_version) : ".$e->getMessage()."\n";
617
+			}
618 618
 		return $error;
619 619
 	}
620 620
 
621 621
 	private static function update_from_19() {
622
-    		$Connection = new Connection();
622
+			$Connection = new Connection();
623 623
 		$error = '';
624
-    		// Update airport table
624
+			// Update airport table
625 625
 		$error .= create_db::import_file('../db/airport.sql');
626 626
 		if ($error != '') return 'Import airport.sql : '.$error;
627 627
 		// Remove primary key on Spotter_Archive
628 628
 		$query = "alter table spotter_archive drop spotter_archive_id";
629
-        	try {
630
-            	    $sth = $Connection->db->prepare($query);
631
-		    $sth->execute();
632
-    		} catch(PDOException $e) {
633
-		    return "error (remove primary key on spotter_archive) : ".$e->getMessage()."\n";
634
-    		}
629
+			try {
630
+					$sth = $Connection->db->prepare($query);
631
+			$sth->execute();
632
+			} catch(PDOException $e) {
633
+			return "error (remove primary key on spotter_archive) : ".$e->getMessage()."\n";
634
+			}
635 635
 		$query = "alter table spotter_archive add spotter_archive_id INT(11)";
636
-        	try {
637
-            	    $sth = $Connection->db->prepare($query);
638
-		    $sth->execute();
639
-    		} catch(PDOException $e) {
640
-		    return "error (add id again on spotter_archive) : ".$e->getMessage()."\n";
641
-    		}
636
+			try {
637
+					$sth = $Connection->db->prepare($query);
638
+			$sth->execute();
639
+			} catch(PDOException $e) {
640
+			return "error (add id again on spotter_archive) : ".$e->getMessage()."\n";
641
+			}
642 642
 		if (!$Connection->checkColumnName('spotter_archive','over_country')) {
643 643
 			// Add column over_country
644
-    			$query = "ALTER TABLE `spotter_archive` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL";
644
+				$query = "ALTER TABLE `spotter_archive` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL";
645 645
 			try {
646
-            			$sth = $Connection->db->prepare($query);
646
+						$sth = $Connection->db->prepare($query);
647 647
 				$sth->execute();
648 648
 			} catch(PDOException $e) {
649 649
 				return "error (add over_country) : ".$e->getMessage()."\n";
@@ -651,9 +651,9 @@  discard block
 block discarded – undo
651 651
 		}
652 652
 		if (!$Connection->checkColumnName('spotter_live','over_country')) {
653 653
 			// Add column over_country
654
-    			$query = "ALTER TABLE `spotter_live` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL";
654
+				$query = "ALTER TABLE `spotter_live` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL";
655 655
 			try {
656
-            			$sth = $Connection->db->prepare($query);
656
+						$sth = $Connection->db->prepare($query);
657 657
 				$sth->execute();
658 658
 			} catch(PDOException $e) {
659 659
 				return "error (add over_country) : ".$e->getMessage()."\n";
@@ -661,74 +661,74 @@  discard block
 block discarded – undo
661 661
 		}
662 662
 		if (!$Connection->checkColumnName('spotter_output','source_name')) {
663 663
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
664
-    			$query = "ALTER TABLE `spotter_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
664
+				$query = "ALTER TABLE `spotter_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
665 665
 			try {
666 666
 				$sth = $Connection->db->prepare($query);
667 667
 				$sth->execute();
668 668
 			} catch(PDOException $e) {
669 669
 				return "error (add source_name column) : ".$e->getMessage()."\n";
670
-    			}
671
-    		}
670
+				}
671
+			}
672 672
 		if (!$Connection->checkColumnName('spotter_live','source_name')) {
673 673
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
674
-    			$query = "ALTER TABLE `spotter_live` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
674
+				$query = "ALTER TABLE `spotter_live` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
675 675
 			try {
676 676
 				$sth = $Connection->db->prepare($query);
677 677
 				$sth->execute();
678 678
 			} catch(PDOException $e) {
679 679
 				return "error (add source_name column) : ".$e->getMessage()."\n";
680
-    			}
681
-    		}
680
+				}
681
+			}
682 682
 		if (!$Connection->checkColumnName('spotter_archive_output','source_name')) {
683 683
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
684
-    			$query = "ALTER TABLE `spotter_archive_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
684
+				$query = "ALTER TABLE `spotter_archive_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`";
685 685
 			try {
686 686
 				$sth = $Connection->db->prepare($query);
687 687
 				$sth->execute();
688 688
 			} catch(PDOException $e) {
689 689
 				return "error (add source_name column) : ".$e->getMessage()."\n";
690
-    			}
691
-    		}
690
+				}
691
+			}
692 692
 		if (!$Connection->checkColumnName('spotter_archive','source_name')) {
693 693
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
694
-    			$query = "ALTER TABLE `spotter_archive` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`;";
694
+				$query = "ALTER TABLE `spotter_archive` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`;";
695 695
 			try {
696 696
 				$sth = $Connection->db->prepare($query);
697 697
 				$sth->execute();
698 698
 			} catch(PDOException $e) {
699 699
 				return "error (add source_name column) : ".$e->getMessage()."\n";
700
-    			}
701
-    		}
700
+				}
701
+			}
702 702
 		if ($error != '') return $error;
703 703
 		$query = "UPDATE `config` SET `value` = '20' WHERE `name` = 'schema_version'";
704
-        	try {
705
-            	    $sth = $Connection->db->prepare($query);
706
-		    $sth->execute();
707
-    		} catch(PDOException $e) {
708
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
709
-    		}
704
+			try {
705
+					$sth = $Connection->db->prepare($query);
706
+			$sth->execute();
707
+			} catch(PDOException $e) {
708
+			return "error (update schema_version) : ".$e->getMessage()."\n";
709
+			}
710 710
 		return $error;
711 711
 	}
712 712
 
713 713
 	private static function update_from_20() {
714 714
 		global $globalIVAO, $globalVATSIM, $globalphpVMS;
715
-    		$Connection = new Connection();
715
+			$Connection = new Connection();
716 716
 		$error = '';
717
-    		// Update airline table
718
-    		if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) {
717
+			// Update airline table
718
+			if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) {
719 719
 			$error .= create_db::import_file('../db/airlines.sql');
720 720
 			if ($error != '') return 'Import airlines.sql : '.$error;
721 721
 		}
722 722
 		if (!$Connection->checkColumnName('aircraft_modes','type_flight')) {
723 723
 			// Add column over_country
724
-    			$query = "ALTER TABLE `aircraft_modes` ADD `type_flight` VARCHAR(50) NULL DEFAULT NULL;";
725
-        		try {
724
+				$query = "ALTER TABLE `aircraft_modes` ADD `type_flight` VARCHAR(50) NULL DEFAULT NULL;";
725
+				try {
726 726
 				$sth = $Connection->db->prepare($query);
727 727
 				$sth->execute();
728 728
 			} catch(PDOException $e) {
729 729
 				return "error (add over_country) : ".$e->getMessage()."\n";
730
-    			}
731
-    		}
730
+				}
731
+			}
732 732
 		if ($error != '') return $error;
733 733
 		/*
734 734
     		if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) {
@@ -738,12 +738,12 @@  discard block
 block discarded – undo
738 738
 		}
739 739
 		*/
740 740
 		$query = "UPDATE `config` SET `value` = '21' WHERE `name` = 'schema_version'";
741
-        	try {
742
-            	    $sth = $Connection->db->prepare($query);
743
-		    $sth->execute();
744
-    		} catch(PDOException $e) {
745
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
746
-    		}
741
+			try {
742
+					$sth = $Connection->db->prepare($query);
743
+			$sth->execute();
744
+			} catch(PDOException $e) {
745
+			return "error (update schema_version) : ".$e->getMessage()."\n";
746
+			}
747 747
 		return $error;
748 748
 	}
749 749
 
@@ -762,35 +762,35 @@  discard block
 block discarded – undo
762 762
 			if ($error != '') return $error;
763 763
 		}
764 764
 		$query = "UPDATE `config` SET `value` = '22' WHERE `name` = 'schema_version'";
765
-        	try {
766
-            	    $sth = $Connection->db->prepare($query);
767
-		    $sth->execute();
768
-    		} catch(PDOException $e) {
769
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
770
-    		}
765
+			try {
766
+					$sth = $Connection->db->prepare($query);
767
+			$sth->execute();
768
+			} catch(PDOException $e) {
769
+			return "error (update schema_version) : ".$e->getMessage()."\n";
770
+			}
771 771
 		return $error;
772 772
 	}
773 773
 
774 774
 	private static function update_from_22() {
775 775
 		global $globalDBdriver;
776
-    		$Connection = new Connection();
776
+			$Connection = new Connection();
777 777
 		$error = '';
778 778
 		// Add table stats polar
779
-    		if (!$Connection->tableExists('stats_source')) {
779
+			if (!$Connection->tableExists('stats_source')) {
780 780
 			if ($globalDBdriver == 'mysql') {
781
-    				$error .= create_db::import_file('../db/stats_source.sql');
781
+					$error .= create_db::import_file('../db/stats_source.sql');
782 782
 			} else {
783 783
 				$error .= create_db::import_file('../db/pgsql/stats_source.sql');
784 784
 			}
785 785
 			if ($error != '') return $error;
786 786
 		}
787 787
 		$query = "UPDATE config SET value = '23' WHERE name = 'schema_version'";
788
-        	try {
789
-            	    $sth = $Connection->db->prepare($query);
790
-		    $sth->execute();
791
-    		} catch(PDOException $e) {
792
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
793
-    		}
788
+			try {
789
+					$sth = $Connection->db->prepare($query);
790
+			$sth->execute();
791
+			} catch(PDOException $e) {
792
+			return "error (update schema_version) : ".$e->getMessage()."\n";
793
+			}
794 794
 		return $error;
795 795
 	}
796 796
 
@@ -821,14 +821,14 @@  discard block
 block discarded – undo
821 821
 		}
822 822
 		if (!$Connection->checkColumnName('stats_aircraft','aircraft_manufacturer')) {
823 823
 			// Add aircraft_manufacturer to stats_aircraft
824
-    			$query = "ALTER TABLE stats_aircraft ADD aircraft_manufacturer VARCHAR(255) NULL";
824
+				$query = "ALTER TABLE stats_aircraft ADD aircraft_manufacturer VARCHAR(255) NULL";
825 825
 			try {
826 826
 				$sth = $Connection->db->prepare($query);
827 827
 				$sth->execute();
828 828
 			} catch(PDOException $e) {
829 829
 				return "error (add aircraft_manufacturer column) : ".$e->getMessage()."\n";
830
-    			}
831
-    		}
830
+				}
831
+			}
832 832
 		
833 833
 		$query = "UPDATE config SET value = '24' WHERE name = 'schema_version'";
834 834
 		try {
@@ -1129,133 +1129,133 @@  discard block
 block discarded – undo
1129 1129
 
1130 1130
 
1131 1131
 
1132
-    	public static function check_version($update = false) {
1133
-    	    global $globalDBname;
1134
-    	    $version = 0;
1135
-    	    $Connection = new Connection();
1136
-    	    if ($Connection->tableExists('aircraft')) {
1137
-    		if (!$Connection->tableExists('config')) {
1138
-    		    $version = '1';
1139
-    		    if ($update) return self::update_from_1();
1140
-    		    else return $version;
1132
+		public static function check_version($update = false) {
1133
+			global $globalDBname;
1134
+			$version = 0;
1135
+			$Connection = new Connection();
1136
+			if ($Connection->tableExists('aircraft')) {
1137
+			if (!$Connection->tableExists('config')) {
1138
+				$version = '1';
1139
+				if ($update) return self::update_from_1();
1140
+				else return $version;
1141 1141
 		} else {
1142
-    		    $Connection = new Connection();
1143
-		    $query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1";
1144
-		    try {
1145
-            		$sth = $Connection->db->prepare($query);
1146
-		        $sth->execute();
1147
-		    } catch(PDOException $e) {
1142
+				$Connection = new Connection();
1143
+			$query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1";
1144
+			try {
1145
+					$sth = $Connection->db->prepare($query);
1146
+				$sth->execute();
1147
+			} catch(PDOException $e) {
1148 1148
 			return "error : ".$e->getMessage()."\n";
1149
-    		    }
1150
-    		    $result = $sth->fetch(PDO::FETCH_ASSOC);
1151
-    		    if ($update) {
1152
-    			if ($result['value'] == '2') {
1153
-    			    $error = self::update_from_2();
1154
-    			    if ($error != '') return $error;
1155
-    			    else return self::check_version(true);
1156
-    			} elseif ($result['value'] == '3') {
1157
-    			    $error = self::update_from_3();
1158
-    			    if ($error != '') return $error;
1159
-    			    else return self::check_version(true);
1160
-    			} elseif ($result['value'] == '4') {
1161
-    			    $error = self::update_from_4();
1162
-    			    if ($error != '') return $error;
1163
-    			    else return self::check_version(true);
1164
-    			} elseif ($result['value'] == '5') {
1165
-    			    $error = self::update_from_5();
1166
-    			    if ($error != '') return $error;
1167
-    			    else return self::check_version(true);
1168
-    			} elseif ($result['value'] == '6') {
1169
-    			    $error = self::update_from_6();
1170
-    			    if ($error != '') return $error;
1171
-    			    else return self::check_version(true);
1172
-    			} elseif ($result['value'] == '7') {
1173
-    			    $error = self::update_from_7();
1174
-    			    if ($error != '') return $error;
1175
-    			    else return self::check_version(true);
1176
-    			} elseif ($result['value'] == '8') {
1177
-    			    $error = self::update_from_8();
1178
-    			    if ($error != '') return $error;
1179
-    			    else return self::check_version(true);
1180
-    			} elseif ($result['value'] == '9') {
1181
-    			    $error = self::update_from_9();
1182
-    			    if ($error != '') return $error;
1183
-    			    else return self::check_version(true);
1184
-    			} elseif ($result['value'] == '10') {
1185
-    			    $error = self::update_from_10();
1186
-    			    if ($error != '') return $error;
1187
-    			    else return self::check_version(true);
1188
-    			} elseif ($result['value'] == '11') {
1189
-    			    $error = self::update_from_11();
1190
-    			    if ($error != '') return $error;
1191
-    			    else return self::check_version(true);
1192
-    			} elseif ($result['value'] == '12') {
1193
-    			    $error = self::update_from_12();
1194
-    			    if ($error != '') return $error;
1195
-    			    else return self::check_version(true);
1196
-    			} elseif ($result['value'] == '13') {
1197
-    			    $error = self::update_from_13();
1198
-    			    if ($error != '') return $error;
1199
-    			    else return self::check_version(true);
1200
-    			} elseif ($result['value'] == '14') {
1201
-    			    $error = self::update_from_14();
1202
-    			    if ($error != '') return $error;
1203
-    			    else return self::check_version(true);
1204
-    			} elseif ($result['value'] == '15') {
1205
-    			    $error = self::update_from_15();
1206
-    			    if ($error != '') return $error;
1207
-    			    else return self::check_version(true);
1208
-    			} elseif ($result['value'] == '16') {
1209
-    			    $error = self::update_from_16();
1210
-    			    if ($error != '') return $error;
1211
-    			    else return self::check_version(true);
1212
-    			} elseif ($result['value'] == '17') {
1213
-    			    $error = self::update_from_17();
1214
-    			    if ($error != '') return $error;
1215
-    			    else return self::check_version(true);
1216
-    			} elseif ($result['value'] == '18') {
1217
-    			    $error = self::update_from_18();
1218
-    			    if ($error != '') return $error;
1219
-    			    else return self::check_version(true);
1220
-    			} elseif ($result['value'] == '19') {
1221
-    			    $error = self::update_from_19();
1222
-    			    if ($error != '') return $error;
1223
-    			    else return self::check_version(true);
1224
-    			} elseif ($result['value'] == '20') {
1225
-    			    $error = self::update_from_20();
1226
-    			    if ($error != '') return $error;
1227
-    			    else return self::check_version(true);
1228
-    			} elseif ($result['value'] == '21') {
1229
-    			    $error = self::update_from_21();
1230
-    			    if ($error != '') return $error;
1231
-    			    else return self::check_version(true);
1232
-    			} elseif ($result['value'] == '22') {
1233
-    			    $error = self::update_from_22();
1234
-    			    if ($error != '') return $error;
1235
-    			    else return self::check_version(true);
1236
-    			} elseif ($result['value'] == '23') {
1237
-    			    $error = self::update_from_23();
1238
-    			    if ($error != '') return $error;
1239
-    			    else return self::check_version(true);
1240
-    			} elseif ($result['value'] == '24') {
1241
-    			    $error = self::update_from_24();
1242
-    			    if ($error != '') return $error;
1243
-    			    else return self::check_version(true);
1244
-    			} elseif ($result['value'] == '25') {
1245
-    			    $error = self::update_from_25();
1246
-    			    if ($error != '') return $error;
1247
-    			    else return self::check_version(true);
1248
-    			} elseif ($result['value'] == '26') {
1249
-    			    $error = self::update_from_26();
1250
-    			    if ($error != '') return $error;
1251
-    			    else return self::check_version(true);
1252
-    			} else return '';
1253
-    		    }
1254
-    		    else return $result['value'];
1149
+				}
1150
+				$result = $sth->fetch(PDO::FETCH_ASSOC);
1151
+				if ($update) {
1152
+				if ($result['value'] == '2') {
1153
+					$error = self::update_from_2();
1154
+					if ($error != '') return $error;
1155
+					else return self::check_version(true);
1156
+				} elseif ($result['value'] == '3') {
1157
+					$error = self::update_from_3();
1158
+					if ($error != '') return $error;
1159
+					else return self::check_version(true);
1160
+				} elseif ($result['value'] == '4') {
1161
+					$error = self::update_from_4();
1162
+					if ($error != '') return $error;
1163
+					else return self::check_version(true);
1164
+				} elseif ($result['value'] == '5') {
1165
+					$error = self::update_from_5();
1166
+					if ($error != '') return $error;
1167
+					else return self::check_version(true);
1168
+				} elseif ($result['value'] == '6') {
1169
+					$error = self::update_from_6();
1170
+					if ($error != '') return $error;
1171
+					else return self::check_version(true);
1172
+				} elseif ($result['value'] == '7') {
1173
+					$error = self::update_from_7();
1174
+					if ($error != '') return $error;
1175
+					else return self::check_version(true);
1176
+				} elseif ($result['value'] == '8') {
1177
+					$error = self::update_from_8();
1178
+					if ($error != '') return $error;
1179
+					else return self::check_version(true);
1180
+				} elseif ($result['value'] == '9') {
1181
+					$error = self::update_from_9();
1182
+					if ($error != '') return $error;
1183
+					else return self::check_version(true);
1184
+				} elseif ($result['value'] == '10') {
1185
+					$error = self::update_from_10();
1186
+					if ($error != '') return $error;
1187
+					else return self::check_version(true);
1188
+				} elseif ($result['value'] == '11') {
1189
+					$error = self::update_from_11();
1190
+					if ($error != '') return $error;
1191
+					else return self::check_version(true);
1192
+				} elseif ($result['value'] == '12') {
1193
+					$error = self::update_from_12();
1194
+					if ($error != '') return $error;
1195
+					else return self::check_version(true);
1196
+				} elseif ($result['value'] == '13') {
1197
+					$error = self::update_from_13();
1198
+					if ($error != '') return $error;
1199
+					else return self::check_version(true);
1200
+				} elseif ($result['value'] == '14') {
1201
+					$error = self::update_from_14();
1202
+					if ($error != '') return $error;
1203
+					else return self::check_version(true);
1204
+				} elseif ($result['value'] == '15') {
1205
+					$error = self::update_from_15();
1206
+					if ($error != '') return $error;
1207
+					else return self::check_version(true);
1208
+				} elseif ($result['value'] == '16') {
1209
+					$error = self::update_from_16();
1210
+					if ($error != '') return $error;
1211
+					else return self::check_version(true);
1212
+				} elseif ($result['value'] == '17') {
1213
+					$error = self::update_from_17();
1214
+					if ($error != '') return $error;
1215
+					else return self::check_version(true);
1216
+				} elseif ($result['value'] == '18') {
1217
+					$error = self::update_from_18();
1218
+					if ($error != '') return $error;
1219
+					else return self::check_version(true);
1220
+				} elseif ($result['value'] == '19') {
1221
+					$error = self::update_from_19();
1222
+					if ($error != '') return $error;
1223
+					else return self::check_version(true);
1224
+				} elseif ($result['value'] == '20') {
1225
+					$error = self::update_from_20();
1226
+					if ($error != '') return $error;
1227
+					else return self::check_version(true);
1228
+				} elseif ($result['value'] == '21') {
1229
+					$error = self::update_from_21();
1230
+					if ($error != '') return $error;
1231
+					else return self::check_version(true);
1232
+				} elseif ($result['value'] == '22') {
1233
+					$error = self::update_from_22();
1234
+					if ($error != '') return $error;
1235
+					else return self::check_version(true);
1236
+				} elseif ($result['value'] == '23') {
1237
+					$error = self::update_from_23();
1238
+					if ($error != '') return $error;
1239
+					else return self::check_version(true);
1240
+				} elseif ($result['value'] == '24') {
1241
+					$error = self::update_from_24();
1242
+					if ($error != '') return $error;
1243
+					else return self::check_version(true);
1244
+				} elseif ($result['value'] == '25') {
1245
+					$error = self::update_from_25();
1246
+					if ($error != '') return $error;
1247
+					else return self::check_version(true);
1248
+				} elseif ($result['value'] == '26') {
1249
+					$error = self::update_from_26();
1250
+					if ($error != '') return $error;
1251
+					else return self::check_version(true);
1252
+				} else return '';
1253
+				}
1254
+				else return $result['value'];
1255 1255
 		}
1256 1256
 		
1257
-	    } else return $version;
1258
-    	}
1257
+		} else return $version;
1258
+		}
1259 1259
     	
1260 1260
 }
1261 1261
 //echo update_schema::check_version();
Please login to merge, or discard this patch.