Completed
Push — master ( d636a6...772110 )
by Yannick
07:07
created
install/populate_all.php 1 patch
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -1,48 +1,48 @@
 block discarded – undo
1 1
 #!/usr/bin/php
2 2
 <?php
3
-    require_once('../require/settings.php');
4
-    if ($globalInstalled) {
5
-        echo '$globalInstalled must be set to FALSE in require/settings.php';
6
-        exit;
7
-    }
8
-    require('class.update_db.php');
9
-    echo "Populate all tables...\n";
10
-    update_db::update_all();
11
-    echo "\nInstall waypoints...(VERY slow!)";
12
-    update_db::update_waypoints();
13
-    echo "Done !\n";
14
-    echo "Install airspace...";
15
-    update_db::update_airspace();
16
-    echo "Done !\n";
17
-    echo "Install countries...";
18
-    update_db::update_countries();
19
-    echo "Done !\n";
20
-    if (isset($globalOwner) && $globalOwner) {
3
+	require_once('../require/settings.php');
4
+	if ($globalInstalled) {
5
+		echo '$globalInstalled must be set to FALSE in require/settings.php';
6
+		exit;
7
+	}
8
+	require('class.update_db.php');
9
+	echo "Populate all tables...\n";
10
+	update_db::update_all();
11
+	echo "\nInstall waypoints...(VERY slow!)";
12
+	update_db::update_waypoints();
13
+	echo "Done !\n";
14
+	echo "Install airspace...";
15
+	update_db::update_airspace();
16
+	echo "Done !\n";
17
+	echo "Install countries...";
18
+	update_db::update_countries();
19
+	echo "Done !\n";
20
+	if (isset($globalOwner) && $globalOwner) {
21 21
 	echo "Install private owners...";
22 22
 	update_db::update_owner();
23
-        echo "Done !\n";
24
-    }
25
-    /*
23
+		echo "Done !\n";
24
+	}
25
+	/*
26 26
     if (isset($globalIVAO) && $globalIVAO) {
27 27
         echo "Install IVAO airlines and logos...";
28 28
         update_db::update_IVAO();
29 29
 	echo "Done !\n";
30 30
     }
31 31
     */
32
-    if (isset($globalNOTAM) && $globalNOTAM && isset($globalNOTAMSource) && $globalNOTAMSource != '') {
32
+	if (isset($globalNOTAM) && $globalNOTAM && isset($globalNOTAMSource) && $globalNOTAMSource != '') {
33 33
 	echo "Install NOTAM from notaminfo.com...";
34
-        update_db:update_notam();
35
-        echo "Done !\n";
36
-    }
37
-    if (isset($globalMap3D) && $globalMap3D) {
34
+		update_db:update_notam();
35
+		echo "Done !\n";
36
+	}
37
+	if (isset($globalMap3D) && $globalMap3D) {
38 38
 	echo "Install 3D models...";
39 39
 	update_db::update_models();
40 40
 	echo "Done !\n";
41 41
 	if (isset($globalMapSatellites) && $globalMapSatellites) {
42
-	    echo "Install Space 3D models...";
43
-	    update_db::update_space_models();
44
-	    echo "Done !\n";
45
-        }
46
-    }
42
+		echo "Install Space 3D models...";
43
+		update_db::update_space_models();
44
+		echo "Done !\n";
45
+		}
46
+	}
47 47
 
48 48
 ?>
49 49
\ No newline at end of file
Please login to merge, or discard this patch.
header.php 3 patches
Braces   +32 added lines, -7 removed lines patch added patch discarded remove patch
@@ -5,8 +5,11 @@  discard block
 block discarded – undo
5 5
 $file_path = pathinfo($_SERVER['SCRIPT_NAME']);
6 6
 $current_page = $file_path['filename'];
7 7
 date_default_timezone_set($globalTimezone);
8
-if (isset($_COOKIE['MapType']) && $_COOKIE['MapType'] != '') $MapType = $_COOKIE['MapType'];
9
-else $MapType = $globalMapProvider;
8
+if (isset($_COOKIE['MapType']) && $_COOKIE['MapType'] != '') {
9
+	$MapType = $_COOKIE['MapType'];
10
+} else {
11
+	$MapType = $globalMapProvider;
12
+}
10 13
 ?>
11 14
 <!DOCTYPE html>
12 15
 <html>
@@ -181,7 +184,13 @@  discard block
 block discarded – undo
181 184
 <script src="<?php print $globalURL; ?>/js/Marker.Rotate.js"></script>
182 185
 <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script>
183 186
 <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script>
184
-<script src="<?php print $globalURL; ?>/js/map.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script>
187
+<script src="<?php print $globalURL; ?>/js/map.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) {
188
+	print '&latitude='.$latitude;
189
+}
190
+?><?php if(isset($longitude)) {
191
+	print '&longitude='.$longitude;
192
+}
193
+?>&<?php print time(); ?>"></script>
185 194
 <?php
186 195
 		if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '' && ($MapType == 'Google-Roadmap' || $MapType == 'Google-Satellite' || $MapType == 'Google-Hybrid' || $MapType == 'Google-Terrain')) {
187 196
 ?>
@@ -235,7 +244,13 @@  discard block
 block discarded – undo
235 244
 <script src="<?php print $globalURL; ?>/js/Marker.Rotate.js"></script>
236 245
 <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script>
237 246
 <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script>
238
-<script src="<?php print $globalURL; ?>/js/map.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script>
247
+<script src="<?php print $globalURL; ?>/js/map.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if(isset($latitude)) {
248
+	print '&latitude='.$latitude;
249
+}
250
+?><?php if(isset($longitude)) {
251
+	print '&longitude='.$longitude;
252
+}
253
+?>&<?php print time(); ?>"></script>
239 254
 <?php
240 255
 		if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '' && ($MapType == 'Google-Roadmap' || $MapType == 'Google-Satellite' || $MapType == 'Google-Hybrid' || $MapType == 'Google-Terrain')) {
241 256
 ?>
@@ -308,7 +323,12 @@  discard block
 block discarded – undo
308 323
         <span class="icon-bar"></span>
309 324
       </button>
310 325
       <a href="<?php print $globalURL; ?>/search" class="navbar-toggle navbar-toggle-search"><i class="fa fa-search"></i></a>
311
-      <a class="navbar-brand" href="<?php if ($globalURL == '') print '/'; else print $globalURL; ?>"><img src="<?php print $globalURL.$logoURL; ?>" height="30px" /></a>
326
+      <a class="navbar-brand" href="<?php if ($globalURL == '') {
327
+	print '/';
328
+} else {
329
+	print $globalURL;
330
+}
331
+?>"><img src="<?php print $globalURL.$logoURL; ?>" height="30px" /></a>
312 332
     </div>
313 333
     <div class="collapse navbar-collapse">
314 334
       <ul class="nav navbar-nav">
@@ -386,7 +406,9 @@  discard block
 block discarded – undo
386 406
   		        $alllang = $Language->getLanguages();
387 407
   		        foreach ($alllang as $key => $lang) {
388 408
   		            print '<option value="'.$key.'"';
389
-  		            if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected ';
409
+  		            if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) {
410
+  		            	print ' selected ';
411
+  		            }
390 412
   		            print '>'.$lang[0].'</option>';
391 413
   		        }
392 414
   		    ?>
@@ -533,4 +555,7 @@  discard block
 block discarded – undo
533 555
 
534 556
 ?>
535 557
 
536
-<section class="container main-content <?php if (strtolower($current_page) == 'index') print 'index '; ?>clear">
558
+<section class="container main-content <?php if (strtolower($current_page) == 'index') {
559
+	print 'index ';
560
+}
561
+?>clear">
Please login to merge, or discard this patch.
Indentation   +40 added lines, -40 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>
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
 }
461 461
 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))
462 462
 {
463
-    ?>
463
+	?>
464 464
     <div class="top-header clear" role="main">
465 465
         <div id="map"></div>
466 466
 	<link rel="stylesheet" href="<?php print $globalURL; ?>/css/leaflet.css" />
@@ -471,15 +471,15 @@  discard block
 block discarded – undo
471 471
         var zoom = 13;
472 472
 //create the map
473 473
 <?php
474
-    if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) {
474
+	if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) {
475 475
 ?>
476 476
   map = L.map('map', { zoomControl:true }).setView([<?php print $airport_array[0]['latitude']; ?>,<?php print $airport_array[0]['longitude']; ?>], zoom);
477 477
 <?php
478
-    } elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) {
478
+	} elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) {
479 479
 ?>
480 480
   map = L.map('map', { zoomControl:true });
481 481
 <?php
482
-    } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) {
482
+	} elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) {
483 483
 ?>
484 484
   map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['departure_airport_latitude']; ?>,<?php print $spotter_array[0]['arrival_airport_longitude']; ?>]);
485 485
     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);
@@ -487,22 +487,22 @@  discard block
 block discarded – undo
487 487
     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);
488 488
     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);
489 489
 <?php
490
-    } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude'])) {
490
+	} elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude'])) {
491 491
 ?>
492 492
   map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['latitude']; ?>,<?php print $spotter_array[0]['longitude']; ?>]);
493 493
 <?php
494
-    } elseif (!isset($spotter_array[0]['latitude']) && !isset($spotter_array[0]['longitude'])) {
494
+	} elseif (!isset($spotter_array[0]['latitude']) && !isset($spotter_array[0]['longitude'])) {
495 495
 ?>
496 496
   map = L.map('map', { zoomControl:true });
497 497
 <?php
498
-    }
498
+	}
499 499
 ?>
500 500
   //initialize the layer group for the aircrft markers
501 501
   var layer_data = L.layerGroup();
502 502
 
503 503
   //a few title layers
504 504
 <?php
505
-    if ($globalMapProvider == 'Mapbox') {
505
+	if ($globalMapProvider == 'Mapbox') {
506 506
 ?>
507 507
   L.tileLayer('https://{s}.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={token}', {
508 508
     maxZoom: 18,
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
     token : '<?php print $globalMapboxToken; ?>'
514 514
   }).addTo(map);
515 515
 <?php
516
-    } elseif ($globalMapProvider == 'OpenStreetMap') {
516
+	} elseif ($globalMapProvider == 'OpenStreetMap') {
517 517
 ?>
518 518
   L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
519 519
     maxZoom: 18,
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
       '<a href="http://www.openstreetmap.org/copyright">Open Database Licence</a>'
522 522
   }).addTo(map);
523 523
 <?php
524
-    } elseif ($globalMapProvider == 'MapQuest-OSM') {
524
+	} elseif ($globalMapProvider == 'MapQuest-OSM') {
525 525
 ?>
526 526
   L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.png', {
527 527
     maxZoom: 18,
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
       'Tiles Courtesy of <a href="http://www.mapquest.com">MapQuest</a>'
531 531
   }).addTo(map);
532 532
 <?php
533
-    } elseif ($globalMapProvider == 'MapQuest-Aerial') {
533
+	} elseif ($globalMapProvider == 'MapQuest-Aerial') {
534 534
 ?>
535 535
   L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.png', {
536 536
     maxZoom: 18,
@@ -539,27 +539,27 @@  discard block
 block discarded – undo
539 539
       '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"'
540 540
   }).addTo(map);
541 541
 <?php
542
-    } elseif ($globalMapProvider == 'Google-Roadmap') {
542
+	} elseif ($globalMapProvider == 'Google-Roadmap') {
543 543
 ?>
544 544
     var googleLayer = new L.Google('ROADMAP');
545 545
     map.addLayer(googleLayer);
546 546
 <?php
547
-    } elseif ($globalMapProvider == 'Google-Satellite') {
547
+	} elseif ($globalMapProvider == 'Google-Satellite') {
548 548
 ?>
549 549
     var googleLayer = new L.Google('SATELLITE');
550 550
     map.addLayer(googleLayer);
551 551
 <?php
552
-    } elseif ($globalMapProvider == 'Google-Hybrid') {
552
+	} elseif ($globalMapProvider == 'Google-Hybrid') {
553 553
 ?>
554 554
     var googleLayer = new L.Google('HYBRID');
555 555
     map.addLayer(googleLayer);
556 556
 <?php
557
-    } elseif ($globalMapProvider == 'Google-Terrain') {
557
+	} elseif ($globalMapProvider == 'Google-Terrain') {
558 558
 ?>
559 559
     var googleLayer = new L.Google('Terrain');
560 560
     map.addLayer(googleLayer);
561 561
 <?php
562
-    }
562
+	}
563 563
 ?>
564 564
         </script>
565 565
     </div>
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -8,31 +8,31 @@  discard block
 block discarded – undo
8 8
 if (isset($_COOKIE['MapType']) && $_COOKIE['MapType'] != '') $MapType = $_COOKIE['MapType'];
9 9
 else $MapType = $globalMapProvider;
10 10
 if (isset($_GET['3d'])) {
11
-	setcookie('MapFormat','3d');
11
+	setcookie('MapFormat', '3d');
12 12
 } else if (isset($_GET['2d'])) {
13
-	setcookie('MapFormat','2d');
13
+	setcookie('MapFormat', '2d');
14 14
 }
15 15
 
16 16
 if (isset($_POST['archive'])) {
17
-	setcookie('archive','true');
18
-	setcookie('archive_begin',strtotime($_POST['start_date']));
19
-	setcookie('archive_end',strtotime($_POST['end_date']));
20
-	setcookie('archive_speed',$_POST['archivespeed']);
17
+	setcookie('archive', 'true');
18
+	setcookie('archive_begin', strtotime($_POST['start_date']));
19
+	setcookie('archive_end', strtotime($_POST['end_date']));
20
+	setcookie('archive_speed', $_POST['archivespeed']);
21 21
 }
22 22
 if (isset($_POST['noarchive'])) {
23
-	setcookie('archive','false',-1);
24
-	setcookie('archive_begin','',-1);
25
-	setcookie('archive_end','',-1);
26
-	setcookie('archive_speed','',-1);
23
+	setcookie('archive', 'false', -1);
24
+	setcookie('archive_begin', '', -1);
25
+	setcookie('archive_end', '', -1);
26
+	setcookie('archive_speed', '', -1);
27 27
 }
28 28
 // When button "Remove all filters" is clicked
29 29
 if (isset($_POST['removefilters'])) {
30
-	$allfilters = array_filter(array_keys($_COOKIE),function($key) {
31
-	    return strpos($key,'filter_') === 0;
30
+	$allfilters = array_filter(array_keys($_COOKIE), function($key) {
31
+	    return strpos($key, 'filter_') === 0;
32 32
 	});
33 33
 	foreach ($allfilters as $filt) {
34 34
 		unset($_COOKIE[$filt]);
35
-		setcookie($filt,null,-1);
35
+		setcookie($filt, null, -1);
36 36
 	}
37 37
 }
38 38
 
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 <script src="<?php print $globalURL; ?>/js/Marker.Rotate.js"></script>
217 217
 <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script>
218 218
 <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script>
219
-<script src="<?php print $globalURL; ?>/js/map.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script>
219
+<script src="<?php print $globalURL; ?>/js/map.js.php?ident=<?php print $ident; ?><?php if (isset($latitude)) print '&latitude='.$latitude; ?><?php if (isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script>
220 220
 <?php
221 221
 		if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '' && ($MapType == 'Google-Roadmap' || $MapType == 'Google-Satellite' || $MapType == 'Google-Hybrid' || $MapType == 'Google-Terrain')) {
222 222
 ?>
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 <script src="<?php print $globalURL; ?>/js/Marker.Rotate.js"></script>
271 271
 <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script>
272 272
 <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script>
273
-<script src="<?php print $globalURL; ?>/js/map.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script>
273
+<script src="<?php print $globalURL; ?>/js/map.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if (isset($latitude)) print '&latitude='.$latitude; ?><?php if (isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script>
274 274
 <?php
275 275
 		if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '' && ($MapType == 'Google-Roadmap' || $MapType == 'Google-Satellite' || $MapType == 'Google-Hybrid' || $MapType == 'Google-Terrain')) {
276 276
 ?>
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 ?>
434 434
       <div class="search">
435 435
       <form action="<?php print $globalURL; ?>/search" method="get">
436
-		<input type="text" name="q" value="<?php if (isset($GET['q'])) { if ($_GET['q'] != ""){ print $_GET['q']; } else { print _("Search"); } } else { print _("Search"); } ?>" onfocus="if (this.value=='search'){this.value='';}" /><button type="submit"><i class="fa fa-search"></i></button>
436
+		<input type="text" name="q" value="<?php if (isset($GET['q'])) { if ($_GET['q'] != "") { print $_GET['q']; } else { print _("Search"); } } else { print _("Search"); } ?>" onfocus="if (this.value=='search'){this.value='';}" /><button type="submit"><i class="fa fa-search"></i></button>
437 437
 	</form>
438 438
 	</div>
439 439
   	<div class="social">
@@ -451,14 +451,14 @@  discard block
 block discarded – undo
451 451
 	print '</div>';
452 452
 }
453 453
 
454
-if (strtolower($current_page) =='ident-detailed' || strtolower($current_page) == 'flightid-overview') {
454
+if (strtolower($current_page) == 'ident-detailed' || strtolower($current_page) == 'flightid-overview') {
455 455
 ?>
456 456
     <div class="top-header clear" role="main">
457 457
     <div id="archive-map"></div>
458 458
     </div>
459 459
 <?php
460 460
 }
461
-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))
461
+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))
462 462
 {
463 463
     ?>
464 464
     <div class="top-header clear" role="main">
@@ -471,15 +471,15 @@  discard block
 block discarded – undo
471 471
         var zoom = 13;
472 472
 //create the map
473 473
 <?php
474
-    if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) {
474
+    if (strpos(strtolower($current_page), 'airport-') !== false && strpos(strtolower($current_page), 'statistics-') === false && isset($airport_array[0]['latitude'])) {
475 475
 ?>
476 476
   map = L.map('map', { zoomControl:true }).setView([<?php print $airport_array[0]['latitude']; ?>,<?php print $airport_array[0]['longitude']; ?>], zoom);
477 477
 <?php
478
-    } elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) {
478
+    } elseif (strpos(strtolower($current_page), 'airport-') !== false && strpos(strtolower($current_page), 'statistics-') === false) {
479 479
 ?>
480 480
   map = L.map('map', { zoomControl:true });
481 481
 <?php
482
-    } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) {
482
+    } elseif (strpos(strtolower($current_page), 'route-') !== false && strpos(strtolower($current_page), 'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) {
483 483
 ?>
484 484
   map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['departure_airport_latitude']; ?>,<?php print $spotter_array[0]['arrival_airport_longitude']; ?>]);
485 485
     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);
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
     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);
488 488
     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);
489 489
 <?php
490
-    } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude'])) {
490
+    } elseif (strpos(strtolower($current_page), 'route-') !== false && strpos(strtolower($current_page), 'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude'])) {
491 491
 ?>
492 492
   map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['latitude']; ?>,<?php print $spotter_array[0]['longitude']; ?>]);
493 493
 <?php
Please login to merge, or discard this patch.
live-sat-czml.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -20,17 +20,17 @@  discard block
 block discarded – undo
20 20
 
21 21
 $spotter_array = array();
22 22
 if (isset($_COOKIE['sattypes']) && $_COOKIE['sattypes'] != '') {
23
-	$sattypes = explode(',',$_COOKIE['sattypes']);
23
+	$sattypes = explode(',', $_COOKIE['sattypes']);
24 24
 	foreach ($sattypes as $sattype) {
25
-		$spotter_array = array_merge($Satellite->position_all_type($sattype,$timeb-$globalLiveInterval,$timeb),$spotter_array);
25
+		$spotter_array = array_merge($Satellite->position_all_type($sattype, $timeb - $globalLiveInterval, $timeb), $spotter_array);
26 26
 	}
27 27
 }
28 28
 if (isset($_COOKIE['displayiss']) && $_COOKIE['displayiss']) {
29
-	$spotter_array = array_merge($Satellite->position('ISS (ZARYA)',time()-$globalLiveInterval,time()),$spotter_array);
30
-	$spotter_array = array_merge($Satellite->position('TIANGONG 1',time()-$globalLiveInterval,time()),$spotter_array);
31
-	$spotter_array = array_merge($Satellite->position('TIANGONG-2',time()-$globalLiveInterval,time()),$spotter_array);
29
+	$spotter_array = array_merge($Satellite->position('ISS (ZARYA)', time() - $globalLiveInterval, time()), $spotter_array);
30
+	$spotter_array = array_merge($Satellite->position('TIANGONG 1', time() - $globalLiveInterval, time()), $spotter_array);
31
+	$spotter_array = array_merge($Satellite->position('TIANGONG-2', time() - $globalLiveInterval, time()), $spotter_array);
32 32
 }
33
-$spotter_array = array_unique($spotter_array,SORT_REGULAR);
33
+$spotter_array = array_unique($spotter_array, SORT_REGULAR);
34 34
 /*
35 35
 $modelsdb = array();
36 36
 if (file_exists('models/space/space_modelsdb')) {
@@ -54,14 +54,14 @@  discard block
 block discarded – undo
54 54
 //	$output .= ',"clock": {"interval" : "'.date("c",time()-$globalLiveInterval).'/'.date("c").'","currentTime" : "'.date("c",time() - $globalLiveInterval).'","multiplier" : 1,"range" : "LOOP_STOP","step": "SYSTEM_CLOCK_MULTIPLIER"}';
55 55
 
56 56
 //	$output .= ',"clock": {"interval" : "'.date("c",time()-$globalLiveInterval).'/'.date("c").'","currentTime" : "'.date("c",time() - $globalLiveInterval).'","multiplier" : 1,"range" : "UNBOUNDED","step": "SYSTEM_CLOCK_MULTIPLIER"}';
57
-$output .= ',"clock": {"currentTime" : "'.date("c",time() - $globalLiveInterval).'","multiplier" : 1,"range" : "UNBOUNDED","step": "SYSTEM_CLOCK_MULTIPLIER"}';
57
+$output .= ',"clock": {"currentTime" : "'.date("c", time() - $globalLiveInterval).'","multiplier" : 1,"range" : "UNBOUNDED","step": "SYSTEM_CLOCK_MULTIPLIER"}';
58 58
 //$output .= ',"clock": {"currentTime" : "%minitime%","multiplier" : 1,"range" : "UNBOUNDED","step": "SYSTEM_CLOCK_MULTIPLIER"}';
59 59
 
60 60
 //	$output .= ',"clock": {"interval" : "'.date("c",time()-$globalLiveInterval).'/'.date("c").'","currentTime" : "'.date("c",time() - $globalLiveInterval).'","multiplier" : 1,"step": "SYSTEM_CLOCK_MULTIPLIER"}';
61 61
 $output .= '},';
62 62
 if (!empty($spotter_array) && is_array($spotter_array))
63 63
 {
64
-	foreach($spotter_array as $spotter_item)
64
+	foreach ($spotter_array as $spotter_item)
65 65
 	{
66 66
 		$j++;
67 67
 		date_default_timezone_set('UTC');
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 			$orientation = '';
77 77
 			$prev_satname = $spotter_item['name'];
78 78
 			$output .= '{';
79
-			$output .= '"id": "'.trim(str_replace(array('[+]','[-]'),'',$spotter_item['name'])).'",';
79
+			$output .= '"id": "'.trim(str_replace(array('[+]', '[-]'), '', $spotter_item['name'])).'",';
80 80
 			$output .= '"properties": {';
81 81
 			// Not yet supported in CZML with Cesium
82 82
 			$output .= '},';
@@ -114,23 +114,23 @@  discard block
 block discarded – undo
114 114
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/space/cubiesat.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },';
115 115
 				} elseif ($spotter_item['name'] == 'TERRA') {
116 116
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/space/terra.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },';
117
-				} elseif (strpos($spotter_item['name'],'O3B') !== false) {
117
+				} elseif (strpos($spotter_item['name'], 'O3B') !== false) {
118 118
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/space/o3b.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },';
119
-				} elseif (strpos($spotter_item['name'],'GLOBALSTAR') !== false) {
119
+				} elseif (strpos($spotter_item['name'], 'GLOBALSTAR') !== false) {
120 120
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/space/globalstar.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },';
121
-				} elseif (strpos($spotter_item['name'],'GPS') !== false) {
121
+				} elseif (strpos($spotter_item['name'], 'GPS') !== false) {
122 122
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/space/gps.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },';
123
-				} elseif (strpos($spotter_item['name'],'GENESIS') !== false) {
123
+				} elseif (strpos($spotter_item['name'], 'GENESIS') !== false) {
124 124
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/space/genesis.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },';
125
-				} elseif (strpos($spotter_item['name'],'OSCAR 7') !== false) {
125
+				} elseif (strpos($spotter_item['name'], 'OSCAR 7') !== false) {
126 126
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/space/oscar7.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },';
127
-				} elseif (strpos($spotter_item['name'],'FLOCK') !== false) {
127
+				} elseif (strpos($spotter_item['name'], 'FLOCK') !== false) {
128 128
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/space/cubesat.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },';
129
-				} elseif (strpos($spotter_item['name'],'PLEIADES') !== false) {
129
+				} elseif (strpos($spotter_item['name'], 'PLEIADES') !== false) {
130 130
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/space/pleiades.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },';
131
-				} elseif (strpos($spotter_item['name'],'DUCHIFAT') !== false) {
131
+				} elseif (strpos($spotter_item['name'], 'DUCHIFAT') !== false) {
132 132
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/space/duchifat.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },';
133
-				} elseif (strpos($spotter_item['name'],'FORMOSAT-2') !== false) {
133
+				} elseif (strpos($spotter_item['name'], 'FORMOSAT-2') !== false) {
134 134
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/space/formosat2.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },';
135 135
 				} elseif ($spotter_item['type'] == 'iridium') {
136 136
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/space/iridium.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },';
@@ -151,14 +151,14 @@  discard block
 block discarded – undo
151 151
 	//		$output .= '"interpolationDegree" : 5,';
152 152
 	//		$output .= '"epoch" : "'.date("c",strtotime($spotter_item['date'])).'", ';
153 153
 			$output .= '"cartographicDegrees": [';
154
-			$output .= '"'.date("c",$spotter_item['timestamp']).'", ';
154
+			$output .= '"'.date("c", $spotter_item['timestamp']).'", ';
155 155
 			$output .= $spotter_item['longitude'].', ';
156 156
 			$output .= $spotter_item['latitude'].', ';
157 157
 			$output .= $spotter_item['altitude']*1000;
158 158
 			$orientation = '"orientation" : { ';
159 159
 			$orientation .= '"unitQuaternion": [';
160 160
 		} else {
161
-			$output .= ',"'.date("c",$spotter_item['timestamp']).'", ';
161
+			$output .= ',"'.date("c", $spotter_item['timestamp']).'", ';
162 162
 			$output .= $spotter_item['longitude'].', ';
163 163
 			$output .= $spotter_item['latitude'].', ';
164 164
 			$output .= $spotter_item['altitude']*1000;
Please login to merge, or discard this patch.
require/class.Stats.php 4 patches
Doc Comments   +32 added lines patch added patch discarded remove patch
@@ -13,6 +13,10 @@  discard block
 block discarded – undo
13 13
 		$this->db = $Connection->db();
14 14
         }
15 15
               
16
+	/**
17
+	 * @param string $type
18
+	 * @param string $stats_date
19
+	 */
16 20
 	public function addLastStatsUpdate($type,$stats_date) {
17 21
                 $query = "DELETE FROM config WHERE name = :type;
18 22
             		INSERT INTO config (name,value) VALUES (:type,:stats_date);";
@@ -578,6 +582,11 @@  discard block
 block discarded – undo
578 582
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
579 583
                 return $all;
580 584
         }
585
+
586
+	/**
587
+	 * @param string $type
588
+	 * @param string $year
589
+	 */
581 590
 	public function getSumStats($type,$year,$stats_airline = '') {
582 591
     		global $globalArchiveMonths, $globalDBdriver;
583 592
     		if ($globalDBdriver == 'mysql') {
@@ -677,6 +686,10 @@  discard block
 block discarded – undo
677 686
                 return $all[0]['total'];
678 687
         }
679 688
 
689
+	/**
690
+	 * @param string $type
691
+	 * @param string $stats_date
692
+	 */
680 693
 	public function addStat($type,$cnt,$stats_date,$stats_airline = '') {
681 694
 		global $globalDBdriver;
682 695
 		if ($globalDBdriver == 'mysql') {
@@ -708,6 +721,10 @@  discard block
 block discarded – undo
708 721
                         return "error : ".$e->getMessage();
709 722
                 }
710 723
         }
724
+
725
+	/**
726
+	 * @param string $date
727
+	 */
711 728
 	public function getStatsSource($date,$stats_type = '') {
712 729
 		if ($stats_type == '') {
713 730
 			$query = "SELECT * FROM stats_source WHERE stats_date = :date ORDER BY source_name";
@@ -726,6 +743,9 @@  discard block
 block discarded – undo
726 743
                 return $all;
727 744
         }
728 745
 
746
+	/**
747
+	 * @param string $stats_type
748
+	 */
729 749
 	public function addStatSource($data,$source_name,$stats_type,$date) {
730 750
 		global $globalDBdriver;
731 751
 		if ($globalDBdriver == 'mysql') {
@@ -741,6 +761,10 @@  discard block
 block discarded – undo
741 761
                         return "error : ".$e->getMessage();
742 762
                 }
743 763
         }
764
+
765
+	/**
766
+	 * @param string $type
767
+	 */
744 768
 	public function addStatFlight($type,$date_name,$cnt,$stats_airline = '') {
745 769
                 $query = "INSERT INTO stats_flight (stats_type,flight_date,cnt,stats_airline) VALUES (:type,:flight_date,:cnt,:stats_airline)";
746 770
                 $query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt, ':stats_airline' => $stats_airline);
@@ -927,6 +951,10 @@  discard block
 block discarded – undo
927 951
                         return "error : ".$e->getMessage();
928 952
                 }
929 953
         }
954
+
955
+	/**
956
+	 * @param string $type
957
+	 */
930 958
 	public function deleteStatFlight($type) {
931 959
                 $query = "DELETE FROM stats_flight WHERE stats_type = :type";
932 960
                 $query_values = array(':type' => $type);
@@ -937,6 +965,10 @@  discard block
 block discarded – undo
937 965
                         return "error : ".$e->getMessage();
938 966
                 }
939 967
         }
968
+
969
+	/**
970
+	 * @param string $type
971
+	 */
940 972
 	public function deleteStatAirport($type) {
941 973
                 $query = "DELETE FROM stats_airport WHERE stats_type = :type";
942 974
                 $query_values = array(':type' => $type);
Please login to merge, or discard this patch.
Indentation   +815 added lines, -815 removed lines patch added patch discarded remove patch
@@ -15,67 +15,67 @@  discard block
 block discarded – undo
15 15
 		if (isset($globalFilterName)) $this->filter_name = $globalFilterName;
16 16
 		$Connection = new Connection($dbc);
17 17
 		$this->db = $Connection->db();
18
-        }
18
+		}
19 19
               
20 20
 	public function addLastStatsUpdate($type,$stats_date) {
21
-                $query = "DELETE FROM config WHERE name = :type;
21
+				$query = "DELETE FROM config WHERE name = :type;
22 22
             		INSERT INTO config (name,value) VALUES (:type,:stats_date);";
23
-                $query_values = array('type' => $type,':stats_date' => $stats_date);
24
-                 try {
25
-                        $sth = $this->db->prepare($query);
26
-                        $sth->execute($query_values);
27
-                } catch(PDOException $e) {
28
-                        return "error : ".$e->getMessage();
29
-                }
30
-        }
23
+				$query_values = array('type' => $type,':stats_date' => $stats_date);
24
+				 try {
25
+						$sth = $this->db->prepare($query);
26
+						$sth->execute($query_values);
27
+				} catch(PDOException $e) {
28
+						return "error : ".$e->getMessage();
29
+				}
30
+		}
31 31
 
32 32
 	public function getLastStatsUpdate($type = 'last_update_stats') {
33
-                $query = "SELECT value FROM config WHERE name = :type";
34
-                 try {
35
-                        $sth = $this->db->prepare($query);
36
-                        $sth->execute(array(':type' => $type));
37
-                } catch(PDOException $e) {
38
-                        echo "error : ".$e->getMessage();
39
-                }
40
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
41
-                return $all;
42
-        }
33
+				$query = "SELECT value FROM config WHERE name = :type";
34
+				 try {
35
+						$sth = $this->db->prepare($query);
36
+						$sth->execute(array(':type' => $type));
37
+				} catch(PDOException $e) {
38
+						echo "error : ".$e->getMessage();
39
+				}
40
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
41
+				return $all;
42
+		}
43 43
 	public function getAllAirlineNames($filter_name = '') {
44 44
 		if ($filter_name == '') $filter_name = $this->filter_name;
45
-                $query = "SELECT * FROM stats_airline WHERE filter_name = :filter_name ORDER BY airline_name ASC";
46
-                 try {
47
-                        $sth = $this->db->prepare($query);
48
-                        $sth->execute(array(':filter_name' => $filter_name));
49
-                } catch(PDOException $e) {
50
-                        echo "error : ".$e->getMessage();
51
-                }
52
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
53
-                return $all;
54
-        }
45
+				$query = "SELECT * FROM stats_airline WHERE filter_name = :filter_name ORDER BY airline_name ASC";
46
+				 try {
47
+						$sth = $this->db->prepare($query);
48
+						$sth->execute(array(':filter_name' => $filter_name));
49
+				} catch(PDOException $e) {
50
+						echo "error : ".$e->getMessage();
51
+				}
52
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
53
+				return $all;
54
+		}
55 55
 	public function getAllAircraftTypes($stats_airline = '',$filter_name = '') {
56 56
 		if ($filter_name == '') $filter_name = $this->filter_name;
57
-                $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC";
58
-                 try {
59
-                        $sth = $this->db->prepare($query);
60
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
61
-                } catch(PDOException $e) {
62
-                        echo "error : ".$e->getMessage();
63
-                }
64
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
65
-                return $all;
66
-        }
57
+				$query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC";
58
+				 try {
59
+						$sth = $this->db->prepare($query);
60
+						$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
61
+				} catch(PDOException $e) {
62
+						echo "error : ".$e->getMessage();
63
+				}
64
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
65
+				return $all;
66
+		}
67 67
 	public function getAllAirportNames($stats_airline = '',$filter_name = '') {
68 68
 		if ($filter_name == '') $filter_name = $this->filter_name;
69
-                $query = "SELECT airport_icao, airport_name,airport_city,airport_country FROM stats_airport WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND stats_type = 'daily' GROUP BY airport_icao,airport_name,airport_city,airport_country ORDER BY airport_city ASC";
70
-                 try {
71
-                        $sth = $this->db->prepare($query);
72
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
73
-                } catch(PDOException $e) {
74
-                        echo "error : ".$e->getMessage();
75
-                }
76
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
77
-                return $all;
78
-        }
69
+				$query = "SELECT airport_icao, airport_name,airport_city,airport_country FROM stats_airport WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND stats_type = 'daily' GROUP BY airport_icao,airport_name,airport_city,airport_country ORDER BY airport_city ASC";
70
+				 try {
71
+						$sth = $this->db->prepare($query);
72
+						$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
73
+				} catch(PDOException $e) {
74
+						echo "error : ".$e->getMessage();
75
+				}
76
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
77
+				return $all;
78
+		}
79 79
 
80 80
 
81 81
 	public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '') {
@@ -83,66 +83,66 @@  discard block
 block discarded – undo
83 83
 		if ($filter_name == '') $filter_name = $this->filter_name;
84 84
 		if ($limit) $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0";
85 85
 		else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC";
86
-                 try {
87
-                        $sth = $this->db->prepare($query);
88
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
89
-                } catch(PDOException $e) {
90
-                        echo "error : ".$e->getMessage();
91
-                }
92
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
93
-                if (empty($all)) {
94
-            	    $filters = array('airlines' => array($stats_airline));
95
-            	    if ($filter_name != '') {
96
-            		    $filters = array_merge($filters,$globalStatsFilters[$filter_name]);
97
-            	    }
98
-            	    $Spotter = new Spotter($this->db);
99
-            	    $all = $Spotter->countAllAircraftTypes($limit,0,'',$filters);
100
-                }
101
-                return $all;
86
+				 try {
87
+						$sth = $this->db->prepare($query);
88
+						$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
89
+				} catch(PDOException $e) {
90
+						echo "error : ".$e->getMessage();
91
+				}
92
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
93
+				if (empty($all)) {
94
+					$filters = array('airlines' => array($stats_airline));
95
+					if ($filter_name != '') {
96
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
97
+					}
98
+					$Spotter = new Spotter($this->db);
99
+					$all = $Spotter->countAllAircraftTypes($limit,0,'',$filters);
100
+				}
101
+				return $all;
102 102
 	}
103 103
 	public function countAllAirlineCountries($limit = true,$filter_name = '') {
104 104
 		global $globalStatsFilters;
105 105
 		if ($filter_name == '') $filter_name = $this->filter_name;
106 106
 		if ($limit) $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0";
107 107
 		else $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC";
108
-                 try {
109
-                        $sth = $this->db->prepare($query);
110
-                        $sth->execute(array(':filter_name' => $filter_name));
111
-                } catch(PDOException $e) {
112
-                        echo "error : ".$e->getMessage();
113
-                }
114
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
115
-                if (empty($all)) {
116
-            		$Spotter = new Spotter($this->db);
117
-            		$filters = array();
118
-            		if ($filter_name != '') {
119
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
120
-			}
121
-            		$all = $Spotter->countAllAirlineCountries($limit,$filters);
122
-                }
123
-                return $all;
108
+				 try {
109
+						$sth = $this->db->prepare($query);
110
+						$sth->execute(array(':filter_name' => $filter_name));
111
+				} catch(PDOException $e) {
112
+						echo "error : ".$e->getMessage();
113
+				}
114
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
115
+				if (empty($all)) {
116
+					$Spotter = new Spotter($this->db);
117
+					$filters = array();
118
+					if ($filter_name != '') {
119
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
120
+			}
121
+					$all = $Spotter->countAllAirlineCountries($limit,$filters);
122
+				}
123
+				return $all;
124 124
 	}
125 125
 	public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '') {
126 126
 		global $globalStatsFilters;
127 127
 		if ($filter_name == '') $filter_name = $this->filter_name;
128 128
 		if ($limit) $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0";
129 129
 		else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC";
130
-                 try {
131
-                        $sth = $this->db->prepare($query);
132
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
133
-                } catch(PDOException $e) {
134
-                        echo "error : ".$e->getMessage();
135
-                }
136
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
137
-                if (empty($all)) {
138
-            		$filters = array('airlines' => array($stats_airline));
139
-            		if ($filter_name != '') {
140
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
130
+				 try {
131
+						$sth = $this->db->prepare($query);
132
+						$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
133
+				} catch(PDOException $e) {
134
+						echo "error : ".$e->getMessage();
135
+				}
136
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
137
+				if (empty($all)) {
138
+					$filters = array('airlines' => array($stats_airline));
139
+					if ($filter_name != '') {
140
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
141 141
 			}
142
-            		$Spotter = new Spotter($this->db);
142
+					$Spotter = new Spotter($this->db);
143 143
 			$all = $Spotter->countAllAircraftManufacturers($filters);
144
-                }
145
-                return $all;
144
+				}
145
+				return $all;
146 146
 	}
147 147
 
148 148
 	public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '') {
@@ -150,44 +150,44 @@  discard block
 block discarded – undo
150 150
 		if ($filter_name == '') $filter_name = $this->filter_name;
151 151
 		if ($limit) $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0";
152 152
 		else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC";
153
-                 try {
154
-                        $sth = $this->db->prepare($query);
155
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
156
-                } catch(PDOException $e) {
157
-                        echo "error : ".$e->getMessage();
158
-                }
159
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
160
-                if (empty($all)) {
153
+				 try {
154
+						$sth = $this->db->prepare($query);
155
+						$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
156
+				} catch(PDOException $e) {
157
+						echo "error : ".$e->getMessage();
158
+				}
159
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
160
+				if (empty($all)) {
161 161
 			$filters = array('airlines' => array($stats_airline));
162 162
 			if ($filter_name != '') {
163
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
163
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
164 164
 			}
165 165
 			$Spotter = new Spotter($this->db);
166 166
 			$all = $Spotter->countAllArrivalCountries($limit,$filters);
167
-                }
168
-                return $all;
167
+				}
168
+				return $all;
169 169
 	}
170 170
 	public function countAllDepartureCountries($limit = true, $stats_airline = '', $filter_name = '') {
171 171
 		global $globalStatsFilters;
172 172
 		if ($filter_name == '') $filter_name = $this->filter_name;
173 173
 		if ($limit) $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0";
174 174
 		else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC";
175
-                 try {
176
-                        $sth = $this->db->prepare($query);
177
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
178
-                } catch(PDOException $e) {
179
-                        echo "error : ".$e->getMessage();
180
-                }
181
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
182
-                if (empty($all)) {
175
+				 try {
176
+						$sth = $this->db->prepare($query);
177
+						$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
178
+				} catch(PDOException $e) {
179
+						echo "error : ".$e->getMessage();
180
+				}
181
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
182
+				if (empty($all)) {
183 183
 			$filters = array('airlines' => array($stats_airline));
184 184
 			if ($filter_name != '') {
185
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
185
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
186 186
 			}
187 187
 			$Spotter = new Spotter($this->db);
188 188
 			$all = $Spotter->countAllDepartureCountries($filters);
189
-                }
190
-                return $all;
189
+				}
190
+				return $all;
191 191
 	}
192 192
 
193 193
 	public function countAllAirlines($limit = true,$filter_name = '') {
@@ -195,45 +195,45 @@  discard block
 block discarded – undo
195 195
 		if ($filter_name == '') $filter_name = $this->filter_name;
196 196
 		if ($limit) $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name ORDER BY airline_count DESC LIMIT 10 OFFSET 0";
197 197
 		else $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name ORDER BY airline_count DESC";
198
-                 try {
199
-                        $sth = $this->db->prepare($query);
200
-                        $sth->execute(array(':filter_name' => $filter_name));
201
-                } catch(PDOException $e) {
202
-                        echo "error : ".$e->getMessage();
203
-                }
204
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
205
-                if (empty($all)) {
206
-	                $Spotter = new Spotter($this->db);
207
-            		$filters = array();
208
-            		if ($filter_name != '') {
209
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
198
+				 try {
199
+						$sth = $this->db->prepare($query);
200
+						$sth->execute(array(':filter_name' => $filter_name));
201
+				} catch(PDOException $e) {
202
+						echo "error : ".$e->getMessage();
203
+				}
204
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
205
+				if (empty($all)) {
206
+					$Spotter = new Spotter($this->db);
207
+					$filters = array();
208
+					if ($filter_name != '') {
209
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
210 210
 			}
211 211
 
212
-    		        $all = $Spotter->countAllAirlines($limit,0,'',$filters);
213
-                }
214
-                return $all;
212
+					$all = $Spotter->countAllAirlines($limit,0,'',$filters);
213
+				}
214
+				return $all;
215 215
 	}
216 216
 	public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '') {
217 217
 		global $globalStatsFilters;
218 218
 		if ($filter_name == '') $filter_name = $this->filter_name;
219 219
 		if ($limit) $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0";
220 220
 		else $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC";
221
-                 try {
222
-                        $sth = $this->db->prepare($query);
223
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
224
-                } catch(PDOException $e) {
225
-                        echo "error : ".$e->getMessage();
226
-                }
227
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
228
-                if (empty($all)) {
221
+				 try {
222
+						$sth = $this->db->prepare($query);
223
+						$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
224
+				} catch(PDOException $e) {
225
+						echo "error : ".$e->getMessage();
226
+				}
227
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
228
+				if (empty($all)) {
229 229
 			$filters = array('airlines' => array($stats_airline));
230 230
 			if ($filter_name != '') {
231 231
 				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
232 232
 			}
233
-	                $Spotter = new Spotter($this->db);
234
-    		        $all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters);
235
-                }
236
-                return $all;
233
+					$Spotter = new Spotter($this->db);
234
+					$all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters);
235
+				}
236
+				return $all;
237 237
 	}
238 238
 	public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '') {
239 239
 		global $globalStatsFilters;
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 				echo "error : ".$e->getMessage();
271 271
 			}
272 272
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
273
-                /*
273
+				/*
274 274
                 if (empty($all)) {
275 275
 	                $Spotter = new Spotter($this->db);
276 276
     		        $all = $Spotter->countAllFlightOverCountries($limit);
@@ -286,84 +286,84 @@  discard block
 block discarded – undo
286 286
 		if ($filter_name == '') $filter_name = $this->filter_name;
287 287
 		if ($limit) $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC LIMIT 10 OFFSET 0";
288 288
 		else $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC";
289
-                 try {
290
-                        $sth = $this->db->prepare($query);
291
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
292
-                } catch(PDOException $e) {
293
-                        echo "error : ".$e->getMessage();
294
-                }
295
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
296
-                if (empty($all)) {
289
+				 try {
290
+						$sth = $this->db->prepare($query);
291
+						$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
292
+				} catch(PDOException $e) {
293
+						echo "error : ".$e->getMessage();
294
+				}
295
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
296
+				if (empty($all)) {
297 297
 			$filters = array('airlines' => array($stats_airline));
298 298
 			if ($filter_name != '') {
299 299
 				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
300 300
 			}
301
-            		$Spotter = new Spotter($this->db);
302
-            		$all = $Spotter->countAllPilots($limit,0,'',$filters);
303
-                }
304
-                return $all;
301
+					$Spotter = new Spotter($this->db);
302
+					$all = $Spotter->countAllPilots($limit,0,'',$filters);
303
+				}
304
+				return $all;
305 305
 	}
306 306
 	public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '') {
307 307
 		global $globalStatsFilters;
308 308
 		if ($filter_name == '') $filter_name = $this->filter_name;
309 309
 		if ($limit) $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0";
310 310
 		else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC";
311
-                 try {
312
-                        $sth = $this->db->prepare($query);
313
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
314
-                } catch(PDOException $e) {
315
-                        echo "error : ".$e->getMessage();
316
-                }
317
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
318
-                if (empty($all)) {
311
+				 try {
312
+						$sth = $this->db->prepare($query);
313
+						$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
314
+				} catch(PDOException $e) {
315
+						echo "error : ".$e->getMessage();
316
+				}
317
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
318
+				if (empty($all)) {
319 319
 			$filters = array('airlines' => array($stats_airline));
320 320
 			if ($filter_name != '') {
321 321
 				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
322 322
 			}
323
-            		$Spotter = new Spotter($this->db);
324
-            		$all = $Spotter->countAllOwners($limit,0,'',$filters);
325
-                }
326
-                return $all;
323
+					$Spotter = new Spotter($this->db);
324
+					$all = $Spotter->countAllOwners($limit,0,'',$filters);
325
+				}
326
+				return $all;
327 327
 	}
328 328
 	public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '') {
329 329
 		global $globalStatsFilters;
330 330
 		if ($filter_name == '') $filter_name = $this->filter_name;
331 331
 		if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0";
332 332
 		else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC";
333
-                 try {
334
-                        $sth = $this->db->prepare($query);
335
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
336
-                } catch(PDOException $e) {
337
-                        echo "error : ".$e->getMessage();
338
-                }
339
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
340
-                if (empty($all)) {
333
+				 try {
334
+						$sth = $this->db->prepare($query);
335
+						$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
336
+				} catch(PDOException $e) {
337
+						echo "error : ".$e->getMessage();
338
+				}
339
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
340
+				if (empty($all)) {
341 341
 			$filters = array('airlines' => array($stats_airline));
342
-            		if ($filter_name != '') {
343
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
344
-			}
345
-            		$Spotter = new Spotter($this->db);
346
-            		$pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters);
347
-        		$dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters);
348
-        		$all = array();
349
-        		foreach ($pall as $value) {
350
-        			$icao = $value['airport_departure_icao'];
351
-        			$all[$icao] = $value;
352
-        		}
342
+					if ($filter_name != '') {
343
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
344
+			}
345
+					$Spotter = new Spotter($this->db);
346
+					$pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters);
347
+				$dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters);
348
+				$all = array();
349
+				foreach ($pall as $value) {
350
+					$icao = $value['airport_departure_icao'];
351
+					$all[$icao] = $value;
352
+				}
353 353
         		
354
-        		foreach ($dall as $value) {
355
-        			$icao = $value['airport_departure_icao'];
356
-        			if (isset($all[$icao])) {
357
-        				$all[$icao]['airport_departure_icao_count'] = $all[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
358
-        			} else $all[$icao] = $value;
359
-        		}
360
-        		$count = array();
361
-        		foreach ($all as $key => $row) {
362
-        			$count[$key] = $row['airport_departure_icao_count'];
363
-        		}
364
-        		array_multisort($count,SORT_DESC,$all);
365
-                }
366
-                return $all;
354
+				foreach ($dall as $value) {
355
+					$icao = $value['airport_departure_icao'];
356
+					if (isset($all[$icao])) {
357
+						$all[$icao]['airport_departure_icao_count'] = $all[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
358
+					} else $all[$icao] = $value;
359
+				}
360
+				$count = array();
361
+				foreach ($all as $key => $row) {
362
+					$count[$key] = $row['airport_departure_icao_count'];
363
+				}
364
+				array_multisort($count,SORT_DESC,$all);
365
+				}
366
+				return $all;
367 367
 	}
368 368
 	public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '') {
369 369
 		global $globalStatsFilters;
@@ -385,26 +385,26 @@  discard block
 block discarded – undo
385 385
 			$Spotter = new Spotter($this->db);
386 386
 			$pall = $Spotter->countAllArrivalAirports($limit,0,'',false,$filters);
387 387
 			$dall = $Spotter->countAllDetectedArrivalAirports($limit,0,'',false,$filters);
388
-        		$all = array();
389
-        		foreach ($pall as $value) {
390
-        			$icao = $value['airport_arrival_icao'];
391
-        			$all[$icao] = $value;
392
-        		}
388
+				$all = array();
389
+				foreach ($pall as $value) {
390
+					$icao = $value['airport_arrival_icao'];
391
+					$all[$icao] = $value;
392
+				}
393 393
         		
394
-        		foreach ($dall as $value) {
395
-        			$icao = $value['airport_arrival_icao'];
396
-        			if (isset($all[$icao])) {
397
-        				$all[$icao]['airport_arrival_icao_count'] = $all[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
398
-        			} else $all[$icao] = $value;
399
-        		}
400
-        		$count = array();
401
-        		foreach ($all as $key => $row) {
402
-        			$count[$key] = $row['airport_arrival_icao_count'];
403
-        		}
404
-        		array_multisort($count,SORT_DESC,$all);
405
-                }
394
+				foreach ($dall as $value) {
395
+					$icao = $value['airport_arrival_icao'];
396
+					if (isset($all[$icao])) {
397
+						$all[$icao]['airport_arrival_icao_count'] = $all[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
398
+					} else $all[$icao] = $value;
399
+				}
400
+				$count = array();
401
+				foreach ($all as $key => $row) {
402
+					$count[$key] = $row['airport_arrival_icao_count'];
403
+				}
404
+				array_multisort($count,SORT_DESC,$all);
405
+				}
406 406
  
407
-                return $all;
407
+				return $all;
408 408
 	}
409 409
 	public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') {
410 410
 		global $globalDBdriver, $globalStatsFilters;
@@ -417,23 +417,23 @@  discard block
 block discarded – undo
417 417
 			else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
418 418
 		}
419 419
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
420
-                 try {
421
-                        $sth = $this->db->prepare($query);
422
-                        $sth->execute($query_data);
423
-                } catch(PDOException $e) {
424
-                        echo "error : ".$e->getMessage();
425
-                }
426
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
427
-                if (empty($all)) {
420
+				 try {
421
+						$sth = $this->db->prepare($query);
422
+						$sth->execute($query_data);
423
+				} catch(PDOException $e) {
424
+						echo "error : ".$e->getMessage();
425
+				}
426
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
427
+				if (empty($all)) {
428 428
 			$filters = array('airlines' => array($stats_airline));
429 429
 			if ($filter_name != '') {
430 430
 				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
431 431
 			}
432
-            		$Spotter = new Spotter($this->db);
433
-            		$all = $Spotter->countAllMonthsLastYear($filters);
434
-                }
432
+					$Spotter = new Spotter($this->db);
433
+					$all = $Spotter->countAllMonthsLastYear($filters);
434
+				}
435 435
                 
436
-                return $all;
436
+				return $all;
437 437
 	}
438 438
 	
439 439
 	public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') {
@@ -441,22 +441,22 @@  discard block
 block discarded – undo
441 441
 		if ($filter_name == '') $filter_name = $this->filter_name;
442 442
 		$query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND stats_airline = :stats_airline AND filter_name = :filter_name";
443 443
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
444
-                 try {
445
-                        $sth = $this->db->prepare($query);
446
-                        $sth->execute($query_data);
447
-                } catch(PDOException $e) {
448
-                        echo "error : ".$e->getMessage();
449
-                }
450
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
451
-                if (empty($all)) {
444
+				 try {
445
+						$sth = $this->db->prepare($query);
446
+						$sth->execute($query_data);
447
+				} catch(PDOException $e) {
448
+						echo "error : ".$e->getMessage();
449
+				}
450
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
451
+				if (empty($all)) {
452 452
 			$filters = array('airlines' => array($stats_airline));
453 453
 			if ($filter_name != '') {
454 454
 				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
455 455
 			}
456
-            		$Spotter = new Spotter($this->db);
457
-            		$all = $Spotter->countAllDatesLastMonth($filters);
458
-                }
459
-                return $all;
456
+					$Spotter = new Spotter($this->db);
457
+					$all = $Spotter->countAllDatesLastMonth($filters);
458
+				}
459
+				return $all;
460 460
 	}
461 461
 	public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') {
462 462
 		global $globalDBdriver, $globalStatsFilters;
@@ -467,108 +467,108 @@  discard block
 block discarded – undo
467 467
 			$query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '7 DAYS' AND stats_airline = :stats_airline AND filter_name = :filter_name";
468 468
 		}
469 469
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
470
-                 try {
471
-                        $sth = $this->db->prepare($query);
472
-                        $sth->execute($query_data);
473
-                } catch(PDOException $e) {
474
-                        echo "error : ".$e->getMessage();
475
-                }
476
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
477
-                if (empty($all)) {
470
+				 try {
471
+						$sth = $this->db->prepare($query);
472
+						$sth->execute($query_data);
473
+				} catch(PDOException $e) {
474
+						echo "error : ".$e->getMessage();
475
+				}
476
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
477
+				if (empty($all)) {
478 478
 			$filters = array('airlines' => array($stats_airline));
479 479
 			if ($filter_name != '') {
480 480
 				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
481 481
 			}
482
-            		$Spotter = new Spotter($this->db);
483
-            		$all = $Spotter->countAllDatesLast7Days($filters);
484
-                }
485
-                return $all;
482
+					$Spotter = new Spotter($this->db);
483
+					$all = $Spotter->countAllDatesLast7Days($filters);
484
+				}
485
+				return $all;
486 486
 	}
487 487
 	public function countAllDates($stats_airline = '',$filter_name = '') {
488 488
 		global $globalStatsFilters;
489 489
 		if ($filter_name == '') $filter_name = $this->filter_name;
490 490
 		$query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND stats_airline = :stats_airline AND filter_name = :filter_name";
491 491
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
492
-                 try {
493
-                        $sth = $this->db->prepare($query);
494
-                        $sth->execute($query_data);
495
-                } catch(PDOException $e) {
496
-                        echo "error : ".$e->getMessage();
497
-                }
498
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
499
-                if (empty($all)) {
492
+				 try {
493
+						$sth = $this->db->prepare($query);
494
+						$sth->execute($query_data);
495
+				} catch(PDOException $e) {
496
+						echo "error : ".$e->getMessage();
497
+				}
498
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
499
+				if (empty($all)) {
500 500
 			$filters = array('airlines' => array($stats_airline));
501 501
 			if ($filter_name != '') {
502
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
502
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
503 503
 			}
504
-            		$Spotter = new Spotter($this->db);
505
-            		$all = $Spotter->countAllDates($filters);
506
-                }
507
-                return $all;
504
+					$Spotter = new Spotter($this->db);
505
+					$all = $Spotter->countAllDates($filters);
506
+				}
507
+				return $all;
508 508
 	}
509 509
 	public function countAllDatesByAirlines($filter_name = '') {
510 510
 		global $globalStatsFilters;
511 511
 		if ($filter_name == '') $filter_name = $this->filter_name;
512 512
 		$query = "SELECT stats_airline as airline_icao, flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND filter_name = :filter_name";
513 513
 		$query_data = array('filter_name' => $filter_name);
514
-                 try {
515
-                        $sth = $this->db->prepare($query);
516
-                        $sth->execute($query_data);
517
-                } catch(PDOException $e) {
518
-                        echo "error : ".$e->getMessage();
519
-                }
520
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
521
-                if (empty($all)) {
522
-            		$filters = array();
523
-            		if ($filter_name != '') {
524
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
525
-			}
526
-            		$Spotter = new Spotter($this->db);
527
-            		$all = $Spotter->countAllDatesByAirlines($filters);
528
-                }
529
-                return $all;
514
+				 try {
515
+						$sth = $this->db->prepare($query);
516
+						$sth->execute($query_data);
517
+				} catch(PDOException $e) {
518
+						echo "error : ".$e->getMessage();
519
+				}
520
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
521
+				if (empty($all)) {
522
+					$filters = array();
523
+					if ($filter_name != '') {
524
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
525
+			}
526
+					$Spotter = new Spotter($this->db);
527
+					$all = $Spotter->countAllDatesByAirlines($filters);
528
+				}
529
+				return $all;
530 530
 	}
531 531
 	public function countAllMonths($stats_airline = '',$filter_name = '') {
532 532
 		global $globalStatsFilters;
533 533
 		if ($filter_name == '') $filter_name = $this->filter_name;
534
-	    	$query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
535
-                 try {
536
-                        $sth = $this->db->prepare($query);
537
-                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
538
-                } catch(PDOException $e) {
539
-                        echo "error : ".$e->getMessage();
540
-                }
541
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
542
-                if (empty($all)) {
534
+			$query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
535
+				 try {
536
+						$sth = $this->db->prepare($query);
537
+						$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
538
+				} catch(PDOException $e) {
539
+						echo "error : ".$e->getMessage();
540
+				}
541
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
542
+				if (empty($all)) {
543 543
 			$filters = array('airlines' => array($stats_airline));
544 544
 			if ($filter_name != '') {
545 545
 				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
546 546
 			}
547
-            		$Spotter = new Spotter($this->db);
548
-            		$all = $Spotter->countAllMonths($filters);
549
-                }
550
-                return $all;
547
+					$Spotter = new Spotter($this->db);
548
+					$all = $Spotter->countAllMonths($filters);
549
+				}
550
+				return $all;
551 551
 	}
552 552
 	public function countAllMilitaryMonths($filter_name = '') {
553 553
 		global $globalStatsFilters;
554 554
 		if ($filter_name == '') $filter_name = $this->filter_name;
555
-	    	$query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'military_flights_bymonth' AND filter_name = :filter_name";
556
-                 try {
557
-                        $sth = $this->db->prepare($query);
558
-                        $sth->execute(array(':filter_name' => $filter_name));
559
-                } catch(PDOException $e) {
560
-                        echo "error : ".$e->getMessage();
561
-                }
562
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
563
-                if (empty($all)) {
564
-            		$filters = array();
565
-            		if ($filter_name != '') {
566
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
567
-			}
568
-            		$Spotter = new Spotter($this->db);
569
-            		$all = $Spotter->countAllMilitaryMonths($filters);
570
-                }
571
-                return $all;
555
+			$query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'military_flights_bymonth' AND filter_name = :filter_name";
556
+				 try {
557
+						$sth = $this->db->prepare($query);
558
+						$sth->execute(array(':filter_name' => $filter_name));
559
+				} catch(PDOException $e) {
560
+						echo "error : ".$e->getMessage();
561
+				}
562
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
563
+				if (empty($all)) {
564
+					$filters = array();
565
+					if ($filter_name != '') {
566
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
567
+			}
568
+					$Spotter = new Spotter($this->db);
569
+					$all = $Spotter->countAllMilitaryMonths($filters);
570
+				}
571
+				return $all;
572 572
 	}
573 573
 	public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') {
574 574
 		global $globalTimezone, $globalDBdriver, $globalStatsFilters;
@@ -584,22 +584,22 @@  discard block
 block discarded – undo
584 584
 			$query .= " ORDER BY CAST(flight_date AS integer) ASC";
585 585
 		}
586 586
 		if ($orderby == 'count') $query .= " ORDER BY hour_count DESC";
587
-                 try {
588
-                        $sth = $this->db->prepare($query);
589
-                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
590
-                } catch(PDOException $e) {
591
-                        echo "error : ".$e->getMessage();
592
-                }
593
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
594
-                if (empty($all)) {
587
+				 try {
588
+						$sth = $this->db->prepare($query);
589
+						$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
590
+				} catch(PDOException $e) {
591
+						echo "error : ".$e->getMessage();
592
+				}
593
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
594
+				if (empty($all)) {
595 595
 			$filters = array('airlines' => array($stats_airline));
596 596
 			if ($filter_name != '') {
597
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
597
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
598 598
 			}
599
-            		$Spotter = new Spotter($this->db);
600
-            		$all = $Spotter->countAllHours($orderby,$filters);
601
-                }
602
-                return $all;
599
+					$Spotter = new Spotter($this->db);
600
+					$all = $Spotter->countAllHours($orderby,$filters);
601
+				}
602
+				return $all;
603 603
 	}
604 604
 	
605 605
 	public function countOverallFlights($stats_airline = '', $filter_name = '') {
@@ -621,9 +621,9 @@  discard block
 block discarded – undo
621 621
 		if ($filter_name == '') $filter_name = $this->filter_name;
622 622
 		$all = $this->getSumStats('military_flights_bymonth',date('Y'),'',$filter_name);
623 623
 		if (empty($all)) {
624
-		        $filters = array();
625
-            		if ($filter_name != '') {
626
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
624
+				$filters = array();
625
+					if ($filter_name != '') {
626
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
627 627
 			}
628 628
 			$Spotter = new Spotter($this->db);
629 629
 			$all = $Spotter->countOverallMilitaryFlights($filters);
@@ -662,19 +662,19 @@  discard block
 block discarded – undo
662 662
 		global $globalStatsFilters;
663 663
 		if ($filter_name == '') $filter_name = $this->filter_name;
664 664
 		$query = "SELECT COUNT(*) AS nb_airline FROM stats_airline WHERE filter_name = :filter_name";
665
-                 try {
666
-                        $sth = $this->db->prepare($query);
667
-                        $sth->execute(array(':filter_name' => $filter_name));
668
-                } catch(PDOException $e) {
669
-                        echo "error : ".$e->getMessage();
670
-                }
671
-                $result = $sth->fetchAll(PDO::FETCH_ASSOC);
672
-                $all = $result[0]['nb_airline'];
665
+				 try {
666
+						$sth = $this->db->prepare($query);
667
+						$sth->execute(array(':filter_name' => $filter_name));
668
+				} catch(PDOException $e) {
669
+						echo "error : ".$e->getMessage();
670
+				}
671
+				$result = $sth->fetchAll(PDO::FETCH_ASSOC);
672
+				$all = $result[0]['nb_airline'];
673 673
 		//$all = $this->getSumStats('airlines_bymonth',date('Y'));
674 674
 		if (empty($all)) {
675
-            		$filters = array();
676
-            		if ($filter_name != '') {
677
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
675
+					$filters = array();
676
+					if ($filter_name != '') {
677
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
678 678
 			}
679 679
 			$Spotter = new Spotter($this->db);
680 680
 			$all = $Spotter->countOverallAirlines($filters);
@@ -725,166 +725,166 @@  discard block
 block discarded – undo
725 725
 		if ($filter_name == '') $filter_name = $this->filter_name;
726 726
 		$query = "SELECT * FROM stats_airport WHERE stats_type = 'daily' AND airport_icao = :airport_icao AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY date";
727 727
 		$query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
728
-                 try {
729
-                        $sth = $this->db->prepare($query);
730
-                        $sth->execute($query_values);
731
-                } catch(PDOException $e) {
732
-                        echo "error : ".$e->getMessage();
733
-                }
734
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
735
-                return $all;
728
+				 try {
729
+						$sth = $this->db->prepare($query);
730
+						$sth->execute($query_values);
731
+				} catch(PDOException $e) {
732
+						echo "error : ".$e->getMessage();
733
+				}
734
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
735
+				return $all;
736 736
 	}
737 737
 	public function getStats($type,$stats_airline = '', $filter_name = '') {
738 738
 		if ($filter_name == '') $filter_name = $this->filter_name;
739
-                $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date";
740
-                $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
741
-                 try {
742
-                        $sth = $this->db->prepare($query);
743
-                        $sth->execute($query_values);
744
-                } catch(PDOException $e) {
745
-                        echo "error : ".$e->getMessage();
746
-                }
747
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
748
-                return $all;
749
-        }
739
+				$query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date";
740
+				$query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
741
+				 try {
742
+						$sth = $this->db->prepare($query);
743
+						$sth->execute($query_values);
744
+				} catch(PDOException $e) {
745
+						echo "error : ".$e->getMessage();
746
+				}
747
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
748
+				return $all;
749
+		}
750 750
 	public function getSumStats($type,$year,$stats_airline = '',$filter_name = '') {
751 751
 		if ($filter_name == '') $filter_name = $this->filter_name;
752
-    		global $globalArchiveMonths, $globalDBdriver;
753
-    		if ($globalDBdriver == 'mysql') {
754
-	                $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND stats_airline = :stats_airline AND filter_name = :filter_name";
755
-	        } else {
756
-            		$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND stats_airline = :stats_airline AND filter_name = :filter_name";
757
-                }
758
-                $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name);
759
-                 try {
760
-                        $sth = $this->db->prepare($query);
761
-                        $sth->execute($query_values);
762
-                } catch(PDOException $e) {
763
-                        echo "error : ".$e->getMessage();
764
-                }
765
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
766
-                return $all[0]['total'];
767
-        }
752
+			global $globalArchiveMonths, $globalDBdriver;
753
+			if ($globalDBdriver == 'mysql') {
754
+					$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND stats_airline = :stats_airline AND filter_name = :filter_name";
755
+			} else {
756
+					$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND stats_airline = :stats_airline AND filter_name = :filter_name";
757
+				}
758
+				$query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name);
759
+				 try {
760
+						$sth = $this->db->prepare($query);
761
+						$sth->execute($query_values);
762
+				} catch(PDOException $e) {
763
+						echo "error : ".$e->getMessage();
764
+				}
765
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
766
+				return $all[0]['total'];
767
+		}
768 768
 	public function getStatsTotal($type, $stats_airline = '', $filter_name = '') {
769
-    		global $globalArchiveMonths, $globalDBdriver;
769
+			global $globalArchiveMonths, $globalDBdriver;
770 770
 		if ($filter_name == '') $filter_name = $this->filter_name;
771
-    		if ($globalDBdriver == 'mysql') {
771
+			if ($globalDBdriver == 'mysql') {
772 772
 			$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL ".$globalArchiveMonths." MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name";
773 773
 		} else {
774 774
 			$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalArchiveMonths." MONTHS' AND stats_airline = :stats_airline AND filter_name = :filter_name";
775
-                }
776
-                $query_values = array(':type' => $type, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
777
-                 try {
778
-                        $sth = $this->db->prepare($query);
779
-                        $sth->execute($query_values);
780
-                } catch(PDOException $e) {
781
-                        echo "error : ".$e->getMessage();
782
-                }
783
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
784
-                return $all[0]['total'];
785
-        }
775
+				}
776
+				$query_values = array(':type' => $type, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
777
+				 try {
778
+						$sth = $this->db->prepare($query);
779
+						$sth->execute($query_values);
780
+				} catch(PDOException $e) {
781
+						echo "error : ".$e->getMessage();
782
+				}
783
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
784
+				return $all[0]['total'];
785
+		}
786 786
 	public function getStatsAircraftTotal($stats_airline = '', $filter_name = '') {
787
-    		global $globalArchiveMonths, $globalDBdriver;
787
+			global $globalArchiveMonths, $globalDBdriver;
788 788
 		if ($filter_name == '') $filter_name = $this->filter_name;
789
-    		if ($globalDBdriver == 'mysql') {
789
+			if ($globalDBdriver == 'mysql') {
790 790
 			$query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name";
791
-                } else {
791
+				} else {
792 792
 			$query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name";
793
-                }
794
-                 try {
795
-                        $sth = $this->db->prepare($query);
796
-                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
797
-                } catch(PDOException $e) {
798
-                        echo "error : ".$e->getMessage();
799
-                }
800
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
801
-                return $all[0]['total'];
802
-        }
793
+				}
794
+				 try {
795
+						$sth = $this->db->prepare($query);
796
+						$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
797
+				} catch(PDOException $e) {
798
+						echo "error : ".$e->getMessage();
799
+				}
800
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
801
+				return $all[0]['total'];
802
+		}
803 803
 	public function getStatsAirlineTotal($filter_name = '') {
804
-    		global $globalArchiveMonths, $globalDBdriver;
804
+			global $globalArchiveMonths, $globalDBdriver;
805 805
 		if ($filter_name == '') $filter_name = $this->filter_name;
806
-    		if ($globalDBdriver == 'mysql') {
806
+			if ($globalDBdriver == 'mysql') {
807 807
 			$query = "SELECT SUM(cnt) as total FROM stats_airline WHERE filter_name = :filter_name";
808
-                } else {
808
+				} else {
809 809
 			$query = "SELECT SUM(cnt) as total FROM stats_airline WHERE filter_name = :filter_name";
810
-                }
811
-                 try {
812
-                        $sth = $this->db->prepare($query);
813
-                        $sth->execute(array(':filter_name' => $filter_name));
814
-                } catch(PDOException $e) {
815
-                        echo "error : ".$e->getMessage();
816
-                }
817
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
818
-                return $all[0]['total'];
819
-        }
810
+				}
811
+				 try {
812
+						$sth = $this->db->prepare($query);
813
+						$sth->execute(array(':filter_name' => $filter_name));
814
+				} catch(PDOException $e) {
815
+						echo "error : ".$e->getMessage();
816
+				}
817
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
818
+				return $all[0]['total'];
819
+		}
820 820
 	public function getStatsOwnerTotal($filter_name = '') {
821
-    		global $globalArchiveMonths, $globalDBdriver;
821
+			global $globalArchiveMonths, $globalDBdriver;
822 822
 		if ($filter_name == '') $filter_name = $this->filter_name;
823
-    		if ($globalDBdriver == 'mysql') {
823
+			if ($globalDBdriver == 'mysql') {
824 824
 			$query = "SELECT SUM(cnt) as total FROM stats_owner WHERE filter_name = :filter_name";
825 825
 		} else {
826 826
 			$query = "SELECT SUM(cnt) as total FROM stats_owner WHERE filter_name = :filter_name";
827
-                }
828
-                 try {
829
-                        $sth = $this->db->prepare($query);
830
-                        $sth->execute(array(':filter_name' => $filter_name));
831
-                } catch(PDOException $e) {
832
-                        echo "error : ".$e->getMessage();
833
-                }
834
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
835
-                return $all[0]['total'];
836
-        }
827
+				}
828
+				 try {
829
+						$sth = $this->db->prepare($query);
830
+						$sth->execute(array(':filter_name' => $filter_name));
831
+				} catch(PDOException $e) {
832
+						echo "error : ".$e->getMessage();
833
+				}
834
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
835
+				return $all[0]['total'];
836
+		}
837 837
 	public function getStatsPilotTotal($filter_name = '') {
838
-    		global $globalArchiveMonths, $globalDBdriver;
838
+			global $globalArchiveMonths, $globalDBdriver;
839 839
 		if ($filter_name == '') $filter_name = $this->filter_name;
840
-    		if ($globalDBdriver == 'mysql') {
841
-            		$query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name";
842
-            	} else {
843
-            		$query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name";
844
-            	}
845
-                 try {
846
-                        $sth = $this->db->prepare($query);
847
-                        $sth->execute(array(':filter_name' => $filter_name));
848
-                } catch(PDOException $e) {
849
-                        echo "error : ".$e->getMessage();
850
-                }
851
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
852
-                return $all[0]['total'];
853
-        }
840
+			if ($globalDBdriver == 'mysql') {
841
+					$query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name";
842
+				} else {
843
+					$query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name";
844
+				}
845
+				 try {
846
+						$sth = $this->db->prepare($query);
847
+						$sth->execute(array(':filter_name' => $filter_name));
848
+				} catch(PDOException $e) {
849
+						echo "error : ".$e->getMessage();
850
+				}
851
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
852
+				return $all[0]['total'];
853
+		}
854 854
 
855 855
 	public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') {
856 856
 		global $globalDBdriver;
857 857
 		if ($filter_name == '') $filter_name = $this->filter_name;
858 858
 		if ($globalDBdriver == 'mysql') {
859 859
 			$query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = :cnt";
860
-                } else {
860
+				} else {
861 861
 			$query = "UPDATE stats SET cnt = :cnt WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) SELECT :type,:cnt,:stats_date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats WHERE  stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
862 862
 		}
863
-                $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date, ':stats_airline' => $stats_airline,':filter_name' => $filter_name);
864
-                 try {
865
-                        $sth = $this->db->prepare($query);
866
-                        $sth->execute($query_values);
867
-                } catch(PDOException $e) {
868
-                        return "error : ".$e->getMessage();
869
-                }
870
-        }
863
+				$query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date, ':stats_airline' => $stats_airline,':filter_name' => $filter_name);
864
+				 try {
865
+						$sth = $this->db->prepare($query);
866
+						$sth->execute($query_values);
867
+				} catch(PDOException $e) {
868
+						return "error : ".$e->getMessage();
869
+				}
870
+		}
871 871
 	public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') {
872 872
 		global $globalDBdriver;
873 873
 		if ($filter_name == '') $filter_name = $this->filter_name;
874 874
 		if ($globalDBdriver == 'mysql') {
875 875
 			$query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date";
876 876
 		} else {
877
-            		//$query = "INSERT INTO stats (stats_type,cnt,stats_date) VALUES (:type,:cnt,:stats_date) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date";
877
+					//$query = "INSERT INTO stats (stats_type,cnt,stats_date) VALUES (:type,:cnt,:stats_date) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date";
878 878
 			$query = "UPDATE stats SET cnt = cnt+:cnt WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) SELECT :type,:cnt,:stats_date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats WHERE  stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
879
-                }
880
-                $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
881
-                 try {
882
-                        $sth = $this->db->prepare($query);
883
-                        $sth->execute($query_values);
884
-                } catch(PDOException $e) {
885
-                        return "error : ".$e->getMessage();
886
-                }
887
-        }
879
+				}
880
+				$query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
881
+				 try {
882
+						$sth = $this->db->prepare($query);
883
+						$sth->execute($query_values);
884
+				} catch(PDOException $e) {
885
+						return "error : ".$e->getMessage();
886
+				}
887
+		}
888 888
 	public function getStatsSource($date,$stats_type = '') {
889 889
 		if ($stats_type == '') {
890 890
 			$query = "SELECT * FROM stats_source WHERE stats_date = :date ORDER BY source_name";
@@ -893,15 +893,15 @@  discard block
 block discarded – undo
893 893
 			$query = "SELECT * FROM stats_source WHERE stats_date = :date AND stats_type = :stats_type ORDER BY source_name";
894 894
 			$query_values = array(':date' => $date,':stats_type' => $stats_type);
895 895
 		}
896
-                 try {
897
-                        $sth = $this->db->prepare($query);
898
-                        $sth->execute($query_values);
899
-                } catch(PDOException $e) {
900
-                        echo "error : ".$e->getMessage();
901
-                }
902
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
903
-                return $all;
904
-        }
896
+				 try {
897
+						$sth = $this->db->prepare($query);
898
+						$sth->execute($query_values);
899
+				} catch(PDOException $e) {
900
+						echo "error : ".$e->getMessage();
901
+				}
902
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
903
+				return $all;
904
+		}
905 905
 
906 906
 	public function addStatSource($data,$source_name,$stats_type,$date) {
907 907
 		global $globalDBdriver;
@@ -909,25 +909,25 @@  discard block
 block discarded – undo
909 909
 			$query = "INSERT INTO stats_source (source_data,source_name,stats_type,stats_date) VALUES (:data,:source_name,:stats_type,:stats_date) ON DUPLICATE KEY UPDATE source_data = :data";
910 910
 		} else {
911 911
 			$query = "UPDATE stats_source SET source_data = :data WHERE stats_date = :stats_date AND source_name = :source_name AND stats_type = :stats_type; INSERT INTO stats_source (source_data,source_name,stats_type,stats_date) SELECT :data,:source_name,:stats_type,:stats_date WHERE NOT EXISTS (SELECT 1 FROM stats_source WHERE stats_date = :stats_date AND source_name = :source_name AND stats_type = :stats_type);"; 
912
-                }
913
-                $query_values = array(':data' => $data,':stats_date' => $date,':source_name' => $source_name,':stats_type' => $stats_type);
914
-                 try {
915
-                        $sth = $this->db->prepare($query);
916
-                        $sth->execute($query_values);
917
-                } catch(PDOException $e) {
918
-                        return "error : ".$e->getMessage();
919
-                }
920
-        }
912
+				}
913
+				$query_values = array(':data' => $data,':stats_date' => $date,':source_name' => $source_name,':stats_type' => $stats_type);
914
+				 try {
915
+						$sth = $this->db->prepare($query);
916
+						$sth->execute($query_values);
917
+				} catch(PDOException $e) {
918
+						return "error : ".$e->getMessage();
919
+				}
920
+		}
921 921
 	public function addStatFlight($type,$date_name,$cnt,$stats_airline = '',$filter_name = '') {
922
-                $query = "INSERT INTO stats_flight (stats_type,flight_date,cnt,stats_airline,filter_name) VALUES (:type,:flight_date,:cnt,:stats_airline,:filter_name)";
923
-                $query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt, ':stats_airline' => $stats_airline,':filter_name' => $filter_name);
924
-                 try {
925
-                        $sth = $this->db->prepare($query);
926
-                        $sth->execute($query_values);
927
-                } catch(PDOException $e) {
928
-                        return "error : ".$e->getMessage();
929
-                }
930
-        }
922
+				$query = "INSERT INTO stats_flight (stats_type,flight_date,cnt,stats_airline,filter_name) VALUES (:type,:flight_date,:cnt,:stats_airline,:filter_name)";
923
+				$query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt, ':stats_airline' => $stats_airline,':filter_name' => $filter_name);
924
+				 try {
925
+						$sth = $this->db->prepare($query);
926
+						$sth->execute($query_values);
927
+				} catch(PDOException $e) {
928
+						return "error : ".$e->getMessage();
929
+				}
930
+		}
931 931
 	public function addStatAircraftRegistration($registration,$cnt,$aircraft_icao = '',$airline_icao = '',$filter_name = '') {
932 932
 		global $globalDBdriver;
933 933
 		if ($globalDBdriver == 'mysql') {
@@ -935,14 +935,14 @@  discard block
 block discarded – undo
935 935
 		} else {
936 936
 			$query = "UPDATE stats_registration SET cnt = cnt+:cnt WHERE registration = :registration AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_registration (aircraft_icao,registration,cnt,stats_airline,filter_name) SELECT :aircraft_icao,:registration,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_registration WHERE registration = :registration AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
937 937
 		}
938
-                $query_values = array(':aircraft_icao' => $aircraft_icao,':registration' => $registration,':cnt' => $cnt,':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
939
-                 try {
940
-                        $sth = $this->db->prepare($query);
941
-                        $sth->execute($query_values);
942
-                } catch(PDOException $e) {
943
-                        return "error : ".$e->getMessage();
944
-                }
945
-        }
938
+				$query_values = array(':aircraft_icao' => $aircraft_icao,':registration' => $registration,':cnt' => $cnt,':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
939
+				 try {
940
+						$sth = $this->db->prepare($query);
941
+						$sth->execute($query_values);
942
+				} catch(PDOException $e) {
943
+						return "error : ".$e->getMessage();
944
+				}
945
+		}
946 946
 	public function addStatCallsign($callsign_icao,$cnt,$airline_icao = '', $filter_name = '') {
947 947
 		global $globalDBdriver;
948 948
 		if ($globalDBdriver == 'mysql') {
@@ -950,14 +950,14 @@  discard block
 block discarded – undo
950 950
 		} else {
951 951
 			$query = "UPDATE stats_callsign SET cnt = cnt+:cnt WHERE callsign_icao = :callsign_icao AND filter_name = :filter_name; INSERT INTO stats_callsign (callsign_icao,airline_icao,cnt,filter_name) SELECT :callsign_icao,:airline_icao,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_callsign WHERE callsign_icao = :callsign_icao AND filter_name = :filter_name);"; 
952 952
 		}
953
-                $query_values = array(':callsign_icao' => $callsign_icao,':airline_icao' => $airline_icao,':cnt' => $cnt, ':filter_name' => $filter_name);
954
-                 try {
955
-                        $sth = $this->db->prepare($query);
956
-                        $sth->execute($query_values);
957
-                } catch(PDOException $e) {
958
-                        return "error : ".$e->getMessage();
959
-                }
960
-        }
953
+				$query_values = array(':callsign_icao' => $callsign_icao,':airline_icao' => $airline_icao,':cnt' => $cnt, ':filter_name' => $filter_name);
954
+				 try {
955
+						$sth = $this->db->prepare($query);
956
+						$sth->execute($query_values);
957
+				} catch(PDOException $e) {
958
+						return "error : ".$e->getMessage();
959
+				}
960
+		}
961 961
 	public function addStatCountry($iso2,$iso3,$name,$cnt,$filter_name = '') {
962 962
 		global $globalDBdriver;
963 963
 		if ($globalDBdriver == 'mysql') {
@@ -965,14 +965,14 @@  discard block
 block discarded – undo
965 965
 		} else {
966 966
 			$query = "UPDATE stats_country SET cnt = cnt+:cnt WHERE iso2 = :iso2 AND filter_name = :filter_name; INSERT INTO stats_country (iso2,iso3,name,cnt,filter_name) SELECT :iso2,:iso3,:name,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_country WHERE iso2 = :iso2 AND filter_name = :filter_name);"; 
967 967
 		}
968
-                $query_values = array(':iso2' => $iso2,':iso3' => $iso3,':name' => $name,':cnt' => $cnt,':filter_name' => $filter_name);
969
-                 try {
970
-                        $sth = $this->db->prepare($query);
971
-                        $sth->execute($query_values);
972
-                } catch(PDOException $e) {
973
-                        return "error : ".$e->getMessage();
974
-                }
975
-        }
968
+				$query_values = array(':iso2' => $iso2,':iso3' => $iso3,':name' => $name,':cnt' => $cnt,':filter_name' => $filter_name);
969
+				 try {
970
+						$sth = $this->db->prepare($query);
971
+						$sth->execute($query_values);
972
+				} catch(PDOException $e) {
973
+						return "error : ".$e->getMessage();
974
+				}
975
+		}
976 976
 	public function addStatAircraft($aircraft_icao,$cnt,$aircraft_name = '',$aircraft_manufacturer = '', $airline_icao = '', $filter_name = '') {
977 977
 		global $globalDBdriver;
978 978
 		if ($globalDBdriver == 'mysql') {
@@ -980,14 +980,14 @@  discard block
 block discarded – undo
980 980
 		} else {
981 981
 			$query = "UPDATE stats_aircraft SET cnt = cnt+:cnt, aircraft_name = :aircraft_name, aircraft_manufacturer = :aircraft_manufacturer, filter_name = :filter_name WHERE aircraft_icao = :aircraft_icao AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_aircraft (aircraft_icao,aircraft_name,aircraft_manufacturer,cnt,stats_airline,filter_name) SELECT :aircraft_icao,:aircraft_name,:aircraft_manufacturer,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_aircraft WHERE aircraft_icao = :aircraft_icao AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
982 982
 		}
983
-                $query_values = array(':aircraft_icao' => $aircraft_icao,':aircraft_name' => $aircraft_name,':cnt' => $cnt, ':aircraft_manufacturer' => $aircraft_manufacturer,':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
984
-                 try {
985
-                        $sth = $this->db->prepare($query);
986
-                        $sth->execute($query_values);
987
-                } catch(PDOException $e) {
988
-                        return "error : ".$e->getMessage();
989
-                }
990
-        }
983
+				$query_values = array(':aircraft_icao' => $aircraft_icao,':aircraft_name' => $aircraft_name,':cnt' => $cnt, ':aircraft_manufacturer' => $aircraft_manufacturer,':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
984
+				 try {
985
+						$sth = $this->db->prepare($query);
986
+						$sth->execute($query_values);
987
+				} catch(PDOException $e) {
988
+						return "error : ".$e->getMessage();
989
+				}
990
+		}
991 991
 	public function addStatAirline($airline_icao,$cnt,$airline_name = '',$filter_name = '') {
992 992
 		global $globalDBdriver;
993 993
 		if ($globalDBdriver == 'mysql') {
@@ -995,14 +995,14 @@  discard block
 block discarded – undo
995 995
 		} else {
996 996
 			$query = "UPDATE stats_airline SET cnt = cnt+:cnt WHERE airline_icao = :airline_icao AND filter_name = :filter_name; INSERT INTO stats_airline (airline_icao,airline_name,cnt,filter_name) SELECT :airline_icao,:airline_name,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airline WHERE airline_icao = :airline_icao AND filter_name = :filter_name);"; 
997 997
 		}
998
-                $query_values = array(':airline_icao' => $airline_icao,':airline_name' => $airline_name,':cnt' => $cnt,':filter_name' => $filter_name);
999
-                 try {
1000
-                        $sth = $this->db->prepare($query);
1001
-                        $sth->execute($query_values);
1002
-                } catch(PDOException $e) {
1003
-                        return "error : ".$e->getMessage();
1004
-                }
1005
-        }
998
+				$query_values = array(':airline_icao' => $airline_icao,':airline_name' => $airline_name,':cnt' => $cnt,':filter_name' => $filter_name);
999
+				 try {
1000
+						$sth = $this->db->prepare($query);
1001
+						$sth->execute($query_values);
1002
+				} catch(PDOException $e) {
1003
+						return "error : ".$e->getMessage();
1004
+				}
1005
+		}
1006 1006
 	public function addStatOwner($owner_name,$cnt,$stats_airline = '', $filter_name = '') {
1007 1007
 		global $globalDBdriver;
1008 1008
 		if ($globalDBdriver == 'mysql') {
@@ -1010,14 +1010,14 @@  discard block
 block discarded – undo
1010 1010
 		} else {
1011 1011
 			$query = "UPDATE stats_owner SET cnt = cnt+:cnt WHERE owner_name = :owner_name AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_owner (owner_name,cnt,stats_airline,filter_name) SELECT :owner_name,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_owner WHERE owner_name = :owner_name AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
1012 1012
 		}
1013
-                $query_values = array(':owner_name' => $owner_name,':cnt' => $cnt,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
1014
-                 try {
1015
-                        $sth = $this->db->prepare($query);
1016
-                        $sth->execute($query_values);
1017
-                } catch(PDOException $e) {
1018
-                        return "error : ".$e->getMessage();
1019
-                }
1020
-        }
1013
+				$query_values = array(':owner_name' => $owner_name,':cnt' => $cnt,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
1014
+				 try {
1015
+						$sth = $this->db->prepare($query);
1016
+						$sth->execute($query_values);
1017
+				} catch(PDOException $e) {
1018
+						return "error : ".$e->getMessage();
1019
+				}
1020
+		}
1021 1021
 	public function addStatPilot($pilot_id,$cnt,$pilot_name,$stats_airline = '',$filter_name = '') {
1022 1022
 		global $globalDBdriver;
1023 1023
 		if ($globalDBdriver == 'mysql') {
@@ -1025,14 +1025,14 @@  discard block
 block discarded – undo
1025 1025
 		} else {
1026 1026
 			$query = "UPDATE stats_pilot SET cnt = cnt+:cnt, pilot_name = :pilot_name WHERE pilot_id = :pilot_id AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_pilot (pilot_id,cnt,pilot_name,stats_airline,filter_name) SELECT :pilot_id,:cnt,:pilot_name,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_pilot WHERE pilot_id = :pilot_id AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
1027 1027
 		}
1028
-                $query_values = array(':pilot_id' => $pilot_id,':cnt' => $cnt,':pilot_name' => $pilot_name,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
1029
-                 try {
1030
-                        $sth = $this->db->prepare($query);
1031
-                        $sth->execute($query_values);
1032
-                } catch(PDOException $e) {
1033
-                        return "error : ".$e->getMessage();
1034
-                }
1035
-        }
1028
+				$query_values = array(':pilot_id' => $pilot_id,':cnt' => $cnt,':pilot_name' => $pilot_name,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
1029
+				 try {
1030
+						$sth = $this->db->prepare($query);
1031
+						$sth->execute($query_values);
1032
+				} catch(PDOException $e) {
1033
+						return "error : ".$e->getMessage();
1034
+				}
1035
+		}
1036 1036
 	public function addStatDepartureAirports($airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '') {
1037 1037
 		global $globalDBdriver;
1038 1038
 		if ($globalDBdriver == 'mysql') {
@@ -1040,14 +1040,14 @@  discard block
 block discarded – undo
1040 1040
 		} else {
1041 1041
 			$query = "UPDATE stats_airport SET departure = departure+:departure WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:departure,'yearly',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name);"; 
1042 1042
 		}
1043
-                $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':departure' => $departure,':date' => date('Y').'-01-01 00:00:00', ':stats_airline' => $airline_icao,':filter_name' => $filter_name);
1044
-                 try {
1045
-                        $sth = $this->db->prepare($query);
1046
-                        $sth->execute($query_values);
1047
-                } catch(PDOException $e) {
1048
-                        return "error : ".$e->getMessage();
1049
-                }
1050
-        }
1043
+				$query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':departure' => $departure,':date' => date('Y').'-01-01 00:00:00', ':stats_airline' => $airline_icao,':filter_name' => $filter_name);
1044
+				 try {
1045
+						$sth = $this->db->prepare($query);
1046
+						$sth->execute($query_values);
1047
+				} catch(PDOException $e) {
1048
+						return "error : ".$e->getMessage();
1049
+				}
1050
+		}
1051 1051
 	public function addStatDepartureAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '') {
1052 1052
 		global $globalDBdriver;
1053 1053
 		if ($globalDBdriver == 'mysql') {
@@ -1055,14 +1055,14 @@  discard block
 block discarded – undo
1055 1055
 		} else {
1056 1056
 			$query = "UPDATE stats_airport SET departure = departure+:departure WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:departure,'daily',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
1057 1057
 		}
1058
-                $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':departure' => $departure,':date' => $date,':stats_airline' => $airline_icao,':filter_name' => $filter_name);
1059
-                 try {
1060
-                        $sth = $this->db->prepare($query);
1061
-                        $sth->execute($query_values);
1062
-                } catch(PDOException $e) {
1063
-                        return "error : ".$e->getMessage();
1064
-                }
1065
-        }
1058
+				$query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':departure' => $departure,':date' => $date,':stats_airline' => $airline_icao,':filter_name' => $filter_name);
1059
+				 try {
1060
+						$sth = $this->db->prepare($query);
1061
+						$sth->execute($query_values);
1062
+				} catch(PDOException $e) {
1063
+						return "error : ".$e->getMessage();
1064
+				}
1065
+		}
1066 1066
 	public function addStatArrivalAirports($airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') {
1067 1067
 		global $globalDBdriver;
1068 1068
 		if ($globalDBdriver == 'mysql') {
@@ -1070,14 +1070,14 @@  discard block
 block discarded – undo
1070 1070
 		} else {
1071 1071
 			$query = "UPDATE stats_airport SET arrival = arrival+:arrival WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'yearly',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name);"; 
1072 1072
 		}
1073
-                $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':arrival' => $arrival,':date' => date('Y').'-01-01 00:00:00',':stats_airline' => $airline_icao,':filter_name' => $filter_name);
1074
-                 try {
1075
-                        $sth = $this->db->prepare($query);
1076
-                        $sth->execute($query_values);
1077
-                } catch(PDOException $e) {
1078
-                        return "error : ".$e->getMessage();
1079
-                }
1080
-        }
1073
+				$query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':arrival' => $arrival,':date' => date('Y').'-01-01 00:00:00',':stats_airline' => $airline_icao,':filter_name' => $filter_name);
1074
+				 try {
1075
+						$sth = $this->db->prepare($query);
1076
+						$sth->execute($query_values);
1077
+				} catch(PDOException $e) {
1078
+						return "error : ".$e->getMessage();
1079
+				}
1080
+		}
1081 1081
 	public function addStatArrivalAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') {
1082 1082
 		global $globalDBdriver;
1083 1083
 		if ($globalDBdriver == 'mysql') {
@@ -1085,52 +1085,52 @@  discard block
 block discarded – undo
1085 1085
 		} else {
1086 1086
 			$query = "UPDATE stats_airport SET arrival = arrival+:arrival WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'daily',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
1087 1087
 		}
1088
-                $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':arrival' => $arrival, ':date' => $date,':stats_airline' => $airline_icao,':filter_name' => $filter_name);
1089
-                 try {
1090
-                        $sth = $this->db->prepare($query);
1091
-                        $sth->execute($query_values);
1092
-                } catch(PDOException $e) {
1093
-                        return "error : ".$e->getMessage();
1094
-                }
1095
-        }
1088
+				$query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':arrival' => $arrival, ':date' => $date,':stats_airline' => $airline_icao,':filter_name' => $filter_name);
1089
+				 try {
1090
+						$sth = $this->db->prepare($query);
1091
+						$sth->execute($query_values);
1092
+				} catch(PDOException $e) {
1093
+						return "error : ".$e->getMessage();
1094
+				}
1095
+		}
1096 1096
 
1097 1097
 	public function deleteStat($id) {
1098
-                $query = "DELETE FROM stats WHERE stats_id = :id";
1099
-                $query_values = array(':id' => $id);
1100
-                 try {
1101
-                        $sth = $this->db->prepare($query);
1102
-                        $sth->execute($query_values);
1103
-                } catch(PDOException $e) {
1104
-                        return "error : ".$e->getMessage();
1105
-                }
1106
-        }
1098
+				$query = "DELETE FROM stats WHERE stats_id = :id";
1099
+				$query_values = array(':id' => $id);
1100
+				 try {
1101
+						$sth = $this->db->prepare($query);
1102
+						$sth->execute($query_values);
1103
+				} catch(PDOException $e) {
1104
+						return "error : ".$e->getMessage();
1105
+				}
1106
+		}
1107 1107
 	public function deleteStatFlight($type) {
1108
-                $query = "DELETE FROM stats_flight WHERE stats_type = :type";
1109
-                $query_values = array(':type' => $type);
1110
-                 try {
1111
-                        $sth = $this->db->prepare($query);
1112
-                        $sth->execute($query_values);
1113
-                } catch(PDOException $e) {
1114
-                        return "error : ".$e->getMessage();
1115
-                }
1116
-        }
1108
+				$query = "DELETE FROM stats_flight WHERE stats_type = :type";
1109
+				$query_values = array(':type' => $type);
1110
+				 try {
1111
+						$sth = $this->db->prepare($query);
1112
+						$sth->execute($query_values);
1113
+				} catch(PDOException $e) {
1114
+						return "error : ".$e->getMessage();
1115
+				}
1116
+		}
1117 1117
 	public function deleteStatAirport($type) {
1118
-                $query = "DELETE FROM stats_airport WHERE stats_type = :type";
1119
-                $query_values = array(':type' => $type);
1120
-                 try {
1121
-                        $sth = $this->db->prepare($query);
1122
-                        $sth->execute($query_values);
1123
-                } catch(PDOException $e) {
1124
-                        return "error : ".$e->getMessage();
1125
-                }
1126
-        }
1118
+				$query = "DELETE FROM stats_airport WHERE stats_type = :type";
1119
+				$query_values = array(':type' => $type);
1120
+				 try {
1121
+						$sth = $this->db->prepare($query);
1122
+						$sth->execute($query_values);
1123
+				} catch(PDOException $e) {
1124
+						return "error : ".$e->getMessage();
1125
+				}
1126
+		}
1127 1127
         
1128
-        public function addOldStats() {
1129
-    		global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters;
1130
-    		$Common = new Common();
1131
-    		$Connection = new Connection();
1132
-    		date_default_timezone_set('UTC');
1133
-    		$last_update = $this->getLastStatsUpdate('last_update_stats');
1128
+		public function addOldStats() {
1129
+			global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters;
1130
+			$Common = new Common();
1131
+			$Connection = new Connection();
1132
+			date_default_timezone_set('UTC');
1133
+			$last_update = $this->getLastStatsUpdate('last_update_stats');
1134 1134
 		//print_r($last_update);
1135 1135
 		/*
1136 1136
 		$flightsbymonth = $this->getStats('flights_by_month');
@@ -1392,24 +1392,24 @@  discard block
 block discarded – undo
1392 1392
 			if ($globalDebug) echo 'Count all departure airports...'."\n";
1393 1393
 			$pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day);
1394 1394
 			if ($globalDebug) echo 'Count all detected departure airports...'."\n";
1395
-        		$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day);
1395
+				$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day);
1396 1396
 			if ($globalDebug) echo 'Order departure airports...'."\n";
1397
-	        	$alldata = array();
1397
+				$alldata = array();
1398 1398
 	        	
1399
-    			foreach ($pall as $value) {
1400
-	        		$icao = $value['airport_departure_icao'];
1401
-    				$alldata[$icao] = $value;
1402
-	        	}
1403
-	        	foreach ($dall as $value) {
1404
-    				$icao = $value['airport_departure_icao'];
1405
-        			if (isset($alldata[$icao])) {
1406
-    					$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1407
-        			} else $alldata[$icao] = $value;
1408
-			}
1409
-    			$count = array();
1410
-    			foreach ($alldata as $key => $row) {
1411
-    				$count[$key] = $row['airport_departure_icao_count'];
1412
-        		}
1399
+				foreach ($pall as $value) {
1400
+					$icao = $value['airport_departure_icao'];
1401
+					$alldata[$icao] = $value;
1402
+				}
1403
+				foreach ($dall as $value) {
1404
+					$icao = $value['airport_departure_icao'];
1405
+					if (isset($alldata[$icao])) {
1406
+						$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1407
+					} else $alldata[$icao] = $value;
1408
+			}
1409
+				$count = array();
1410
+				foreach ($alldata as $key => $row) {
1411
+					$count[$key] = $row['airport_departure_icao_count'];
1412
+				}
1413 1413
 			array_multisort($count,SORT_DESC,$alldata);
1414 1414
 			foreach ($alldata as $number) {
1415 1415
 				echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count']);
@@ -1417,25 +1417,25 @@  discard block
 block discarded – undo
1417 1417
 			if ($globalDebug) echo 'Count all arrival airports...'."\n";
1418 1418
 			$pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day);
1419 1419
 			if ($globalDebug) echo 'Count all detected arrival airports...'."\n";
1420
-        		$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day);
1420
+				$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day);
1421 1421
 			if ($globalDebug) echo 'Order arrival airports...'."\n";
1422
-	        	$alldata = array();
1423
-    			foreach ($pall as $value) {
1424
-	        		$icao = $value['airport_arrival_icao'];
1425
-    				$alldata[$icao] = $value;
1426
-	        	}
1427
-	        	foreach ($dall as $value) {
1428
-    				$icao = $value['airport_arrival_icao'];
1429
-        			if (isset($alldata[$icao])) {
1430
-        				$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1431
-	        		} else $alldata[$icao] = $value;
1432
-    			}
1433
-        		$count = array();
1434
-        		foreach ($alldata as $key => $row) {
1435
-        			$count[$key] = $row['airport_arrival_icao_count'];
1436
-	        	}
1437
-    			array_multisort($count,SORT_DESC,$alldata);
1438
-                        foreach ($alldata as $number) {
1422
+				$alldata = array();
1423
+				foreach ($pall as $value) {
1424
+					$icao = $value['airport_arrival_icao'];
1425
+					$alldata[$icao] = $value;
1426
+				}
1427
+				foreach ($dall as $value) {
1428
+					$icao = $value['airport_arrival_icao'];
1429
+					if (isset($alldata[$icao])) {
1430
+						$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1431
+					} else $alldata[$icao] = $value;
1432
+				}
1433
+				$count = array();
1434
+				foreach ($alldata as $key => $row) {
1435
+					$count[$key] = $row['airport_arrival_icao_count'];
1436
+				}
1437
+				array_multisort($count,SORT_DESC,$alldata);
1438
+						foreach ($alldata as $number) {
1439 1439
 				echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count']);
1440 1440
 			}
1441 1441
 			if ($Connection->tableExists('countries')) {
@@ -1495,8 +1495,8 @@  discard block
 block discarded – undo
1495 1495
 //			$pall = $Spotter->getLast7DaysAirportsDeparture();
1496 1496
   //      		$dall = $Spotter->getLast7DaysDetectedAirportsDeparture();
1497 1497
 			$pall = $Spotter->getLast7DaysAirportsDeparture();
1498
-        		$dall = $Spotter->getLast7DaysDetectedAirportsDeparture();
1499
-        		/*
1498
+				$dall = $Spotter->getLast7DaysDetectedAirportsDeparture();
1499
+				/*
1500 1500
 	        	$alldata = array();
1501 1501
     			foreach ($pall as $value) {
1502 1502
 	        		$icao = $value['departure_airport_icao'];
@@ -1515,29 +1515,29 @@  discard block
 block discarded – undo
1515 1515
 	        	}
1516 1516
     			array_multisort($count,SORT_DESC,$alldata);
1517 1517
     			*/
1518
-    			foreach ($dall as $value) {
1519
-    				$icao = $value['departure_airport_icao'];
1520
-    				$ddate = $value['date'];
1521
-    				$find = false;
1522
-    				foreach ($pall as $pvalue) {
1523
-    					if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate) {
1524
-    						$pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count'];
1525
-    						$find = true;
1526
-    						break;
1527
-    					}
1528
-    				}
1529
-    				if ($find === false) {
1530
-    					$pall[] = $value;
1531
-    				}
1532
-    			}
1533
-    			$alldata = $pall;
1518
+				foreach ($dall as $value) {
1519
+					$icao = $value['departure_airport_icao'];
1520
+					$ddate = $value['date'];
1521
+					$find = false;
1522
+					foreach ($pall as $pvalue) {
1523
+						if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate) {
1524
+							$pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count'];
1525
+							$find = true;
1526
+							break;
1527
+						}
1528
+					}
1529
+					if ($find === false) {
1530
+						$pall[] = $value;
1531
+					}
1532
+				}
1533
+				$alldata = $pall;
1534 1534
 			foreach ($alldata as $number) {
1535 1535
 				$this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count']);
1536 1536
 			}
1537 1537
 			echo '...Arrival'."\n";
1538 1538
 			$pall = $Spotter->getLast7DaysAirportsArrival();
1539
-        		$dall = $Spotter->getLast7DaysDetectedAirportsArrival();
1540
-        		/*
1539
+				$dall = $Spotter->getLast7DaysDetectedAirportsArrival();
1540
+				/*
1541 1541
 	        	$alldata = array();
1542 1542
     			foreach ($pall as $value) {
1543 1543
 	        		$icao = $value['arrival_airport_icao'];
@@ -1557,22 +1557,22 @@  discard block
 block discarded – undo
1557 1557
     			*/
1558 1558
 
1559 1559
 
1560
-    			foreach ($dall as $value) {
1561
-    				$icao = $value['arrival_airport_icao'];
1562
-    				$ddate = $value['date'];
1563
-    				$find = false;
1564
-    				foreach ($pall as $pvalue) {
1565
-    					if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate) {
1566
-    						$pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count'];
1567
-    						$find = true;
1568
-    						break;
1569
-    					}
1570
-    				}
1571
-    				if ($find === false) {
1572
-    					$pall[] = $value;
1573
-    				}
1574
-    			}
1575
-    			$alldata = $pall;
1560
+				foreach ($dall as $value) {
1561
+					$icao = $value['arrival_airport_icao'];
1562
+					$ddate = $value['date'];
1563
+					$find = false;
1564
+					foreach ($pall as $pvalue) {
1565
+						if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate) {
1566
+							$pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count'];
1567
+							$find = true;
1568
+							break;
1569
+						}
1570
+					}
1571
+					if ($find === false) {
1572
+						$pall[] = $value;
1573
+					}
1574
+				}
1575
+				$alldata = $pall;
1576 1576
 			foreach ($alldata as $number) {
1577 1577
 				$this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count']);
1578 1578
 			}
@@ -1639,51 +1639,51 @@  discard block
 block discarded – undo
1639 1639
 			if ($globalDebug) echo 'Count all departure airports by airlines...'."\n";
1640 1640
 			$pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day);
1641 1641
 			if ($globalDebug) echo 'Count all detected departure airports by airlines...'."\n";
1642
-       			$dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day);
1642
+	   			$dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day);
1643 1643
 			if ($globalDebug) echo 'Order detected departure airports by airlines...'."\n";
1644
-	        	//$alldata = array();
1645
-    			foreach ($dall as $value) {
1646
-    				$icao = $value['airport_departure_icao'];
1647
-    				$dicao = $value['airline_icao'];
1648
-    				$find = false;
1649
-    				foreach ($pall as $pvalue) {
1650
-    					if ($pvalue['airport_departure_icao'] == $icao && $pvalue['airline_icao'] = $dicao) {
1651
-    						$pvalue['airport_departure_icao_count'] = $pvalue['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1652
-    						$find = true;
1653
-    						break;
1654
-    					}
1655
-    				}
1656
-    				if ($find === false) {
1657
-    					$pall[] = $value;
1658
-    				}
1659
-    			}
1660
-    			$alldata = $pall;
1644
+				//$alldata = array();
1645
+				foreach ($dall as $value) {
1646
+					$icao = $value['airport_departure_icao'];
1647
+					$dicao = $value['airline_icao'];
1648
+					$find = false;
1649
+					foreach ($pall as $pvalue) {
1650
+						if ($pvalue['airport_departure_icao'] == $icao && $pvalue['airline_icao'] = $dicao) {
1651
+							$pvalue['airport_departure_icao_count'] = $pvalue['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1652
+							$find = true;
1653
+							break;
1654
+						}
1655
+					}
1656
+					if ($find === false) {
1657
+						$pall[] = $value;
1658
+					}
1659
+				}
1660
+				$alldata = $pall;
1661 1661
 			foreach ($alldata as $number) {
1662 1662
 				echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],$number['airline_icao']);
1663 1663
 			}
1664 1664
 			if ($globalDebug) echo 'Count all arrival airports by airlines...'."\n";
1665 1665
 			$pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day);
1666 1666
 			if ($globalDebug) echo 'Count all detected arrival airports by airlines...'."\n";
1667
-        		$dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day);
1667
+				$dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day);
1668 1668
 			if ($globalDebug) echo 'Order arrival airports by airlines...'."\n";
1669
-	        	//$alldata = array();
1670
-    			foreach ($dall as $value) {
1671
-    				$icao = $value['airport_arrival_icao'];
1672
-    				$dicao = $value['airline_icao'];
1673
-    				$find = false;
1674
-    				foreach ($pall as $pvalue) {
1675
-    					if ($pvalue['airport_arrival_icao'] == $icao && $pvalue['airline_icao'] = $dicao) {
1676
-    						$pvalue['airport_arrival_icao_count'] = $pvalue['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1677
-    						$find = true;
1678
-    						break;
1679
-    					}
1680
-    				}
1681
-    				if ($find === false) {
1682
-    					$pall[] = $value;
1683
-    				}
1684
-    			}
1685
-    			$alldata = $pall;
1686
-                        foreach ($alldata as $number) {
1669
+				//$alldata = array();
1670
+				foreach ($dall as $value) {
1671
+					$icao = $value['airport_arrival_icao'];
1672
+					$dicao = $value['airline_icao'];
1673
+					$find = false;
1674
+					foreach ($pall as $pvalue) {
1675
+						if ($pvalue['airport_arrival_icao'] == $icao && $pvalue['airline_icao'] = $dicao) {
1676
+							$pvalue['airport_arrival_icao_count'] = $pvalue['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1677
+							$find = true;
1678
+							break;
1679
+						}
1680
+					}
1681
+					if ($find === false) {
1682
+						$pall[] = $value;
1683
+					}
1684
+				}
1685
+				$alldata = $pall;
1686
+						foreach ($alldata as $number) {
1687 1687
 				echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],$number['airline_icao']);
1688 1688
 			}
1689 1689
 			if ($globalDebug) echo 'Count all flights by months by airlines...'."\n";
@@ -1716,47 +1716,47 @@  discard block
 block discarded – undo
1716 1716
 			}
1717 1717
 			if ($globalDebug) echo '...Departure'."\n";
1718 1718
 			$pall = $Spotter->getLast7DaysAirportsDepartureByAirlines();
1719
-        		$dall = $Spotter->getLast7DaysDetectedAirportsDepartureByAirlines();
1720
-    			foreach ($dall as $value) {
1721
-    				$icao = $value['departure_airport_icao'];
1722
-    				$airline = $value['airline_icao'];
1723
-    				$ddate = $value['date'];
1724
-    				$find = false;
1725
-    				foreach ($pall as $pvalue) {
1726
-    					if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] = $airline) {
1727
-    						$pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count'];
1728
-    						$find = true;
1729
-    						break;
1730
-    					}
1731
-    				}
1732
-    				if ($find === false) {
1733
-    					$pall[] = $value;
1734
-    				}
1735
-    			}
1736
-    			$alldata = $pall;
1719
+				$dall = $Spotter->getLast7DaysDetectedAirportsDepartureByAirlines();
1720
+				foreach ($dall as $value) {
1721
+					$icao = $value['departure_airport_icao'];
1722
+					$airline = $value['airline_icao'];
1723
+					$ddate = $value['date'];
1724
+					$find = false;
1725
+					foreach ($pall as $pvalue) {
1726
+						if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] = $airline) {
1727
+							$pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count'];
1728
+							$find = true;
1729
+							break;
1730
+						}
1731
+					}
1732
+					if ($find === false) {
1733
+						$pall[] = $value;
1734
+					}
1735
+				}
1736
+				$alldata = $pall;
1737 1737
 			foreach ($alldata as $number) {
1738 1738
 				$this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count'],$number['airline_icao']);
1739 1739
 			}
1740 1740
 			if ($globalDebug) echo '...Arrival'."\n";
1741 1741
 			$pall = $Spotter->getLast7DaysAirportsArrivalByAirlines();
1742
-        		$dall = $Spotter->getLast7DaysDetectedAirportsArrivalByAirlines();
1743
-    			foreach ($dall as $value) {
1744
-    				$icao = $value['arrival_airport_icao'];
1745
-    				$airline = $value['airline_icao'];
1746
-    				$ddate = $value['date'];
1747
-    				$find = false;
1748
-    				foreach ($pall as $pvalue) {
1749
-    					if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] == $airline) {
1750
-    						$pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count'];
1751
-    						$find = true;
1752
-    						break;
1753
-    					}
1754
-    				}
1755
-    				if ($find === false) {
1756
-    					$pall[] = $value;
1757
-    				}
1758
-    			}
1759
-    			$alldata = $pall;
1742
+				$dall = $Spotter->getLast7DaysDetectedAirportsArrivalByAirlines();
1743
+				foreach ($dall as $value) {
1744
+					$icao = $value['arrival_airport_icao'];
1745
+					$airline = $value['airline_icao'];
1746
+					$ddate = $value['date'];
1747
+					$find = false;
1748
+					foreach ($pall as $pvalue) {
1749
+						if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] == $airline) {
1750
+							$pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count'];
1751
+							$find = true;
1752
+							break;
1753
+						}
1754
+					}
1755
+					if ($find === false) {
1756
+						$pall[] = $value;
1757
+					}
1758
+				}
1759
+				$alldata = $pall;
1760 1760
 			foreach ($alldata as $number) {
1761 1761
 				$this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count'],$number['airline_icao']);
1762 1762
 			}
@@ -1820,44 +1820,44 @@  discard block
 block discarded – undo
1820 1820
 				}
1821 1821
     			
1822 1822
 				$pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day,$filter);
1823
-	       			$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter);
1824
-		        	$alldata = array();
1825
-	    			foreach ($pall as $value) {
1826
-		        		$icao = $value['airport_departure_icao'];
1827
-    					$alldata[$icao] = $value;
1828
-	    			}
1829
-		        	foreach ($dall as $value) {
1830
-	    				$icao = $value['airport_departure_icao'];
1831
-        				if (isset($alldata[$icao])) {
1832
-    						$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1833
-        				} else $alldata[$icao] = $value;
1834
-				}
1835
-	    			$count = array();
1836
-    				foreach ($alldata as $key => $row) {
1837
-    					$count[$key] = $row['airport_departure_icao_count'];
1838
-    				}
1823
+		   			$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter);
1824
+					$alldata = array();
1825
+					foreach ($pall as $value) {
1826
+						$icao = $value['airport_departure_icao'];
1827
+						$alldata[$icao] = $value;
1828
+					}
1829
+					foreach ($dall as $value) {
1830
+						$icao = $value['airport_departure_icao'];
1831
+						if (isset($alldata[$icao])) {
1832
+							$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1833
+						} else $alldata[$icao] = $value;
1834
+				}
1835
+					$count = array();
1836
+					foreach ($alldata as $key => $row) {
1837
+						$count[$key] = $row['airport_departure_icao_count'];
1838
+					}
1839 1839
 				array_multisort($count,SORT_DESC,$alldata);
1840 1840
 				foreach ($alldata as $number) {
1841
-    					echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],'',$filter_name);
1841
+						echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],'',$filter_name);
1842 1842
 				}
1843 1843
 				$pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day,$filter);
1844
-    				$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,$filter);
1844
+					$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,$filter);
1845 1845
 				$alldata = array();
1846
-    				foreach ($pall as $value) {
1847
-		        		$icao = $value['airport_arrival_icao'];
1848
-    					$alldata[$icao] = $value;
1849
-	    			}
1850
-		        	foreach ($dall as $value) {
1851
-	    				$icao = $value['airport_arrival_icao'];
1852
-        				if (isset($alldata[$icao])) {
1853
-        					$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1854
-		        		} else $alldata[$icao] = $value;
1855
-	    			}
1856
-        			$count = array();
1857
-        			foreach ($alldata as $key => $row) {
1858
-    					$count[$key] = $row['airport_arrival_icao_count'];
1859
-		        	}
1860
-        			array_multisort($count,SORT_DESC,$alldata);
1846
+					foreach ($pall as $value) {
1847
+						$icao = $value['airport_arrival_icao'];
1848
+						$alldata[$icao] = $value;
1849
+					}
1850
+					foreach ($dall as $value) {
1851
+						$icao = $value['airport_arrival_icao'];
1852
+						if (isset($alldata[$icao])) {
1853
+							$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1854
+						} else $alldata[$icao] = $value;
1855
+					}
1856
+					$count = array();
1857
+					foreach ($alldata as $key => $row) {
1858
+						$count[$key] = $row['airport_arrival_icao_count'];
1859
+					}
1860
+					array_multisort($count,SORT_DESC,$alldata);
1861 1861
 				foreach ($alldata as $number) {
1862 1862
 					echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],'',$filter_name);
1863 1863
 				}
@@ -1886,45 +1886,45 @@  discard block
 block discarded – undo
1886 1886
 				}
1887 1887
 				echo '...Departure'."\n";
1888 1888
 				$pall = $Spotter->getLast7DaysAirportsDeparture('',$filter);
1889
-        			$dall = $Spotter->getLast7DaysDetectedAirportsDeparture('',$filter);
1889
+					$dall = $Spotter->getLast7DaysDetectedAirportsDeparture('',$filter);
1890 1890
 				foreach ($dall as $value) {
1891
-    					$icao = $value['departure_airport_icao'];
1892
-    					$ddate = $value['date'];
1893
-    					$find = false;
1894
-    					foreach ($pall as $pvalue) {
1895
-    						if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate) {
1896
-    							$pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count'];
1897
-	    						$find = true;
1898
-    							break;
1899
-    						}
1900
-    					}
1901
-    					if ($find === false) {
1902
-    						$pall[] = $value;
1903
-	    				}
1904
-    				}
1905
-	    			$alldata = $pall;
1891
+						$icao = $value['departure_airport_icao'];
1892
+						$ddate = $value['date'];
1893
+						$find = false;
1894
+						foreach ($pall as $pvalue) {
1895
+							if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate) {
1896
+								$pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count'];
1897
+								$find = true;
1898
+								break;
1899
+							}
1900
+						}
1901
+						if ($find === false) {
1902
+							$pall[] = $value;
1903
+						}
1904
+					}
1905
+					$alldata = $pall;
1906 1906
 				foreach ($alldata as $number) {
1907 1907
 					$this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count'],'',$filter_name);
1908 1908
 				}
1909 1909
 				echo '...Arrival'."\n";
1910 1910
 				$pall = $Spotter->getLast7DaysAirportsArrival('',$filter);
1911
-    				$dall = $Spotter->getLast7DaysDetectedAirportsArrival('',$filter);
1911
+					$dall = $Spotter->getLast7DaysDetectedAirportsArrival('',$filter);
1912 1912
 				foreach ($dall as $value) {
1913 1913
 					$icao = $value['arrival_airport_icao'];
1914 1914
 					$ddate = $value['date'];
1915
-    					$find = false;
1915
+						$find = false;
1916 1916
 					foreach ($pall as $pvalue) {
1917
-    						if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate) {
1918
-    							$pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count'];
1919
-    							$find = true;
1920
-    							break;
1921
-	    					}
1922
-    					}
1923
-    					if ($find === false) {
1924
-    						$pall[] = $value;
1925
-	    				}
1926
-    				}
1927
-    				$alldata = $pall;
1917
+							if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate) {
1918
+								$pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count'];
1919
+								$find = true;
1920
+								break;
1921
+							}
1922
+						}
1923
+						if ($find === false) {
1924
+							$pall[] = $value;
1925
+						}
1926
+					}
1927
+					$alldata = $pall;
1928 1928
 				foreach ($alldata as $number) {
1929 1929
 					$this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count'],'',$filter_name);
1930 1930
 				}
Please login to merge, or discard this patch.
Spacing   +299 added lines, -299 removed lines patch added patch discarded remove patch
@@ -17,14 +17,14 @@  discard block
 block discarded – undo
17 17
 		$this->db = $Connection->db();
18 18
         }
19 19
               
20
-	public function addLastStatsUpdate($type,$stats_date) {
20
+	public function addLastStatsUpdate($type, $stats_date) {
21 21
                 $query = "DELETE FROM config WHERE name = :type;
22 22
             		INSERT INTO config (name,value) VALUES (:type,:stats_date);";
23
-                $query_values = array('type' => $type,':stats_date' => $stats_date);
23
+                $query_values = array('type' => $type, ':stats_date' => $stats_date);
24 24
                  try {
25 25
                         $sth = $this->db->prepare($query);
26 26
                         $sth->execute($query_values);
27
-                } catch(PDOException $e) {
27
+                } catch (PDOException $e) {
28 28
                         return "error : ".$e->getMessage();
29 29
                 }
30 30
         }
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
                  try {
35 35
                         $sth = $this->db->prepare($query);
36 36
                         $sth->execute(array(':type' => $type));
37
-                } catch(PDOException $e) {
37
+                } catch (PDOException $e) {
38 38
                         echo "error : ".$e->getMessage();
39 39
                 }
40 40
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -46,31 +46,31 @@  discard block
 block discarded – undo
46 46
                  try {
47 47
                         $sth = $this->db->prepare($query);
48 48
                         $sth->execute(array(':filter_name' => $filter_name));
49
-                } catch(PDOException $e) {
49
+                } catch (PDOException $e) {
50 50
                         echo "error : ".$e->getMessage();
51 51
                 }
52 52
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
53 53
                 return $all;
54 54
         }
55
-	public function getAllAircraftTypes($stats_airline = '',$filter_name = '') {
55
+	public function getAllAircraftTypes($stats_airline = '', $filter_name = '') {
56 56
 		if ($filter_name == '') $filter_name = $this->filter_name;
57 57
                 $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC";
58 58
                  try {
59 59
                         $sth = $this->db->prepare($query);
60
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
61
-                } catch(PDOException $e) {
60
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
61
+                } catch (PDOException $e) {
62 62
                         echo "error : ".$e->getMessage();
63 63
                 }
64 64
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
65 65
                 return $all;
66 66
         }
67
-	public function getAllAirportNames($stats_airline = '',$filter_name = '') {
67
+	public function getAllAirportNames($stats_airline = '', $filter_name = '') {
68 68
 		if ($filter_name == '') $filter_name = $this->filter_name;
69 69
                 $query = "SELECT airport_icao, airport_name,airport_city,airport_country FROM stats_airport WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND stats_type = 'daily' GROUP BY airport_icao,airport_name,airport_city,airport_country ORDER BY airport_city ASC";
70 70
                  try {
71 71
                         $sth = $this->db->prepare($query);
72
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
73
-                } catch(PDOException $e) {
72
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
73
+                } catch (PDOException $e) {
74 74
                         echo "error : ".$e->getMessage();
75 75
                 }
76 76
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -85,22 +85,22 @@  discard block
 block discarded – undo
85 85
 		else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC";
86 86
                  try {
87 87
                         $sth = $this->db->prepare($query);
88
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
89
-                } catch(PDOException $e) {
88
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
89
+                } catch (PDOException $e) {
90 90
                         echo "error : ".$e->getMessage();
91 91
                 }
92 92
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
93 93
                 if (empty($all)) {
94 94
             	    $filters = array('airlines' => array($stats_airline));
95 95
             	    if ($filter_name != '') {
96
-            		    $filters = array_merge($filters,$globalStatsFilters[$filter_name]);
96
+            		    $filters = array_merge($filters, $globalStatsFilters[$filter_name]);
97 97
             	    }
98 98
             	    $Spotter = new Spotter($this->db);
99
-            	    $all = $Spotter->countAllAircraftTypes($limit,0,'',$filters);
99
+            	    $all = $Spotter->countAllAircraftTypes($limit, 0, '', $filters);
100 100
                 }
101 101
                 return $all;
102 102
 	}
103
-	public function countAllAirlineCountries($limit = true,$filter_name = '') {
103
+	public function countAllAirlineCountries($limit = true, $filter_name = '') {
104 104
 		global $globalStatsFilters;
105 105
 		if ($filter_name == '') $filter_name = $this->filter_name;
106 106
 		if ($limit) $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0";
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
                  try {
109 109
                         $sth = $this->db->prepare($query);
110 110
                         $sth->execute(array(':filter_name' => $filter_name));
111
-                } catch(PDOException $e) {
111
+                } catch (PDOException $e) {
112 112
                         echo "error : ".$e->getMessage();
113 113
                 }
114 114
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -116,28 +116,28 @@  discard block
 block discarded – undo
116 116
             		$Spotter = new Spotter($this->db);
117 117
             		$filters = array();
118 118
             		if ($filter_name != '') {
119
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
119
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
120 120
 			}
121
-            		$all = $Spotter->countAllAirlineCountries($limit,$filters);
121
+            		$all = $Spotter->countAllAirlineCountries($limit, $filters);
122 122
                 }
123 123
                 return $all;
124 124
 	}
125
-	public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '') {
125
+	public function countAllAircraftManufacturers($limit = true, $stats_airline = '', $filter_name = '') {
126 126
 		global $globalStatsFilters;
127 127
 		if ($filter_name == '') $filter_name = $this->filter_name;
128 128
 		if ($limit) $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0";
129 129
 		else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC";
130 130
                  try {
131 131
                         $sth = $this->db->prepare($query);
132
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
133
-                } catch(PDOException $e) {
132
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
133
+                } catch (PDOException $e) {
134 134
                         echo "error : ".$e->getMessage();
135 135
                 }
136 136
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
137 137
                 if (empty($all)) {
138 138
             		$filters = array('airlines' => array($stats_airline));
139 139
             		if ($filter_name != '') {
140
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
140
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
141 141
 			}
142 142
             		$Spotter = new Spotter($this->db);
143 143
 			$all = $Spotter->countAllAircraftManufacturers($filters);
@@ -152,18 +152,18 @@  discard block
 block discarded – undo
152 152
 		else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC";
153 153
                  try {
154 154
                         $sth = $this->db->prepare($query);
155
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
156
-                } catch(PDOException $e) {
155
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
156
+                } catch (PDOException $e) {
157 157
                         echo "error : ".$e->getMessage();
158 158
                 }
159 159
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
160 160
                 if (empty($all)) {
161 161
 			$filters = array('airlines' => array($stats_airline));
162 162
 			if ($filter_name != '') {
163
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
163
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
164 164
 			}
165 165
 			$Spotter = new Spotter($this->db);
166
-			$all = $Spotter->countAllArrivalCountries($limit,$filters);
166
+			$all = $Spotter->countAllArrivalCountries($limit, $filters);
167 167
                 }
168 168
                 return $all;
169 169
 	}
@@ -174,15 +174,15 @@  discard block
 block discarded – undo
174 174
 		else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC";
175 175
                  try {
176 176
                         $sth = $this->db->prepare($query);
177
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
178
-                } catch(PDOException $e) {
177
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
178
+                } catch (PDOException $e) {
179 179
                         echo "error : ".$e->getMessage();
180 180
                 }
181 181
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
182 182
                 if (empty($all)) {
183 183
 			$filters = array('airlines' => array($stats_airline));
184 184
 			if ($filter_name != '') {
185
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
185
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
186 186
 			}
187 187
 			$Spotter = new Spotter($this->db);
188 188
 			$all = $Spotter->countAllDepartureCountries($filters);
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
                 return $all;
191 191
 	}
192 192
 
193
-	public function countAllAirlines($limit = true,$filter_name = '') {
193
+	public function countAllAirlines($limit = true, $filter_name = '') {
194 194
 		global $globalStatsFilters;
195 195
 		if ($filter_name == '') $filter_name = $this->filter_name;
196 196
 		if ($limit) $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name ORDER BY airline_count DESC LIMIT 10 OFFSET 0";
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
                  try {
199 199
                         $sth = $this->db->prepare($query);
200 200
                         $sth->execute(array(':filter_name' => $filter_name));
201
-                } catch(PDOException $e) {
201
+                } catch (PDOException $e) {
202 202
                         echo "error : ".$e->getMessage();
203 203
                 }
204 204
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -206,58 +206,58 @@  discard block
 block discarded – undo
206 206
 	                $Spotter = new Spotter($this->db);
207 207
             		$filters = array();
208 208
             		if ($filter_name != '') {
209
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
209
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
210 210
 			}
211 211
 
212
-    		        $all = $Spotter->countAllAirlines($limit,0,'',$filters);
212
+    		        $all = $Spotter->countAllAirlines($limit, 0, '', $filters);
213 213
                 }
214 214
                 return $all;
215 215
 	}
216
-	public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '') {
216
+	public function countAllAircraftRegistrations($limit = true, $stats_airline = '', $filter_name = '') {
217 217
 		global $globalStatsFilters;
218 218
 		if ($filter_name == '') $filter_name = $this->filter_name;
219 219
 		if ($limit) $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0";
220 220
 		else $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC";
221 221
                  try {
222 222
                         $sth = $this->db->prepare($query);
223
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
224
-                } catch(PDOException $e) {
223
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
224
+                } catch (PDOException $e) {
225 225
                         echo "error : ".$e->getMessage();
226 226
                 }
227 227
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
228 228
                 if (empty($all)) {
229 229
 			$filters = array('airlines' => array($stats_airline));
230 230
 			if ($filter_name != '') {
231
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
231
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
232 232
 			}
233 233
 	                $Spotter = new Spotter($this->db);
234
-    		        $all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters);
234
+    		        $all = $Spotter->countAllAircraftRegistrations($limit, 0, '', $filters);
235 235
                 }
236 236
                 return $all;
237 237
 	}
238
-	public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '') {
238
+	public function countAllCallsigns($limit = true, $stats_airline = '', $filter_name = '') {
239 239
 		global $globalStatsFilters;
240 240
 		if ($filter_name == '') $filter_name = $this->filter_name;
241 241
 		if ($limit) $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0";
242 242
 		else $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC";
243 243
 		 try {
244 244
 			$sth = $this->db->prepare($query);
245
-			$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
246
-		} catch(PDOException $e) {
245
+			$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
246
+		} catch (PDOException $e) {
247 247
 			echo "error : ".$e->getMessage();
248 248
 		}
249 249
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
250 250
 		if (empty($all)) {
251 251
 			$filters = array('airlines' => array($stats_airline));
252 252
 			if ($filter_name != '') {
253
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
253
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
254 254
 			}
255 255
 			$Spotter = new Spotter($this->db);
256
-			$all = $Spotter->countAllCallsigns($limit,0,'',$filters);
256
+			$all = $Spotter->countAllCallsigns($limit, 0, '', $filters);
257 257
 		}
258 258
 		return $all;
259 259
 	}
260
-	public function countAllFlightOverCountries($limit = true, $stats_airline = '',$filter_name = '') {
260
+	public function countAllFlightOverCountries($limit = true, $stats_airline = '', $filter_name = '') {
261 261
 		$Connection = new Connection();
262 262
 		if ($filter_name == '') $filter_name = $this->filter_name;
263 263
 		if ($Connection->tableExists('countries')) {
@@ -265,8 +265,8 @@  discard block
 block discarded – undo
265 265
 			else $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC";
266 266
 			 try {
267 267
 				$sth = $this->db->prepare($query);
268
-				$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
269
-			} catch(PDOException $e) {
268
+				$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
269
+			} catch (PDOException $e) {
270 270
 				echo "error : ".$e->getMessage();
271 271
 			}
272 272
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -281,70 +281,70 @@  discard block
 block discarded – undo
281 281
 			return array();
282 282
 		}
283 283
 	}
284
-	public function countAllPilots($limit = true,$stats_airline = '',$filter_name = '') {
284
+	public function countAllPilots($limit = true, $stats_airline = '', $filter_name = '') {
285 285
 		global $globalStatsFilters;
286 286
 		if ($filter_name == '') $filter_name = $this->filter_name;
287 287
 		if ($limit) $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC LIMIT 10 OFFSET 0";
288 288
 		else $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC";
289 289
                  try {
290 290
                         $sth = $this->db->prepare($query);
291
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
292
-                } catch(PDOException $e) {
291
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
292
+                } catch (PDOException $e) {
293 293
                         echo "error : ".$e->getMessage();
294 294
                 }
295 295
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
296 296
                 if (empty($all)) {
297 297
 			$filters = array('airlines' => array($stats_airline));
298 298
 			if ($filter_name != '') {
299
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
299
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
300 300
 			}
301 301
             		$Spotter = new Spotter($this->db);
302
-            		$all = $Spotter->countAllPilots($limit,0,'',$filters);
302
+            		$all = $Spotter->countAllPilots($limit, 0, '', $filters);
303 303
                 }
304 304
                 return $all;
305 305
 	}
306
-	public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '') {
306
+	public function countAllOwners($limit = true, $stats_airline = '', $filter_name = '') {
307 307
 		global $globalStatsFilters;
308 308
 		if ($filter_name == '') $filter_name = $this->filter_name;
309 309
 		if ($limit) $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0";
310 310
 		else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC";
311 311
                  try {
312 312
                         $sth = $this->db->prepare($query);
313
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
314
-                } catch(PDOException $e) {
313
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
314
+                } catch (PDOException $e) {
315 315
                         echo "error : ".$e->getMessage();
316 316
                 }
317 317
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
318 318
                 if (empty($all)) {
319 319
 			$filters = array('airlines' => array($stats_airline));
320 320
 			if ($filter_name != '') {
321
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
321
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
322 322
 			}
323 323
             		$Spotter = new Spotter($this->db);
324
-            		$all = $Spotter->countAllOwners($limit,0,'',$filters);
324
+            		$all = $Spotter->countAllOwners($limit, 0, '', $filters);
325 325
                 }
326 326
                 return $all;
327 327
 	}
328
-	public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '') {
328
+	public function countAllDepartureAirports($limit = true, $stats_airline = '', $filter_name = '') {
329 329
 		global $globalStatsFilters;
330 330
 		if ($filter_name == '') $filter_name = $this->filter_name;
331 331
 		if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0";
332 332
 		else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC";
333 333
                  try {
334 334
                         $sth = $this->db->prepare($query);
335
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
336
-                } catch(PDOException $e) {
335
+                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
336
+                } catch (PDOException $e) {
337 337
                         echo "error : ".$e->getMessage();
338 338
                 }
339 339
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
340 340
                 if (empty($all)) {
341 341
 			$filters = array('airlines' => array($stats_airline));
342 342
             		if ($filter_name != '') {
343
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
343
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
344 344
 			}
345 345
             		$Spotter = new Spotter($this->db);
346
-            		$pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters);
347
-        		$dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters);
346
+            		$pall = $Spotter->countAllDepartureAirports($limit, 0, '', $filters);
347
+        		$dall = $Spotter->countAllDetectedDepartureAirports($limit, 0, '', $filters);
348 348
         		$all = array();
349 349
         		foreach ($pall as $value) {
350 350
         			$icao = $value['airport_departure_icao'];
@@ -361,30 +361,30 @@  discard block
 block discarded – undo
361 361
         		foreach ($all as $key => $row) {
362 362
         			$count[$key] = $row['airport_departure_icao_count'];
363 363
         		}
364
-        		array_multisort($count,SORT_DESC,$all);
364
+        		array_multisort($count, SORT_DESC, $all);
365 365
                 }
366 366
                 return $all;
367 367
 	}
368
-	public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '') {
368
+	public function countAllArrivalAirports($limit = true, $stats_airline = '', $filter_name = '') {
369 369
 		global $globalStatsFilters;
370 370
 		if ($filter_name == '') $filter_name = $this->filter_name;
371 371
 		if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0";
372 372
 		else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC";
373 373
 		try {
374 374
 			$sth = $this->db->prepare($query);
375
-			$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
376
-		} catch(PDOException $e) {
375
+			$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
376
+		} catch (PDOException $e) {
377 377
 			echo "error : ".$e->getMessage();
378 378
 		}
379 379
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
380 380
 		if (empty($all)) {
381 381
 			$filters = array('airlines' => array($stats_airline));
382 382
 			if ($filter_name != '') {
383
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
383
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
384 384
 			}
385 385
 			$Spotter = new Spotter($this->db);
386
-			$pall = $Spotter->countAllArrivalAirports($limit,0,'',false,$filters);
387
-			$dall = $Spotter->countAllDetectedArrivalAirports($limit,0,'',false,$filters);
386
+			$pall = $Spotter->countAllArrivalAirports($limit, 0, '', false, $filters);
387
+			$dall = $Spotter->countAllDetectedArrivalAirports($limit, 0, '', false, $filters);
388 388
         		$all = array();
389 389
         		foreach ($pall as $value) {
390 390
         			$icao = $value['airport_arrival_icao'];
@@ -401,12 +401,12 @@  discard block
 block discarded – undo
401 401
         		foreach ($all as $key => $row) {
402 402
         			$count[$key] = $row['airport_arrival_icao_count'];
403 403
         		}
404
-        		array_multisort($count,SORT_DESC,$all);
404
+        		array_multisort($count, SORT_DESC, $all);
405 405
                 }
406 406
  
407 407
                 return $all;
408 408
 	}
409
-	public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') {
409
+	public function countAllMonthsLastYear($limit = true, $stats_airline = '', $filter_name = '') {
410 410
 		global $globalDBdriver, $globalStatsFilters;
411 411
 		if ($filter_name == '') $filter_name = $this->filter_name;
412 412
 		if ($globalDBdriver == 'mysql') {
@@ -416,18 +416,18 @@  discard block
 block discarded – undo
416 416
 			if ($limit) $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline = :stats_airline AND filter_name = :filter_name";
417 417
 			else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
418 418
 		}
419
-		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
419
+		$query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
420 420
                  try {
421 421
                         $sth = $this->db->prepare($query);
422 422
                         $sth->execute($query_data);
423
-                } catch(PDOException $e) {
423
+                } catch (PDOException $e) {
424 424
                         echo "error : ".$e->getMessage();
425 425
                 }
426 426
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
427 427
                 if (empty($all)) {
428 428
 			$filters = array('airlines' => array($stats_airline));
429 429
 			if ($filter_name != '') {
430
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
430
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
431 431
 			}
432 432
             		$Spotter = new Spotter($this->db);
433 433
             		$all = $Spotter->countAllMonthsLastYear($filters);
@@ -436,29 +436,29 @@  discard block
 block discarded – undo
436 436
                 return $all;
437 437
 	}
438 438
 	
439
-	public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') {
439
+	public function countAllDatesLastMonth($stats_airline = '', $filter_name = '') {
440 440
 		global $globalStatsFilters;
441 441
 		if ($filter_name == '') $filter_name = $this->filter_name;
442 442
 		$query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND stats_airline = :stats_airline AND filter_name = :filter_name";
443
-		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
443
+		$query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
444 444
                  try {
445 445
                         $sth = $this->db->prepare($query);
446 446
                         $sth->execute($query_data);
447
-                } catch(PDOException $e) {
447
+                } catch (PDOException $e) {
448 448
                         echo "error : ".$e->getMessage();
449 449
                 }
450 450
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
451 451
                 if (empty($all)) {
452 452
 			$filters = array('airlines' => array($stats_airline));
453 453
 			if ($filter_name != '') {
454
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
454
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
455 455
 			}
456 456
             		$Spotter = new Spotter($this->db);
457 457
             		$all = $Spotter->countAllDatesLastMonth($filters);
458 458
                 }
459 459
                 return $all;
460 460
 	}
461
-	public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') {
461
+	public function countAllDatesLast7Days($stats_airline = '', $filter_name = '') {
462 462
 		global $globalDBdriver, $globalStatsFilters;
463 463
 		if ($filter_name == '') $filter_name = $this->filter_name;
464 464
 		if ($globalDBdriver == 'mysql') {
@@ -466,40 +466,40 @@  discard block
 block discarded – undo
466 466
 		} else {
467 467
 			$query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '7 DAYS' AND stats_airline = :stats_airline AND filter_name = :filter_name";
468 468
 		}
469
-		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
469
+		$query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
470 470
                  try {
471 471
                         $sth = $this->db->prepare($query);
472 472
                         $sth->execute($query_data);
473
-                } catch(PDOException $e) {
473
+                } catch (PDOException $e) {
474 474
                         echo "error : ".$e->getMessage();
475 475
                 }
476 476
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
477 477
                 if (empty($all)) {
478 478
 			$filters = array('airlines' => array($stats_airline));
479 479
 			if ($filter_name != '') {
480
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
480
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
481 481
 			}
482 482
             		$Spotter = new Spotter($this->db);
483 483
             		$all = $Spotter->countAllDatesLast7Days($filters);
484 484
                 }
485 485
                 return $all;
486 486
 	}
487
-	public function countAllDates($stats_airline = '',$filter_name = '') {
487
+	public function countAllDates($stats_airline = '', $filter_name = '') {
488 488
 		global $globalStatsFilters;
489 489
 		if ($filter_name == '') $filter_name = $this->filter_name;
490 490
 		$query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND stats_airline = :stats_airline AND filter_name = :filter_name";
491
-		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
491
+		$query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
492 492
                  try {
493 493
                         $sth = $this->db->prepare($query);
494 494
                         $sth->execute($query_data);
495
-                } catch(PDOException $e) {
495
+                } catch (PDOException $e) {
496 496
                         echo "error : ".$e->getMessage();
497 497
                 }
498 498
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
499 499
                 if (empty($all)) {
500 500
 			$filters = array('airlines' => array($stats_airline));
501 501
 			if ($filter_name != '') {
502
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
502
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
503 503
 			}
504 504
             		$Spotter = new Spotter($this->db);
505 505
             		$all = $Spotter->countAllDates($filters);
@@ -514,35 +514,35 @@  discard block
 block discarded – undo
514 514
                  try {
515 515
                         $sth = $this->db->prepare($query);
516 516
                         $sth->execute($query_data);
517
-                } catch(PDOException $e) {
517
+                } catch (PDOException $e) {
518 518
                         echo "error : ".$e->getMessage();
519 519
                 }
520 520
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
521 521
                 if (empty($all)) {
522 522
             		$filters = array();
523 523
             		if ($filter_name != '') {
524
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
524
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
525 525
 			}
526 526
             		$Spotter = new Spotter($this->db);
527 527
             		$all = $Spotter->countAllDatesByAirlines($filters);
528 528
                 }
529 529
                 return $all;
530 530
 	}
531
-	public function countAllMonths($stats_airline = '',$filter_name = '') {
531
+	public function countAllMonths($stats_airline = '', $filter_name = '') {
532 532
 		global $globalStatsFilters;
533 533
 		if ($filter_name == '') $filter_name = $this->filter_name;
534 534
 	    	$query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
535 535
                  try {
536 536
                         $sth = $this->db->prepare($query);
537 537
                         $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
538
-                } catch(PDOException $e) {
538
+                } catch (PDOException $e) {
539 539
                         echo "error : ".$e->getMessage();
540 540
                 }
541 541
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
542 542
                 if (empty($all)) {
543 543
 			$filters = array('airlines' => array($stats_airline));
544 544
 			if ($filter_name != '') {
545
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
545
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
546 546
 			}
547 547
             		$Spotter = new Spotter($this->db);
548 548
             		$all = $Spotter->countAllMonths($filters);
@@ -556,21 +556,21 @@  discard block
 block discarded – undo
556 556
                  try {
557 557
                         $sth = $this->db->prepare($query);
558 558
                         $sth->execute(array(':filter_name' => $filter_name));
559
-                } catch(PDOException $e) {
559
+                } catch (PDOException $e) {
560 560
                         echo "error : ".$e->getMessage();
561 561
                 }
562 562
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
563 563
                 if (empty($all)) {
564 564
             		$filters = array();
565 565
             		if ($filter_name != '') {
566
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
566
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
567 567
 			}
568 568
             		$Spotter = new Spotter($this->db);
569 569
             		$all = $Spotter->countAllMilitaryMonths($filters);
570 570
                 }
571 571
                 return $all;
572 572
 	}
573
-	public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') {
573
+	public function countAllHours($orderby = 'hour', $limit = true, $stats_airline = '', $filter_name = '') {
574 574
 		global $globalTimezone, $globalDBdriver, $globalStatsFilters;
575 575
 		if ($filter_name == '') $filter_name = $this->filter_name;
576 576
 		if ($limit) $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name";
@@ -587,17 +587,17 @@  discard block
 block discarded – undo
587 587
                  try {
588 588
                         $sth = $this->db->prepare($query);
589 589
                         $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
590
-                } catch(PDOException $e) {
590
+                } catch (PDOException $e) {
591 591
                         echo "error : ".$e->getMessage();
592 592
                 }
593 593
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
594 594
                 if (empty($all)) {
595 595
 			$filters = array('airlines' => array($stats_airline));
596 596
 			if ($filter_name != '') {
597
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
597
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
598 598
 			}
599 599
             		$Spotter = new Spotter($this->db);
600
-            		$all = $Spotter->countAllHours($orderby,$filters);
600
+            		$all = $Spotter->countAllHours($orderby, $filters);
601 601
                 }
602 602
                 return $all;
603 603
 	}
@@ -605,11 +605,11 @@  discard block
 block discarded – undo
605 605
 	public function countOverallFlights($stats_airline = '', $filter_name = '') {
606 606
 		global $globalStatsFilters;
607 607
 		if ($filter_name == '') $filter_name = $this->filter_name;
608
-		$all = $this->getSumStats('flights_bymonth',date('Y'),$stats_airline,$filter_name);
608
+		$all = $this->getSumStats('flights_bymonth', date('Y'), $stats_airline, $filter_name);
609 609
 		if (empty($all)) {
610 610
 			$filters = array('airlines' => array($stats_airline));
611 611
 			if ($filter_name != '') {
612
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
612
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
613 613
 			}
614 614
 			$Spotter = new Spotter($this->db);
615 615
 			$all = $Spotter->countOverallFlights($filters);
@@ -619,39 +619,39 @@  discard block
 block discarded – undo
619 619
 	public function countOverallMilitaryFlights($filter_name = '') {
620 620
 		global $globalStatsFilters;
621 621
 		if ($filter_name == '') $filter_name = $this->filter_name;
622
-		$all = $this->getSumStats('military_flights_bymonth',date('Y'),'',$filter_name);
622
+		$all = $this->getSumStats('military_flights_bymonth', date('Y'), '', $filter_name);
623 623
 		if (empty($all)) {
624 624
 		        $filters = array();
625 625
             		if ($filter_name != '') {
626
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
626
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
627 627
 			}
628 628
 			$Spotter = new Spotter($this->db);
629 629
 			$all = $Spotter->countOverallMilitaryFlights($filters);
630 630
 		}
631 631
 		return $all;
632 632
 	}
633
-	public function countOverallArrival($stats_airline = '',$filter_name = '') {
633
+	public function countOverallArrival($stats_airline = '', $filter_name = '') {
634 634
 		global $globalStatsFilters;
635 635
 		if ($filter_name == '') $filter_name = $this->filter_name;
636
-		$all = $this->getSumStats('realarrivals_bymonth',date('Y'),$stats_airline,$filter_name);
636
+		$all = $this->getSumStats('realarrivals_bymonth', date('Y'), $stats_airline, $filter_name);
637 637
 		if (empty($all)) {
638 638
 			$filters = array('airlines' => array($stats_airline));
639 639
 			if ($filter_name != '') {
640
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
640
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
641 641
 			}
642 642
 			$Spotter = new Spotter($this->db);
643 643
 			$all = $Spotter->countOverallArrival($filters);
644 644
 		}
645 645
 		return $all;
646 646
 	}
647
-	public function countOverallAircrafts($stats_airline = '',$filter_name = '') {
647
+	public function countOverallAircrafts($stats_airline = '', $filter_name = '') {
648 648
 		global $globalStatsFilters;
649 649
 		if ($filter_name == '') $filter_name = $this->filter_name;
650
-		$all = $this->getSumStats('aircrafts_bymonth',date('Y'),$stats_airline,$filter_name);
650
+		$all = $this->getSumStats('aircrafts_bymonth', date('Y'), $stats_airline, $filter_name);
651 651
 		if (empty($all)) {
652 652
 			$filters = array('airlines' => array($stats_airline));
653 653
 			if ($filter_name != '') {
654
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
654
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
655 655
 			}
656 656
 			$Spotter = new Spotter($this->db);
657 657
 			$all = $Spotter->countOverallAircrafts($filters);
@@ -665,7 +665,7 @@  discard block
 block discarded – undo
665 665
                  try {
666 666
                         $sth = $this->db->prepare($query);
667 667
                         $sth->execute(array(':filter_name' => $filter_name));
668
-                } catch(PDOException $e) {
668
+                } catch (PDOException $e) {
669 669
                         echo "error : ".$e->getMessage();
670 670
                 }
671 671
                 $result = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -674,14 +674,14 @@  discard block
 block discarded – undo
674 674
 		if (empty($all)) {
675 675
             		$filters = array();
676 676
             		if ($filter_name != '') {
677
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
677
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
678 678
 			}
679 679
 			$Spotter = new Spotter($this->db);
680 680
 			$all = $Spotter->countOverallAirlines($filters);
681 681
 		}
682 682
 		return $all;
683 683
 	}
684
-	public function countOverallOwners($stats_airline = '',$filter_name = '') {
684
+	public function countOverallOwners($stats_airline = '', $filter_name = '') {
685 685
 		global $globalStatsFilters;
686 686
 		if ($filter_name == '') $filter_name = $this->filter_name;
687 687
 		/*
@@ -695,25 +695,25 @@  discard block
 block discarded – undo
695 695
                 $result = $sth->fetchAll(PDO::FETCH_ASSOC);
696 696
                 $all = $result[0]['nb_owner'];
697 697
                 */
698
-		$all = $this->getSumStats('owners_bymonth',date('Y'),$stats_airline,$filter_name);
698
+		$all = $this->getSumStats('owners_bymonth', date('Y'), $stats_airline, $filter_name);
699 699
 		if (empty($all)) {
700 700
 			$filters = array('airlines' => array($stats_airline));
701 701
 			if ($filter_name != '') {
702
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
702
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
703 703
 			}
704 704
 			$Spotter = new Spotter($this->db);
705 705
 			$all = $Spotter->countOverallOwners($filters);
706 706
 		}
707 707
 		return $all;
708 708
 	}
709
-	public function countOverallPilots($stats_airline = '',$filter_name = '') {
709
+	public function countOverallPilots($stats_airline = '', $filter_name = '') {
710 710
 		global $globalStatsFilters;
711 711
 		if ($filter_name == '') $filter_name = $this->filter_name;
712
-		$all = $this->getSumStats('pilots_bymonth',date('Y'),$stats_airline,$filter_name);
712
+		$all = $this->getSumStats('pilots_bymonth', date('Y'), $stats_airline, $filter_name);
713 713
 		if (empty($all)) {
714 714
 			$filters = array('airlines' => array($stats_airline));
715 715
 			if ($filter_name != '') {
716
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
716
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
717 717
 			}
718 718
 			$Spotter = new Spotter($this->db);
719 719
 			$all = $Spotter->countOverallPilots($filters);
@@ -721,33 +721,33 @@  discard block
 block discarded – undo
721 721
 		return $all;
722 722
 	}
723 723
 
724
-	public function getLast7DaysAirports($airport_icao = '', $stats_airline = '',$filter_name = '') {
724
+	public function getLast7DaysAirports($airport_icao = '', $stats_airline = '', $filter_name = '') {
725 725
 		if ($filter_name == '') $filter_name = $this->filter_name;
726 726
 		$query = "SELECT * FROM stats_airport WHERE stats_type = 'daily' AND airport_icao = :airport_icao AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY date";
727
-		$query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
727
+		$query_values = array(':airport_icao' => $airport_icao, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
728 728
                  try {
729 729
                         $sth = $this->db->prepare($query);
730 730
                         $sth->execute($query_values);
731
-                } catch(PDOException $e) {
731
+                } catch (PDOException $e) {
732 732
                         echo "error : ".$e->getMessage();
733 733
                 }
734 734
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
735 735
                 return $all;
736 736
 	}
737
-	public function getStats($type,$stats_airline = '', $filter_name = '') {
737
+	public function getStats($type, $stats_airline = '', $filter_name = '') {
738 738
 		if ($filter_name == '') $filter_name = $this->filter_name;
739 739
                 $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date";
740
-                $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
740
+                $query_values = array(':type' => $type, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
741 741
                  try {
742 742
                         $sth = $this->db->prepare($query);
743 743
                         $sth->execute($query_values);
744
-                } catch(PDOException $e) {
744
+                } catch (PDOException $e) {
745 745
                         echo "error : ".$e->getMessage();
746 746
                 }
747 747
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
748 748
                 return $all;
749 749
         }
750
-	public function getSumStats($type,$year,$stats_airline = '',$filter_name = '') {
750
+	public function getSumStats($type, $year, $stats_airline = '', $filter_name = '') {
751 751
 		if ($filter_name == '') $filter_name = $this->filter_name;
752 752
     		global $globalArchiveMonths, $globalDBdriver;
753 753
     		if ($globalDBdriver == 'mysql') {
@@ -755,11 +755,11 @@  discard block
 block discarded – undo
755 755
 	        } else {
756 756
             		$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND stats_airline = :stats_airline AND filter_name = :filter_name";
757 757
                 }
758
-                $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name);
758
+                $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
759 759
                  try {
760 760
                         $sth = $this->db->prepare($query);
761 761
                         $sth->execute($query_values);
762
-                } catch(PDOException $e) {
762
+                } catch (PDOException $e) {
763 763
                         echo "error : ".$e->getMessage();
764 764
                 }
765 765
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -777,7 +777,7 @@  discard block
 block discarded – undo
777 777
                  try {
778 778
                         $sth = $this->db->prepare($query);
779 779
                         $sth->execute($query_values);
780
-                } catch(PDOException $e) {
780
+                } catch (PDOException $e) {
781 781
                         echo "error : ".$e->getMessage();
782 782
                 }
783 783
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -794,7 +794,7 @@  discard block
 block discarded – undo
794 794
                  try {
795 795
                         $sth = $this->db->prepare($query);
796 796
                         $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
797
-                } catch(PDOException $e) {
797
+                } catch (PDOException $e) {
798 798
                         echo "error : ".$e->getMessage();
799 799
                 }
800 800
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -811,7 +811,7 @@  discard block
 block discarded – undo
811 811
                  try {
812 812
                         $sth = $this->db->prepare($query);
813 813
                         $sth->execute(array(':filter_name' => $filter_name));
814
-                } catch(PDOException $e) {
814
+                } catch (PDOException $e) {
815 815
                         echo "error : ".$e->getMessage();
816 816
                 }
817 817
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -828,7 +828,7 @@  discard block
 block discarded – undo
828 828
                  try {
829 829
                         $sth = $this->db->prepare($query);
830 830
                         $sth->execute(array(':filter_name' => $filter_name));
831
-                } catch(PDOException $e) {
831
+                } catch (PDOException $e) {
832 832
                         echo "error : ".$e->getMessage();
833 833
                 }
834 834
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -845,14 +845,14 @@  discard block
 block discarded – undo
845 845
                  try {
846 846
                         $sth = $this->db->prepare($query);
847 847
                         $sth->execute(array(':filter_name' => $filter_name));
848
-                } catch(PDOException $e) {
848
+                } catch (PDOException $e) {
849 849
                         echo "error : ".$e->getMessage();
850 850
                 }
851 851
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
852 852
                 return $all[0]['total'];
853 853
         }
854 854
 
855
-	public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') {
855
+	public function addStat($type, $cnt, $stats_date, $stats_airline = '', $filter_name = '') {
856 856
 		global $globalDBdriver;
857 857
 		if ($filter_name == '') $filter_name = $this->filter_name;
858 858
 		if ($globalDBdriver == 'mysql') {
@@ -860,15 +860,15 @@  discard block
 block discarded – undo
860 860
                 } else {
861 861
 			$query = "UPDATE stats SET cnt = :cnt WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) SELECT :type,:cnt,:stats_date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats WHERE  stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
862 862
 		}
863
-                $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date, ':stats_airline' => $stats_airline,':filter_name' => $filter_name);
863
+                $query_values = array(':type' => $type, ':cnt' => $cnt, ':stats_date' => $stats_date, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
864 864
                  try {
865 865
                         $sth = $this->db->prepare($query);
866 866
                         $sth->execute($query_values);
867
-                } catch(PDOException $e) {
867
+                } catch (PDOException $e) {
868 868
                         return "error : ".$e->getMessage();
869 869
                 }
870 870
         }
871
-	public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') {
871
+	public function updateStat($type, $cnt, $stats_date, $stats_airline = '', $filter_name = '') {
872 872
 		global $globalDBdriver;
873 873
 		if ($filter_name == '') $filter_name = $this->filter_name;
874 874
 		if ($globalDBdriver == 'mysql') {
@@ -877,219 +877,219 @@  discard block
 block discarded – undo
877 877
             		//$query = "INSERT INTO stats (stats_type,cnt,stats_date) VALUES (:type,:cnt,:stats_date) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date";
878 878
 			$query = "UPDATE stats SET cnt = cnt+:cnt WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) SELECT :type,:cnt,:stats_date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats WHERE  stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
879 879
                 }
880
-                $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
880
+                $query_values = array(':type' => $type, ':cnt' => $cnt, ':stats_date' => $stats_date, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
881 881
                  try {
882 882
                         $sth = $this->db->prepare($query);
883 883
                         $sth->execute($query_values);
884
-                } catch(PDOException $e) {
884
+                } catch (PDOException $e) {
885 885
                         return "error : ".$e->getMessage();
886 886
                 }
887 887
         }
888
-	public function getStatsSource($date,$stats_type = '') {
888
+	public function getStatsSource($date, $stats_type = '') {
889 889
 		if ($stats_type == '') {
890 890
 			$query = "SELECT * FROM stats_source WHERE stats_date = :date ORDER BY source_name";
891 891
 			$query_values = array(':date' => $date);
892 892
 		} else {
893 893
 			$query = "SELECT * FROM stats_source WHERE stats_date = :date AND stats_type = :stats_type ORDER BY source_name";
894
-			$query_values = array(':date' => $date,':stats_type' => $stats_type);
894
+			$query_values = array(':date' => $date, ':stats_type' => $stats_type);
895 895
 		}
896 896
                  try {
897 897
                         $sth = $this->db->prepare($query);
898 898
                         $sth->execute($query_values);
899
-                } catch(PDOException $e) {
899
+                } catch (PDOException $e) {
900 900
                         echo "error : ".$e->getMessage();
901 901
                 }
902 902
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
903 903
                 return $all;
904 904
         }
905 905
 
906
-	public function addStatSource($data,$source_name,$stats_type,$date) {
906
+	public function addStatSource($data, $source_name, $stats_type, $date) {
907 907
 		global $globalDBdriver;
908 908
 		if ($globalDBdriver == 'mysql') {
909 909
 			$query = "INSERT INTO stats_source (source_data,source_name,stats_type,stats_date) VALUES (:data,:source_name,:stats_type,:stats_date) ON DUPLICATE KEY UPDATE source_data = :data";
910 910
 		} else {
911 911
 			$query = "UPDATE stats_source SET source_data = :data WHERE stats_date = :stats_date AND source_name = :source_name AND stats_type = :stats_type; INSERT INTO stats_source (source_data,source_name,stats_type,stats_date) SELECT :data,:source_name,:stats_type,:stats_date WHERE NOT EXISTS (SELECT 1 FROM stats_source WHERE stats_date = :stats_date AND source_name = :source_name AND stats_type = :stats_type);"; 
912 912
                 }
913
-                $query_values = array(':data' => $data,':stats_date' => $date,':source_name' => $source_name,':stats_type' => $stats_type);
913
+                $query_values = array(':data' => $data, ':stats_date' => $date, ':source_name' => $source_name, ':stats_type' => $stats_type);
914 914
                  try {
915 915
                         $sth = $this->db->prepare($query);
916 916
                         $sth->execute($query_values);
917
-                } catch(PDOException $e) {
917
+                } catch (PDOException $e) {
918 918
                         return "error : ".$e->getMessage();
919 919
                 }
920 920
         }
921
-	public function addStatFlight($type,$date_name,$cnt,$stats_airline = '',$filter_name = '') {
921
+	public function addStatFlight($type, $date_name, $cnt, $stats_airline = '', $filter_name = '') {
922 922
                 $query = "INSERT INTO stats_flight (stats_type,flight_date,cnt,stats_airline,filter_name) VALUES (:type,:flight_date,:cnt,:stats_airline,:filter_name)";
923
-                $query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt, ':stats_airline' => $stats_airline,':filter_name' => $filter_name);
923
+                $query_values = array(':type' => $type, ':flight_date' => $date_name, ':cnt' => $cnt, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
924 924
                  try {
925 925
                         $sth = $this->db->prepare($query);
926 926
                         $sth->execute($query_values);
927
-                } catch(PDOException $e) {
927
+                } catch (PDOException $e) {
928 928
                         return "error : ".$e->getMessage();
929 929
                 }
930 930
         }
931
-	public function addStatAircraftRegistration($registration,$cnt,$aircraft_icao = '',$airline_icao = '',$filter_name = '') {
931
+	public function addStatAircraftRegistration($registration, $cnt, $aircraft_icao = '', $airline_icao = '', $filter_name = '') {
932 932
 		global $globalDBdriver;
933 933
 		if ($globalDBdriver == 'mysql') {
934 934
 			$query = "INSERT INTO stats_registration (aircraft_icao,registration,cnt,stats_airline,filter_name) VALUES (:aircraft_icao,:registration,:cnt,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt";
935 935
 		} else {
936 936
 			$query = "UPDATE stats_registration SET cnt = cnt+:cnt WHERE registration = :registration AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_registration (aircraft_icao,registration,cnt,stats_airline,filter_name) SELECT :aircraft_icao,:registration,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_registration WHERE registration = :registration AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
937 937
 		}
938
-                $query_values = array(':aircraft_icao' => $aircraft_icao,':registration' => $registration,':cnt' => $cnt,':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
938
+                $query_values = array(':aircraft_icao' => $aircraft_icao, ':registration' => $registration, ':cnt' => $cnt, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
939 939
                  try {
940 940
                         $sth = $this->db->prepare($query);
941 941
                         $sth->execute($query_values);
942
-                } catch(PDOException $e) {
942
+                } catch (PDOException $e) {
943 943
                         return "error : ".$e->getMessage();
944 944
                 }
945 945
         }
946
-	public function addStatCallsign($callsign_icao,$cnt,$airline_icao = '', $filter_name = '') {
946
+	public function addStatCallsign($callsign_icao, $cnt, $airline_icao = '', $filter_name = '') {
947 947
 		global $globalDBdriver;
948 948
 		if ($globalDBdriver == 'mysql') {
949 949
 			$query = "INSERT INTO stats_callsign (callsign_icao,airline_icao,cnt,filter_name) VALUES (:callsign_icao,:airline_icao,:cnt,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt";
950 950
 		} else {
951 951
 			$query = "UPDATE stats_callsign SET cnt = cnt+:cnt WHERE callsign_icao = :callsign_icao AND filter_name = :filter_name; INSERT INTO stats_callsign (callsign_icao,airline_icao,cnt,filter_name) SELECT :callsign_icao,:airline_icao,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_callsign WHERE callsign_icao = :callsign_icao AND filter_name = :filter_name);"; 
952 952
 		}
953
-                $query_values = array(':callsign_icao' => $callsign_icao,':airline_icao' => $airline_icao,':cnt' => $cnt, ':filter_name' => $filter_name);
953
+                $query_values = array(':callsign_icao' => $callsign_icao, ':airline_icao' => $airline_icao, ':cnt' => $cnt, ':filter_name' => $filter_name);
954 954
                  try {
955 955
                         $sth = $this->db->prepare($query);
956 956
                         $sth->execute($query_values);
957
-                } catch(PDOException $e) {
957
+                } catch (PDOException $e) {
958 958
                         return "error : ".$e->getMessage();
959 959
                 }
960 960
         }
961
-	public function addStatCountry($iso2,$iso3,$name,$cnt,$filter_name = '') {
961
+	public function addStatCountry($iso2, $iso3, $name, $cnt, $filter_name = '') {
962 962
 		global $globalDBdriver;
963 963
 		if ($globalDBdriver == 'mysql') {
964 964
 			$query = "INSERT INTO stats_country (iso2,iso3,name,cnt,filter_name) VALUES (:iso2,:iso3,:name,:cnt,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt";
965 965
 		} else {
966 966
 			$query = "UPDATE stats_country SET cnt = cnt+:cnt WHERE iso2 = :iso2 AND filter_name = :filter_name; INSERT INTO stats_country (iso2,iso3,name,cnt,filter_name) SELECT :iso2,:iso3,:name,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_country WHERE iso2 = :iso2 AND filter_name = :filter_name);"; 
967 967
 		}
968
-                $query_values = array(':iso2' => $iso2,':iso3' => $iso3,':name' => $name,':cnt' => $cnt,':filter_name' => $filter_name);
968
+                $query_values = array(':iso2' => $iso2, ':iso3' => $iso3, ':name' => $name, ':cnt' => $cnt, ':filter_name' => $filter_name);
969 969
                  try {
970 970
                         $sth = $this->db->prepare($query);
971 971
                         $sth->execute($query_values);
972
-                } catch(PDOException $e) {
972
+                } catch (PDOException $e) {
973 973
                         return "error : ".$e->getMessage();
974 974
                 }
975 975
         }
976
-	public function addStatAircraft($aircraft_icao,$cnt,$aircraft_name = '',$aircraft_manufacturer = '', $airline_icao = '', $filter_name = '') {
976
+	public function addStatAircraft($aircraft_icao, $cnt, $aircraft_name = '', $aircraft_manufacturer = '', $airline_icao = '', $filter_name = '') {
977 977
 		global $globalDBdriver;
978 978
 		if ($globalDBdriver == 'mysql') {
979 979
 			$query = "INSERT INTO stats_aircraft (aircraft_icao,aircraft_name,aircraft_manufacturer,cnt,stats_airline, filter_name) VALUES (:aircraft_icao,:aircraft_name,:aircraft_manufacturer,:cnt,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, aircraft_name = :aircraft_name, aircraft_manufacturer = :aircraft_manufacturer, stats_airline = :stats_airline";
980 980
 		} else {
981 981
 			$query = "UPDATE stats_aircraft SET cnt = cnt+:cnt, aircraft_name = :aircraft_name, aircraft_manufacturer = :aircraft_manufacturer, filter_name = :filter_name WHERE aircraft_icao = :aircraft_icao AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_aircraft (aircraft_icao,aircraft_name,aircraft_manufacturer,cnt,stats_airline,filter_name) SELECT :aircraft_icao,:aircraft_name,:aircraft_manufacturer,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_aircraft WHERE aircraft_icao = :aircraft_icao AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
982 982
 		}
983
-                $query_values = array(':aircraft_icao' => $aircraft_icao,':aircraft_name' => $aircraft_name,':cnt' => $cnt, ':aircraft_manufacturer' => $aircraft_manufacturer,':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
983
+                $query_values = array(':aircraft_icao' => $aircraft_icao, ':aircraft_name' => $aircraft_name, ':cnt' => $cnt, ':aircraft_manufacturer' => $aircraft_manufacturer, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
984 984
                  try {
985 985
                         $sth = $this->db->prepare($query);
986 986
                         $sth->execute($query_values);
987
-                } catch(PDOException $e) {
987
+                } catch (PDOException $e) {
988 988
                         return "error : ".$e->getMessage();
989 989
                 }
990 990
         }
991
-	public function addStatAirline($airline_icao,$cnt,$airline_name = '',$filter_name = '') {
991
+	public function addStatAirline($airline_icao, $cnt, $airline_name = '', $filter_name = '') {
992 992
 		global $globalDBdriver;
993 993
 		if ($globalDBdriver == 'mysql') {
994 994
 			$query = "INSERT INTO stats_airline (airline_icao,airline_name,cnt,filter_name) VALUES (:airline_icao,:airline_name,:cnt,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt,airline_name = :airline_name";
995 995
 		} else {
996 996
 			$query = "UPDATE stats_airline SET cnt = cnt+:cnt WHERE airline_icao = :airline_icao AND filter_name = :filter_name; INSERT INTO stats_airline (airline_icao,airline_name,cnt,filter_name) SELECT :airline_icao,:airline_name,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airline WHERE airline_icao = :airline_icao AND filter_name = :filter_name);"; 
997 997
 		}
998
-                $query_values = array(':airline_icao' => $airline_icao,':airline_name' => $airline_name,':cnt' => $cnt,':filter_name' => $filter_name);
998
+                $query_values = array(':airline_icao' => $airline_icao, ':airline_name' => $airline_name, ':cnt' => $cnt, ':filter_name' => $filter_name);
999 999
                  try {
1000 1000
                         $sth = $this->db->prepare($query);
1001 1001
                         $sth->execute($query_values);
1002
-                } catch(PDOException $e) {
1002
+                } catch (PDOException $e) {
1003 1003
                         return "error : ".$e->getMessage();
1004 1004
                 }
1005 1005
         }
1006
-	public function addStatOwner($owner_name,$cnt,$stats_airline = '', $filter_name = '') {
1006
+	public function addStatOwner($owner_name, $cnt, $stats_airline = '', $filter_name = '') {
1007 1007
 		global $globalDBdriver;
1008 1008
 		if ($globalDBdriver == 'mysql') {
1009 1009
 			$query = "INSERT INTO stats_owner (owner_name,cnt,stats_airline,filter_name) VALUES (:owner_name,:cnt,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt";
1010 1010
 		} else {
1011 1011
 			$query = "UPDATE stats_owner SET cnt = cnt+:cnt WHERE owner_name = :owner_name AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_owner (owner_name,cnt,stats_airline,filter_name) SELECT :owner_name,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_owner WHERE owner_name = :owner_name AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
1012 1012
 		}
1013
-                $query_values = array(':owner_name' => $owner_name,':cnt' => $cnt,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
1013
+                $query_values = array(':owner_name' => $owner_name, ':cnt' => $cnt, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
1014 1014
                  try {
1015 1015
                         $sth = $this->db->prepare($query);
1016 1016
                         $sth->execute($query_values);
1017
-                } catch(PDOException $e) {
1017
+                } catch (PDOException $e) {
1018 1018
                         return "error : ".$e->getMessage();
1019 1019
                 }
1020 1020
         }
1021
-	public function addStatPilot($pilot_id,$cnt,$pilot_name,$stats_airline = '',$filter_name = '') {
1021
+	public function addStatPilot($pilot_id, $cnt, $pilot_name, $stats_airline = '', $filter_name = '') {
1022 1022
 		global $globalDBdriver;
1023 1023
 		if ($globalDBdriver == 'mysql') {
1024 1024
 			$query = "INSERT INTO stats_pilot (pilot_id,cnt,pilot_name,stats_airline,filter_name) VALUES (:pilot_id,:cnt,:pilot_name,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, pilot_name = :pilot_name";
1025 1025
 		} else {
1026 1026
 			$query = "UPDATE stats_pilot SET cnt = cnt+:cnt, pilot_name = :pilot_name WHERE pilot_id = :pilot_id AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_pilot (pilot_id,cnt,pilot_name,stats_airline,filter_name) SELECT :pilot_id,:cnt,:pilot_name,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_pilot WHERE pilot_id = :pilot_id AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
1027 1027
 		}
1028
-                $query_values = array(':pilot_id' => $pilot_id,':cnt' => $cnt,':pilot_name' => $pilot_name,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
1028
+                $query_values = array(':pilot_id' => $pilot_id, ':cnt' => $cnt, ':pilot_name' => $pilot_name, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
1029 1029
                  try {
1030 1030
                         $sth = $this->db->prepare($query);
1031 1031
                         $sth->execute($query_values);
1032
-                } catch(PDOException $e) {
1032
+                } catch (PDOException $e) {
1033 1033
                         return "error : ".$e->getMessage();
1034 1034
                 }
1035 1035
         }
1036
-	public function addStatDepartureAirports($airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '') {
1036
+	public function addStatDepartureAirports($airport_icao, $airport_name, $airport_city, $airport_country, $departure, $airline_icao = '', $filter_name = '') {
1037 1037
 		global $globalDBdriver;
1038 1038
 		if ($globalDBdriver == 'mysql') {
1039 1039
 			$query = "INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) VALUES (:airport_icao,:airport_name,:airport_city,:airport_country,:departure,'yearly',:date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE departure = departure+:departure";
1040 1040
 		} else {
1041 1041
 			$query = "UPDATE stats_airport SET departure = departure+:departure WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:departure,'yearly',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name);"; 
1042 1042
 		}
1043
-                $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':departure' => $departure,':date' => date('Y').'-01-01 00:00:00', ':stats_airline' => $airline_icao,':filter_name' => $filter_name);
1043
+                $query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':departure' => $departure, ':date' => date('Y').'-01-01 00:00:00', ':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
1044 1044
                  try {
1045 1045
                         $sth = $this->db->prepare($query);
1046 1046
                         $sth->execute($query_values);
1047
-                } catch(PDOException $e) {
1047
+                } catch (PDOException $e) {
1048 1048
                         return "error : ".$e->getMessage();
1049 1049
                 }
1050 1050
         }
1051
-	public function addStatDepartureAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '') {
1051
+	public function addStatDepartureAirportsDaily($date, $airport_icao, $airport_name, $airport_city, $airport_country, $departure, $airline_icao = '', $filter_name = '') {
1052 1052
 		global $globalDBdriver;
1053 1053
 		if ($globalDBdriver == 'mysql') {
1054 1054
 			$query = "INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) VALUES (:airport_icao,:airport_name,:airport_city,:airport_country,:departure,'daily',:date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE departure = :departure";
1055 1055
 		} else {
1056 1056
 			$query = "UPDATE stats_airport SET departure = departure+:departure WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:departure,'daily',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
1057 1057
 		}
1058
-                $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':departure' => $departure,':date' => $date,':stats_airline' => $airline_icao,':filter_name' => $filter_name);
1058
+                $query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':departure' => $departure, ':date' => $date, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
1059 1059
                  try {
1060 1060
                         $sth = $this->db->prepare($query);
1061 1061
                         $sth->execute($query_values);
1062
-                } catch(PDOException $e) {
1062
+                } catch (PDOException $e) {
1063 1063
                         return "error : ".$e->getMessage();
1064 1064
                 }
1065 1065
         }
1066
-	public function addStatArrivalAirports($airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') {
1066
+	public function addStatArrivalAirports($airport_icao, $airport_name, $airport_city, $airport_country, $arrival, $airline_icao = '', $filter_name = '') {
1067 1067
 		global $globalDBdriver;
1068 1068
 		if ($globalDBdriver == 'mysql') {
1069 1069
 			$query = "INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) VALUES (:airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'yearly',:date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE arrival = arrival+:arrival";
1070 1070
 		} else {
1071 1071
 			$query = "UPDATE stats_airport SET arrival = arrival+:arrival WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'yearly',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name);"; 
1072 1072
 		}
1073
-                $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':arrival' => $arrival,':date' => date('Y').'-01-01 00:00:00',':stats_airline' => $airline_icao,':filter_name' => $filter_name);
1073
+                $query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':arrival' => $arrival, ':date' => date('Y').'-01-01 00:00:00', ':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
1074 1074
                  try {
1075 1075
                         $sth = $this->db->prepare($query);
1076 1076
                         $sth->execute($query_values);
1077
-                } catch(PDOException $e) {
1077
+                } catch (PDOException $e) {
1078 1078
                         return "error : ".$e->getMessage();
1079 1079
                 }
1080 1080
         }
1081
-	public function addStatArrivalAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') {
1081
+	public function addStatArrivalAirportsDaily($date, $airport_icao, $airport_name, $airport_city, $airport_country, $arrival, $airline_icao = '', $filter_name = '') {
1082 1082
 		global $globalDBdriver;
1083 1083
 		if ($globalDBdriver == 'mysql') {
1084 1084
 			$query = "INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) VALUES (:airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'daily',:date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE arrival = :arrival";
1085 1085
 		} else {
1086 1086
 			$query = "UPDATE stats_airport SET arrival = arrival+:arrival WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'daily',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
1087 1087
 		}
1088
-                $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':arrival' => $arrival, ':date' => $date,':stats_airline' => $airline_icao,':filter_name' => $filter_name);
1088
+                $query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':arrival' => $arrival, ':date' => $date, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
1089 1089
                  try {
1090 1090
                         $sth = $this->db->prepare($query);
1091 1091
                         $sth->execute($query_values);
1092
-                } catch(PDOException $e) {
1092
+                } catch (PDOException $e) {
1093 1093
                         return "error : ".$e->getMessage();
1094 1094
                 }
1095 1095
         }
@@ -1100,7 +1100,7 @@  discard block
 block discarded – undo
1100 1100
                  try {
1101 1101
                         $sth = $this->db->prepare($query);
1102 1102
                         $sth->execute($query_values);
1103
-                } catch(PDOException $e) {
1103
+                } catch (PDOException $e) {
1104 1104
                         return "error : ".$e->getMessage();
1105 1105
                 }
1106 1106
         }
@@ -1110,7 +1110,7 @@  discard block
 block discarded – undo
1110 1110
                  try {
1111 1111
                         $sth = $this->db->prepare($query);
1112 1112
                         $sth->execute($query_values);
1113
-                } catch(PDOException $e) {
1113
+                } catch (PDOException $e) {
1114 1114
                         return "error : ".$e->getMessage();
1115 1115
                 }
1116 1116
         }
@@ -1120,7 +1120,7 @@  discard block
 block discarded – undo
1120 1120
                  try {
1121 1121
                         $sth = $this->db->prepare($query);
1122 1122
                         $sth->execute($query_values);
1123
-                } catch(PDOException $e) {
1123
+                } catch (PDOException $e) {
1124 1124
                         return "error : ".$e->getMessage();
1125 1125
                 }
1126 1126
         }
@@ -1359,40 +1359,40 @@  discard block
 block discarded – undo
1359 1359
 				$last_update_day = $last_update[0]['value'];
1360 1360
 			} else $last_update_day = '2012-12-12 12:12:12';
1361 1361
 			$Spotter = new Spotter($this->db);
1362
-			$alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day);
1362
+			$alldata = $Spotter->countAllAircraftTypes(false, 0, $last_update_day);
1363 1363
 			foreach ($alldata as $number) {
1364
-				$this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer']);
1364
+				$this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer']);
1365 1365
 			}
1366 1366
 			if ($globalDebug) echo 'Count all airlines...'."\n";
1367
-			$alldata = $Spotter->countAllAirlines(false,0,$last_update_day);
1367
+			$alldata = $Spotter->countAllAirlines(false, 0, $last_update_day);
1368 1368
 			foreach ($alldata as $number) {
1369
-				$this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name']);
1369
+				$this->addStatAirline($number['airline_icao'], $number['airline_count'], $number['airline_name']);
1370 1370
 			}
1371 1371
 			if ($globalDebug) echo 'Count all registrations...'."\n";
1372
-			$alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day);
1372
+			$alldata = $Spotter->countAllAircraftRegistrations(false, 0, $last_update_day);
1373 1373
 			foreach ($alldata as $number) {
1374
-				$this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao']);
1374
+				$this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao']);
1375 1375
 			}
1376 1376
 			if ($globalDebug) echo 'Count all callsigns...'."\n";
1377
-			$alldata = $Spotter->countAllCallsigns(false,0,$last_update_day);
1377
+			$alldata = $Spotter->countAllCallsigns(false, 0, $last_update_day);
1378 1378
 			foreach ($alldata as $number) {
1379
-				$this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao']);
1379
+				$this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], $number['airline_icao']);
1380 1380
 			}
1381 1381
 			if ($globalDebug) echo 'Count all owners...'."\n";
1382
-			$alldata = $Spotter->countAllOwners(false,0,$last_update_day);
1382
+			$alldata = $Spotter->countAllOwners(false, 0, $last_update_day);
1383 1383
 			foreach ($alldata as $number) {
1384
-				$this->addStatOwner($number['owner_name'],$number['owner_count']);
1384
+				$this->addStatOwner($number['owner_name'], $number['owner_count']);
1385 1385
 			}
1386 1386
 			if ($globalDebug) echo 'Count all pilots...'."\n";
1387
-			$alldata = $Spotter->countAllPilots(false,0,$last_update_day);
1387
+			$alldata = $Spotter->countAllPilots(false, 0, $last_update_day);
1388 1388
 			foreach ($alldata as $number) {
1389
-				$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name']);
1389
+				$this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name']);
1390 1390
 			}
1391 1391
 			
1392 1392
 			if ($globalDebug) echo 'Count all departure airports...'."\n";
1393
-			$pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day);
1393
+			$pall = $Spotter->countAllDepartureAirports(false, 0, $last_update_day);
1394 1394
 			if ($globalDebug) echo 'Count all detected departure airports...'."\n";
1395
-        		$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day);
1395
+        		$dall = $Spotter->countAllDetectedDepartureAirports(false, 0, $last_update_day);
1396 1396
 			if ($globalDebug) echo 'Order departure airports...'."\n";
1397 1397
 	        	$alldata = array();
1398 1398
 	        	
@@ -1410,14 +1410,14 @@  discard block
 block discarded – undo
1410 1410
     			foreach ($alldata as $key => $row) {
1411 1411
     				$count[$key] = $row['airport_departure_icao_count'];
1412 1412
         		}
1413
-			array_multisort($count,SORT_DESC,$alldata);
1413
+			array_multisort($count, SORT_DESC, $alldata);
1414 1414
 			foreach ($alldata as $number) {
1415
-				echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count']);
1415
+				echo $this->addStatDepartureAirports($number['airport_departure_icao'], $number['airport_departure_name'], $number['airport_departure_city'], $number['airport_departure_country'], $number['airport_departure_icao_count']);
1416 1416
 			}
1417 1417
 			if ($globalDebug) echo 'Count all arrival airports...'."\n";
1418
-			$pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day);
1418
+			$pall = $Spotter->countAllArrivalAirports(false, 0, $last_update_day);
1419 1419
 			if ($globalDebug) echo 'Count all detected arrival airports...'."\n";
1420
-        		$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day);
1420
+        		$dall = $Spotter->countAllDetectedArrivalAirports(false, 0, $last_update_day);
1421 1421
 			if ($globalDebug) echo 'Order arrival airports...'."\n";
1422 1422
 	        	$alldata = array();
1423 1423
     			foreach ($pall as $value) {
@@ -1434,16 +1434,16 @@  discard block
 block discarded – undo
1434 1434
         		foreach ($alldata as $key => $row) {
1435 1435
         			$count[$key] = $row['airport_arrival_icao_count'];
1436 1436
 	        	}
1437
-    			array_multisort($count,SORT_DESC,$alldata);
1437
+    			array_multisort($count, SORT_DESC, $alldata);
1438 1438
                         foreach ($alldata as $number) {
1439
-				echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count']);
1439
+				echo $this->addStatArrivalAirports($number['airport_arrival_icao'], $number['airport_arrival_name'], $number['airport_arrival_city'], $number['airport_arrival_country'], $number['airport_arrival_icao_count']);
1440 1440
 			}
1441 1441
 			if ($Connection->tableExists('countries')) {
1442 1442
 				if ($globalDebug) echo 'Count all flights by countries...'."\n";
1443 1443
 				$SpotterArchive = new SpotterArchive();
1444
-				$alldata = $SpotterArchive->countAllFlightOverCountries(false,0,$last_update_day);
1444
+				$alldata = $SpotterArchive->countAllFlightOverCountries(false, 0, $last_update_day);
1445 1445
 				foreach ($alldata as $number) {
1446
-					$this->addStatCountry($number['flight_country_iso2'],$number['flight_country_iso3'],$number['flight_country'],$number['flight_count']);
1446
+					$this->addStatCountry($number['flight_country_iso2'], $number['flight_country_iso3'], $number['flight_country'], $number['flight_count']);
1447 1447
 				}
1448 1448
 			}
1449 1449
 			
@@ -1457,37 +1457,37 @@  discard block
 block discarded – undo
1457 1457
 			$lastyear = false;
1458 1458
 			foreach ($alldata as $number) {
1459 1459
 				if ($number['year_name'] != date('Y')) $lastyear = true;
1460
-				$this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1460
+				$this->addStat('flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])));
1461 1461
 			}
1462 1462
 			if ($globalDebug) echo 'Count all military flights by months...'."\n";
1463 1463
 			$alldata = $Spotter->countAllMilitaryMonths();
1464 1464
 			foreach ($alldata as $number) {
1465
-				$this->addStat('military_flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1465
+				$this->addStat('military_flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])));
1466 1466
 			}
1467 1467
 			if ($globalDebug) echo 'Count all owners by months...'."\n";
1468 1468
 			$alldata = $Spotter->countAllMonthsOwners();
1469 1469
 			foreach ($alldata as $number) {
1470
-				$this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1470
+				$this->addStat('owners_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])));
1471 1471
 			}
1472 1472
 			if ($globalDebug) echo 'Count all pilots by months...'."\n";
1473 1473
 			$alldata = $Spotter->countAllMonthsPilots();
1474 1474
 			foreach ($alldata as $number) {
1475
-				$this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1475
+				$this->addStat('pilots_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])));
1476 1476
 			}
1477 1477
 			if ($globalDebug) echo 'Count all airlines by months...'."\n";
1478 1478
 			$alldata = $Spotter->countAllMonthsAirlines();
1479 1479
 			foreach ($alldata as $number) {
1480
-				$this->addStat('airlines_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1480
+				$this->addStat('airlines_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])));
1481 1481
 			}
1482 1482
 			if ($globalDebug) echo 'Count all aircrafts by months...'."\n";
1483 1483
 			$alldata = $Spotter->countAllMonthsAircrafts();
1484 1484
 			foreach ($alldata as $number) {
1485
-				$this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1485
+				$this->addStat('aircrafts_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])));
1486 1486
 			}
1487 1487
 			if ($globalDebug) echo 'Count all real arrivals by months...'."\n";
1488 1488
 			$alldata = $Spotter->countAllMonthsRealArrivals();
1489 1489
 			foreach ($alldata as $number) {
1490
-				$this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1490
+				$this->addStat('realarrivals_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])));
1491 1491
 			}
1492 1492
 			if ($globalDebug) echo 'Airports data...'."\n";
1493 1493
 			if ($globalDebug) echo '...Departure'."\n";
@@ -1532,7 +1532,7 @@  discard block
 block discarded – undo
1532 1532
     			}
1533 1533
     			$alldata = $pall;
1534 1534
 			foreach ($alldata as $number) {
1535
-				$this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count']);
1535
+				$this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count']);
1536 1536
 			}
1537 1537
 			echo '...Arrival'."\n";
1538 1538
 			$pall = $Spotter->getLast7DaysAirportsArrival();
@@ -1574,7 +1574,7 @@  discard block
 block discarded – undo
1574 1574
     			}
1575 1575
     			$alldata = $pall;
1576 1576
 			foreach ($alldata as $number) {
1577
-				$this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count']);
1577
+				$this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count']);
1578 1578
 			}
1579 1579
 
1580 1580
 			echo 'Flights data...'."\n";
@@ -1582,28 +1582,28 @@  discard block
 block discarded – undo
1582 1582
 			echo '-> countAllDatesLastMonth...'."\n";
1583 1583
 			$alldata = $Spotter->countAllDatesLastMonth();
1584 1584
 			foreach ($alldata as $number) {
1585
-				$this->addStatFlight('month',$number['date_name'],$number['date_count']);
1585
+				$this->addStatFlight('month', $number['date_name'], $number['date_count']);
1586 1586
 			}
1587 1587
 			echo '-> countAllDates...'."\n";
1588 1588
 			$previousdata = $this->countAllDates();
1589 1589
 			$previousdatabyairlines = $this->countAllDatesByAirlines();
1590 1590
 			$this->deleteStatFlight('date');
1591
-			$alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDates());
1591
+			$alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDates());
1592 1592
 			$values = array();
1593 1593
 			foreach ($alldata as $cnt) {
1594 1594
 				$values[] = $cnt['date_count'];
1595 1595
 			}
1596
-			array_multisort($values,SORT_DESC,$alldata);
1597
-			array_splice($alldata,11);
1596
+			array_multisort($values, SORT_DESC, $alldata);
1597
+			array_splice($alldata, 11);
1598 1598
 			foreach ($alldata as $number) {
1599
-				$this->addStatFlight('date',$number['date_name'],$number['date_count']);
1599
+				$this->addStatFlight('date', $number['date_name'], $number['date_count']);
1600 1600
 			}
1601 1601
 			
1602 1602
 			$this->deleteStatFlight('hour');
1603 1603
 			echo '-> countAllHours...'."\n";
1604 1604
 			$alldata = $Spotter->countAllHours('hour');
1605 1605
 			foreach ($alldata as $number) {
1606
-				$this->addStatFlight('hour',$number['hour_name'],$number['hour_count']);
1606
+				$this->addStatFlight('hour', $number['hour_name'], $number['hour_count']);
1607 1607
 			}
1608 1608
 
1609 1609
 
@@ -1612,34 +1612,34 @@  discard block
 block discarded – undo
1612 1612
 			echo '--- Stats by airlines ---'."\n";
1613 1613
 			if ($globalDebug) echo 'Count all aircraft types by airlines...'."\n";
1614 1614
 			$Spotter = new Spotter($this->db);
1615
-			$alldata = $Spotter->countAllAircraftTypesByAirlines(false,0,$last_update_day);
1615
+			$alldata = $Spotter->countAllAircraftTypesByAirlines(false, 0, $last_update_day);
1616 1616
 			foreach ($alldata as $number) {
1617
-				$this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],$number['airline_icao']);
1617
+				$this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], $number['airline_icao']);
1618 1618
 			}
1619 1619
 			if ($globalDebug) echo 'Count all aircraft registrations by airlines...'."\n";
1620
-			$alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false,0,$last_update_day);
1620
+			$alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false, 0, $last_update_day);
1621 1621
 			foreach ($alldata as $number) {
1622
-				$this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],$number['airline_icao']);
1622
+				$this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], $number['airline_icao']);
1623 1623
 			}
1624 1624
 			if ($globalDebug) echo 'Count all callsigns by airlines...'."\n";
1625
-			$alldata = $Spotter->countAllCallsignsByAirlines(false,0,$last_update_day);
1625
+			$alldata = $Spotter->countAllCallsignsByAirlines(false, 0, $last_update_day);
1626 1626
 			foreach ($alldata as $number) {
1627
-				$this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao']);
1627
+				$this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], $number['airline_icao']);
1628 1628
 			}
1629 1629
 			if ($globalDebug) echo 'Count all owners by airlines...'."\n";
1630
-			$alldata = $Spotter->countAllOwnersByAirlines(false,0,$last_update_day);
1630
+			$alldata = $Spotter->countAllOwnersByAirlines(false, 0, $last_update_day);
1631 1631
 			foreach ($alldata as $number) {
1632
-				$this->addStatOwner($number['owner_name'],$number['owner_count'],$number['airline_icao']);
1632
+				$this->addStatOwner($number['owner_name'], $number['owner_count'], $number['airline_icao']);
1633 1633
 			}
1634 1634
 			if ($globalDebug) echo 'Count all pilots by airlines...'."\n";
1635
-			$alldata = $Spotter->countAllPilotsByAirlines(false,0,$last_update_day);
1635
+			$alldata = $Spotter->countAllPilotsByAirlines(false, 0, $last_update_day);
1636 1636
 			foreach ($alldata as $number) {
1637
-				$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],$number['airline_icao']);
1637
+				$this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], $number['airline_icao']);
1638 1638
 			}
1639 1639
 			if ($globalDebug) echo 'Count all departure airports by airlines...'."\n";
1640
-			$pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day);
1640
+			$pall = $Spotter->countAllDepartureAirportsByAirlines(false, 0, $last_update_day);
1641 1641
 			if ($globalDebug) echo 'Count all detected departure airports by airlines...'."\n";
1642
-       			$dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day);
1642
+       			$dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false, 0, $last_update_day);
1643 1643
 			if ($globalDebug) echo 'Order detected departure airports by airlines...'."\n";
1644 1644
 	        	//$alldata = array();
1645 1645
     			foreach ($dall as $value) {
@@ -1659,12 +1659,12 @@  discard block
 block discarded – undo
1659 1659
     			}
1660 1660
     			$alldata = $pall;
1661 1661
 			foreach ($alldata as $number) {
1662
-				echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],$number['airline_icao']);
1662
+				echo $this->addStatDepartureAirports($number['airport_departure_icao'], $number['airport_departure_name'], $number['airport_departure_city'], $number['airport_departure_country'], $number['airport_departure_icao_count'], $number['airline_icao']);
1663 1663
 			}
1664 1664
 			if ($globalDebug) echo 'Count all arrival airports by airlines...'."\n";
1665
-			$pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day);
1665
+			$pall = $Spotter->countAllArrivalAirportsByAirlines(false, 0, $last_update_day);
1666 1666
 			if ($globalDebug) echo 'Count all detected arrival airports by airlines...'."\n";
1667
-        		$dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day);
1667
+        		$dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false, 0, $last_update_day);
1668 1668
 			if ($globalDebug) echo 'Order arrival airports by airlines...'."\n";
1669 1669
 	        	//$alldata = array();
1670 1670
     			foreach ($dall as $value) {
@@ -1684,7 +1684,7 @@  discard block
 block discarded – undo
1684 1684
     			}
1685 1685
     			$alldata = $pall;
1686 1686
                         foreach ($alldata as $number) {
1687
-				echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],$number['airline_icao']);
1687
+				echo $this->addStatArrivalAirports($number['airport_arrival_icao'], $number['airport_arrival_name'], $number['airport_arrival_city'], $number['airport_arrival_country'], $number['airport_arrival_icao_count'], $number['airline_icao']);
1688 1688
 			}
1689 1689
 			if ($globalDebug) echo 'Count all flights by months by airlines...'."\n";
1690 1690
 			$Spotter = new Spotter($this->db);
@@ -1692,27 +1692,27 @@  discard block
 block discarded – undo
1692 1692
 			$lastyear = false;
1693 1693
 			foreach ($alldata as $number) {
1694 1694
 				if ($number['year_name'] != date('Y')) $lastyear = true;
1695
-				$this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
1695
+				$this->addStat('flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']);
1696 1696
 			}
1697 1697
 			if ($globalDebug) echo 'Count all owners by months by airlines...'."\n";
1698 1698
 			$alldata = $Spotter->countAllMonthsOwnersByAirlines();
1699 1699
 			foreach ($alldata as $number) {
1700
-				$this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
1700
+				$this->addStat('owners_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']);
1701 1701
 			}
1702 1702
 			if ($globalDebug) echo 'Count all pilots by months by airlines...'."\n";
1703 1703
 			$alldata = $Spotter->countAllMonthsPilotsByAirlines();
1704 1704
 			foreach ($alldata as $number) {
1705
-				$this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
1705
+				$this->addStat('pilots_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']);
1706 1706
 			}
1707 1707
 			if ($globalDebug) echo 'Count all aircrafts by months by airlines...'."\n";
1708 1708
 			$alldata = $Spotter->countAllMonthsAircraftsByAirlines();
1709 1709
 			foreach ($alldata as $number) {
1710
-				$this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
1710
+				$this->addStat('aircrafts_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']);
1711 1711
 			}
1712 1712
 			if ($globalDebug) echo 'Count all real arrivals by months by airlines...'."\n";
1713 1713
 			$alldata = $Spotter->countAllMonthsRealArrivalsByAirlines();
1714 1714
 			foreach ($alldata as $number) {
1715
-				$this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
1715
+				$this->addStat('realarrivals_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']);
1716 1716
 			}
1717 1717
 			if ($globalDebug) echo '...Departure'."\n";
1718 1718
 			$pall = $Spotter->getLast7DaysAirportsDepartureByAirlines();
@@ -1735,7 +1735,7 @@  discard block
 block discarded – undo
1735 1735
     			}
1736 1736
     			$alldata = $pall;
1737 1737
 			foreach ($alldata as $number) {
1738
-				$this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count'],$number['airline_icao']);
1738
+				$this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count'], $number['airline_icao']);
1739 1739
 			}
1740 1740
 			if ($globalDebug) echo '...Arrival'."\n";
1741 1741
 			$pall = $Spotter->getLast7DaysAirportsArrivalByAirlines();
@@ -1758,32 +1758,32 @@  discard block
 block discarded – undo
1758 1758
     			}
1759 1759
     			$alldata = $pall;
1760 1760
 			foreach ($alldata as $number) {
1761
-				$this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count'],$number['airline_icao']);
1761
+				$this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count'], $number['airline_icao']);
1762 1762
 			}
1763 1763
 
1764 1764
 			if ($globalDebug) echo 'Flights data...'."\n";
1765 1765
 			if ($globalDebug) echo '-> countAllDatesLastMonth...'."\n";
1766 1766
 			$alldata = $Spotter->countAllDatesLastMonthByAirlines();
1767 1767
 			foreach ($alldata as $number) {
1768
-				$this->addStatFlight('month',$number['date_name'],$number['date_count'], $number['airline_icao']);
1768
+				$this->addStatFlight('month', $number['date_name'], $number['date_count'], $number['airline_icao']);
1769 1769
 			}
1770 1770
 			if ($globalDebug) echo '-> countAllDates...'."\n";
1771 1771
 			//$previousdata = $this->countAllDatesByAirlines();
1772
-			$alldata = $Common->array_merge_noappend($previousdatabyairlines,$Spotter->countAllDatesByAirlines());
1772
+			$alldata = $Common->array_merge_noappend($previousdatabyairlines, $Spotter->countAllDatesByAirlines());
1773 1773
 			$values = array();
1774 1774
 			foreach ($alldata as $cnt) {
1775 1775
 				$values[] = $cnt['date_count'];
1776 1776
 			}
1777
-			array_multisort($values,SORT_DESC,$alldata);
1778
-			array_splice($alldata,11);
1777
+			array_multisort($values, SORT_DESC, $alldata);
1778
+			array_splice($alldata, 11);
1779 1779
 			foreach ($alldata as $number) {
1780
-				$this->addStatFlight('date',$number['date_name'],$number['date_count'],$number['airline_icao']);
1780
+				$this->addStatFlight('date', $number['date_name'], $number['date_count'], $number['airline_icao']);
1781 1781
 			}
1782 1782
 			
1783 1783
 			if ($globalDebug) echo '-> countAllHours...'."\n";
1784 1784
 			$alldata = $Spotter->countAllHoursByAirlines('hour');
1785 1785
 			foreach ($alldata as $number) {
1786
-				$this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],$number['airline_icao']);
1786
+				$this->addStatFlight('hour', $number['hour_name'], $number['hour_count'], $number['airline_icao']);
1787 1787
 			}
1788 1788
 			
1789 1789
 
@@ -1794,33 +1794,33 @@  discard block
 block discarded – undo
1794 1794
 				// Count by filter
1795 1795
 				if ($globalDebug) echo '--- Stats for filter '.$filter_name.' ---'."\n";
1796 1796
 				$Spotter = new Spotter($this->db);
1797
-				$alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day,$filter);
1797
+				$alldata = $Spotter->countAllAircraftTypes(false, 0, $last_update_day, $filter);
1798 1798
 				foreach ($alldata as $number) {
1799
-					$this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'',$filter_name);
1799
+					$this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], '', $filter_name);
1800 1800
 				}
1801
-				$alldata = $Spotter->countAllAirlines(false,0,$last_update_day,$filter);
1801
+				$alldata = $Spotter->countAllAirlines(false, 0, $last_update_day, $filter);
1802 1802
 				foreach ($alldata as $number) {
1803
-					$this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],$filter_name);
1803
+					$this->addStatAirline($number['airline_icao'], $number['airline_count'], $number['airline_name'], $filter_name);
1804 1804
 				}
1805
-				$alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day,$filter);
1805
+				$alldata = $Spotter->countAllAircraftRegistrations(false, 0, $last_update_day, $filter);
1806 1806
 				foreach ($alldata as $number) {
1807
-					$this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'',$filter_name);
1807
+					$this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], '', $filter_name);
1808 1808
 				}
1809
-				$alldata = $Spotter->countAllCallsigns(false,0,$last_update_day,$filter);
1809
+				$alldata = $Spotter->countAllCallsigns(false, 0, $last_update_day, $filter);
1810 1810
 				foreach ($alldata as $number) {
1811
-					$this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],'',$filter_name);
1811
+					$this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], '', $filter_name);
1812 1812
 				}
1813
-				$alldata = $Spotter->countAllOwners(false,0,$last_update_day,$filter);
1813
+				$alldata = $Spotter->countAllOwners(false, 0, $last_update_day, $filter);
1814 1814
 				foreach ($alldata as $number) {
1815
-					$this->addStatOwner($number['owner_name'],$number['owner_count'],'',$filter_name);
1815
+					$this->addStatOwner($number['owner_name'], $number['owner_count'], '', $filter_name);
1816 1816
 				}
1817
-				$alldata = $Spotter->countAllPilots(false,0,$last_update_day,$filter);
1817
+				$alldata = $Spotter->countAllPilots(false, 0, $last_update_day, $filter);
1818 1818
 				foreach ($alldata as $number) {
1819
-					$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'',$filter_name);
1819
+					$this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], '', $filter_name);
1820 1820
 				}
1821 1821
     			
1822
-				$pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day,$filter);
1823
-	       			$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter);
1822
+				$pall = $Spotter->countAllDepartureAirports(false, 0, $last_update_day, $filter);
1823
+	       			$dall = $Spotter->countAllDetectedDepartureAirports(false, 0, $last_update_day, $filter);
1824 1824
 		        	$alldata = array();
1825 1825
 	    			foreach ($pall as $value) {
1826 1826
 		        		$icao = $value['airport_departure_icao'];
@@ -1836,12 +1836,12 @@  discard block
 block discarded – undo
1836 1836
     				foreach ($alldata as $key => $row) {
1837 1837
     					$count[$key] = $row['airport_departure_icao_count'];
1838 1838
     				}
1839
-				array_multisort($count,SORT_DESC,$alldata);
1839
+				array_multisort($count, SORT_DESC, $alldata);
1840 1840
 				foreach ($alldata as $number) {
1841
-    					echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],'',$filter_name);
1841
+    					echo $this->addStatDepartureAirports($number['airport_departure_icao'], $number['airport_departure_name'], $number['airport_departure_city'], $number['airport_departure_country'], $number['airport_departure_icao_count'], '', $filter_name);
1842 1842
 				}
1843
-				$pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day,$filter);
1844
-    				$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,$filter);
1843
+				$pall = $Spotter->countAllArrivalAirports(false, 0, $last_update_day, $filter);
1844
+    				$dall = $Spotter->countAllDetectedArrivalAirports(false, 0, $last_update_day, $filter);
1845 1845
 				$alldata = array();
1846 1846
     				foreach ($pall as $value) {
1847 1847
 		        		$icao = $value['airport_arrival_icao'];
@@ -1857,36 +1857,36 @@  discard block
 block discarded – undo
1857 1857
         			foreach ($alldata as $key => $row) {
1858 1858
     					$count[$key] = $row['airport_arrival_icao_count'];
1859 1859
 		        	}
1860
-        			array_multisort($count,SORT_DESC,$alldata);
1860
+        			array_multisort($count, SORT_DESC, $alldata);
1861 1861
 				foreach ($alldata as $number) {
1862
-					echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],'',$filter_name);
1862
+					echo $this->addStatArrivalAirports($number['airport_arrival_icao'], $number['airport_arrival_name'], $number['airport_arrival_city'], $number['airport_arrival_country'], $number['airport_arrival_icao_count'], '', $filter_name);
1863 1863
 				}
1864 1864
 				$Spotter = new Spotter($this->db);
1865 1865
 				$alldata = $Spotter->countAllMonths($filter);
1866 1866
 				$lastyear = false;
1867 1867
 				foreach ($alldata as $number) {
1868 1868
 					if ($number['year_name'] != date('Y')) $lastyear = true;
1869
-					$this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name);
1869
+					$this->addStat('flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name);
1870 1870
 				}
1871 1871
 				$alldata = $Spotter->countAllMonthsOwners($filter);
1872 1872
 				foreach ($alldata as $number) {
1873
-					$this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name);
1873
+					$this->addStat('owners_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name);
1874 1874
 				}
1875 1875
 				$alldata = $Spotter->countAllMonthsPilots($filter);
1876 1876
 				foreach ($alldata as $number) {
1877
-					$this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name);
1877
+					$this->addStat('pilots_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name);
1878 1878
 				}
1879 1879
 				$alldata = $Spotter->countAllMonthsAircrafts($filter);
1880 1880
 				foreach ($alldata as $number) {
1881
-					$this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name);
1881
+					$this->addStat('aircrafts_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name);
1882 1882
 				}
1883 1883
 				$alldata = $Spotter->countAllMonthsRealArrivals($filter);
1884 1884
 				foreach ($alldata as $number) {
1885
-					$this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name);
1885
+					$this->addStat('realarrivals_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name);
1886 1886
 				}
1887 1887
 				echo '...Departure'."\n";
1888
-				$pall = $Spotter->getLast7DaysAirportsDeparture('',$filter);
1889
-        			$dall = $Spotter->getLast7DaysDetectedAirportsDeparture('',$filter);
1888
+				$pall = $Spotter->getLast7DaysAirportsDeparture('', $filter);
1889
+        			$dall = $Spotter->getLast7DaysDetectedAirportsDeparture('', $filter);
1890 1890
 				foreach ($dall as $value) {
1891 1891
     					$icao = $value['departure_airport_icao'];
1892 1892
     					$ddate = $value['date'];
@@ -1904,11 +1904,11 @@  discard block
 block discarded – undo
1904 1904
     				}
1905 1905
 	    			$alldata = $pall;
1906 1906
 				foreach ($alldata as $number) {
1907
-					$this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count'],'',$filter_name);
1907
+					$this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count'], '', $filter_name);
1908 1908
 				}
1909 1909
 				echo '...Arrival'."\n";
1910
-				$pall = $Spotter->getLast7DaysAirportsArrival('',$filter);
1911
-    				$dall = $Spotter->getLast7DaysDetectedAirportsArrival('',$filter);
1910
+				$pall = $Spotter->getLast7DaysAirportsArrival('', $filter);
1911
+    				$dall = $Spotter->getLast7DaysDetectedAirportsArrival('', $filter);
1912 1912
 				foreach ($dall as $value) {
1913 1913
 					$icao = $value['arrival_airport_icao'];
1914 1914
 					$ddate = $value['date'];
@@ -1926,32 +1926,32 @@  discard block
 block discarded – undo
1926 1926
     				}
1927 1927
     				$alldata = $pall;
1928 1928
 				foreach ($alldata as $number) {
1929
-					$this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count'],'',$filter_name);
1929
+					$this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count'], '', $filter_name);
1930 1930
 				}
1931 1931
     
1932 1932
 				echo 'Flights data...'."\n";
1933 1933
 				echo '-> countAllDatesLastMonth...'."\n";
1934 1934
 				$alldata = $Spotter->countAllDatesLastMonth($filter);
1935 1935
 				foreach ($alldata as $number) {
1936
-					$this->addStatFlight('month',$number['date_name'],$number['date_count'], '',$filter_name);
1936
+					$this->addStatFlight('month', $number['date_name'], $number['date_count'], '', $filter_name);
1937 1937
 				}
1938 1938
 				echo '-> countAllDates...'."\n";
1939
-				$previousdata = $this->countAllDates('',$filter_name);
1940
-				$alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDates($filter));
1939
+				$previousdata = $this->countAllDates('', $filter_name);
1940
+				$alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDates($filter));
1941 1941
 				$values = array();
1942 1942
 				foreach ($alldata as $cnt) {
1943 1943
 					$values[] = $cnt['date_count'];
1944 1944
 				}
1945
-				array_multisort($values,SORT_DESC,$alldata);
1946
-				array_splice($alldata,11);
1945
+				array_multisort($values, SORT_DESC, $alldata);
1946
+				array_splice($alldata, 11);
1947 1947
 				foreach ($alldata as $number) {
1948
-					$this->addStatFlight('date',$number['date_name'],$number['date_count'],'',$filter_name);
1948
+					$this->addStatFlight('date', $number['date_name'], $number['date_count'], '', $filter_name);
1949 1949
 				}
1950 1950
 				
1951 1951
 				echo '-> countAllHours...'."\n";
1952
-				$alldata = $Spotter->countAllHours('hour',$filter);
1952
+				$alldata = $Spotter->countAllHours('hour', $filter);
1953 1953
 				foreach ($alldata as $number) {
1954
-					$this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],'',$filter_name);
1954
+					$this->addStatFlight('hour', $number['hour_name'], $number['hour_count'], '', $filter_name);
1955 1955
 				}
1956 1956
 			}
1957 1957
 	
@@ -1962,16 +1962,16 @@  discard block
 block discarded – undo
1962 1962
 				// SUM all previous month to put as year
1963 1963
 				$previous_year = date('Y');
1964 1964
 				$previous_year--;
1965
-				$this->addStat('aircrafts_byyear',$this->getSumStats('aircrafts_bymonth',$previous_year),$previous_year.'-01-01 00:00:00');
1966
-				$this->addStat('airlines_byyear',$this->getSumStats('airlines_bymonth',$previous_year),$previous_year.'-01-01 00:00:00');
1967
-				$this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year),$previous_year.'-01-01 00:00:00');
1968
-				$this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year),$previous_year.'-01-01 00:00:00');
1965
+				$this->addStat('aircrafts_byyear', $this->getSumStats('aircrafts_bymonth', $previous_year), $previous_year.'-01-01 00:00:00');
1966
+				$this->addStat('airlines_byyear', $this->getSumStats('airlines_bymonth', $previous_year), $previous_year.'-01-01 00:00:00');
1967
+				$this->addStat('owner_byyear', $this->getSumStats('owner_bymonth', $previous_year), $previous_year.'-01-01 00:00:00');
1968
+				$this->addStat('pilot_byyear', $this->getSumStats('pilot_bymonth', $previous_year), $previous_year.'-01-01 00:00:00');
1969 1969
 				$allairlines = $this->getAllAirlineNames();
1970 1970
 				foreach ($allairlines as $data) {
1971
-					$this->addStat('aircrafts_byyear',$this->getSumStats('aircrafts_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']);
1972
-					$this->addStat('airlines_byyear',$this->getSumStats('airlines_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']);
1973
-					$this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']);
1974
-					$this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']);
1971
+					$this->addStat('aircrafts_byyear', $this->getSumStats('aircrafts_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']);
1972
+					$this->addStat('airlines_byyear', $this->getSumStats('airlines_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']);
1973
+					$this->addStat('owner_byyear', $this->getSumStats('owner_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']);
1974
+					$this->addStat('pilot_byyear', $this->getSumStats('pilot_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']);
1975 1975
 				}
1976 1976
 				
1977 1977
 				if (isset($globalArchiveYear) && $globalArchiveYear) {
@@ -1980,7 +1980,7 @@  discard block
 block discarded – undo
1980 1980
 						try {
1981 1981
 							$sth = $this->db->prepare($query);
1982 1982
 							$sth->execute();
1983
-						} catch(PDOException $e) {
1983
+						} catch (PDOException $e) {
1984 1984
 							return "error : ".$e->getMessage().' - query : '.$query."\n";
1985 1985
 						}
1986 1986
 					}
@@ -1989,7 +1989,7 @@  discard block
 block discarded – undo
1989 1989
 					try {
1990 1990
 						$sth = $this->db->prepare($query);
1991 1991
 						$sth->execute();
1992
-					} catch(PDOException $e) {
1992
+					} catch (PDOException $e) {
1993 1993
 						return "error : ".$e->getMessage().' - query : '.$query."\n";
1994 1994
 					}
1995 1995
 				}
@@ -2011,7 +2011,7 @@  discard block
 block discarded – undo
2011 2011
 					try {
2012 2012
 						$sth = $this->db->prepare($query);
2013 2013
 						$sth->execute();
2014
-					} catch(PDOException $e) {
2014
+					} catch (PDOException $e) {
2015 2015
 						return "error : ".$e->getMessage();
2016 2016
 					}
2017 2017
 				}
@@ -2025,13 +2025,13 @@  discard block
 block discarded – undo
2025 2025
 				try {
2026 2026
 					$sth = $this->db->prepare($query);
2027 2027
 					$sth->execute();
2028
-				} catch(PDOException $e) {
2028
+				} catch (PDOException $e) {
2029 2029
 					return "error : ".$e->getMessage();
2030 2030
 				}
2031 2031
 			}
2032 2032
 			echo 'Insert last stats update date...'."\n";
2033 2033
 			date_default_timezone_set('UTC');
2034
-			$this->addLastStatsUpdate('last_update_stats',date('Y-m-d G:i:s'));
2034
+			$this->addLastStatsUpdate('last_update_stats', date('Y-m-d G:i:s'));
2035 2035
 		//}
2036 2036
 	}
2037 2037
 }
Please login to merge, or discard this patch.
Braces   +380 added lines, -132 removed lines patch added patch discarded remove patch
@@ -12,7 +12,9 @@  discard block
 block discarded – undo
12 12
 	
13 13
 	public function __construct($dbc = null) {
14 14
 		global $globalFilterName;
15
-		if (isset($globalFilterName)) $this->filter_name = $globalFilterName;
15
+		if (isset($globalFilterName)) {
16
+			$this->filter_name = $globalFilterName;
17
+		}
16 18
 		$Connection = new Connection($dbc);
17 19
 		$this->db = $Connection->db();
18 20
         }
@@ -41,7 +43,9 @@  discard block
 block discarded – undo
41 43
                 return $all;
42 44
         }
43 45
 	public function getAllAirlineNames($filter_name = '') {
44
-		if ($filter_name == '') $filter_name = $this->filter_name;
46
+		if ($filter_name == '') {
47
+			$filter_name = $this->filter_name;
48
+		}
45 49
                 $query = "SELECT * FROM stats_airline WHERE filter_name = :filter_name ORDER BY airline_name ASC";
46 50
                  try {
47 51
                         $sth = $this->db->prepare($query);
@@ -53,7 +57,9 @@  discard block
 block discarded – undo
53 57
                 return $all;
54 58
         }
55 59
 	public function getAllAircraftTypes($stats_airline = '',$filter_name = '') {
56
-		if ($filter_name == '') $filter_name = $this->filter_name;
60
+		if ($filter_name == '') {
61
+			$filter_name = $this->filter_name;
62
+		}
57 63
                 $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC";
58 64
                  try {
59 65
                         $sth = $this->db->prepare($query);
@@ -65,7 +71,9 @@  discard block
 block discarded – undo
65 71
                 return $all;
66 72
         }
67 73
 	public function getAllAirportNames($stats_airline = '',$filter_name = '') {
68
-		if ($filter_name == '') $filter_name = $this->filter_name;
74
+		if ($filter_name == '') {
75
+			$filter_name = $this->filter_name;
76
+		}
69 77
                 $query = "SELECT airport_icao, airport_name,airport_city,airport_country FROM stats_airport WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND stats_type = 'daily' GROUP BY airport_icao,airport_name,airport_city,airport_country ORDER BY airport_city ASC";
70 78
                  try {
71 79
                         $sth = $this->db->prepare($query);
@@ -80,9 +88,14 @@  discard block
 block discarded – undo
80 88
 
81 89
 	public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '') {
82 90
 		global $globalStatsFilters;
83
-		if ($filter_name == '') $filter_name = $this->filter_name;
84
-		if ($limit) $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0";
85
-		else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC";
91
+		if ($filter_name == '') {
92
+			$filter_name = $this->filter_name;
93
+		}
94
+		if ($limit) {
95
+			$query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0";
96
+		} else {
97
+			$query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC";
98
+		}
86 99
                  try {
87 100
                         $sth = $this->db->prepare($query);
88 101
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -102,9 +115,14 @@  discard block
 block discarded – undo
102 115
 	}
103 116
 	public function countAllAirlineCountries($limit = true,$filter_name = '') {
104 117
 		global $globalStatsFilters;
105
-		if ($filter_name == '') $filter_name = $this->filter_name;
106
-		if ($limit) $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0";
107
-		else $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC";
118
+		if ($filter_name == '') {
119
+			$filter_name = $this->filter_name;
120
+		}
121
+		if ($limit) {
122
+			$query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0";
123
+		} else {
124
+			$query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC";
125
+		}
108 126
                  try {
109 127
                         $sth = $this->db->prepare($query);
110 128
                         $sth->execute(array(':filter_name' => $filter_name));
@@ -124,9 +142,14 @@  discard block
 block discarded – undo
124 142
 	}
125 143
 	public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '') {
126 144
 		global $globalStatsFilters;
127
-		if ($filter_name == '') $filter_name = $this->filter_name;
128
-		if ($limit) $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0";
129
-		else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC";
145
+		if ($filter_name == '') {
146
+			$filter_name = $this->filter_name;
147
+		}
148
+		if ($limit) {
149
+			$query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0";
150
+		} else {
151
+			$query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC";
152
+		}
130 153
                  try {
131 154
                         $sth = $this->db->prepare($query);
132 155
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -147,9 +170,14 @@  discard block
 block discarded – undo
147 170
 
148 171
 	public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '') {
149 172
 		global $globalStatsFilters;
150
-		if ($filter_name == '') $filter_name = $this->filter_name;
151
-		if ($limit) $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0";
152
-		else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC";
173
+		if ($filter_name == '') {
174
+			$filter_name = $this->filter_name;
175
+		}
176
+		if ($limit) {
177
+			$query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0";
178
+		} else {
179
+			$query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC";
180
+		}
153 181
                  try {
154 182
                         $sth = $this->db->prepare($query);
155 183
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -169,9 +197,14 @@  discard block
 block discarded – undo
169 197
 	}
170 198
 	public function countAllDepartureCountries($limit = true, $stats_airline = '', $filter_name = '') {
171 199
 		global $globalStatsFilters;
172
-		if ($filter_name == '') $filter_name = $this->filter_name;
173
-		if ($limit) $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0";
174
-		else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC";
200
+		if ($filter_name == '') {
201
+			$filter_name = $this->filter_name;
202
+		}
203
+		if ($limit) {
204
+			$query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0";
205
+		} else {
206
+			$query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC";
207
+		}
175 208
                  try {
176 209
                         $sth = $this->db->prepare($query);
177 210
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -192,9 +225,14 @@  discard block
 block discarded – undo
192 225
 
193 226
 	public function countAllAirlines($limit = true,$filter_name = '') {
194 227
 		global $globalStatsFilters;
195
-		if ($filter_name == '') $filter_name = $this->filter_name;
196
-		if ($limit) $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name ORDER BY airline_count DESC LIMIT 10 OFFSET 0";
197
-		else $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name ORDER BY airline_count DESC";
228
+		if ($filter_name == '') {
229
+			$filter_name = $this->filter_name;
230
+		}
231
+		if ($limit) {
232
+			$query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name ORDER BY airline_count DESC LIMIT 10 OFFSET 0";
233
+		} else {
234
+			$query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name ORDER BY airline_count DESC";
235
+		}
198 236
                  try {
199 237
                         $sth = $this->db->prepare($query);
200 238
                         $sth->execute(array(':filter_name' => $filter_name));
@@ -215,9 +253,14 @@  discard block
 block discarded – undo
215 253
 	}
216 254
 	public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '') {
217 255
 		global $globalStatsFilters;
218
-		if ($filter_name == '') $filter_name = $this->filter_name;
219
-		if ($limit) $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0";
220
-		else $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC";
256
+		if ($filter_name == '') {
257
+			$filter_name = $this->filter_name;
258
+		}
259
+		if ($limit) {
260
+			$query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0";
261
+		} else {
262
+			$query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC";
263
+		}
221 264
                  try {
222 265
                         $sth = $this->db->prepare($query);
223 266
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -237,9 +280,14 @@  discard block
 block discarded – undo
237 280
 	}
238 281
 	public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '') {
239 282
 		global $globalStatsFilters;
240
-		if ($filter_name == '') $filter_name = $this->filter_name;
241
-		if ($limit) $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0";
242
-		else $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC";
283
+		if ($filter_name == '') {
284
+			$filter_name = $this->filter_name;
285
+		}
286
+		if ($limit) {
287
+			$query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0";
288
+		} else {
289
+			$query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC";
290
+		}
243 291
 		 try {
244 292
 			$sth = $this->db->prepare($query);
245 293
 			$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -259,10 +307,15 @@  discard block
 block discarded – undo
259 307
 	}
260 308
 	public function countAllFlightOverCountries($limit = true, $stats_airline = '',$filter_name = '') {
261 309
 		$Connection = new Connection();
262
-		if ($filter_name == '') $filter_name = $this->filter_name;
310
+		if ($filter_name == '') {
311
+			$filter_name = $this->filter_name;
312
+		}
263 313
 		if ($Connection->tableExists('countries')) {
264
-			if ($limit) $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0";
265
-			else $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC";
314
+			if ($limit) {
315
+				$query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0";
316
+			} else {
317
+				$query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC";
318
+			}
266 319
 			 try {
267 320
 				$sth = $this->db->prepare($query);
268 321
 				$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -283,9 +336,14 @@  discard block
 block discarded – undo
283 336
 	}
284 337
 	public function countAllPilots($limit = true,$stats_airline = '',$filter_name = '') {
285 338
 		global $globalStatsFilters;
286
-		if ($filter_name == '') $filter_name = $this->filter_name;
287
-		if ($limit) $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC LIMIT 10 OFFSET 0";
288
-		else $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC";
339
+		if ($filter_name == '') {
340
+			$filter_name = $this->filter_name;
341
+		}
342
+		if ($limit) {
343
+			$query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC LIMIT 10 OFFSET 0";
344
+		} else {
345
+			$query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC";
346
+		}
289 347
                  try {
290 348
                         $sth = $this->db->prepare($query);
291 349
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -305,9 +363,14 @@  discard block
 block discarded – undo
305 363
 	}
306 364
 	public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '') {
307 365
 		global $globalStatsFilters;
308
-		if ($filter_name == '') $filter_name = $this->filter_name;
309
-		if ($limit) $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0";
310
-		else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC";
366
+		if ($filter_name == '') {
367
+			$filter_name = $this->filter_name;
368
+		}
369
+		if ($limit) {
370
+			$query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0";
371
+		} else {
372
+			$query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC";
373
+		}
311 374
                  try {
312 375
                         $sth = $this->db->prepare($query);
313 376
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -327,9 +390,14 @@  discard block
 block discarded – undo
327 390
 	}
328 391
 	public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '') {
329 392
 		global $globalStatsFilters;
330
-		if ($filter_name == '') $filter_name = $this->filter_name;
331
-		if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0";
332
-		else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC";
393
+		if ($filter_name == '') {
394
+			$filter_name = $this->filter_name;
395
+		}
396
+		if ($limit) {
397
+			$query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0";
398
+		} else {
399
+			$query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC";
400
+		}
333 401
                  try {
334 402
                         $sth = $this->db->prepare($query);
335 403
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -355,7 +423,9 @@  discard block
 block discarded – undo
355 423
         			$icao = $value['airport_departure_icao'];
356 424
         			if (isset($all[$icao])) {
357 425
         				$all[$icao]['airport_departure_icao_count'] = $all[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
358
-        			} else $all[$icao] = $value;
426
+        			} else {
427
+        				$all[$icao] = $value;
428
+        			}
359 429
         		}
360 430
         		$count = array();
361 431
         		foreach ($all as $key => $row) {
@@ -367,9 +437,14 @@  discard block
 block discarded – undo
367 437
 	}
368 438
 	public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '') {
369 439
 		global $globalStatsFilters;
370
-		if ($filter_name == '') $filter_name = $this->filter_name;
371
-		if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0";
372
-		else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC";
440
+		if ($filter_name == '') {
441
+			$filter_name = $this->filter_name;
442
+		}
443
+		if ($limit) {
444
+			$query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0";
445
+		} else {
446
+			$query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC";
447
+		}
373 448
 		try {
374 449
 			$sth = $this->db->prepare($query);
375 450
 			$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -395,7 +470,9 @@  discard block
 block discarded – undo
395 470
         			$icao = $value['airport_arrival_icao'];
396 471
         			if (isset($all[$icao])) {
397 472
         				$all[$icao]['airport_arrival_icao_count'] = $all[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
398
-        			} else $all[$icao] = $value;
473
+        			} else {
474
+        				$all[$icao] = $value;
475
+        			}
399 476
         		}
400 477
         		$count = array();
401 478
         		foreach ($all as $key => $row) {
@@ -408,13 +485,21 @@  discard block
 block discarded – undo
408 485
 	}
409 486
 	public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') {
410 487
 		global $globalDBdriver, $globalStatsFilters;
411
-		if ($filter_name == '') $filter_name = $this->filter_name;
488
+		if ($filter_name == '') {
489
+			$filter_name = $this->filter_name;
490
+		}
412 491
 		if ($globalDBdriver == 'mysql') {
413
-			if ($limit) $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name";
414
-			else $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
492
+			if ($limit) {
493
+				$query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name";
494
+			} else {
495
+				$query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
496
+			}
415 497
 		} else {
416
-			if ($limit) $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline = :stats_airline AND filter_name = :filter_name";
417
-			else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
498
+			if ($limit) {
499
+				$query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline = :stats_airline AND filter_name = :filter_name";
500
+			} else {
501
+				$query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
502
+			}
418 503
 		}
419 504
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
420 505
                  try {
@@ -438,7 +523,9 @@  discard block
 block discarded – undo
438 523
 	
439 524
 	public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') {
440 525
 		global $globalStatsFilters;
441
-		if ($filter_name == '') $filter_name = $this->filter_name;
526
+		if ($filter_name == '') {
527
+			$filter_name = $this->filter_name;
528
+		}
442 529
 		$query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND stats_airline = :stats_airline AND filter_name = :filter_name";
443 530
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
444 531
                  try {
@@ -460,7 +547,9 @@  discard block
 block discarded – undo
460 547
 	}
461 548
 	public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') {
462 549
 		global $globalDBdriver, $globalStatsFilters;
463
-		if ($filter_name == '') $filter_name = $this->filter_name;
550
+		if ($filter_name == '') {
551
+			$filter_name = $this->filter_name;
552
+		}
464 553
 		if ($globalDBdriver == 'mysql') {
465 554
 			$query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) AND stats_airline = :stats_airline AND filter_name = :filter_name";
466 555
 		} else {
@@ -486,7 +575,9 @@  discard block
 block discarded – undo
486 575
 	}
487 576
 	public function countAllDates($stats_airline = '',$filter_name = '') {
488 577
 		global $globalStatsFilters;
489
-		if ($filter_name == '') $filter_name = $this->filter_name;
578
+		if ($filter_name == '') {
579
+			$filter_name = $this->filter_name;
580
+		}
490 581
 		$query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND stats_airline = :stats_airline AND filter_name = :filter_name";
491 582
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
492 583
                  try {
@@ -508,7 +599,9 @@  discard block
 block discarded – undo
508 599
 	}
509 600
 	public function countAllDatesByAirlines($filter_name = '') {
510 601
 		global $globalStatsFilters;
511
-		if ($filter_name == '') $filter_name = $this->filter_name;
602
+		if ($filter_name == '') {
603
+			$filter_name = $this->filter_name;
604
+		}
512 605
 		$query = "SELECT stats_airline as airline_icao, flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND filter_name = :filter_name";
513 606
 		$query_data = array('filter_name' => $filter_name);
514 607
                  try {
@@ -530,7 +623,9 @@  discard block
 block discarded – undo
530 623
 	}
531 624
 	public function countAllMonths($stats_airline = '',$filter_name = '') {
532 625
 		global $globalStatsFilters;
533
-		if ($filter_name == '') $filter_name = $this->filter_name;
626
+		if ($filter_name == '') {
627
+			$filter_name = $this->filter_name;
628
+		}
534 629
 	    	$query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
535 630
                  try {
536 631
                         $sth = $this->db->prepare($query);
@@ -551,7 +646,9 @@  discard block
 block discarded – undo
551 646
 	}
552 647
 	public function countAllMilitaryMonths($filter_name = '') {
553 648
 		global $globalStatsFilters;
554
-		if ($filter_name == '') $filter_name = $this->filter_name;
649
+		if ($filter_name == '') {
650
+			$filter_name = $this->filter_name;
651
+		}
555 652
 	    	$query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'military_flights_bymonth' AND filter_name = :filter_name";
556 653
                  try {
557 654
                         $sth = $this->db->prepare($query);
@@ -572,9 +669,14 @@  discard block
 block discarded – undo
572 669
 	}
573 670
 	public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') {
574 671
 		global $globalTimezone, $globalDBdriver, $globalStatsFilters;
575
-		if ($filter_name == '') $filter_name = $this->filter_name;
576
-		if ($limit) $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name";
577
-		else $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name";
672
+		if ($filter_name == '') {
673
+			$filter_name = $this->filter_name;
674
+		}
675
+		if ($limit) {
676
+			$query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name";
677
+		} else {
678
+			$query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name";
679
+		}
578 680
 		if ($orderby == 'hour') {
579 681
 			/*
580 682
 			if ($globalDBdriver == 'mysql') {
@@ -583,7 +685,9 @@  discard block
 block discarded – undo
583 685
 			*/
584 686
 			$query .= " ORDER BY CAST(flight_date AS integer) ASC";
585 687
 		}
586
-		if ($orderby == 'count') $query .= " ORDER BY hour_count DESC";
688
+		if ($orderby == 'count') {
689
+			$query .= " ORDER BY hour_count DESC";
690
+		}
587 691
                  try {
588 692
                         $sth = $this->db->prepare($query);
589 693
                         $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
@@ -604,7 +708,9 @@  discard block
 block discarded – undo
604 708
 	
605 709
 	public function countOverallFlights($stats_airline = '', $filter_name = '') {
606 710
 		global $globalStatsFilters;
607
-		if ($filter_name == '') $filter_name = $this->filter_name;
711
+		if ($filter_name == '') {
712
+			$filter_name = $this->filter_name;
713
+		}
608 714
 		$all = $this->getSumStats('flights_bymonth',date('Y'),$stats_airline,$filter_name);
609 715
 		if (empty($all)) {
610 716
 			$filters = array('airlines' => array($stats_airline));
@@ -618,7 +724,9 @@  discard block
 block discarded – undo
618 724
 	}
619 725
 	public function countOverallMilitaryFlights($filter_name = '') {
620 726
 		global $globalStatsFilters;
621
-		if ($filter_name == '') $filter_name = $this->filter_name;
727
+		if ($filter_name == '') {
728
+			$filter_name = $this->filter_name;
729
+		}
622 730
 		$all = $this->getSumStats('military_flights_bymonth',date('Y'),'',$filter_name);
623 731
 		if (empty($all)) {
624 732
 		        $filters = array();
@@ -632,7 +740,9 @@  discard block
 block discarded – undo
632 740
 	}
633 741
 	public function countOverallArrival($stats_airline = '',$filter_name = '') {
634 742
 		global $globalStatsFilters;
635
-		if ($filter_name == '') $filter_name = $this->filter_name;
743
+		if ($filter_name == '') {
744
+			$filter_name = $this->filter_name;
745
+		}
636 746
 		$all = $this->getSumStats('realarrivals_bymonth',date('Y'),$stats_airline,$filter_name);
637 747
 		if (empty($all)) {
638 748
 			$filters = array('airlines' => array($stats_airline));
@@ -646,7 +756,9 @@  discard block
 block discarded – undo
646 756
 	}
647 757
 	public function countOverallAircrafts($stats_airline = '',$filter_name = '') {
648 758
 		global $globalStatsFilters;
649
-		if ($filter_name == '') $filter_name = $this->filter_name;
759
+		if ($filter_name == '') {
760
+			$filter_name = $this->filter_name;
761
+		}
650 762
 		$all = $this->getSumStats('aircrafts_bymonth',date('Y'),$stats_airline,$filter_name);
651 763
 		if (empty($all)) {
652 764
 			$filters = array('airlines' => array($stats_airline));
@@ -660,7 +772,9 @@  discard block
 block discarded – undo
660 772
 	}
661 773
 	public function countOverallAirlines($filter_name = '') {
662 774
 		global $globalStatsFilters;
663
-		if ($filter_name == '') $filter_name = $this->filter_name;
775
+		if ($filter_name == '') {
776
+			$filter_name = $this->filter_name;
777
+		}
664 778
 		$query = "SELECT COUNT(*) AS nb_airline FROM stats_airline WHERE filter_name = :filter_name";
665 779
                  try {
666 780
                         $sth = $this->db->prepare($query);
@@ -683,7 +797,9 @@  discard block
 block discarded – undo
683 797
 	}
684 798
 	public function countOverallOwners($stats_airline = '',$filter_name = '') {
685 799
 		global $globalStatsFilters;
686
-		if ($filter_name == '') $filter_name = $this->filter_name;
800
+		if ($filter_name == '') {
801
+			$filter_name = $this->filter_name;
802
+		}
687 803
 		/*
688 804
 		$query = "SELECT COUNT(*) AS nb_owner FROM stats_owner";
689 805
                  try {
@@ -708,7 +824,9 @@  discard block
 block discarded – undo
708 824
 	}
709 825
 	public function countOverallPilots($stats_airline = '',$filter_name = '') {
710 826
 		global $globalStatsFilters;
711
-		if ($filter_name == '') $filter_name = $this->filter_name;
827
+		if ($filter_name == '') {
828
+			$filter_name = $this->filter_name;
829
+		}
712 830
 		$all = $this->getSumStats('pilots_bymonth',date('Y'),$stats_airline,$filter_name);
713 831
 		if (empty($all)) {
714 832
 			$filters = array('airlines' => array($stats_airline));
@@ -722,7 +840,9 @@  discard block
 block discarded – undo
722 840
 	}
723 841
 
724 842
 	public function getLast7DaysAirports($airport_icao = '', $stats_airline = '',$filter_name = '') {
725
-		if ($filter_name == '') $filter_name = $this->filter_name;
843
+		if ($filter_name == '') {
844
+			$filter_name = $this->filter_name;
845
+		}
726 846
 		$query = "SELECT * FROM stats_airport WHERE stats_type = 'daily' AND airport_icao = :airport_icao AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY date";
727 847
 		$query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
728 848
                  try {
@@ -735,7 +855,9 @@  discard block
 block discarded – undo
735 855
                 return $all;
736 856
 	}
737 857
 	public function getStats($type,$stats_airline = '', $filter_name = '') {
738
-		if ($filter_name == '') $filter_name = $this->filter_name;
858
+		if ($filter_name == '') {
859
+			$filter_name = $this->filter_name;
860
+		}
739 861
                 $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date";
740 862
                 $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
741 863
                  try {
@@ -748,7 +870,9 @@  discard block
 block discarded – undo
748 870
                 return $all;
749 871
         }
750 872
 	public function getSumStats($type,$year,$stats_airline = '',$filter_name = '') {
751
-		if ($filter_name == '') $filter_name = $this->filter_name;
873
+		if ($filter_name == '') {
874
+			$filter_name = $this->filter_name;
875
+		}
752 876
     		global $globalArchiveMonths, $globalDBdriver;
753 877
     		if ($globalDBdriver == 'mysql') {
754 878
 	                $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND stats_airline = :stats_airline AND filter_name = :filter_name";
@@ -767,7 +891,9 @@  discard block
 block discarded – undo
767 891
         }
768 892
 	public function getStatsTotal($type, $stats_airline = '', $filter_name = '') {
769 893
     		global $globalArchiveMonths, $globalDBdriver;
770
-		if ($filter_name == '') $filter_name = $this->filter_name;
894
+		if ($filter_name == '') {
895
+			$filter_name = $this->filter_name;
896
+		}
771 897
     		if ($globalDBdriver == 'mysql') {
772 898
 			$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL ".$globalArchiveMonths." MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name";
773 899
 		} else {
@@ -785,7 +911,9 @@  discard block
 block discarded – undo
785 911
         }
786 912
 	public function getStatsAircraftTotal($stats_airline = '', $filter_name = '') {
787 913
     		global $globalArchiveMonths, $globalDBdriver;
788
-		if ($filter_name == '') $filter_name = $this->filter_name;
914
+		if ($filter_name == '') {
915
+			$filter_name = $this->filter_name;
916
+		}
789 917
     		if ($globalDBdriver == 'mysql') {
790 918
 			$query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name";
791 919
                 } else {
@@ -802,7 +930,9 @@  discard block
 block discarded – undo
802 930
         }
803 931
 	public function getStatsAirlineTotal($filter_name = '') {
804 932
     		global $globalArchiveMonths, $globalDBdriver;
805
-		if ($filter_name == '') $filter_name = $this->filter_name;
933
+		if ($filter_name == '') {
934
+			$filter_name = $this->filter_name;
935
+		}
806 936
     		if ($globalDBdriver == 'mysql') {
807 937
 			$query = "SELECT SUM(cnt) as total FROM stats_airline WHERE filter_name = :filter_name";
808 938
                 } else {
@@ -819,7 +949,9 @@  discard block
 block discarded – undo
819 949
         }
820 950
 	public function getStatsOwnerTotal($filter_name = '') {
821 951
     		global $globalArchiveMonths, $globalDBdriver;
822
-		if ($filter_name == '') $filter_name = $this->filter_name;
952
+		if ($filter_name == '') {
953
+			$filter_name = $this->filter_name;
954
+		}
823 955
     		if ($globalDBdriver == 'mysql') {
824 956
 			$query = "SELECT SUM(cnt) as total FROM stats_owner WHERE filter_name = :filter_name";
825 957
 		} else {
@@ -836,7 +968,9 @@  discard block
 block discarded – undo
836 968
         }
837 969
 	public function getStatsPilotTotal($filter_name = '') {
838 970
     		global $globalArchiveMonths, $globalDBdriver;
839
-		if ($filter_name == '') $filter_name = $this->filter_name;
971
+		if ($filter_name == '') {
972
+			$filter_name = $this->filter_name;
973
+		}
840 974
     		if ($globalDBdriver == 'mysql') {
841 975
             		$query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name";
842 976
             	} else {
@@ -854,7 +988,9 @@  discard block
 block discarded – undo
854 988
 
855 989
 	public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') {
856 990
 		global $globalDBdriver;
857
-		if ($filter_name == '') $filter_name = $this->filter_name;
991
+		if ($filter_name == '') {
992
+			$filter_name = $this->filter_name;
993
+		}
858 994
 		if ($globalDBdriver == 'mysql') {
859 995
 			$query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = :cnt";
860 996
                 } else {
@@ -870,7 +1006,9 @@  discard block
 block discarded – undo
870 1006
         }
871 1007
 	public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') {
872 1008
 		global $globalDBdriver;
873
-		if ($filter_name == '') $filter_name = $this->filter_name;
1009
+		if ($filter_name == '') {
1010
+			$filter_name = $this->filter_name;
1011
+		}
874 1012
 		if ($globalDBdriver == 'mysql') {
875 1013
 			$query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date";
876 1014
 		} else {
@@ -1353,47 +1491,69 @@  discard block
 block discarded – undo
1353 1491
 			$this->addLastStatsUpdate('last_update_stats',date('Y-m-d G:i:s'));
1354 1492
 		} else {
1355 1493
 		*/
1356
-			if ($globalDebug) echo 'Update stats !'."\n";
1357
-			if ($globalDebug) echo 'Count all aircraft types...'."\n";
1494
+			if ($globalDebug) {
1495
+				echo 'Update stats !'."\n";
1496
+			}
1497
+			if ($globalDebug) {
1498
+				echo 'Count all aircraft types...'."\n";
1499
+			}
1358 1500
 			if (isset($last_update[0]['value'])) {
1359 1501
 				$last_update_day = $last_update[0]['value'];
1360
-			} else $last_update_day = '2012-12-12 12:12:12';
1502
+			} else {
1503
+				$last_update_day = '2012-12-12 12:12:12';
1504
+			}
1361 1505
 			$Spotter = new Spotter($this->db);
1362 1506
 			$alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day);
1363 1507
 			foreach ($alldata as $number) {
1364 1508
 				$this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer']);
1365 1509
 			}
1366
-			if ($globalDebug) echo 'Count all airlines...'."\n";
1510
+			if ($globalDebug) {
1511
+				echo 'Count all airlines...'."\n";
1512
+			}
1367 1513
 			$alldata = $Spotter->countAllAirlines(false,0,$last_update_day);
1368 1514
 			foreach ($alldata as $number) {
1369 1515
 				$this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name']);
1370 1516
 			}
1371
-			if ($globalDebug) echo 'Count all registrations...'."\n";
1517
+			if ($globalDebug) {
1518
+				echo 'Count all registrations...'."\n";
1519
+			}
1372 1520
 			$alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day);
1373 1521
 			foreach ($alldata as $number) {
1374 1522
 				$this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao']);
1375 1523
 			}
1376
-			if ($globalDebug) echo 'Count all callsigns...'."\n";
1524
+			if ($globalDebug) {
1525
+				echo 'Count all callsigns...'."\n";
1526
+			}
1377 1527
 			$alldata = $Spotter->countAllCallsigns(false,0,$last_update_day);
1378 1528
 			foreach ($alldata as $number) {
1379 1529
 				$this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao']);
1380 1530
 			}
1381
-			if ($globalDebug) echo 'Count all owners...'."\n";
1531
+			if ($globalDebug) {
1532
+				echo 'Count all owners...'."\n";
1533
+			}
1382 1534
 			$alldata = $Spotter->countAllOwners(false,0,$last_update_day);
1383 1535
 			foreach ($alldata as $number) {
1384 1536
 				$this->addStatOwner($number['owner_name'],$number['owner_count']);
1385 1537
 			}
1386
-			if ($globalDebug) echo 'Count all pilots...'."\n";
1538
+			if ($globalDebug) {
1539
+				echo 'Count all pilots...'."\n";
1540
+			}
1387 1541
 			$alldata = $Spotter->countAllPilots(false,0,$last_update_day);
1388 1542
 			foreach ($alldata as $number) {
1389 1543
 				$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name']);
1390 1544
 			}
1391 1545
 			
1392
-			if ($globalDebug) echo 'Count all departure airports...'."\n";
1546
+			if ($globalDebug) {
1547
+				echo 'Count all departure airports...'."\n";
1548
+			}
1393 1549
 			$pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day);
1394
-			if ($globalDebug) echo 'Count all detected departure airports...'."\n";
1550
+			if ($globalDebug) {
1551
+				echo 'Count all detected departure airports...'."\n";
1552
+			}
1395 1553
         		$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day);
1396
-			if ($globalDebug) echo 'Order departure airports...'."\n";
1554
+			if ($globalDebug) {
1555
+				echo 'Order departure airports...'."\n";
1556
+			}
1397 1557
 	        	$alldata = array();
1398 1558
 	        	
1399 1559
     			foreach ($pall as $value) {
@@ -1404,7 +1564,9 @@  discard block
 block discarded – undo
1404 1564
     				$icao = $value['airport_departure_icao'];
1405 1565
         			if (isset($alldata[$icao])) {
1406 1566
     					$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1407
-        			} else $alldata[$icao] = $value;
1567
+        			} else {
1568
+        				$alldata[$icao] = $value;
1569
+        			}
1408 1570
 			}
1409 1571
     			$count = array();
1410 1572
     			foreach ($alldata as $key => $row) {
@@ -1414,11 +1576,17 @@  discard block
 block discarded – undo
1414 1576
 			foreach ($alldata as $number) {
1415 1577
 				echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count']);
1416 1578
 			}
1417
-			if ($globalDebug) echo 'Count all arrival airports...'."\n";
1579
+			if ($globalDebug) {
1580
+				echo 'Count all arrival airports...'."\n";
1581
+			}
1418 1582
 			$pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day);
1419
-			if ($globalDebug) echo 'Count all detected arrival airports...'."\n";
1583
+			if ($globalDebug) {
1584
+				echo 'Count all detected arrival airports...'."\n";
1585
+			}
1420 1586
         		$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day);
1421
-			if ($globalDebug) echo 'Order arrival airports...'."\n";
1587
+			if ($globalDebug) {
1588
+				echo 'Order arrival airports...'."\n";
1589
+			}
1422 1590
 	        	$alldata = array();
1423 1591
     			foreach ($pall as $value) {
1424 1592
 	        		$icao = $value['airport_arrival_icao'];
@@ -1428,7 +1596,9 @@  discard block
 block discarded – undo
1428 1596
     				$icao = $value['airport_arrival_icao'];
1429 1597
         			if (isset($alldata[$icao])) {
1430 1598
         				$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1431
-	        		} else $alldata[$icao] = $value;
1599
+	        		} else {
1600
+	        			$alldata[$icao] = $value;
1601
+	        		}
1432 1602
     			}
1433 1603
         		$count = array();
1434 1604
         		foreach ($alldata as $key => $row) {
@@ -1439,7 +1609,9 @@  discard block
 block discarded – undo
1439 1609
 				echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count']);
1440 1610
 			}
1441 1611
 			if ($Connection->tableExists('countries')) {
1442
-				if ($globalDebug) echo 'Count all flights by countries...'."\n";
1612
+				if ($globalDebug) {
1613
+					echo 'Count all flights by countries...'."\n";
1614
+				}
1443 1615
 				$SpotterArchive = new SpotterArchive();
1444 1616
 				$alldata = $SpotterArchive->countAllFlightOverCountries(false,0,$last_update_day);
1445 1617
 				foreach ($alldata as $number) {
@@ -1451,46 +1623,66 @@  discard block
 block discarded – undo
1451 1623
 			// Add by month using getstat if month finish...
1452 1624
 
1453 1625
 			//if (date('m',strtotime($last_update_day)) != date('m')) {
1454
-			if ($globalDebug) echo 'Count all flights by months...'."\n";
1626
+			if ($globalDebug) {
1627
+				echo 'Count all flights by months...'."\n";
1628
+			}
1455 1629
 			$Spotter = new Spotter($this->db);
1456 1630
 			$alldata = $Spotter->countAllMonths();
1457 1631
 			$lastyear = false;
1458 1632
 			foreach ($alldata as $number) {
1459
-				if ($number['year_name'] != date('Y')) $lastyear = true;
1633
+				if ($number['year_name'] != date('Y')) {
1634
+					$lastyear = true;
1635
+				}
1460 1636
 				$this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1461 1637
 			}
1462
-			if ($globalDebug) echo 'Count all military flights by months...'."\n";
1638
+			if ($globalDebug) {
1639
+				echo 'Count all military flights by months...'."\n";
1640
+			}
1463 1641
 			$alldata = $Spotter->countAllMilitaryMonths();
1464 1642
 			foreach ($alldata as $number) {
1465 1643
 				$this->addStat('military_flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1466 1644
 			}
1467
-			if ($globalDebug) echo 'Count all owners by months...'."\n";
1645
+			if ($globalDebug) {
1646
+				echo 'Count all owners by months...'."\n";
1647
+			}
1468 1648
 			$alldata = $Spotter->countAllMonthsOwners();
1469 1649
 			foreach ($alldata as $number) {
1470 1650
 				$this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1471 1651
 			}
1472
-			if ($globalDebug) echo 'Count all pilots by months...'."\n";
1652
+			if ($globalDebug) {
1653
+				echo 'Count all pilots by months...'."\n";
1654
+			}
1473 1655
 			$alldata = $Spotter->countAllMonthsPilots();
1474 1656
 			foreach ($alldata as $number) {
1475 1657
 				$this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1476 1658
 			}
1477
-			if ($globalDebug) echo 'Count all airlines by months...'."\n";
1659
+			if ($globalDebug) {
1660
+				echo 'Count all airlines by months...'."\n";
1661
+			}
1478 1662
 			$alldata = $Spotter->countAllMonthsAirlines();
1479 1663
 			foreach ($alldata as $number) {
1480 1664
 				$this->addStat('airlines_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1481 1665
 			}
1482
-			if ($globalDebug) echo 'Count all aircrafts by months...'."\n";
1666
+			if ($globalDebug) {
1667
+				echo 'Count all aircrafts by months...'."\n";
1668
+			}
1483 1669
 			$alldata = $Spotter->countAllMonthsAircrafts();
1484 1670
 			foreach ($alldata as $number) {
1485 1671
 				$this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1486 1672
 			}
1487
-			if ($globalDebug) echo 'Count all real arrivals by months...'."\n";
1673
+			if ($globalDebug) {
1674
+				echo 'Count all real arrivals by months...'."\n";
1675
+			}
1488 1676
 			$alldata = $Spotter->countAllMonthsRealArrivals();
1489 1677
 			foreach ($alldata as $number) {
1490 1678
 				$this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1491 1679
 			}
1492
-			if ($globalDebug) echo 'Airports data...'."\n";
1493
-			if ($globalDebug) echo '...Departure'."\n";
1680
+			if ($globalDebug) {
1681
+				echo 'Airports data...'."\n";
1682
+			}
1683
+			if ($globalDebug) {
1684
+				echo '...Departure'."\n";
1685
+			}
1494 1686
 			$this->deleteStatAirport('daily');
1495 1687
 //			$pall = $Spotter->getLast7DaysAirportsDeparture();
1496 1688
   //      		$dall = $Spotter->getLast7DaysDetectedAirportsDeparture();
@@ -1610,37 +1802,53 @@  discard block
 block discarded – undo
1610 1802
 
1611 1803
 			// Count by airlines
1612 1804
 			echo '--- Stats by airlines ---'."\n";
1613
-			if ($globalDebug) echo 'Count all aircraft types by airlines...'."\n";
1805
+			if ($globalDebug) {
1806
+				echo 'Count all aircraft types by airlines...'."\n";
1807
+			}
1614 1808
 			$Spotter = new Spotter($this->db);
1615 1809
 			$alldata = $Spotter->countAllAircraftTypesByAirlines(false,0,$last_update_day);
1616 1810
 			foreach ($alldata as $number) {
1617 1811
 				$this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],$number['airline_icao']);
1618 1812
 			}
1619
-			if ($globalDebug) echo 'Count all aircraft registrations by airlines...'."\n";
1813
+			if ($globalDebug) {
1814
+				echo 'Count all aircraft registrations by airlines...'."\n";
1815
+			}
1620 1816
 			$alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false,0,$last_update_day);
1621 1817
 			foreach ($alldata as $number) {
1622 1818
 				$this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],$number['airline_icao']);
1623 1819
 			}
1624
-			if ($globalDebug) echo 'Count all callsigns by airlines...'."\n";
1820
+			if ($globalDebug) {
1821
+				echo 'Count all callsigns by airlines...'."\n";
1822
+			}
1625 1823
 			$alldata = $Spotter->countAllCallsignsByAirlines(false,0,$last_update_day);
1626 1824
 			foreach ($alldata as $number) {
1627 1825
 				$this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao']);
1628 1826
 			}
1629
-			if ($globalDebug) echo 'Count all owners by airlines...'."\n";
1827
+			if ($globalDebug) {
1828
+				echo 'Count all owners by airlines...'."\n";
1829
+			}
1630 1830
 			$alldata = $Spotter->countAllOwnersByAirlines(false,0,$last_update_day);
1631 1831
 			foreach ($alldata as $number) {
1632 1832
 				$this->addStatOwner($number['owner_name'],$number['owner_count'],$number['airline_icao']);
1633 1833
 			}
1634
-			if ($globalDebug) echo 'Count all pilots by airlines...'."\n";
1834
+			if ($globalDebug) {
1835
+				echo 'Count all pilots by airlines...'."\n";
1836
+			}
1635 1837
 			$alldata = $Spotter->countAllPilotsByAirlines(false,0,$last_update_day);
1636 1838
 			foreach ($alldata as $number) {
1637 1839
 				$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],$number['airline_icao']);
1638 1840
 			}
1639
-			if ($globalDebug) echo 'Count all departure airports by airlines...'."\n";
1841
+			if ($globalDebug) {
1842
+				echo 'Count all departure airports by airlines...'."\n";
1843
+			}
1640 1844
 			$pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day);
1641
-			if ($globalDebug) echo 'Count all detected departure airports by airlines...'."\n";
1845
+			if ($globalDebug) {
1846
+				echo 'Count all detected departure airports by airlines...'."\n";
1847
+			}
1642 1848
        			$dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day);
1643
-			if ($globalDebug) echo 'Order detected departure airports by airlines...'."\n";
1849
+			if ($globalDebug) {
1850
+				echo 'Order detected departure airports by airlines...'."\n";
1851
+			}
1644 1852
 	        	//$alldata = array();
1645 1853
     			foreach ($dall as $value) {
1646 1854
     				$icao = $value['airport_departure_icao'];
@@ -1661,11 +1869,17 @@  discard block
 block discarded – undo
1661 1869
 			foreach ($alldata as $number) {
1662 1870
 				echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],$number['airline_icao']);
1663 1871
 			}
1664
-			if ($globalDebug) echo 'Count all arrival airports by airlines...'."\n";
1872
+			if ($globalDebug) {
1873
+				echo 'Count all arrival airports by airlines...'."\n";
1874
+			}
1665 1875
 			$pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day);
1666
-			if ($globalDebug) echo 'Count all detected arrival airports by airlines...'."\n";
1876
+			if ($globalDebug) {
1877
+				echo 'Count all detected arrival airports by airlines...'."\n";
1878
+			}
1667 1879
         		$dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day);
1668
-			if ($globalDebug) echo 'Order arrival airports by airlines...'."\n";
1880
+			if ($globalDebug) {
1881
+				echo 'Order arrival airports by airlines...'."\n";
1882
+			}
1669 1883
 	        	//$alldata = array();
1670 1884
     			foreach ($dall as $value) {
1671 1885
     				$icao = $value['airport_arrival_icao'];
@@ -1686,35 +1900,49 @@  discard block
 block discarded – undo
1686 1900
                         foreach ($alldata as $number) {
1687 1901
 				echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],$number['airline_icao']);
1688 1902
 			}
1689
-			if ($globalDebug) echo 'Count all flights by months by airlines...'."\n";
1903
+			if ($globalDebug) {
1904
+				echo 'Count all flights by months by airlines...'."\n";
1905
+			}
1690 1906
 			$Spotter = new Spotter($this->db);
1691 1907
 			$alldata = $Spotter->countAllMonthsByAirlines();
1692 1908
 			$lastyear = false;
1693 1909
 			foreach ($alldata as $number) {
1694
-				if ($number['year_name'] != date('Y')) $lastyear = true;
1910
+				if ($number['year_name'] != date('Y')) {
1911
+					$lastyear = true;
1912
+				}
1695 1913
 				$this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
1696 1914
 			}
1697
-			if ($globalDebug) echo 'Count all owners by months by airlines...'."\n";
1915
+			if ($globalDebug) {
1916
+				echo 'Count all owners by months by airlines...'."\n";
1917
+			}
1698 1918
 			$alldata = $Spotter->countAllMonthsOwnersByAirlines();
1699 1919
 			foreach ($alldata as $number) {
1700 1920
 				$this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
1701 1921
 			}
1702
-			if ($globalDebug) echo 'Count all pilots by months by airlines...'."\n";
1922
+			if ($globalDebug) {
1923
+				echo 'Count all pilots by months by airlines...'."\n";
1924
+			}
1703 1925
 			$alldata = $Spotter->countAllMonthsPilotsByAirlines();
1704 1926
 			foreach ($alldata as $number) {
1705 1927
 				$this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
1706 1928
 			}
1707
-			if ($globalDebug) echo 'Count all aircrafts by months by airlines...'."\n";
1929
+			if ($globalDebug) {
1930
+				echo 'Count all aircrafts by months by airlines...'."\n";
1931
+			}
1708 1932
 			$alldata = $Spotter->countAllMonthsAircraftsByAirlines();
1709 1933
 			foreach ($alldata as $number) {
1710 1934
 				$this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
1711 1935
 			}
1712
-			if ($globalDebug) echo 'Count all real arrivals by months by airlines...'."\n";
1936
+			if ($globalDebug) {
1937
+				echo 'Count all real arrivals by months by airlines...'."\n";
1938
+			}
1713 1939
 			$alldata = $Spotter->countAllMonthsRealArrivalsByAirlines();
1714 1940
 			foreach ($alldata as $number) {
1715 1941
 				$this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
1716 1942
 			}
1717
-			if ($globalDebug) echo '...Departure'."\n";
1943
+			if ($globalDebug) {
1944
+				echo '...Departure'."\n";
1945
+			}
1718 1946
 			$pall = $Spotter->getLast7DaysAirportsDepartureByAirlines();
1719 1947
         		$dall = $Spotter->getLast7DaysDetectedAirportsDepartureByAirlines();
1720 1948
     			foreach ($dall as $value) {
@@ -1737,7 +1965,9 @@  discard block
 block discarded – undo
1737 1965
 			foreach ($alldata as $number) {
1738 1966
 				$this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count'],$number['airline_icao']);
1739 1967
 			}
1740
-			if ($globalDebug) echo '...Arrival'."\n";
1968
+			if ($globalDebug) {
1969
+				echo '...Arrival'."\n";
1970
+			}
1741 1971
 			$pall = $Spotter->getLast7DaysAirportsArrivalByAirlines();
1742 1972
         		$dall = $Spotter->getLast7DaysDetectedAirportsArrivalByAirlines();
1743 1973
     			foreach ($dall as $value) {
@@ -1761,13 +1991,19 @@  discard block
 block discarded – undo
1761 1991
 				$this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count'],$number['airline_icao']);
1762 1992
 			}
1763 1993
 
1764
-			if ($globalDebug) echo 'Flights data...'."\n";
1765
-			if ($globalDebug) echo '-> countAllDatesLastMonth...'."\n";
1994
+			if ($globalDebug) {
1995
+				echo 'Flights data...'."\n";
1996
+			}
1997
+			if ($globalDebug) {
1998
+				echo '-> countAllDatesLastMonth...'."\n";
1999
+			}
1766 2000
 			$alldata = $Spotter->countAllDatesLastMonthByAirlines();
1767 2001
 			foreach ($alldata as $number) {
1768 2002
 				$this->addStatFlight('month',$number['date_name'],$number['date_count'], $number['airline_icao']);
1769 2003
 			}
1770
-			if ($globalDebug) echo '-> countAllDates...'."\n";
2004
+			if ($globalDebug) {
2005
+				echo '-> countAllDates...'."\n";
2006
+			}
1771 2007
 			//$previousdata = $this->countAllDatesByAirlines();
1772 2008
 			$alldata = $Common->array_merge_noappend($previousdatabyairlines,$Spotter->countAllDatesByAirlines());
1773 2009
 			$values = array();
@@ -1780,19 +2016,25 @@  discard block
 block discarded – undo
1780 2016
 				$this->addStatFlight('date',$number['date_name'],$number['date_count'],$number['airline_icao']);
1781 2017
 			}
1782 2018
 			
1783
-			if ($globalDebug) echo '-> countAllHours...'."\n";
2019
+			if ($globalDebug) {
2020
+				echo '-> countAllHours...'."\n";
2021
+			}
1784 2022
 			$alldata = $Spotter->countAllHoursByAirlines('hour');
1785 2023
 			foreach ($alldata as $number) {
1786 2024
 				$this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],$number['airline_icao']);
1787 2025
 			}
1788 2026
 			
1789 2027
 
1790
-			if (!isset($globalStatsFilters) || $globalStatsFilters == '') $globalStatsFilters = array();
2028
+			if (!isset($globalStatsFilters) || $globalStatsFilters == '') {
2029
+				$globalStatsFilters = array();
2030
+			}
1791 2031
 			foreach ($globalStatsFilters as $name => $filter) {
1792 2032
 				//$filter_name = $filter['name'];
1793 2033
 				$filter_name = $name;
1794 2034
 				// Count by filter
1795
-				if ($globalDebug) echo '--- Stats for filter '.$filter_name.' ---'."\n";
2035
+				if ($globalDebug) {
2036
+					echo '--- Stats for filter '.$filter_name.' ---'."\n";
2037
+				}
1796 2038
 				$Spotter = new Spotter($this->db);
1797 2039
 				$alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day,$filter);
1798 2040
 				foreach ($alldata as $number) {
@@ -1830,7 +2072,9 @@  discard block
 block discarded – undo
1830 2072
 	    				$icao = $value['airport_departure_icao'];
1831 2073
         				if (isset($alldata[$icao])) {
1832 2074
     						$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1833
-        				} else $alldata[$icao] = $value;
2075
+        				} else {
2076
+        					$alldata[$icao] = $value;
2077
+        				}
1834 2078
 				}
1835 2079
 	    			$count = array();
1836 2080
     				foreach ($alldata as $key => $row) {
@@ -1851,7 +2095,9 @@  discard block
 block discarded – undo
1851 2095
 	    				$icao = $value['airport_arrival_icao'];
1852 2096
         				if (isset($alldata[$icao])) {
1853 2097
         					$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1854
-		        		} else $alldata[$icao] = $value;
2098
+		        		} else {
2099
+		        			$alldata[$icao] = $value;
2100
+		        		}
1855 2101
 	    			}
1856 2102
         			$count = array();
1857 2103
         			foreach ($alldata as $key => $row) {
@@ -1865,7 +2111,9 @@  discard block
 block discarded – undo
1865 2111
 				$alldata = $Spotter->countAllMonths($filter);
1866 2112
 				$lastyear = false;
1867 2113
 				foreach ($alldata as $number) {
1868
-					if ($number['year_name'] != date('Y')) $lastyear = true;
2114
+					if ($number['year_name'] != date('Y')) {
2115
+						$lastyear = true;
2116
+					}
1869 2117
 					$this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name);
1870 2118
 				}
1871 2119
 				$alldata = $Spotter->countAllMonthsOwners($filter);
Please login to merge, or discard this patch.
require/class.SpotterLive.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 	/**
15 15
 	* Get SQL query part for filter used
16 16
 	* @param Array $filter the filter
17
-	* @return Array the SQL part
17
+	* @return string the SQL part
18 18
 	*/
19 19
 	public function getFilter($filter = array(),$where = false,$and = false) {
20 20
 		global $globalFilter;
Please login to merge, or discard this patch.
Indentation   +203 added lines, -203 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@  discard block
 block discarded – undo
12 12
 
13 13
 
14 14
 	/**
15
-	* Get SQL query part for filter used
16
-	* @param Array $filter the filter
17
-	* @return Array the SQL part
18
-	*/
15
+	 * Get SQL query part for filter used
16
+	 * @param Array $filter the filter
17
+	 * @return Array the SQL part
18
+	 */
19 19
 	public function getFilter($filter = array(),$where = false,$and = false) {
20 20
 		global $globalFilter;
21 21
 		if (is_array($globalFilter)) $filter = array_merge($globalFilter,$filter);
@@ -50,11 +50,11 @@  discard block
 block discarded – undo
50 50
 	}
51 51
 
52 52
 	/**
53
-	* Gets all the spotter information based on the latest data entry
54
-	*
55
-	* @return Array the spotter information
56
-	*
57
-	*/
53
+	 * Gets all the spotter information based on the latest data entry
54
+	 *
55
+	 * @return Array the spotter information
56
+	 *
57
+	 */
58 58
 	public function getLiveSpotterData($limit = '', $sort = '', $filter = array())
59 59
 	{
60 60
 		global $globalDBdriver, $globalLiveInterval;
@@ -93,11 +93,11 @@  discard block
 block discarded – undo
93 93
 	}
94 94
 
95 95
 	/**
96
-	* Gets Minimal Live Spotter data
97
-	*
98
-	* @return Array the spotter information
99
-	*
100
-	*/
96
+	 * Gets Minimal Live Spotter data
97
+	 *
98
+	 * @return Array the spotter information
99
+	 *
100
+	 */
101 101
 	public function getMinLiveSpotterData($filter = array())
102 102
 	{
103 103
 		global $globalDBdriver, $globalLiveInterval;
@@ -142,11 +142,11 @@  discard block
 block discarded – undo
142 142
 	}
143 143
 
144 144
 	/**
145
-	* Gets Minimal Live Spotter data since xx seconds
146
-	*
147
-	* @return Array the spotter information
148
-	*
149
-	*/
145
+	 * Gets Minimal Live Spotter data since xx seconds
146
+	 *
147
+	 * @return Array the spotter information
148
+	 *
149
+	 */
150 150
 	public function getMinLastLiveSpotterData($filter = array())
151 151
 	{
152 152
 		global $globalDBdriver, $globalLiveInterval;
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 			$query  = 'SELECT a.aircraft_shadow, a.engine_type, a.engine_count, a.wake_category, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
161 161
 			FROM spotter_live LEFT JOIN (SELECT aircraft_shadow,engine_type, engine_count, wake_category,icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= spotter_live.date 
162 162
 			ORDER BY spotter_live.flightaware_id, spotter_live.date';
163
-                } else {
163
+				} else {
164 164
 /*
165 165
 			$query  = "SELECT a.aircraft_shadow, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
166 166
 			FROM spotter_live WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date 
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 //			echo $query;
173 173
 		}
174 174
 
175
-    		try {
175
+			try {
176 176
 			$sth = $this->db->prepare($query);
177 177
 			$sth->execute();
178 178
 		} catch(PDOException $e) {
@@ -184,11 +184,11 @@  discard block
 block discarded – undo
184 184
 	}
185 185
 
186 186
 	/**
187
-	* Gets number of latest data entry
188
-	*
189
-	* @return String number of entry
190
-	*
191
-	*/
187
+	 * Gets number of latest data entry
188
+	 *
189
+	 * @return String number of entry
190
+	 *
191
+	 */
192 192
 	public function getLiveSpotterCount($filter = array())
193 193
 	{
194 194
 		global $globalDBdriver, $globalLiveInterval;
@@ -214,11 +214,11 @@  discard block
 block discarded – undo
214 214
 	}
215 215
 
216 216
 	/**
217
-	* Gets all the spotter information based on the latest data entry and coord
218
-	*
219
-	* @return Array the spotter information
220
-	*
221
-	*/
217
+	 * Gets all the spotter information based on the latest data entry and coord
218
+	 *
219
+	 * @return Array the spotter information
220
+	 *
221
+	 */
222 222
 	public function getLiveSpotterDatabyCoord($coord, $filter = array())
223 223
 	{
224 224
 		global $globalDBdriver, $globalLiveInterval;
@@ -243,11 +243,11 @@  discard block
 block discarded – undo
243 243
 	}
244 244
 
245 245
 	/**
246
-	* Gets all the spotter information based on a user's latitude and longitude
247
-	*
248
-	* @return Array the spotter information
249
-	*
250
-	*/
246
+	 * Gets all the spotter information based on a user's latitude and longitude
247
+	 *
248
+	 * @return Array the spotter information
249
+	 *
250
+	 */
251 251
 	public function getLatestSpotterForLayar($lat, $lng, $radius, $interval)
252 252
 	{
253 253
 		$Spotter = new Spotter($this->db);
@@ -257,145 +257,145 @@  discard block
 block discarded – undo
257 257
 				return false;
258 258
 			}
259 259
 		}
260
-        if ($lng != '')
261
-                {
262
-                        if (!is_numeric($lng))
263
-                        {
264
-                                return false;
265
-                        }
266
-                }
267
-
268
-                if ($radius != '')
269
-                {
270
-                        if (!is_numeric($radius))
271
-                        {
272
-                                return false;
273
-                        }
274
-                }
260
+		if ($lng != '')
261
+				{
262
+						if (!is_numeric($lng))
263
+						{
264
+								return false;
265
+						}
266
+				}
267
+
268
+				if ($radius != '')
269
+				{
270
+						if (!is_numeric($radius))
271
+						{
272
+								return false;
273
+						}
274
+				}
275 275
 		$additional_query = '';
276
-        if ($interval != '')
277
-                {
278
-                        if (!is_string($interval))
279
-                        {
280
-                                //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
281
-			        return false;
282
-                        } else {
283
-                if ($interval == '1m')
284
-                {
285
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
286
-                } else if ($interval == '15m'){
287
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date ';
288
-                } 
289
-            }
290
-                } else {
291
-         $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';   
292
-        }
293
-
294
-                $query  = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live 
276
+		if ($interval != '')
277
+				{
278
+						if (!is_string($interval))
279
+						{
280
+								//$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
281
+					return false;
282
+						} else {
283
+				if ($interval == '1m')
284
+				{
285
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
286
+				} else if ($interval == '15m'){
287
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date ';
288
+				} 
289
+			}
290
+				} else {
291
+		 $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';   
292
+		}
293
+
294
+				$query  = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live 
295 295
                    WHERE spotter_live.latitude <> '' 
296 296
                                    AND spotter_live.longitude <> '' 
297 297
                    ".$additional_query."
298 298
                    HAVING distance < :radius  
299 299
                                    ORDER BY distance";
300 300
 
301
-                $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
301
+				$spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
302 302
 
303
-                return $spotter_array;
304
-        }
303
+				return $spotter_array;
304
+		}
305 305
 
306 306
     
307
-        /**
308
-	* Gets all the spotter information based on a particular callsign
309
-	*
310
-	* @return Array the spotter information
311
-	*
312
-	*/
307
+		/**
308
+		 * Gets all the spotter information based on a particular callsign
309
+		 *
310
+		 * @return Array the spotter information
311
+		 *
312
+		 */
313 313
 	public function getLastLiveSpotterDataByIdent($ident)
314 314
 	{
315 315
 		$Spotter = new Spotter($this->db);
316 316
 		date_default_timezone_set('UTC');
317 317
 
318 318
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
319
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
319
+				$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
320 320
 
321 321
 		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident));
322 322
 
323 323
 		return $spotter_array;
324 324
 	}
325 325
 
326
-        /**
327
-	* Gets all the spotter information based on a particular callsign
328
-	*
329
-	* @return Array the spotter information
330
-	*
331
-	*/
326
+		/**
327
+		 * Gets all the spotter information based on a particular callsign
328
+		 *
329
+		 * @return Array the spotter information
330
+		 *
331
+		 */
332 332
 	public function getDateLiveSpotterDataByIdent($ident,$date)
333 333
 	{
334 334
 		$Spotter = new Spotter($this->db);
335 335
 		date_default_timezone_set('UTC');
336 336
 
337 337
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
338
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
338
+				$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
339 339
 
340
-                $date = date('c',$date);
340
+				$date = date('c',$date);
341 341
 		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
342 342
 
343 343
 		return $spotter_array;
344 344
 	}
345 345
 
346
-        /**
347
-	* Gets last spotter information based on a particular callsign
348
-	*
349
-	* @return Array the spotter information
350
-	*
351
-	*/
346
+		/**
347
+		 * Gets last spotter information based on a particular callsign
348
+		 *
349
+		 * @return Array the spotter information
350
+		 *
351
+		 */
352 352
 	public function getLastLiveSpotterDataById($id)
353 353
 	{
354 354
 		$Spotter = new Spotter($this->db);
355 355
 		date_default_timezone_set('UTC');
356 356
 
357 357
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
358
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
358
+				$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
359 359
 
360 360
 		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id));
361 361
 
362 362
 		return $spotter_array;
363 363
 	}
364 364
 
365
-        /**
366
-	* Gets last spotter information based on a particular callsign
367
-	*
368
-	* @return Array the spotter information
369
-	*
370
-	*/
365
+		/**
366
+		 * Gets last spotter information based on a particular callsign
367
+		 *
368
+		 * @return Array the spotter information
369
+		 *
370
+		 */
371 371
 	public function getDateLiveSpotterDataById($id,$date)
372 372
 	{
373 373
 		$Spotter = new Spotter($this->db);
374 374
 		date_default_timezone_set('UTC');
375 375
 
376 376
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
377
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
378
-                $date = date('c',$date);
377
+				$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
378
+				$date = date('c',$date);
379 379
 		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date));
380 380
 
381 381
 		return $spotter_array;
382 382
 	}
383 383
 
384
-        /**
385
-	* Gets altitude information based on a particular callsign
386
-	*
387
-	* @return Array the spotter information
388
-	*
389
-	*/
384
+		/**
385
+		 * Gets altitude information based on a particular callsign
386
+		 *
387
+		 * @return Array the spotter information
388
+		 *
389
+		 */
390 390
 	public function getAltitudeLiveSpotterDataByIdent($ident)
391 391
 	{
392 392
 
393 393
 		date_default_timezone_set('UTC');
394 394
 
395 395
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
396
-                $query  = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
396
+				$query  = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
397 397
 
398
-    		try {
398
+			try {
399 399
 			
400 400
 			$sth = $this->db->prepare($query);
401 401
 			$sth->execute(array(':ident' => $ident));
@@ -408,12 +408,12 @@  discard block
 block discarded – undo
408 408
 		return $spotter_array;
409 409
 	}
410 410
 
411
-        /**
412
-	* Gets all the spotter information based on a particular id
413
-	*
414
-	* @return Array the spotter information
415
-	*
416
-	*/
411
+		/**
412
+		 * Gets all the spotter information based on a particular id
413
+		 *
414
+		 * @return Array the spotter information
415
+		 *
416
+		 */
417 417
 	public function getAllLiveSpotterDataById($id,$liveinterval = false)
418 418
 	{
419 419
 		global $globalDBdriver, $globalLiveInterval;
@@ -441,18 +441,18 @@  discard block
 block discarded – undo
441 441
 		return $spotter_array;
442 442
 	}
443 443
 
444
-        /**
445
-	* Gets all the spotter information based on a particular ident
446
-	*
447
-	* @return Array the spotter information
448
-	*
449
-	*/
444
+		/**
445
+		 * Gets all the spotter information based on a particular ident
446
+		 *
447
+		 * @return Array the spotter information
448
+		 *
449
+		 */
450 450
 	public function getAllLiveSpotterDataByIdent($ident)
451 451
 	{
452 452
 		date_default_timezone_set('UTC');
453 453
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
454 454
 		$query  = self::$global_query.' WHERE spotter_live.ident = :ident';
455
-    		try {
455
+			try {
456 456
 			
457 457
 			$sth = $this->db->prepare($query);
458 458
 			$sth->execute(array(':ident' => $ident));
@@ -466,23 +466,23 @@  discard block
 block discarded – undo
466 466
 
467 467
 
468 468
 	/**
469
-	* Deletes all info in the table
470
-	*
471
-	* @return String success or false
472
-	*
473
-	*/
469
+	 * Deletes all info in the table
470
+	 *
471
+	 * @return String success or false
472
+	 *
473
+	 */
474 474
 	public function deleteLiveSpotterData()
475 475
 	{
476 476
 		global $globalDBdriver;
477 477
 		if ($globalDBdriver == 'mysql') {
478 478
 			//$query  = "DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= spotter_live.date";
479 479
 			$query  = 'DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= spotter_live.date';
480
-            		//$query  = "DELETE FROM spotter_live WHERE spotter_live.id IN (SELECT spotter_live.id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= spotter_live.date)";
480
+					//$query  = "DELETE FROM spotter_live WHERE spotter_live.id IN (SELECT spotter_live.id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= spotter_live.date)";
481 481
 		} else {
482 482
 			$query  = "DELETE FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= spotter_live.date";
483 483
 		}
484 484
         
485
-    		try {
485
+			try {
486 486
 			
487 487
 			$sth = $this->db->prepare($query);
488 488
 			$sth->execute();
@@ -494,18 +494,18 @@  discard block
 block discarded – undo
494 494
 	}
495 495
 
496 496
 	/**
497
-	* Deletes all info in the table for aircraft not seen since 2 HOUR
498
-	*
499
-	* @return String success or false
500
-	*
501
-	*/
497
+	 * Deletes all info in the table for aircraft not seen since 2 HOUR
498
+	 *
499
+	 * @return String success or false
500
+	 *
501
+	 */
502 502
 	public function deleteLiveSpotterDataNotUpdated()
503 503
 	{
504 504
 		global $globalDBdriver, $globalDebug;
505 505
 		if ($globalDBdriver == 'mysql') {
506 506
 			//$query = 'SELECT flightaware_id FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) >= spotter_live.date AND spotter_live.flightaware_id NOT IN (SELECT flightaware_id FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) < spotter_live.date) LIMIT 800 OFFSET 0';
507
-    			$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0";
508
-    			try {
507
+				$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0";
508
+				try {
509 509
 				
510 510
 				$sth = $this->db->prepare($query);
511 511
 				$sth->execute();
@@ -513,8 +513,8 @@  discard block
 block discarded – undo
513 513
 				return "error";
514 514
 			}
515 515
 			$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
516
-                        $i = 0;
517
-                        $j =0;
516
+						$i = 0;
517
+						$j =0;
518 518
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
519 519
 			foreach($all as $row)
520 520
 			{
@@ -522,20 +522,20 @@  discard block
 block discarded – undo
522 522
 				$j++;
523 523
 				if ($j == 30) {
524 524
 					if ($globalDebug) echo ".";
525
-				    	try {
525
+						try {
526 526
 						
527 527
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
528 528
 						$sth->execute();
529 529
 					} catch(PDOException $e) {
530 530
 						return "error";
531 531
 					}
532
-                                	$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
533
-                                	$j = 0;
532
+									$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
533
+									$j = 0;
534 534
 				}
535 535
 				$query_delete .= "'".$row['flightaware_id']."',";
536 536
 			}
537 537
 			if ($i > 0) {
538
-    				try {
538
+					try {
539 539
 					
540 540
 					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
541 541
 					$sth->execute();
@@ -546,9 +546,9 @@  discard block
 block discarded – undo
546 546
 			return "success";
547 547
 		} elseif ($globalDBdriver == 'pgsql') {
548 548
 			//$query = "SELECT flightaware_id FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= spotter_live.date AND spotter_live.flightaware_id NOT IN (SELECT flightaware_id FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' < spotter_live.date) LIMIT 800 OFFSET 0";
549
-    			//$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0";
550
-    			$query = "DELETE FROM spotter_live WHERE flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)";
551
-    			try {
549
+				//$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0";
550
+				$query = "DELETE FROM spotter_live WHERE flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)";
551
+				try {
552 552
 				
553 553
 				$sth = $this->db->prepare($query);
554 554
 				$sth->execute();
@@ -592,17 +592,17 @@  discard block
 block discarded – undo
592 592
 	}
593 593
 
594 594
 	/**
595
-	* Deletes all info in the table for an ident
596
-	*
597
-	* @return String success or false
598
-	*
599
-	*/
595
+	 * Deletes all info in the table for an ident
596
+	 *
597
+	 * @return String success or false
598
+	 *
599
+	 */
600 600
 	public function deleteLiveSpotterDataByIdent($ident)
601 601
 	{
602 602
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
603 603
 		$query  = 'DELETE FROM spotter_live WHERE ident = :ident';
604 604
         
605
-    		try {
605
+			try {
606 606
 			
607 607
 			$sth = $this->db->prepare($query);
608 608
 			$sth->execute(array(':ident' => $ident));
@@ -614,17 +614,17 @@  discard block
 block discarded – undo
614 614
 	}
615 615
 
616 616
 	/**
617
-	* Deletes all info in the table for an id
618
-	*
619
-	* @return String success or false
620
-	*
621
-	*/
617
+	 * Deletes all info in the table for an id
618
+	 *
619
+	 * @return String success or false
620
+	 *
621
+	 */
622 622
 	public function deleteLiveSpotterDataById($id)
623 623
 	{
624 624
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
625 625
 		$query  = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
626 626
         
627
-    		try {
627
+			try {
628 628
 			
629 629
 			$sth = $this->db->prepare($query);
630 630
 			$sth->execute(array(':id' => $id));
@@ -637,11 +637,11 @@  discard block
 block discarded – undo
637 637
 
638 638
 
639 639
 	/**
640
-	* Gets the aircraft ident within the last hour
641
-	*
642
-	* @return String the ident
643
-	*
644
-	*/
640
+	 * Gets the aircraft ident within the last hour
641
+	 *
642
+	 * @return String the ident
643
+	 *
644
+	 */
645 645
 	public function getIdentFromLastHour($ident)
646 646
 	{
647 647
 		global $globalDBdriver, $globalTimezone;
@@ -667,14 +667,14 @@  discard block
 block discarded – undo
667 667
 			$ident_result = $row['ident'];
668 668
 		}
669 669
 		return $ident_result;
670
-        }
670
+		}
671 671
 
672 672
 	/**
673
-	* Check recent aircraft
674
-	*
675
-	* @return String the ident
676
-	*
677
-	*/
673
+	 * Check recent aircraft
674
+	 *
675
+	 * @return String the ident
676
+	 *
677
+	 */
678 678
 	public function checkIdentRecent($ident)
679 679
 	{
680 680
 		global $globalDBdriver, $globalTimezone;
@@ -700,14 +700,14 @@  discard block
 block discarded – undo
700 700
 			$ident_result = $row['flightaware_id'];
701 701
 		}
702 702
 		return $ident_result;
703
-        }
703
+		}
704 704
 
705 705
 	/**
706
-	* Check recent aircraft by id
707
-	*
708
-	* @return String the ident
709
-	*
710
-	*/
706
+	 * Check recent aircraft by id
707
+	 *
708
+	 * @return String the ident
709
+	 *
710
+	 */
711 711
 	public function checkIdRecent($id)
712 712
 	{
713 713
 		global $globalDBdriver, $globalTimezone;
@@ -733,14 +733,14 @@  discard block
 block discarded – undo
733 733
 			$ident_result = $row['flightaware_id'];
734 734
 		}
735 735
 		return $ident_result;
736
-        }
736
+		}
737 737
 
738 738
 	/**
739
-	* Check recent aircraft by ModeS
740
-	*
741
-	* @return String the ModeS
742
-	*
743
-	*/
739
+	 * Check recent aircraft by ModeS
740
+	 *
741
+	 * @return String the ModeS
742
+	 *
743
+	 */
744 744
 	public function checkModeSRecent($modes)
745 745
 	{
746 746
 		global $globalDBdriver, $globalTimezone;
@@ -767,19 +767,19 @@  discard block
 block discarded – undo
767 767
 			$ident_result = $row['flightaware_id'];
768 768
 		}
769 769
 		return $ident_result;
770
-        }
770
+		}
771 771
 
772 772
 	/**
773
-	* Adds a new spotter data
774
-	*
775
-	* @param String $flightaware_id the ID from flightaware
776
-	* @param String $ident the flight ident
777
-	* @param String $aircraft_icao the aircraft type
778
-	* @param String $departure_airport_icao the departure airport
779
-	* @param String $arrival_airport_icao the arrival airport
780
-	* @return String success or false
781
-	*
782
-	*/
773
+	 * Adds a new spotter data
774
+	 *
775
+	 * @param String $flightaware_id the ID from flightaware
776
+	 * @param String $ident the flight ident
777
+	 * @param String $aircraft_icao the aircraft type
778
+	 * @param String $departure_airport_icao the departure airport
779
+	 * @param String $arrival_airport_icao the arrival airport
780
+	 * @return String success or false
781
+	 *
782
+	 */
783 783
 	public function addLiveSpotterData($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 = '', $ModeS = '', $putinarchive = false,$registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false,$format_source = '', $source_name = '', $over_country = '')
784 784
 	{
785 785
 		global $globalURL, $globalArchive, $globalDebug;
@@ -915,10 +915,10 @@  discard block
 block discarded – undo
915 915
 		$arrival_airport_country = '';
916 916
 		
917 917
             	
918
-            	if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
919
-            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
920
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
921
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
918
+				if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
919
+				if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
920
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
921
+				if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
922 922
             	
923 923
 		$query  = 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, 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, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country) 
924 924
 		VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_shadow,: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,:ModeS, :pilot_id, :pilot_name, :verticalrate, :ground, :format_source, :source_name, :over_country)';
@@ -929,13 +929,13 @@  discard block
 block discarded – undo
929 929
 			
930 930
 			$sth = $this->db->prepare($query);
931 931
 			$sth->execute($query_values);
932
-                } catch(PDOException $e) {
933
-                	return "error : ".$e->getMessage();
934
-                }
932
+				} catch(PDOException $e) {
933
+					return "error : ".$e->getMessage();
934
+				}
935 935
 		if (isset($globalArchive) && $globalArchive && $putinarchive && !$noarchive) {
936
-		    if ($globalDebug) echo '(Add to SBS archive : ';
937
-		    $result =  $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country);
938
-		    if ($globalDebug) echo $result.')';
936
+			if ($globalDebug) echo '(Add to SBS archive : ';
937
+			$result =  $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country);
938
+			if ($globalDebug) echo $result.')';
939 939
 		}
940 940
 		return "success";
941 941
 
Please login to merge, or discard this patch.
Spacing   +103 added lines, -103 removed lines patch added patch discarded remove patch
@@ -16,15 +16,15 @@  discard block
 block discarded – undo
16 16
 	* @param Array $filter the filter
17 17
 	* @return Array the SQL part
18 18
 	*/
19
-	public function getFilter($filter = array(),$where = false,$and = false) {
19
+	public function getFilter($filter = array(), $where = false, $and = false) {
20 20
 		global $globalFilter, $globalStatsFilters, $globalFilterName;
21
-		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) $filter = array_merge($globalStatsFilters[$globalFilterName],$filter);
22
-		if (is_array($globalFilter)) $filter = array_merge($globalFilter,$filter);
21
+		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) $filter = array_merge($globalStatsFilters[$globalFilterName], $filter);
22
+		if (is_array($globalFilter)) $filter = array_merge($globalFilter, $filter);
23 23
 		$filter_query_join = '';
24 24
 		$filter_query_where = '';
25 25
 		if (isset($filter['airlines']) && !empty($filter['airlines'])) {
26 26
 			if ($filter['airlines'][0] != '') {
27
-				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
27
+				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
28 28
 			}
29 29
 		}
30 30
 		
@@ -32,19 +32,19 @@  discard block
 block discarded – undo
32 32
 			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_live.flightaware_id ";
33 33
 		}
34 34
 		if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) {
35
-			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
35
+			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) so ON so.flightaware_id = spotter_live.flightaware_id";
36 36
 		}
37 37
 		if (isset($filter['source']) && !empty($filter['source'])) {
38
-			$filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')";
38
+			$filter_query_where = " WHERE format_source IN ('".implode("','", $filter['source'])."')";
39 39
 		}
40 40
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
41 41
 			$filter_query_where = " WHERE ident = '".$filter['ident']."'";
42 42
 		}
43 43
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
44 44
 			if ($filter_query_where == '') {
45
-				$filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
45
+				$filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
46 46
 			} else {
47
-				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
47
+				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
48 48
 			}
49 49
 		}
50 50
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
@@ -70,8 +70,8 @@  discard block
 block discarded – undo
70 70
 		if ($limit != '')
71 71
 		{
72 72
 			$limit_array = explode(',', $limit);
73
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
74
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
73
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
74
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
75 75
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
76 76
 			{
77 77
 				$limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0];
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 //			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, a.aircraft_shadow FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate INNER JOIN (SELECT * FROM aircraft) a on spotter_live.aircraft_icao = a.icao';
116 116
 //			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query;
117 117
 
118
-			$query  = 'SELECT a.aircraft_shadow, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
118
+			$query = 'SELECT a.aircraft_shadow, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
119 119
 			FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao'.$filter_query;
120 120
 
121 121
 //			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= spotter_live.date ORDER BY spotter_live.date GROUP BY spotter_live.flightaware_id'.$filter_query;
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 			//$query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE NOW() AT TIME ZONE 'UTC' - '30 SECONDS'->INTERVAL <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate";
126 126
 			//$query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE NOW() AT TIME ZONE 'UTC' - '".$globalLiveInterval." SECONDS'->INTERVAL <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate$orderby_query";
127 127
 			//$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, a.aircraft_shadow FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on spotter_live.aircraft_icao = a.icao';
128
-			$query  = "SELECT a.aircraft_shadow, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
128
+			$query = "SELECT a.aircraft_shadow, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
129 129
 			FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao".$filter_query;
130 130
 		}
131 131
 //		$spotter_array = Spotter->getDataFromDB($query.$limit_query);
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 		try {
135 135
 			$sth = $this->db->prepare($query);
136 136
 			$sth->execute();
137
-		} catch(PDOException $e) {
137
+		} catch (PDOException $e) {
138 138
 			echo $e->getMessage();
139 139
 			die;
140 140
 		}
@@ -154,12 +154,12 @@  discard block
 block discarded – undo
154 154
 		global $globalDBdriver, $globalLiveInterval;
155 155
 		date_default_timezone_set('UTC');
156 156
 
157
-		$filter_query = $this->getFilter($filter,true,true);
157
+		$filter_query = $this->getFilter($filter, true, true);
158 158
 
159 159
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
160 160
 		if ($globalDBdriver == 'mysql') {
161 161
 
162
-			$query  = 'SELECT a.aircraft_shadow, a.engine_type, a.engine_count, a.wake_category, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
162
+			$query = 'SELECT a.aircraft_shadow, a.engine_type, a.engine_count, a.wake_category, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
163 163
 			FROM spotter_live LEFT JOIN (SELECT aircraft_shadow,engine_type, engine_count, wake_category,icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= spotter_live.date 
164 164
 			ORDER BY spotter_live.flightaware_id, spotter_live.date';
165 165
                 } else {
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 			FROM spotter_live WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date 
169 169
 			".$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao ORDER BY spotter_live.flightaware_id, spotter_live.date';
170 170
 */
171
-			$query  = "SELECT a.aircraft_shadow, a.engine_type, a.engine_count, a.wake_category, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
171
+			$query = "SELECT a.aircraft_shadow, a.engine_type, a.engine_count, a.wake_category, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
172 172
 			FROM spotter_live LEFT JOIN (SELECT aircraft_shadow,engine_type, engine_count, wake_category, icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date 
173 173
 			ORDER BY spotter_live.flightaware_id, spotter_live.date";
174 174
 //			echo $query;
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
     		try {
178 178
 			$sth = $this->db->prepare($query);
179 179
 			$sth->execute();
180
-		} catch(PDOException $e) {
180
+		} catch (PDOException $e) {
181 181
 			echo $e->getMessage();
182 182
 			die;
183 183
 		}
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 	public function getLiveSpotterCount($filter = array())
195 195
 	{
196 196
 		global $globalDBdriver, $globalLiveInterval;
197
-		$filter_query = $this->getFilter($filter,true,true);
197
+		$filter_query = $this->getFilter($filter, true, true);
198 198
 
199 199
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
200 200
 		if ($globalDBdriver == 'mysql') {
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 		try {
208 208
 			$sth = $this->db->prepare($query);
209 209
 			$sth->execute();
210
-		} catch(PDOException $e) {
210
+		} catch (PDOException $e) {
211 211
 			echo $e->getMessage();
212 212
 			die;
213 213
 		}
@@ -230,10 +230,10 @@  discard block
 block discarded – undo
230 230
 		$filter_query = $this->getFilter($filter);
231 231
 
232 232
 		if (is_array($coord)) {
233
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
234
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
235
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
236
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
233
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
234
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
235
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
236
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
237 237
 		} else return array();
238 238
 		if ($globalDBdriver == 'mysql') {
239 239
 			//$query  = "SELECT spotter_output.* FROM spotter_output WHERE spotter_output.flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL ".$globalLiveInterval." SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")";
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
                 if ($interval == '1m')
287 287
                 {
288 288
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
289
-                } else if ($interval == '15m'){
289
+                } else if ($interval == '15m') {
290 290
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date ';
291 291
                 } 
292 292
             }
@@ -294,14 +294,14 @@  discard block
 block discarded – undo
294 294
          $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';   
295 295
         }
296 296
 
297
-                $query  = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live 
297
+                $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live 
298 298
                    WHERE spotter_live.latitude <> '' 
299 299
                                    AND spotter_live.longitude <> '' 
300 300
                    ".$additional_query."
301 301
                    HAVING distance < :radius  
302 302
                                    ORDER BY distance";
303 303
 
304
-                $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
304
+                $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius));
305 305
 
306 306
                 return $spotter_array;
307 307
         }
@@ -319,9 +319,9 @@  discard block
 block discarded – undo
319 319
 		date_default_timezone_set('UTC');
320 320
 
321 321
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
322
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
322
+                $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
323 323
 
324
-		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident));
324
+		$spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident));
325 325
 
326 326
 		return $spotter_array;
327 327
 	}
@@ -332,16 +332,16 @@  discard block
 block discarded – undo
332 332
 	* @return Array the spotter information
333 333
 	*
334 334
 	*/
335
-	public function getDateLiveSpotterDataByIdent($ident,$date)
335
+	public function getDateLiveSpotterDataByIdent($ident, $date)
336 336
 	{
337 337
 		$Spotter = new Spotter($this->db);
338 338
 		date_default_timezone_set('UTC');
339 339
 
340 340
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
341
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
341
+                $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
342 342
 
343
-                $date = date('c',$date);
344
-		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
343
+                $date = date('c', $date);
344
+		$spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date));
345 345
 
346 346
 		return $spotter_array;
347 347
 	}
@@ -358,9 +358,9 @@  discard block
 block discarded – undo
358 358
 		date_default_timezone_set('UTC');
359 359
 
360 360
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
361
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
361
+                $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
362 362
 
363
-		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id));
363
+		$spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id));
364 364
 
365 365
 		return $spotter_array;
366 366
 	}
@@ -371,15 +371,15 @@  discard block
 block discarded – undo
371 371
 	* @return Array the spotter information
372 372
 	*
373 373
 	*/
374
-	public function getDateLiveSpotterDataById($id,$date)
374
+	public function getDateLiveSpotterDataById($id, $date)
375 375
 	{
376 376
 		$Spotter = new Spotter($this->db);
377 377
 		date_default_timezone_set('UTC');
378 378
 
379 379
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
380
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
381
-                $date = date('c',$date);
382
-		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date));
380
+                $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
381
+                $date = date('c', $date);
382
+		$spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date));
383 383
 
384 384
 		return $spotter_array;
385 385
 	}
@@ -396,13 +396,13 @@  discard block
 block discarded – undo
396 396
 		date_default_timezone_set('UTC');
397 397
 
398 398
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
399
-                $query  = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
399
+                $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
400 400
 
401 401
     		try {
402 402
 			
403 403
 			$sth = $this->db->prepare($query);
404 404
 			$sth->execute(array(':ident' => $ident));
405
-		} catch(PDOException $e) {
405
+		} catch (PDOException $e) {
406 406
 			echo $e->getMessage();
407 407
 			die;
408 408
 		}
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
 	* @return Array the spotter information
418 418
 	*
419 419
 	*/
420
-	public function getAllLiveSpotterDataById($id,$liveinterval = false)
420
+	public function getAllLiveSpotterDataById($id, $liveinterval = false)
421 421
 	{
422 422
 		global $globalDBdriver, $globalLiveInterval;
423 423
 		date_default_timezone_set('UTC');
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
 		try {
437 437
 			$sth = $this->db->prepare($query);
438 438
 			$sth->execute(array(':id' => $id));
439
-		} catch(PDOException $e) {
439
+		} catch (PDOException $e) {
440 440
 			echo $e->getMessage();
441 441
 			die;
442 442
 		}
@@ -454,12 +454,12 @@  discard block
 block discarded – undo
454 454
 	{
455 455
 		date_default_timezone_set('UTC');
456 456
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
457
-		$query  = self::$global_query.' WHERE spotter_live.ident = :ident';
457
+		$query = self::$global_query.' WHERE spotter_live.ident = :ident';
458 458
     		try {
459 459
 			
460 460
 			$sth = $this->db->prepare($query);
461 461
 			$sth->execute(array(':ident' => $ident));
462
-		} catch(PDOException $e) {
462
+		} catch (PDOException $e) {
463 463
 			echo $e->getMessage();
464 464
 			die;
465 465
 		}
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
 			
490 490
 			$sth = $this->db->prepare($query);
491 491
 			$sth->execute();
492
-		} catch(PDOException $e) {
492
+		} catch (PDOException $e) {
493 493
 			return "error";
494 494
 		}
495 495
 
@@ -512,14 +512,14 @@  discard block
 block discarded – undo
512 512
 				
513 513
 				$sth = $this->db->prepare($query);
514 514
 				$sth->execute();
515
-			} catch(PDOException $e) {
515
+			} catch (PDOException $e) {
516 516
 				return "error";
517 517
 			}
518 518
 			$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
519 519
                         $i = 0;
520
-                        $j =0;
520
+                        $j = 0;
521 521
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
522
-			foreach($all as $row)
522
+			foreach ($all as $row)
523 523
 			{
524 524
 				$i++;
525 525
 				$j++;
@@ -527,9 +527,9 @@  discard block
 block discarded – undo
527 527
 					if ($globalDebug) echo ".";
528 528
 				    	try {
529 529
 						
530
-						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
530
+						$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
531 531
 						$sth->execute();
532
-					} catch(PDOException $e) {
532
+					} catch (PDOException $e) {
533 533
 						return "error";
534 534
 					}
535 535
                                 	$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
@@ -540,9 +540,9 @@  discard block
 block discarded – undo
540 540
 			if ($i > 0) {
541 541
     				try {
542 542
 					
543
-					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
543
+					$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
544 544
 					$sth->execute();
545
-				} catch(PDOException $e) {
545
+				} catch (PDOException $e) {
546 546
 					return "error";
547 547
 				}
548 548
 			}
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
 				
556 556
 				$sth = $this->db->prepare($query);
557 557
 				$sth->execute();
558
-			} catch(PDOException $e) {
558
+			} catch (PDOException $e) {
559 559
 				return "error";
560 560
 			}
561 561
 /*			$query_delete = "DELETE FROM spotter_live WHERE flightaware_id IN (";
@@ -603,13 +603,13 @@  discard block
 block discarded – undo
603 603
 	public function deleteLiveSpotterDataByIdent($ident)
604 604
 	{
605 605
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
606
-		$query  = 'DELETE FROM spotter_live WHERE ident = :ident';
606
+		$query = 'DELETE FROM spotter_live WHERE ident = :ident';
607 607
         
608 608
     		try {
609 609
 			
610 610
 			$sth = $this->db->prepare($query);
611 611
 			$sth->execute(array(':ident' => $ident));
612
-		} catch(PDOException $e) {
612
+		} catch (PDOException $e) {
613 613
 			return "error";
614 614
 		}
615 615
 
@@ -625,13 +625,13 @@  discard block
 block discarded – undo
625 625
 	public function deleteLiveSpotterDataById($id)
626 626
 	{
627 627
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
628
-		$query  = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
628
+		$query = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
629 629
         
630 630
     		try {
631 631
 			
632 632
 			$sth = $this->db->prepare($query);
633 633
 			$sth->execute(array(':id' => $id));
634
-		} catch(PDOException $e) {
634
+		} catch (PDOException $e) {
635 635
 			return "error";
636 636
 		}
637 637
 
@@ -649,13 +649,13 @@  discard block
 block discarded – undo
649 649
 	{
650 650
 		global $globalDBdriver, $globalTimezone;
651 651
 		if ($globalDBdriver == 'mysql') {
652
-			$query  = 'SELECT spotter_live.ident FROM spotter_live 
652
+			$query = 'SELECT spotter_live.ident FROM spotter_live 
653 653
 				WHERE spotter_live.ident = :ident 
654 654
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
655 655
 				AND spotter_live.date < UTC_TIMESTAMP()';
656 656
 			$query_data = array(':ident' => $ident);
657 657
 		} else {
658
-			$query  = "SELECT spotter_live.ident FROM spotter_live 
658
+			$query = "SELECT spotter_live.ident FROM spotter_live 
659 659
 				WHERE spotter_live.ident = :ident 
660 660
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
661 661
 				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -664,8 +664,8 @@  discard block
 block discarded – undo
664 664
 		
665 665
 		$sth = $this->db->prepare($query);
666 666
 		$sth->execute($query_data);
667
-		$ident_result='';
668
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
667
+		$ident_result = '';
668
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
669 669
 		{
670 670
 			$ident_result = $row['ident'];
671 671
 		}
@@ -682,13 +682,13 @@  discard block
 block discarded – undo
682 682
 	{
683 683
 		global $globalDBdriver, $globalTimezone;
684 684
 		if ($globalDBdriver == 'mysql') {
685
-			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
685
+			$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
686 686
 				WHERE spotter_live.ident = :ident 
687 687
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; 
688 688
 //				AND spotter_live.date < UTC_TIMESTAMP()";
689 689
 			$query_data = array(':ident' => $ident);
690 690
 		} else {
691
-			$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
691
+			$query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
692 692
 				WHERE spotter_live.ident = :ident 
693 693
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'";
694 694
 //				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -697,8 +697,8 @@  discard block
 block discarded – undo
697 697
 		
698 698
 		$sth = $this->db->prepare($query);
699 699
 		$sth->execute($query_data);
700
-		$ident_result='';
701
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
700
+		$ident_result = '';
701
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
702 702
 		{
703 703
 			$ident_result = $row['flightaware_id'];
704 704
 		}
@@ -715,13 +715,13 @@  discard block
 block discarded – undo
715 715
 	{
716 716
 		global $globalDBdriver, $globalTimezone;
717 717
 		if ($globalDBdriver == 'mysql') {
718
-			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
718
+			$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
719 719
 				WHERE spotter_live.flightaware_id = :id 
720 720
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; 
721 721
 //				AND spotter_live.date < UTC_TIMESTAMP()";
722 722
 			$query_data = array(':id' => $id);
723 723
 		} else {
724
-			$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
724
+			$query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
725 725
 				WHERE spotter_live.flightaware_id = :id 
726 726
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'";
727 727
 //				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -730,8 +730,8 @@  discard block
 block discarded – undo
730 730
 		
731 731
 		$sth = $this->db->prepare($query);
732 732
 		$sth->execute($query_data);
733
-		$ident_result='';
734
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
733
+		$ident_result = '';
734
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
735 735
 		{
736 736
 			$ident_result = $row['flightaware_id'];
737 737
 		}
@@ -748,13 +748,13 @@  discard block
 block discarded – undo
748 748
 	{
749 749
 		global $globalDBdriver, $globalTimezone;
750 750
 		if ($globalDBdriver == 'mysql') {
751
-			$query  = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
751
+			$query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
752 752
 				WHERE spotter_live.ModeS = :modes 
753 753
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; 
754 754
 //				AND spotter_live.date < UTC_TIMESTAMP()";
755 755
 			$query_data = array(':modes' => $modes);
756 756
 		} else {
757
-			$query  = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
757
+			$query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
758 758
 				WHERE spotter_live.ModeS = :modes 
759 759
 				AND spotter_live.date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '30 MINUTE'";
760 760
 //			//	AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
@@ -763,8 +763,8 @@  discard block
 block discarded – undo
763 763
 		
764 764
 		$sth = $this->db->prepare($query);
765 765
 		$sth->execute($query_data);
766
-		$ident_result='';
767
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
766
+		$ident_result = '';
767
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
768 768
 		{
769 769
 			//$ident_result = $row['spotter_live_id'];
770 770
 			$ident_result = $row['flightaware_id'];
@@ -783,7 +783,7 @@  discard block
 block discarded – undo
783 783
 	* @return String success or false
784 784
 	*
785 785
 	*/
786
-	public function addLiveSpotterData($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 = '', $ModeS = '', $putinarchive = false,$registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false,$format_source = '', $source_name = '', $over_country = '')
786
+	public function addLiveSpotterData($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 = '', $ModeS = '', $putinarchive = false, $registration = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false, $format_source = '', $source_name = '', $over_country = '')
787 787
 	{
788 788
 		global $globalURL, $globalArchive, $globalDebug;
789 789
 		$Common = new Common();
@@ -877,26 +877,26 @@  discard block
 block discarded – undo
877 877
 		if ($date == '') $date = date("Y-m-d H:i:s", time());
878 878
 
879 879
         
880
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
881
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
882
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
883
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
884
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
885
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
886
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
887
-		$waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING);
888
-		$altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
889
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
890
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
891
-		$squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT);
892
-		$route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING);
893
-		$ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING);
894
-		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING);
895
-		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
896
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
897
-		$source_name = filter_var($source_name,FILTER_SANITIZE_STRING);
898
-		$over_country = filter_var($over_country,FILTER_SANITIZE_STRING);
899
-		$verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT);
880
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
881
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
882
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
883
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
884
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
885
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
886
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
887
+		$waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING);
888
+		$altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
889
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
890
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
891
+		$squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT);
892
+		$route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING);
893
+		$ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING);
894
+		$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING);
895
+		$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
896
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
897
+		$source_name = filter_var($source_name, FILTER_SANITIZE_STRING);
898
+		$over_country = filter_var($over_country, FILTER_SANITIZE_STRING);
899
+		$verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT);
900 900
 
901 901
 		$airline_name = '';
902 902
 		$airline_icao = '';
@@ -918,26 +918,26 @@  discard block
 block discarded – undo
918 918
 		$arrival_airport_country = '';
919 919
 		
920 920
             	
921
-            	if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
922
-            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
923
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
924
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
921
+            	if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
922
+            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
923
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
924
+            	if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
925 925
             	
926
-		$query  = 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, 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, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country) 
926
+		$query = 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, 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, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country) 
927 927
 		VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_shadow,: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,:ModeS, :pilot_id, :pilot_name, :verticalrate, :ground, :format_source, :source_name, :over_country)';
928 928
 
929
-		$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_shadow' => $aircraft_shadow,':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,':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source,':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country);
929
+		$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_shadow' => $aircraft_shadow, ':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, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country);
930 930
 		//$query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_array[0]['name'],':airline_icao' => $airline_array[0]['icao'],':airline_country' => $airline_array[0]['country'],':airline_type' => $airline_array[0]['type'],':aircraft_icao' => $aircraft_icao,':aircraft_type' => $aircraft_array[0]['type'],':aircraft_manufacturer' => $aircraft_array[0]['manufacturer'],':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date);
931 931
 		try {
932 932
 			
933 933
 			$sth = $this->db->prepare($query);
934 934
 			$sth->execute($query_values);
935
-                } catch(PDOException $e) {
935
+                } catch (PDOException $e) {
936 936
                 	return "error : ".$e->getMessage();
937 937
                 }
938 938
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
939 939
 		    if ($globalDebug) echo '(Add to SBS archive : ';
940
-		    $result =  $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country);
940
+		    $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time, $arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name, $verticalrate, $format_source, $source_name, $over_country);
941 941
 		    if ($globalDebug) echo $result.')';
942 942
 		}
943 943
 		return "success";
@@ -946,7 +946,7 @@  discard block
 block discarded – undo
946 946
 
947 947
 	public function getOrderBy()
948 948
 	{
949
-		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC"));
949
+		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC"));
950 950
 		return $orderby;
951 951
 	}
952 952
 
Please login to merge, or discard this patch.
Braces   +68 added lines, -23 removed lines patch added patch discarded remove patch
@@ -18,8 +18,12 @@  discard block
 block discarded – undo
18 18
 	*/
19 19
 	public function getFilter($filter = array(),$where = false,$and = false) {
20 20
 		global $globalFilter, $globalStatsFilters, $globalFilterName;
21
-		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) $filter = array_merge($globalStatsFilters[$globalFilterName],$filter);
22
-		if (is_array($globalFilter)) $filter = array_merge($globalFilter,$filter);
21
+		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
22
+			$filter = array_merge($globalStatsFilters[$globalFilterName],$filter);
23
+		}
24
+		if (is_array($globalFilter)) {
25
+			$filter = array_merge($globalFilter,$filter);
26
+		}
23 27
 		$filter_query_join = '';
24 28
 		$filter_query_where = '';
25 29
 		if (isset($filter['airlines']) && !empty($filter['airlines'])) {
@@ -47,8 +51,11 @@  discard block
 block discarded – undo
47 51
 				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
48 52
 			}
49 53
 		}
50
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
51
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
54
+		if ($filter_query_where == '' && $where) {
55
+			$filter_query_where = ' WHERE';
56
+		} elseif ($filter_query_where != '' && $and) {
57
+			$filter_query_where .= ' AND';
58
+		}
52 59
 		$filter_query = $filter_query_join.$filter_query_where;
53 60
 		return $filter_query;
54 61
 	}
@@ -84,7 +91,9 @@  discard block
 block discarded – undo
84 91
 			$orderby_query = ' '.$search_orderby_array[$sort]['sql'];
85 92
 		}
86 93
 
87
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
94
+		if (!isset($globalLiveInterval)) {
95
+			$globalLiveInterval = '200';
96
+		}
88 97
 		if ($globalDBdriver == 'mysql') {
89 98
 			//$query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate";
90 99
 			$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query.$orderby_query;
@@ -109,7 +118,9 @@  discard block
 block discarded – undo
109 118
 
110 119
 		$filter_query = $this->getFilter($filter);
111 120
 
112
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
121
+		if (!isset($globalLiveInterval)) {
122
+			$globalLiveInterval = '200';
123
+		}
113 124
 		if ($globalDBdriver == 'mysql') {
114 125
 //			$query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL ".$globalLiveInterval." SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate$orderby_query";
115 126
 //			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, a.aircraft_shadow FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate INNER JOIN (SELECT * FROM aircraft) a on spotter_live.aircraft_icao = a.icao';
@@ -156,7 +167,9 @@  discard block
 block discarded – undo
156 167
 
157 168
 		$filter_query = $this->getFilter($filter,true,true);
158 169
 
159
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
170
+		if (!isset($globalLiveInterval)) {
171
+			$globalLiveInterval = '200';
172
+		}
160 173
 		if ($globalDBdriver == 'mysql') {
161 174
 
162 175
 			$query  = 'SELECT a.aircraft_shadow, a.engine_type, a.engine_count, a.wake_category, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
@@ -196,7 +209,9 @@  discard block
 block discarded – undo
196 209
 		global $globalDBdriver, $globalLiveInterval;
197 210
 		$filter_query = $this->getFilter($filter,true,true);
198 211
 
199
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
212
+		if (!isset($globalLiveInterval)) {
213
+			$globalLiveInterval = '200';
214
+		}
200 215
 		if ($globalDBdriver == 'mysql') {
201 216
 			//$query  = 'SELECT COUNT(*) as nb FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query;
202 217
 			$query = 'SELECT COUNT(DISTINCT spotter_live.flightaware_id) as nb FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
@@ -226,7 +241,9 @@  discard block
 block discarded – undo
226 241
 	{
227 242
 		global $globalDBdriver, $globalLiveInterval;
228 243
 		$Spotter = new Spotter($this->db);
229
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
244
+		if (!isset($globalLiveInterval)) {
245
+			$globalLiveInterval = '200';
246
+		}
230 247
 		$filter_query = $this->getFilter($filter);
231 248
 
232 249
 		if (is_array($coord)) {
@@ -234,7 +251,9 @@  discard block
 block discarded – undo
234 251
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
235 252
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
236 253
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
237
-		} else return array();
254
+		} else {
255
+			return array();
256
+		}
238 257
 		if ($globalDBdriver == 'mysql') {
239 258
 			//$query  = "SELECT spotter_output.* FROM spotter_output WHERE spotter_output.flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL ".$globalLiveInterval." SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")";
240 259
 			$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY spotter_live.flightaware_id'.$filter_query;
@@ -425,11 +444,15 @@  discard block
 block discarded – undo
425 444
 		//$query  = self::$global_query.' WHERE spotter_live.flightaware_id = :id ORDER BY date';
426 445
 		if ($globalDBdriver == 'mysql') {
427 446
 			$query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id';
428
-			if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
447
+			if ($liveinterval) {
448
+				$query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
449
+			}
429 450
 			$query .= ' ORDER BY date';
430 451
 		} else {
431 452
 			$query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id';
432
-			if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
453
+			if ($liveinterval) {
454
+				$query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
455
+			}
433 456
 			$query .= ' ORDER BY date';
434 457
 		}
435 458
 
@@ -524,7 +547,9 @@  discard block
 block discarded – undo
524 547
 				$i++;
525 548
 				$j++;
526 549
 				if ($j == 30) {
527
-					if ($globalDebug) echo ".";
550
+					if ($globalDebug) {
551
+						echo ".";
552
+					}
528 553
 				    	try {
529 554
 						
530 555
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
@@ -856,7 +881,9 @@  discard block
 block discarded – undo
856 881
 			{
857 882
 				return false;
858 883
 			}
859
-		} else $altitude = 0;
884
+		} else {
885
+			$altitude = 0;
886
+		}
860 887
 
861 888
 		if ($heading != '')
862 889
 		{
@@ -864,7 +891,9 @@  discard block
 block discarded – undo
864 891
 			{
865 892
 				return false;
866 893
 			}
867
-		} else $heading = 0;
894
+		} else {
895
+			$heading = 0;
896
+		}
868 897
 
869 898
 		if ($groundspeed != '')
870 899
 		{
@@ -872,9 +901,13 @@  discard block
 block discarded – undo
872 901
 			{
873 902
 				return false;
874 903
 			}
875
-		} else $groundspeed = 0;
904
+		} else {
905
+			$groundspeed = 0;
906
+		}
876 907
 		date_default_timezone_set('UTC');
877
-		if ($date == '') $date = date("Y-m-d H:i:s", time());
908
+		if ($date == '') {
909
+			$date = date("Y-m-d H:i:s", time());
910
+		}
878 911
 
879 912
         
880 913
 		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
@@ -918,10 +951,18 @@  discard block
 block discarded – undo
918 951
 		$arrival_airport_country = '';
919 952
 		
920 953
             	
921
-            	if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
922
-            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
923
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
924
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
954
+            	if ($squawk == '' || $Common->isInteger($squawk) === false ) {
955
+            		$squawk = NULL;
956
+            	}
957
+            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) {
958
+            		$verticalrate = NULL;
959
+            	}
960
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) {
961
+            		$groundspeed = 0;
962
+            	}
963
+            	if ($heading == '' || $Common->isInteger($heading) === false ) {
964
+            		$heading = 0;
965
+            	}
925 966
             	
926 967
 		$query  = 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, 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, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country) 
927 968
 		VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_shadow,: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,:ModeS, :pilot_id, :pilot_name, :verticalrate, :ground, :format_source, :source_name, :over_country)';
@@ -936,9 +977,13 @@  discard block
 block discarded – undo
936 977
                 	return "error : ".$e->getMessage();
937 978
                 }
938 979
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
939
-		    if ($globalDebug) echo '(Add to SBS archive : ';
980
+		    if ($globalDebug) {
981
+		    	echo '(Add to SBS archive : ';
982
+		    }
940 983
 		    $result =  $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country);
941
-		    if ($globalDebug) echo $result.')';
984
+		    if ($globalDebug) {
985
+		    	echo $result.')';
986
+		    }
942 987
 		}
943 988
 		return "success";
944 989
 
Please login to merge, or discard this patch.
install/class.update_schema.php 3 patches
Braces   +220 added lines, -82 removed lines patch added patch discarded remove patch
@@ -258,7 +258,9 @@  discard block
 block discarded – undo
258 258
     		// Update table countries
259 259
     		if ($Connection->tableExists('airspace')) {
260 260
     		    $error .= update_db::update_countries();
261
-		    if ($error != '') return $error;
261
+		    if ($error != '') {
262
+		    	return $error;
263
+		    }
262 264
 		}
263 265
 		// Update schema_version to 7
264 266
 		$query = "UPDATE `config` SET `value` = '7' WHERE `name` = 'schema_version'";
@@ -314,7 +316,9 @@  discard block
 block discarded – undo
314 316
     		$error = '';
315 317
     		// Update table aircraft
316 318
 		$error .= create_db::import_file('../db/source_location.sql');
317
-		if ($error != '') return $error;
319
+		if ($error != '') {
320
+			return $error;
321
+		}
318 322
 		// Update schema_version to 6
319 323
 		$query = "UPDATE `config` SET `value` = '8' WHERE `name` = 'schema_version'";
320 324
         	try {
@@ -331,7 +335,9 @@  discard block
 block discarded – undo
331 335
     		$error = '';
332 336
     		// Update table aircraft
333 337
 		$error .= create_db::import_file('../db/notam.sql');
334
-		if ($error != '') return $error;
338
+		if ($error != '') {
339
+			return $error;
340
+		}
335 341
 		$query = "DELETE FROM config WHERE name = 'last_update_db';
336 342
                         INSERT INTO config (name,value) VALUES ('last_update_db',NOW());
337 343
                         DELETE FROM config WHERE name = 'last_update_notam_db';
@@ -365,7 +371,9 @@  discard block
 block discarded – undo
365 371
 		$error = '';
366 372
     		// Update table atc
367 373
 		$error .= create_db::import_file('../db/atc.sql');
368
-		if ($error != '') return $error;
374
+		if ($error != '') {
375
+			return $error;
376
+		}
369 377
 		
370 378
 		$query = "UPDATE `config` SET `value` = '10' WHERE `name` = 'schema_version'";
371 379
         	try {
@@ -389,13 +397,21 @@  discard block
 block discarded – undo
389 397
 		$error = '';
390 398
     		// Add tables
391 399
 		$error .= create_db::import_file('../db/aircraft_owner.sql');
392
-		if ($error != '') return $error;
400
+		if ($error != '') {
401
+			return $error;
402
+		}
393 403
 		$error .= create_db::import_file('../db/metar.sql');
394
-		if ($error != '') return $error;
404
+		if ($error != '') {
405
+			return $error;
406
+		}
395 407
 		$error .= create_db::import_file('../db/taf.sql');
396
-		if ($error != '') return $error;
408
+		if ($error != '') {
409
+			return $error;
410
+		}
397 411
 		$error .= create_db::import_file('../db/airport.sql');
398
-		if ($error != '') return $error;
412
+		if ($error != '') {
413
+			return $error;
414
+		}
399 415
 		
400 416
 		$query = "UPDATE `config` SET `value` = '11' WHERE `name` = 'schema_version'";
401 417
         	try {
@@ -469,19 +485,33 @@  discard block
 block discarded – undo
469 485
 		$error = '';
470 486
     		// Add tables
471 487
 		$error .= create_db::import_file('../db/stats.sql');
472
-		if ($error != '') return $error;
488
+		if ($error != '') {
489
+			return $error;
490
+		}
473 491
 		$error .= create_db::import_file('../db/stats_aircraft.sql');
474
-		if ($error != '') return $error;
492
+		if ($error != '') {
493
+			return $error;
494
+		}
475 495
 		$error .= create_db::import_file('../db/stats_airline.sql');
476
-		if ($error != '') return $error;
496
+		if ($error != '') {
497
+			return $error;
498
+		}
477 499
 		$error .= create_db::import_file('../db/stats_airport.sql');
478
-		if ($error != '') return $error;
500
+		if ($error != '') {
501
+			return $error;
502
+		}
479 503
 		$error .= create_db::import_file('../db/stats_owner.sql');
480
-		if ($error != '') return $error;
504
+		if ($error != '') {
505
+			return $error;
506
+		}
481 507
 		$error .= create_db::import_file('../db/stats_pilot.sql');
482
-		if ($error != '') return $error;
508
+		if ($error != '') {
509
+			return $error;
510
+		}
483 511
 		$error .= create_db::import_file('../db/spotter_archive_output.sql');
484
-		if ($error != '') return $error;
512
+		if ($error != '') {
513
+			return $error;
514
+		}
485 515
 		
486 516
 		$query = "UPDATE `config` SET `value` = '13' WHERE `name` = 'schema_version'";
487 517
         	try {
@@ -521,7 +551,9 @@  discard block
 block discarded – undo
521 551
     		// Add tables
522 552
     		if (!$Connection->tableExists('stats_flight')) {
523 553
 			$error .= create_db::import_file('../db/stats_flight.sql');
524
-			if ($error != '') return $error;
554
+			if ($error != '') {
555
+				return $error;
556
+			}
525 557
 		}
526 558
 		$query = "UPDATE `config` SET `value` = '15' WHERE `name` = 'schema_version'";
527 559
         	try {
@@ -545,7 +577,9 @@  discard block
 block discarded – undo
545 577
     		} catch(PDOException $e) {
546 578
 		    return "error (update stats) : ".$e->getMessage()."\n";
547 579
     		}
548
-		if ($error != '') return $error;
580
+		if ($error != '') {
581
+			return $error;
582
+		}
549 583
 		$query = "UPDATE `config` SET `value` = '16' WHERE `name` = 'schema_version'";
550 584
         	try {
551 585
             	    $sth = $Connection->db->prepare($query);
@@ -566,7 +600,9 @@  discard block
 block discarded – undo
566 600
     		if (!$Connection->tableExists('stats_callsign')) {
567 601
 			$error .= create_db::import_file('../db/stats_callsign.sql');
568 602
 		}
569
-		if ($error != '') return $error;
603
+		if ($error != '') {
604
+			return $error;
605
+		}
570 606
 		$query = "UPDATE `config` SET `value` = '17' WHERE `name` = 'schema_version'";
571 607
         	try {
572 608
             	    $sth = $Connection->db->prepare($query);
@@ -584,7 +620,9 @@  discard block
 block discarded – undo
584 620
     		if (!$Connection->tableExists('stats_country')) {
585 621
 			$error .= create_db::import_file('../db/stats_country.sql');
586 622
 		}
587
-		if ($error != '') return $error;
623
+		if ($error != '') {
624
+			return $error;
625
+		}
588 626
 		$query = "UPDATE `config` SET `value` = '18' WHERE `name` = 'schema_version'";
589 627
         	try {
590 628
             	    $sth = $Connection->db->prepare($query);
@@ -607,7 +645,9 @@  discard block
 block discarded – undo
607 645
 			    return "error (update stats) : ".$e->getMessage()."\n";
608 646
     			}
609 647
     		}
610
-		if ($error != '') return $error;
648
+		if ($error != '') {
649
+			return $error;
650
+		}
611 651
 		$query = "UPDATE `config` SET `value` = '19' WHERE `name` = 'schema_version'";
612 652
         	try {
613 653
             	    $sth = $Connection->db->prepare($query);
@@ -623,7 +663,9 @@  discard block
 block discarded – undo
623 663
 		$error = '';
624 664
     		// Update airport table
625 665
 		$error .= create_db::import_file('../db/airport.sql');
626
-		if ($error != '') return 'Import airport.sql : '.$error;
666
+		if ($error != '') {
667
+			return 'Import airport.sql : '.$error;
668
+		}
627 669
 		// Remove primary key on Spotter_Archive
628 670
 		$query = "alter table spotter_archive drop spotter_archive_id";
629 671
         	try {
@@ -699,7 +741,9 @@  discard block
 block discarded – undo
699 741
 				return "error (add source_name column) : ".$e->getMessage()."\n";
700 742
     			}
701 743
     		}
702
-		if ($error != '') return $error;
744
+		if ($error != '') {
745
+			return $error;
746
+		}
703 747
 		$query = "UPDATE `config` SET `value` = '20' WHERE `name` = 'schema_version'";
704 748
         	try {
705 749
             	    $sth = $Connection->db->prepare($query);
@@ -717,7 +761,9 @@  discard block
 block discarded – undo
717 761
     		// Update airline table
718 762
     		if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) {
719 763
 			$error .= create_db::import_file('../db/airlines.sql');
720
-			if ($error != '') return 'Import airlines.sql : '.$error;
764
+			if ($error != '') {
765
+				return 'Import airlines.sql : '.$error;
766
+			}
721 767
 		}
722 768
 		if (!$Connection->checkColumnName('aircraft_modes','type_flight')) {
723 769
 			// Add column over_country
@@ -729,7 +775,9 @@  discard block
 block discarded – undo
729 775
 				return "error (add over_country) : ".$e->getMessage()."\n";
730 776
     			}
731 777
     		}
732
-		if ($error != '') return $error;
778
+		if ($error != '') {
779
+			return $error;
780
+		}
733 781
 		/*
734 782
     		if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) {
735 783
 			// Force update ModeS (this will put type_flight data
@@ -759,7 +807,9 @@  discard block
 block discarded – undo
759 807
 			} catch(PDOException $e) {
760 808
 				return "error (rename type to stats_type on stats*) : ".$e->getMessage()."\n";
761 809
 			}
762
-			if ($error != '') return $error;
810
+			if ($error != '') {
811
+				return $error;
812
+			}
763 813
 		}
764 814
 		$query = "UPDATE `config` SET `value` = '22' WHERE `name` = 'schema_version'";
765 815
         	try {
@@ -782,7 +832,9 @@  discard block
 block discarded – undo
782 832
 			} else {
783 833
 				$error .= create_db::import_file('../db/pgsql/stats_source.sql');
784 834
 			}
785
-			if ($error != '') return $error;
835
+			if ($error != '') {
836
+				return $error;
837
+			}
786 838
 		}
787 839
 		$query = "UPDATE config SET value = '23' WHERE name = 'schema_version'";
788 840
         	try {
@@ -804,12 +856,16 @@  discard block
 block discarded – undo
804 856
 		if ($globalDBdriver == 'mysql') {
805 857
 			if (!$Connection->tableExists('tle')) {
806 858
 				$error .= create_db::import_file('../db/tle.sql');
807
-				if ($error != '') return $error;
859
+				if ($error != '') {
860
+					return $error;
861
+				}
808 862
 			}
809 863
 		} else {
810 864
 			if (!$Connection->tableExists('tle')) {
811 865
 				$error .= create_db::import_file('../db/pgsql/tle.sql');
812
-				if ($error != '') return $error;
866
+				if ($error != '') {
867
+					return $error;
868
+				}
813 869
 			}
814 870
 			$query = "create index flightaware_id_idx ON spotter_archive USING btree(flightaware_id)";
815 871
 			try {
@@ -849,7 +905,9 @@  discard block
 block discarded – undo
849 905
 		} else {
850 906
 			$error .= create_db::import_file('../db/pgsql/airlines.sql');
851 907
 		}
852
-		if ($error != '') return 'Import airlines.sql : '.$error;
908
+		if ($error != '') {
909
+			return 'Import airlines.sql : '.$error;
910
+		}
853 911
 		if (!$Connection->checkColumnName('airlines','forsource')) {
854 912
 			// Add forsource to airlines
855 913
 			$query = "ALTER TABLE airlines ADD forsource VARCHAR(255) NULL DEFAULT NULL";
@@ -1102,8 +1160,11 @@  discard block
 block discarded – undo
1102 1160
     	    if ($Connection->tableExists('aircraft')) {
1103 1161
     		if (!$Connection->tableExists('config')) {
1104 1162
     		    $version = '1';
1105
-    		    if ($update) return self::update_from_1();
1106
-    		    else return $version;
1163
+    		    if ($update) {
1164
+    		    	return self::update_from_1();
1165
+    		    } else {
1166
+    		    	return $version;
1167
+    		    }
1107 1168
 		} else {
1108 1169
     		    $Connection = new Connection();
1109 1170
 		    $query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1";
@@ -1117,106 +1178,183 @@  discard block
 block discarded – undo
1117 1178
     		    if ($update) {
1118 1179
     			if ($result['value'] == '2') {
1119 1180
     			    $error = self::update_from_2();
1120
-    			    if ($error != '') return $error;
1121
-    			    else return self::check_version(true);
1181
+    			    if ($error != '') {
1182
+    			    	return $error;
1183
+    			    } else {
1184
+    			    	return self::check_version(true);
1185
+    			    }
1122 1186
     			} elseif ($result['value'] == '3') {
1123 1187
     			    $error = self::update_from_3();
1124
-    			    if ($error != '') return $error;
1125
-    			    else return self::check_version(true);
1188
+    			    if ($error != '') {
1189
+    			    	return $error;
1190
+    			    } else {
1191
+    			    	return self::check_version(true);
1192
+    			    }
1126 1193
     			} elseif ($result['value'] == '4') {
1127 1194
     			    $error = self::update_from_4();
1128
-    			    if ($error != '') return $error;
1129
-    			    else return self::check_version(true);
1195
+    			    if ($error != '') {
1196
+    			    	return $error;
1197
+    			    } else {
1198
+    			    	return self::check_version(true);
1199
+    			    }
1130 1200
     			} elseif ($result['value'] == '5') {
1131 1201
     			    $error = self::update_from_5();
1132
-    			    if ($error != '') return $error;
1133
-    			    else return self::check_version(true);
1202
+    			    if ($error != '') {
1203
+    			    	return $error;
1204
+    			    } else {
1205
+    			    	return self::check_version(true);
1206
+    			    }
1134 1207
     			} elseif ($result['value'] == '6') {
1135 1208
     			    $error = self::update_from_6();
1136
-    			    if ($error != '') return $error;
1137
-    			    else return self::check_version(true);
1209
+    			    if ($error != '') {
1210
+    			    	return $error;
1211
+    			    } else {
1212
+    			    	return self::check_version(true);
1213
+    			    }
1138 1214
     			} elseif ($result['value'] == '7') {
1139 1215
     			    $error = self::update_from_7();
1140
-    			    if ($error != '') return $error;
1141
-    			    else return self::check_version(true);
1216
+    			    if ($error != '') {
1217
+    			    	return $error;
1218
+    			    } else {
1219
+    			    	return self::check_version(true);
1220
+    			    }
1142 1221
     			} elseif ($result['value'] == '8') {
1143 1222
     			    $error = self::update_from_8();
1144
-    			    if ($error != '') return $error;
1145
-    			    else return self::check_version(true);
1223
+    			    if ($error != '') {
1224
+    			    	return $error;
1225
+    			    } else {
1226
+    			    	return self::check_version(true);
1227
+    			    }
1146 1228
     			} elseif ($result['value'] == '9') {
1147 1229
     			    $error = self::update_from_9();
1148
-    			    if ($error != '') return $error;
1149
-    			    else return self::check_version(true);
1230
+    			    if ($error != '') {
1231
+    			    	return $error;
1232
+    			    } else {
1233
+    			    	return self::check_version(true);
1234
+    			    }
1150 1235
     			} elseif ($result['value'] == '10') {
1151 1236
     			    $error = self::update_from_10();
1152
-    			    if ($error != '') return $error;
1153
-    			    else return self::check_version(true);
1237
+    			    if ($error != '') {
1238
+    			    	return $error;
1239
+    			    } else {
1240
+    			    	return self::check_version(true);
1241
+    			    }
1154 1242
     			} elseif ($result['value'] == '11') {
1155 1243
     			    $error = self::update_from_11();
1156
-    			    if ($error != '') return $error;
1157
-    			    else return self::check_version(true);
1244
+    			    if ($error != '') {
1245
+    			    	return $error;
1246
+    			    } else {
1247
+    			    	return self::check_version(true);
1248
+    			    }
1158 1249
     			} elseif ($result['value'] == '12') {
1159 1250
     			    $error = self::update_from_12();
1160
-    			    if ($error != '') return $error;
1161
-    			    else return self::check_version(true);
1251
+    			    if ($error != '') {
1252
+    			    	return $error;
1253
+    			    } else {
1254
+    			    	return self::check_version(true);
1255
+    			    }
1162 1256
     			} elseif ($result['value'] == '13') {
1163 1257
     			    $error = self::update_from_13();
1164
-    			    if ($error != '') return $error;
1165
-    			    else return self::check_version(true);
1258
+    			    if ($error != '') {
1259
+    			    	return $error;
1260
+    			    } else {
1261
+    			    	return self::check_version(true);
1262
+    			    }
1166 1263
     			} elseif ($result['value'] == '14') {
1167 1264
     			    $error = self::update_from_14();
1168
-    			    if ($error != '') return $error;
1169
-    			    else return self::check_version(true);
1265
+    			    if ($error != '') {
1266
+    			    	return $error;
1267
+    			    } else {
1268
+    			    	return self::check_version(true);
1269
+    			    }
1170 1270
     			} elseif ($result['value'] == '15') {
1171 1271
     			    $error = self::update_from_15();
1172
-    			    if ($error != '') return $error;
1173
-    			    else return self::check_version(true);
1272
+    			    if ($error != '') {
1273
+    			    	return $error;
1274
+    			    } else {
1275
+    			    	return self::check_version(true);
1276
+    			    }
1174 1277
     			} elseif ($result['value'] == '16') {
1175 1278
     			    $error = self::update_from_16();
1176
-    			    if ($error != '') return $error;
1177
-    			    else return self::check_version(true);
1279
+    			    if ($error != '') {
1280
+    			    	return $error;
1281
+    			    } else {
1282
+    			    	return self::check_version(true);
1283
+    			    }
1178 1284
     			} elseif ($result['value'] == '17') {
1179 1285
     			    $error = self::update_from_17();
1180
-    			    if ($error != '') return $error;
1181
-    			    else return self::check_version(true);
1286
+    			    if ($error != '') {
1287
+    			    	return $error;
1288
+    			    } else {
1289
+    			    	return self::check_version(true);
1290
+    			    }
1182 1291
     			} elseif ($result['value'] == '18') {
1183 1292
     			    $error = self::update_from_18();
1184
-    			    if ($error != '') return $error;
1185
-    			    else return self::check_version(true);
1293
+    			    if ($error != '') {
1294
+    			    	return $error;
1295
+    			    } else {
1296
+    			    	return self::check_version(true);
1297
+    			    }
1186 1298
     			} elseif ($result['value'] == '19') {
1187 1299
     			    $error = self::update_from_19();
1188
-    			    if ($error != '') return $error;
1189
-    			    else return self::check_version(true);
1300
+    			    if ($error != '') {
1301
+    			    	return $error;
1302
+    			    } else {
1303
+    			    	return self::check_version(true);
1304
+    			    }
1190 1305
     			} elseif ($result['value'] == '20') {
1191 1306
     			    $error = self::update_from_20();
1192
-    			    if ($error != '') return $error;
1193
-    			    else return self::check_version(true);
1307
+    			    if ($error != '') {
1308
+    			    	return $error;
1309
+    			    } else {
1310
+    			    	return self::check_version(true);
1311
+    			    }
1194 1312
     			} elseif ($result['value'] == '21') {
1195 1313
     			    $error = self::update_from_21();
1196
-    			    if ($error != '') return $error;
1197
-    			    else return self::check_version(true);
1314
+    			    if ($error != '') {
1315
+    			    	return $error;
1316
+    			    } else {
1317
+    			    	return self::check_version(true);
1318
+    			    }
1198 1319
     			} elseif ($result['value'] == '22') {
1199 1320
     			    $error = self::update_from_22();
1200
-    			    if ($error != '') return $error;
1201
-    			    else return self::check_version(true);
1321
+    			    if ($error != '') {
1322
+    			    	return $error;
1323
+    			    } else {
1324
+    			    	return self::check_version(true);
1325
+    			    }
1202 1326
     			} elseif ($result['value'] == '23') {
1203 1327
     			    $error = self::update_from_23();
1204
-    			    if ($error != '') return $error;
1205
-    			    else return self::check_version(true);
1328
+    			    if ($error != '') {
1329
+    			    	return $error;
1330
+    			    } else {
1331
+    			    	return self::check_version(true);
1332
+    			    }
1206 1333
     			} elseif ($result['value'] == '24') {
1207 1334
     			    $error = self::update_from_24();
1208
-    			    if ($error != '') return $error;
1209
-    			    else return self::check_version(true);
1335
+    			    if ($error != '') {
1336
+    			    	return $error;
1337
+    			    } else {
1338
+    			    	return self::check_version(true);
1339
+    			    }
1210 1340
     			} elseif ($result['value'] == '25') {
1211 1341
     			    $error = self::update_from_25();
1212
-    			    if ($error != '') return $error;
1213
-    			    else return self::check_version(true);
1214
-    			} else return '';
1342
+    			    if ($error != '') {
1343
+    			    	return $error;
1344
+    			    } else {
1345
+    			    	return self::check_version(true);
1346
+    			    }
1347
+    			} else {
1348
+    				return '';
1349
+    			}
1350
+    		    } else {
1351
+    		    	return $result['value'];
1215 1352
     		    }
1216
-    		    else return $result['value'];
1217 1353
 		}
1218 1354
 		
1219
-	    } else return $version;
1355
+	    } else {
1356
+	    	return $version;
1357
+	    }
1220 1358
     	}
1221 1359
     	
1222 1360
 }
Please login to merge, or discard this patch.
Indentation   +558 added lines, -558 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 {
@@ -1112,129 +1112,129 @@  discard block
 block discarded – undo
1112 1112
 
1113 1113
 
1114 1114
 
1115
-    	public static function check_version($update = false) {
1116
-    	    global $globalDBname;
1117
-    	    $version = 0;
1118
-    	    $Connection = new Connection();
1119
-    	    if ($Connection->tableExists('aircraft')) {
1120
-    		if (!$Connection->tableExists('config')) {
1121
-    		    $version = '1';
1122
-    		    if ($update) return self::update_from_1();
1123
-    		    else return $version;
1115
+		public static function check_version($update = false) {
1116
+			global $globalDBname;
1117
+			$version = 0;
1118
+			$Connection = new Connection();
1119
+			if ($Connection->tableExists('aircraft')) {
1120
+			if (!$Connection->tableExists('config')) {
1121
+				$version = '1';
1122
+				if ($update) return self::update_from_1();
1123
+				else return $version;
1124 1124
 		} else {
1125
-    		    $Connection = new Connection();
1126
-		    $query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1";
1127
-		    try {
1128
-            		$sth = $Connection->db->prepare($query);
1129
-		        $sth->execute();
1130
-		    } catch(PDOException $e) {
1125
+				$Connection = new Connection();
1126
+			$query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1";
1127
+			try {
1128
+					$sth = $Connection->db->prepare($query);
1129
+				$sth->execute();
1130
+			} catch(PDOException $e) {
1131 1131
 			return "error : ".$e->getMessage()."\n";
1132
-    		    }
1133
-    		    $result = $sth->fetch(PDO::FETCH_ASSOC);
1134
-    		    if ($update) {
1135
-    			if ($result['value'] == '2') {
1136
-    			    $error = self::update_from_2();
1137
-    			    if ($error != '') return $error;
1138
-    			    else return self::check_version(true);
1139
-    			} elseif ($result['value'] == '3') {
1140
-    			    $error = self::update_from_3();
1141
-    			    if ($error != '') return $error;
1142
-    			    else return self::check_version(true);
1143
-    			} elseif ($result['value'] == '4') {
1144
-    			    $error = self::update_from_4();
1145
-    			    if ($error != '') return $error;
1146
-    			    else return self::check_version(true);
1147
-    			} elseif ($result['value'] == '5') {
1148
-    			    $error = self::update_from_5();
1149
-    			    if ($error != '') return $error;
1150
-    			    else return self::check_version(true);
1151
-    			} elseif ($result['value'] == '6') {
1152
-    			    $error = self::update_from_6();
1153
-    			    if ($error != '') return $error;
1154
-    			    else return self::check_version(true);
1155
-    			} elseif ($result['value'] == '7') {
1156
-    			    $error = self::update_from_7();
1157
-    			    if ($error != '') return $error;
1158
-    			    else return self::check_version(true);
1159
-    			} elseif ($result['value'] == '8') {
1160
-    			    $error = self::update_from_8();
1161
-    			    if ($error != '') return $error;
1162
-    			    else return self::check_version(true);
1163
-    			} elseif ($result['value'] == '9') {
1164
-    			    $error = self::update_from_9();
1165
-    			    if ($error != '') return $error;
1166
-    			    else return self::check_version(true);
1167
-    			} elseif ($result['value'] == '10') {
1168
-    			    $error = self::update_from_10();
1169
-    			    if ($error != '') return $error;
1170
-    			    else return self::check_version(true);
1171
-    			} elseif ($result['value'] == '11') {
1172
-    			    $error = self::update_from_11();
1173
-    			    if ($error != '') return $error;
1174
-    			    else return self::check_version(true);
1175
-    			} elseif ($result['value'] == '12') {
1176
-    			    $error = self::update_from_12();
1177
-    			    if ($error != '') return $error;
1178
-    			    else return self::check_version(true);
1179
-    			} elseif ($result['value'] == '13') {
1180
-    			    $error = self::update_from_13();
1181
-    			    if ($error != '') return $error;
1182
-    			    else return self::check_version(true);
1183
-    			} elseif ($result['value'] == '14') {
1184
-    			    $error = self::update_from_14();
1185
-    			    if ($error != '') return $error;
1186
-    			    else return self::check_version(true);
1187
-    			} elseif ($result['value'] == '15') {
1188
-    			    $error = self::update_from_15();
1189
-    			    if ($error != '') return $error;
1190
-    			    else return self::check_version(true);
1191
-    			} elseif ($result['value'] == '16') {
1192
-    			    $error = self::update_from_16();
1193
-    			    if ($error != '') return $error;
1194
-    			    else return self::check_version(true);
1195
-    			} elseif ($result['value'] == '17') {
1196
-    			    $error = self::update_from_17();
1197
-    			    if ($error != '') return $error;
1198
-    			    else return self::check_version(true);
1199
-    			} elseif ($result['value'] == '18') {
1200
-    			    $error = self::update_from_18();
1201
-    			    if ($error != '') return $error;
1202
-    			    else return self::check_version(true);
1203
-    			} elseif ($result['value'] == '19') {
1204
-    			    $error = self::update_from_19();
1205
-    			    if ($error != '') return $error;
1206
-    			    else return self::check_version(true);
1207
-    			} elseif ($result['value'] == '20') {
1208
-    			    $error = self::update_from_20();
1209
-    			    if ($error != '') return $error;
1210
-    			    else return self::check_version(true);
1211
-    			} elseif ($result['value'] == '21') {
1212
-    			    $error = self::update_from_21();
1213
-    			    if ($error != '') return $error;
1214
-    			    else return self::check_version(true);
1215
-    			} elseif ($result['value'] == '22') {
1216
-    			    $error = self::update_from_22();
1217
-    			    if ($error != '') return $error;
1218
-    			    else return self::check_version(true);
1219
-    			} elseif ($result['value'] == '23') {
1220
-    			    $error = self::update_from_23();
1221
-    			    if ($error != '') return $error;
1222
-    			    else return self::check_version(true);
1223
-    			} elseif ($result['value'] == '24') {
1224
-    			    $error = self::update_from_24();
1225
-    			    if ($error != '') return $error;
1226
-    			    else return self::check_version(true);
1227
-    			} elseif ($result['value'] == '25') {
1228
-    			    $error = self::update_from_25();
1229
-    			    if ($error != '') return $error;
1230
-    			    else return self::check_version(true);
1231
-    			} else return '';
1232
-    		    }
1233
-    		    else return $result['value'];
1132
+				}
1133
+				$result = $sth->fetch(PDO::FETCH_ASSOC);
1134
+				if ($update) {
1135
+				if ($result['value'] == '2') {
1136
+					$error = self::update_from_2();
1137
+					if ($error != '') return $error;
1138
+					else return self::check_version(true);
1139
+				} elseif ($result['value'] == '3') {
1140
+					$error = self::update_from_3();
1141
+					if ($error != '') return $error;
1142
+					else return self::check_version(true);
1143
+				} elseif ($result['value'] == '4') {
1144
+					$error = self::update_from_4();
1145
+					if ($error != '') return $error;
1146
+					else return self::check_version(true);
1147
+				} elseif ($result['value'] == '5') {
1148
+					$error = self::update_from_5();
1149
+					if ($error != '') return $error;
1150
+					else return self::check_version(true);
1151
+				} elseif ($result['value'] == '6') {
1152
+					$error = self::update_from_6();
1153
+					if ($error != '') return $error;
1154
+					else return self::check_version(true);
1155
+				} elseif ($result['value'] == '7') {
1156
+					$error = self::update_from_7();
1157
+					if ($error != '') return $error;
1158
+					else return self::check_version(true);
1159
+				} elseif ($result['value'] == '8') {
1160
+					$error = self::update_from_8();
1161
+					if ($error != '') return $error;
1162
+					else return self::check_version(true);
1163
+				} elseif ($result['value'] == '9') {
1164
+					$error = self::update_from_9();
1165
+					if ($error != '') return $error;
1166
+					else return self::check_version(true);
1167
+				} elseif ($result['value'] == '10') {
1168
+					$error = self::update_from_10();
1169
+					if ($error != '') return $error;
1170
+					else return self::check_version(true);
1171
+				} elseif ($result['value'] == '11') {
1172
+					$error = self::update_from_11();
1173
+					if ($error != '') return $error;
1174
+					else return self::check_version(true);
1175
+				} elseif ($result['value'] == '12') {
1176
+					$error = self::update_from_12();
1177
+					if ($error != '') return $error;
1178
+					else return self::check_version(true);
1179
+				} elseif ($result['value'] == '13') {
1180
+					$error = self::update_from_13();
1181
+					if ($error != '') return $error;
1182
+					else return self::check_version(true);
1183
+				} elseif ($result['value'] == '14') {
1184
+					$error = self::update_from_14();
1185
+					if ($error != '') return $error;
1186
+					else return self::check_version(true);
1187
+				} elseif ($result['value'] == '15') {
1188
+					$error = self::update_from_15();
1189
+					if ($error != '') return $error;
1190
+					else return self::check_version(true);
1191
+				} elseif ($result['value'] == '16') {
1192
+					$error = self::update_from_16();
1193
+					if ($error != '') return $error;
1194
+					else return self::check_version(true);
1195
+				} elseif ($result['value'] == '17') {
1196
+					$error = self::update_from_17();
1197
+					if ($error != '') return $error;
1198
+					else return self::check_version(true);
1199
+				} elseif ($result['value'] == '18') {
1200
+					$error = self::update_from_18();
1201
+					if ($error != '') return $error;
1202
+					else return self::check_version(true);
1203
+				} elseif ($result['value'] == '19') {
1204
+					$error = self::update_from_19();
1205
+					if ($error != '') return $error;
1206
+					else return self::check_version(true);
1207
+				} elseif ($result['value'] == '20') {
1208
+					$error = self::update_from_20();
1209
+					if ($error != '') return $error;
1210
+					else return self::check_version(true);
1211
+				} elseif ($result['value'] == '21') {
1212
+					$error = self::update_from_21();
1213
+					if ($error != '') return $error;
1214
+					else return self::check_version(true);
1215
+				} elseif ($result['value'] == '22') {
1216
+					$error = self::update_from_22();
1217
+					if ($error != '') return $error;
1218
+					else return self::check_version(true);
1219
+				} elseif ($result['value'] == '23') {
1220
+					$error = self::update_from_23();
1221
+					if ($error != '') return $error;
1222
+					else return self::check_version(true);
1223
+				} elseif ($result['value'] == '24') {
1224
+					$error = self::update_from_24();
1225
+					if ($error != '') return $error;
1226
+					else return self::check_version(true);
1227
+				} elseif ($result['value'] == '25') {
1228
+					$error = self::update_from_25();
1229
+					if ($error != '') return $error;
1230
+					else return self::check_version(true);
1231
+				} else return '';
1232
+				}
1233
+				else return $result['value'];
1234 1234
 		}
1235 1235
 		
1236
-	    } else return $version;
1237
-    	}
1236
+		} else return $version;
1237
+		}
1238 1238
     	
1239 1239
 }
1240 1240
 //echo update_schema::check_version();
Please login to merge, or discard this patch.
Spacing   +123 added lines, -123 removed lines patch added patch discarded remove patch
@@ -14,11 +14,11 @@  discard block
 block discarded – undo
14 14
             try {
15 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 19
     	    }
20 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']);
21
+    		$Schedule->addSchedule($row['ident'], $row['departure_airport_icao'], $row['departure_airport_time'], $row['arrival_airport_icao'], $row['arrival_airport_time']);
22 22
     	    }
23 23
 	
24 24
 	}
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
         	try {
51 51
             	    $sth = $Connection->db->prepare($query);
52 52
 		    $sth->execute();
53
-    		} catch(PDOException $e) {
53
+    		} catch (PDOException $e) {
54 54
 		    return "error (add new columns to routes table) : ".$e->getMessage()."\n";
55 55
     		}
56 56
     		// Copy schedules data to routes table
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         	try {
61 61
             	    $sth = $Connection->db->prepare($query);
62 62
 		    $sth->execute();
63
-    		} catch(PDOException $e) {
63
+    		} catch (PDOException $e) {
64 64
 		    return "error (delete schedule table) : ".$e->getMessage()."\n";
65 65
     		}
66 66
     		// Add source column
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     		try {
69 69
             	    $sth = $Connection->db->prepare($query);
70 70
 		    $sth->execute();
71
-    		} catch(PDOException $e) {
71
+    		} catch (PDOException $e) {
72 72
 		    return "error (add source column to aircraft_modes) : ".$e->getMessage()."\n";
73 73
     		}
74 74
 		// Delete unused column
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
     		try {
77 77
             	    $sth = $Connection->db->prepare($query);
78 78
 		    $sth->execute();
79
-    		} catch(PDOException $e) {
79
+    		} catch (PDOException $e) {
80 80
 		    return "error (Delete unused column of aircraft_modes) : ".$e->getMessage()."\n";
81 81
     		}
82 82
 		// Add ModeS column
@@ -84,14 +84,14 @@  discard block
 block discarded – undo
84 84
     		try {
85 85
             	    $sth = $Connection->db->prepare($query);
86 86
 		    $sth->execute();
87
-    		} catch(PDOException $e) {
87
+    		} catch (PDOException $e) {
88 88
 		    return "error (Add ModeS column in spotter_output) : ".$e->getMessage()."\n";
89 89
     		}
90 90
 		$query = "ALTER TABLE `spotter_live`  ADD `ModeS` VARCHAR(255)";
91 91
     		try {
92 92
             	    $sth = $Connection->db->prepare($query);
93 93
 		    $sth->execute();
94
-    		} catch(PDOException $e) {
94
+    		} catch (PDOException $e) {
95 95
 		    return "error (Add ModeS column in spotter_live) : ".$e->getMessage()."\n";
96 96
     		}
97 97
     		// Add auto_increment for aircraft_modes
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
     		try {
100 100
             	    $sth = $Connection->db->prepare($query);
101 101
 		    $sth->execute();
102
-    		} catch(PDOException $e) {
102
+    		} catch (PDOException $e) {
103 103
 		    return "error (Add Auto increment in aircraft_modes) : ".$e->getMessage()."\n";
104 104
     		}
105 105
     		$error = '';
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
         	try {
111 111
             	    $sth = $Connection->db->prepare($query);
112 112
 		    $sth->execute();
113
-    		} catch(PDOException $e) {
113
+    		} catch (PDOException $e) {
114 114
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
115 115
     		}
116 116
 		return $error;
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
         	try {
124 124
             	    $sth = $Connection->db->prepare($query);
125 125
 		    $sth->execute();
126
-    		} catch(PDOException $e) {
126
+    		} catch (PDOException $e) {
127 127
 		    return "error (add new columns to routes table) : ".$e->getMessage()."\n";
128 128
     		}
129 129
     		$error = '';
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
         	try {
135 135
             	    $sth = $Connection->db->prepare($query);
136 136
 		    $sth->execute();
137
-    		} catch(PDOException $e) {
137
+    		} catch (PDOException $e) {
138 138
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
139 139
     		}
140 140
 		return $error;
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
         	try {
148 148
             	    $sth = $Connection->db->prepare($query);
149 149
 		    $sth->execute();
150
-    		} catch(PDOException $e) {
150
+    		} catch (PDOException $e) {
151 151
 		    return "error (add new columns to aircraft_modes) : ".$e->getMessage()."\n";
152 152
     		}
153 153
     		// Add image_source_website column to spotter_image
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
         	try {
156 156
             	    $sth = $Connection->db->prepare($query);
157 157
 		    $sth->execute();
158
-    		} catch(PDOException $e) {
158
+    		} catch (PDOException $e) {
159 159
 		    return "error (add new columns to spotter_image) : ".$e->getMessage()."\n";
160 160
     		}
161 161
     		$error = '';
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
         	try {
165 165
             	    $sth = $Connection->db->prepare($query);
166 166
 		    $sth->execute();
167
-    		} catch(PDOException $e) {
167
+    		} catch (PDOException $e) {
168 168
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
169 169
     		}
170 170
 		return $error;
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
         	    try {
183 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 187
     		    }
188 188
     		}
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
         	try {
197 197
             	    $sth = $Connection->db->prepare($query);
198 198
 		    $sth->execute();
199
-    		} catch(PDOException $e) {
199
+    		} catch (PDOException $e) {
200 200
 		    return "error (add new columns to translation) : ".$e->getMessage()."\n";
201 201
     		}
202 202
     		// Add aircraft_shadow column to aircraft
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
         	try {
205 205
             	    $sth = $Connection->db->prepare($query);
206 206
 		    $sth->execute();
207
-    		} catch(PDOException $e) {
207
+    		} catch (PDOException $e) {
208 208
 		    return "error (add new column to aircraft) : ".$e->getMessage()."\n";
209 209
     		}
210 210
     		// Add aircraft_shadow column to spotter_live
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
         	try {
213 213
             	    $sth = $Connection->db->prepare($query);
214 214
 		    $sth->execute();
215
-    		} catch(PDOException $e) {
215
+    		} catch (PDOException $e) {
216 216
 		    return "error (add new column to spotter_live) : ".$e->getMessage()."\n";
217 217
     		}
218 218
     		$error = '';
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
         	try {
226 226
             	    $sth = $Connection->db->prepare($query);
227 227
 		    $sth->execute();
228
-    		} catch(PDOException $e) {
228
+    		} catch (PDOException $e) {
229 229
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
230 230
     		}
231 231
 		return $error;
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 
234 234
 	private static function update_from_6() {
235 235
     		$Connection = new Connection();
236
-    		if (!$Connection->indexExists('spotter_output','flightaware_id')) {
236
+    		if (!$Connection->indexExists('spotter_output', 'flightaware_id')) {
237 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);
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
         	    try {
251 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 255
     		    }
256 256
     		}
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
         	try {
266 266
             	    $sth = $Connection->db->prepare($query);
267 267
 		    $sth->execute();
268
-    		} catch(PDOException $e) {
268
+    		} catch (PDOException $e) {
269 269
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
270 270
     		}
271 271
 		return $error;
@@ -274,12 +274,12 @@  discard block
 block discarded – undo
274 274
 	private static function update_from_7() {
275 275
 		global $globalDBname, $globalDBdriver;
276 276
     		$Connection = new Connection();
277
-    		$query="ALTER TABLE spotter_live ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;
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 279
         	try {
280 280
             	    $sth = $Connection->db->prepare($query);
281 281
 		    $sth->execute();
282
-    		} catch(PDOException $e) {
282
+    		} catch (PDOException $e) {
283 283
 		    return "error (add pilot column to spotter_live and spotter_output) : ".$e->getMessage()."\n";
284 284
     		}
285 285
     		if ($globalDBdriver == 'mysql') {
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 		    try {
288 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 292
     		    }
293 293
     		    $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -299,15 +299,15 @@  discard block
 block discarded – undo
299 299
 				DROP TABLE spotter_archive;
300 300
 				RENAME TABLE copy TO spotter_archive;";
301 301
             	    } else {
302
-    			$query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
302
+    			$query = "ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
303 303
             	    }
304 304
                 } else {
305
-    		    $query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
305
+    		    $query = "ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
306 306
                 }
307 307
         	try {
308 308
             	    $sth = $Connection->db->prepare($query);
309 309
 		    $sth->execute();
310
-    		} catch(PDOException $e) {
310
+    		} catch (PDOException $e) {
311 311
 		    return "error (add pilot column to spotter_archive) : ".$e->getMessage()."\n";
312 312
     		}
313 313
 
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
         	try {
321 321
             	    $sth = $Connection->db->prepare($query);
322 322
 		    $sth->execute();
323
-    		} catch(PDOException $e) {
323
+    		} catch (PDOException $e) {
324 324
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
325 325
     		}
326 326
 		return $error;
@@ -339,14 +339,14 @@  discard block
 block discarded – undo
339 339
         	try {
340 340
             	    $sth = $Connection->db->prepare($query);
341 341
 		    $sth->execute();
342
-    		} catch(PDOException $e) {
342
+    		} catch (PDOException $e) {
343 343
 		    return "error (insert last_update values) : ".$e->getMessage()."\n";
344 344
     		}
345 345
 		$query = "UPDATE `config` SET `value` = '9' WHERE `name` = 'schema_version'";
346 346
         	try {
347 347
             	    $sth = $Connection->db->prepare($query);
348 348
 		    $sth->execute();
349
-    		} catch(PDOException $e) {
349
+    		} catch (PDOException $e) {
350 350
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
351 351
     		}
352 352
 		return $error;
@@ -354,12 +354,12 @@  discard block
 block discarded – undo
354 354
 
355 355
 	private static function update_from_9() {
356 356
     		$Connection = new Connection();
357
-    		$query="ALTER TABLE spotter_live ADD verticalrate INT(11) NULL;
357
+    		$query = "ALTER TABLE spotter_live ADD verticalrate INT(11) NULL;
358 358
     			ALTER TABLE spotter_output ADD verticalrate INT(11) NULL;";
359 359
         	try {
360 360
             	    $sth = $Connection->db->prepare($query);
361 361
 		    $sth->execute();
362
-    		} catch(PDOException $e) {
362
+    		} catch (PDOException $e) {
363 363
 		    return "error (add verticalrate column to spotter_live and spotter_output) : ".$e->getMessage()."\n";
364 364
     		}
365 365
 		$error = '';
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
         	try {
372 372
             	    $sth = $Connection->db->prepare($query);
373 373
 		    $sth->execute();
374
-    		} catch(PDOException $e) {
374
+    		} catch (PDOException $e) {
375 375
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
376 376
     		}
377 377
 		return $error;
@@ -379,11 +379,11 @@  discard block
 block discarded – undo
379 379
 
380 380
 	private static function update_from_10() {
381 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";
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 383
         	try {
384 384
             	    $sth = $Connection->db->prepare($query);
385 385
 		    $sth->execute();
386
-    		} catch(PDOException $e) {
386
+    		} catch (PDOException $e) {
387 387
 		    return "error (add new enum to ATC table) : ".$e->getMessage()."\n";
388 388
     		}
389 389
 		$error = '';
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
         	try {
402 402
             	    $sth = $Connection->db->prepare($query);
403 403
 		    $sth->execute();
404
-    		} catch(PDOException $e) {
404
+    		} catch (PDOException $e) {
405 405
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
406 406
     		}
407 407
 		return $error;
@@ -410,18 +410,18 @@  discard block
 block discarded – undo
410 410
 	private static function update_from_11() {
411 411
 		global $globalDBdriver, $globalDBname;
412 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)";
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 414
         	try {
415 415
             	    $sth = $Connection->db->prepare($query);
416 416
 		    $sth->execute();
417
-    		} catch(PDOException $e) {
417
+    		} catch (PDOException $e) {
418 418
 		    return "error (add owner_name & format_source column to spotter_output) : ".$e->getMessage()."\n";
419 419
     		}
420
-    		$query="ALTER TABLE spotter_live ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
420
+    		$query = "ALTER TABLE spotter_live ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
421 421
         	try {
422 422
             	    $sth = $Connection->db->prepare($query);
423 423
 		    $sth->execute();
424
-    		} catch(PDOException $e) {
424
+    		} catch (PDOException $e) {
425 425
 		    return "error (format_source column to spotter_live) : ".$e->getMessage()."\n";
426 426
     		}
427 427
     		if ($globalDBdriver == 'mysql') {
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
 		    try {
430 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 434
     		    }
435 435
     		    $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -441,15 +441,15 @@  discard block
 block discarded – undo
441 441
 				DROP TABLE spotter_archive;
442 442
 				RENAME TABLE copy TO spotter_archive;";
443 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";
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 445
             	    }
446 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";
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 448
                 }
449 449
         	try {
450 450
             	    $sth = $Connection->db->prepare($query);
451 451
 		    $sth->execute();
452
-    		} catch(PDOException $e) {
452
+    		} catch (PDOException $e) {
453 453
 		    return "error (add columns to spotter_archive) : ".$e->getMessage()."\n";
454 454
     		}
455 455
 
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
         	try {
460 460
             	    $sth = $Connection->db->prepare($query);
461 461
 		    $sth->execute();
462
-    		} catch(PDOException $e) {
462
+    		} catch (PDOException $e) {
463 463
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
464 464
     		}
465 465
 		return $error;
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
         	try {
488 488
             	    $sth = $Connection->db->prepare($query);
489 489
 		    $sth->execute();
490
-    		} catch(PDOException $e) {
490
+    		} catch (PDOException $e) {
491 491
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
492 492
     		}
493 493
 		return $error;
@@ -495,12 +495,12 @@  discard block
 block discarded – undo
495 495
 
496 496
 	private static function update_from_13() {
497 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)";
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
 		}
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
         	try {
510 510
             	    $sth = $Connection->db->prepare($query);
511 511
 		    $sth->execute();
512
-    		} catch(PDOException $e) {
512
+    		} catch (PDOException $e) {
513 513
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
514 514
     		}
515 515
 		return $error;
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
         	try {
528 528
             	    $sth = $Connection->db->prepare($query);
529 529
 		    $sth->execute();
530
-    		} catch(PDOException $e) {
530
+    		} catch (PDOException $e) {
531 531
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
532 532
     		}
533 533
 		return $error;
@@ -538,11 +538,11 @@  discard block
 block discarded – undo
538 538
     		$Connection = new Connection();
539 539
 		$error = '';
540 540
     		// Add tables
541
-    		$query="ALTER TABLE `stats` CHANGE `stats_date` `stats_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP";
541
+    		$query = "ALTER TABLE `stats` CHANGE `stats_date` `stats_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP";
542 542
         	try {
543 543
             	    $sth = $Connection->db->prepare($query);
544 544
 		    $sth->execute();
545
-    		} catch(PDOException $e) {
545
+    		} catch (PDOException $e) {
546 546
 		    return "error (update stats) : ".$e->getMessage()."\n";
547 547
     		}
548 548
 		if ($error != '') return $error;
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
         	try {
551 551
             	    $sth = $Connection->db->prepare($query);
552 552
 		    $sth->execute();
553
-    		} catch(PDOException $e) {
553
+    		} catch (PDOException $e) {
554 554
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
555 555
     		}
556 556
 		return $error;
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
         	try {
572 572
             	    $sth = $Connection->db->prepare($query);
573 573
 		    $sth->execute();
574
-    		} catch(PDOException $e) {
574
+    		} catch (PDOException $e) {
575 575
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
576 576
     		}
577 577
 		return $error;
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
         	try {
590 590
             	    $sth = $Connection->db->prepare($query);
591 591
 		    $sth->execute();
592
-    		} catch(PDOException $e) {
592
+    		} catch (PDOException $e) {
593 593
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
594 594
     		}
595 595
 		return $error;
@@ -598,12 +598,12 @@  discard block
 block discarded – undo
598 598
     		$Connection = new Connection();
599 599
 		$error = '';
600 600
     		// Modify stats_airport table
601
-    		if (!$Connection->checkColumnName('stats_airport','airport_name')) {
601
+    		if (!$Connection->checkColumnName('stats_airport', 'airport_name')) {
602 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 603
     	        	try {
604 604
 	            	    $sth = $Connection->db->prepare($query);
605 605
 			    $sth->execute();
606
-    			} catch(PDOException $e) {
606
+    			} catch (PDOException $e) {
607 607
 			    return "error (update stats) : ".$e->getMessage()."\n";
608 608
     			}
609 609
     		}
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
         	try {
613 613
             	    $sth = $Connection->db->prepare($query);
614 614
 		    $sth->execute();
615
-    		} catch(PDOException $e) {
615
+    		} catch (PDOException $e) {
616 616
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
617 617
     		}
618 618
 		return $error;
@@ -629,73 +629,73 @@  discard block
 block discarded – undo
629 629
         	try {
630 630
             	    $sth = $Connection->db->prepare($query);
631 631
 		    $sth->execute();
632
-    		} catch(PDOException $e) {
632
+    		} catch (PDOException $e) {
633 633
 		    return "error (remove primary key on spotter_archive) : ".$e->getMessage()."\n";
634 634
     		}
635 635
 		$query = "alter table spotter_archive add spotter_archive_id INT(11)";
636 636
         	try {
637 637
             	    $sth = $Connection->db->prepare($query);
638 638
 		    $sth->execute();
639
-    		} catch(PDOException $e) {
639
+    		} catch (PDOException $e) {
640 640
 		    return "error (add id again on spotter_archive) : ".$e->getMessage()."\n";
641 641
     		}
642
-		if (!$Connection->checkColumnName('spotter_archive','over_country')) {
642
+		if (!$Connection->checkColumnName('spotter_archive', 'over_country')) {
643 643
 			// Add column over_country
644 644
     			$query = "ALTER TABLE `spotter_archive` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL";
645 645
 			try {
646 646
             			$sth = $Connection->db->prepare($query);
647 647
 				$sth->execute();
648
-			} catch(PDOException $e) {
648
+			} catch (PDOException $e) {
649 649
 				return "error (add over_country) : ".$e->getMessage()."\n";
650 650
 			}
651 651
 		}
652
-		if (!$Connection->checkColumnName('spotter_live','over_country')) {
652
+		if (!$Connection->checkColumnName('spotter_live', 'over_country')) {
653 653
 			// Add column over_country
654 654
     			$query = "ALTER TABLE `spotter_live` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL";
655 655
 			try {
656 656
             			$sth = $Connection->db->prepare($query);
657 657
 				$sth->execute();
658
-			} catch(PDOException $e) {
658
+			} catch (PDOException $e) {
659 659
 				return "error (add over_country) : ".$e->getMessage()."\n";
660 660
 			}
661 661
 		}
662
-		if (!$Connection->checkColumnName('spotter_output','source_name')) {
662
+		if (!$Connection->checkColumnName('spotter_output', 'source_name')) {
663 663
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
664 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
-			} catch(PDOException $e) {
668
+			} catch (PDOException $e) {
669 669
 				return "error (add source_name column) : ".$e->getMessage()."\n";
670 670
     			}
671 671
     		}
672
-		if (!$Connection->checkColumnName('spotter_live','source_name')) {
672
+		if (!$Connection->checkColumnName('spotter_live', 'source_name')) {
673 673
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
674 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
-			} catch(PDOException $e) {
678
+			} catch (PDOException $e) {
679 679
 				return "error (add source_name column) : ".$e->getMessage()."\n";
680 680
     			}
681 681
     		}
682
-		if (!$Connection->checkColumnName('spotter_archive_output','source_name')) {
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 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
-			} catch(PDOException $e) {
688
+			} catch (PDOException $e) {
689 689
 				return "error (add source_name column) : ".$e->getMessage()."\n";
690 690
     			}
691 691
     		}
692
-		if (!$Connection->checkColumnName('spotter_archive','source_name')) {
692
+		if (!$Connection->checkColumnName('spotter_archive', 'source_name')) {
693 693
 			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
694 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
-			} catch(PDOException $e) {
698
+			} catch (PDOException $e) {
699 699
 				return "error (add source_name column) : ".$e->getMessage()."\n";
700 700
     			}
701 701
     		}
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
         	try {
705 705
             	    $sth = $Connection->db->prepare($query);
706 706
 		    $sth->execute();
707
-    		} catch(PDOException $e) {
707
+    		} catch (PDOException $e) {
708 708
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
709 709
     		}
710 710
 		return $error;
@@ -719,13 +719,13 @@  discard block
 block discarded – undo
719 719
 			$error .= create_db::import_file('../db/airlines.sql');
720 720
 			if ($error != '') return 'Import airlines.sql : '.$error;
721 721
 		}
722
-		if (!$Connection->checkColumnName('aircraft_modes','type_flight')) {
722
+		if (!$Connection->checkColumnName('aircraft_modes', 'type_flight')) {
723 723
 			// Add column over_country
724 724
     			$query = "ALTER TABLE `aircraft_modes` ADD `type_flight` VARCHAR(50) NULL DEFAULT NULL;";
725 725
         		try {
726 726
 				$sth = $Connection->db->prepare($query);
727 727
 				$sth->execute();
728
-			} catch(PDOException $e) {
728
+			} catch (PDOException $e) {
729 729
 				return "error (add over_country) : ".$e->getMessage()."\n";
730 730
     			}
731 731
     		}
@@ -741,7 +741,7 @@  discard block
 block discarded – undo
741 741
         	try {
742 742
             	    $sth = $Connection->db->prepare($query);
743 743
 		    $sth->execute();
744
-    		} catch(PDOException $e) {
744
+    		} catch (PDOException $e) {
745 745
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
746 746
     		}
747 747
 		return $error;
@@ -750,13 +750,13 @@  discard block
 block discarded – undo
750 750
 	private static function update_from_21() {
751 751
 		$Connection = new Connection();
752 752
 		$error = '';
753
-		if (!$Connection->checkColumnName('stats_airport','stats_type')) {
753
+		if (!$Connection->checkColumnName('stats_airport', 'stats_type')) {
754 754
 			// Rename type to stats_type
755 755
 			$query = "ALTER TABLE `stats_airport` CHANGE `type` `stats_type` VARCHAR(50);ALTER TABLE `stats` CHANGE `type` `stats_type` VARCHAR(50);ALTER TABLE `stats_flight` CHANGE `type` `stats_type` VARCHAR(50);";
756 756
 			try {
757 757
 				$sth = $Connection->db->prepare($query);
758 758
 				$sth->execute();
759
-			} catch(PDOException $e) {
759
+			} catch (PDOException $e) {
760 760
 				return "error (rename type to stats_type on stats*) : ".$e->getMessage()."\n";
761 761
 			}
762 762
 			if ($error != '') return $error;
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
         	try {
766 766
             	    $sth = $Connection->db->prepare($query);
767 767
 		    $sth->execute();
768
-    		} catch(PDOException $e) {
768
+    		} catch (PDOException $e) {
769 769
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
770 770
     		}
771 771
 		return $error;
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
         	try {
789 789
             	    $sth = $Connection->db->prepare($query);
790 790
 		    $sth->execute();
791
-    		} catch(PDOException $e) {
791
+    		} catch (PDOException $e) {
792 792
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
793 793
     		}
794 794
 		return $error;
@@ -815,17 +815,17 @@  discard block
 block discarded – undo
815 815
 			try {
816 816
 				$sth = $Connection->db->prepare($query);
817 817
 				$sth->execute();
818
-			} catch(PDOException $e) {
818
+			} catch (PDOException $e) {
819 819
 				return "error (create index on spotter_archive) : ".$e->getMessage()."\n";
820 820
 			}
821 821
 		}
822
-		if (!$Connection->checkColumnName('stats_aircraft','aircraft_manufacturer')) {
822
+		if (!$Connection->checkColumnName('stats_aircraft', 'aircraft_manufacturer')) {
823 823
 			// Add aircraft_manufacturer to stats_aircraft
824 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
-			} catch(PDOException $e) {
828
+			} catch (PDOException $e) {
829 829
 				return "error (add aircraft_manufacturer column) : ".$e->getMessage()."\n";
830 830
     			}
831 831
     		}
@@ -834,7 +834,7 @@  discard block
 block discarded – undo
834 834
 		try {
835 835
 			$sth = $Connection->db->prepare($query);
836 836
 			$sth->execute();
837
-		} catch(PDOException $e) {
837
+		} catch (PDOException $e) {
838 838
 			return "error (update schema_version) : ".$e->getMessage()."\n";
839 839
 		}
840 840
 		return $error;
@@ -850,23 +850,23 @@  discard block
 block discarded – undo
850 850
 			$error .= create_db::import_file('../db/pgsql/airlines.sql');
851 851
 		}
852 852
 		if ($error != '') return 'Import airlines.sql : '.$error;
853
-		if (!$Connection->checkColumnName('airlines','forsource')) {
853
+		if (!$Connection->checkColumnName('airlines', 'forsource')) {
854 854
 			// Add forsource to airlines
855 855
 			$query = "ALTER TABLE airlines ADD forsource VARCHAR(255) NULL DEFAULT NULL";
856 856
 			try {
857 857
 				$sth = $Connection->db->prepare($query);
858 858
 				$sth->execute();
859
-			} catch(PDOException $e) {
859
+			} catch (PDOException $e) {
860 860
 				return "error (add forsource column) : ".$e->getMessage()."\n";
861 861
 			}
862 862
 		}
863
-		if (!$Connection->checkColumnName('stats_aircraft','stats_airline')) {
863
+		if (!$Connection->checkColumnName('stats_aircraft', 'stats_airline')) {
864 864
 			// Add forsource to airlines
865 865
 			$query = "ALTER TABLE stats_aircraft ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
866 866
 			try {
867 867
 				$sth = $Connection->db->prepare($query);
868 868
 				$sth->execute();
869
-			} catch(PDOException $e) {
869
+			} catch (PDOException $e) {
870 870
 				return "error (add stats_airline & filter_name column in stats_aircraft) : ".$e->getMessage()."\n";
871 871
 			}
872 872
 			// Add unique key
@@ -878,17 +878,17 @@  discard block
 block discarded – undo
878 878
 			try {
879 879
 				$sth = $Connection->db->prepare($query);
880 880
 				$sth->execute();
881
-			} catch(PDOException $e) {
881
+			} catch (PDOException $e) {
882 882
 				return "error (add unique key in stats_aircraft) : ".$e->getMessage()."\n";
883 883
 			}
884 884
 		}
885
-		if (!$Connection->checkColumnName('stats_airport','stats_airline')) {
885
+		if (!$Connection->checkColumnName('stats_airport', 'stats_airline')) {
886 886
 			// Add forsource to airlines
887 887
 			$query = "ALTER TABLE stats_airport ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
888 888
 			try {
889 889
 				$sth = $Connection->db->prepare($query);
890 890
 				$sth->execute();
891
-			} catch(PDOException $e) {
891
+			} catch (PDOException $e) {
892 892
 				return "error (add filter_name column in stats_airport) : ".$e->getMessage()."\n";
893 893
 			}
894 894
 			// Add unique key
@@ -900,17 +900,17 @@  discard block
 block discarded – undo
900 900
 			try {
901 901
 				$sth = $Connection->db->prepare($query);
902 902
 				$sth->execute();
903
-			} catch(PDOException $e) {
903
+			} catch (PDOException $e) {
904 904
 				return "error (add unique key in stats_airport) : ".$e->getMessage()."\n";
905 905
 			}
906 906
 		}
907
-		if (!$Connection->checkColumnName('stats_country','stats_airline')) {
907
+		if (!$Connection->checkColumnName('stats_country', 'stats_airline')) {
908 908
 			// Add forsource to airlines
909 909
 			$query = "ALTER TABLE stats_country ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
910 910
 			try {
911 911
 				$sth = $Connection->db->prepare($query);
912 912
 				$sth->execute();
913
-			} catch(PDOException $e) {
913
+			} catch (PDOException $e) {
914 914
 				return "error (add stats_airline & filter_name column in stats_country) : ".$e->getMessage()."\n";
915 915
 			}
916 916
 			// Add unique key
@@ -922,36 +922,36 @@  discard block
 block discarded – undo
922 922
 			try {
923 923
 				$sth = $Connection->db->prepare($query);
924 924
 				$sth->execute();
925
-			} catch(PDOException $e) {
925
+			} catch (PDOException $e) {
926 926
 				return "error (add unique key in stats_airline) : ".$e->getMessage()."\n";
927 927
 			}
928 928
 		}
929
-		if (!$Connection->checkColumnName('stats_flight','stats_airline')) {
929
+		if (!$Connection->checkColumnName('stats_flight', 'stats_airline')) {
930 930
 			// Add forsource to airlines
931 931
 			$query = "ALTER TABLE stats_flight ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
932 932
 			try {
933 933
 				$sth = $Connection->db->prepare($query);
934 934
 				$sth->execute();
935
-			} catch(PDOException $e) {
935
+			} catch (PDOException $e) {
936 936
 				return "error (add stats_airline & filter_name column in stats_flight) : ".$e->getMessage()."\n";
937 937
 			}
938 938
 		}
939
-		if (!$Connection->checkColumnName('stats','stats_airline')) {
939
+		if (!$Connection->checkColumnName('stats', 'stats_airline')) {
940 940
 			// Add forsource to airlines
941 941
 			$query = "ALTER TABLE stats ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
942 942
 			try {
943 943
 				$sth = $Connection->db->prepare($query);
944 944
 				$sth->execute();
945
-			} catch(PDOException $e) {
945
+			} catch (PDOException $e) {
946 946
 				return "error (add stats_airline & filter_name column in stats) : ".$e->getMessage()."\n";
947 947
 			}
948
-			if ($globalDBdriver == 'mysql' && $Connection->indexExists('stats','type')) {
948
+			if ($globalDBdriver == 'mysql' && $Connection->indexExists('stats', 'type')) {
949 949
 				// Add unique key
950 950
 				$query = "drop index type on stats;ALTER TABLE stats ADD UNIQUE stats_type (stats_type,stats_date,stats_airline,filter_name);";
951 951
 				try {
952 952
 					$sth = $Connection->db->prepare($query);
953 953
 					$sth->execute();
954
-				} catch(PDOException $e) {
954
+				} catch (PDOException $e) {
955 955
 					return "error (add unique key in stats) : ".$e->getMessage()."\n";
956 956
 				}
957 957
 			} else {
@@ -964,18 +964,18 @@  discard block
 block discarded – undo
964 964
 				try {
965 965
 					$sth = $Connection->db->prepare($query);
966 966
 					$sth->execute();
967
-				} catch(PDOException $e) {
967
+				} catch (PDOException $e) {
968 968
 					return "error (add unique key in stats) : ".$e->getMessage()."\n";
969 969
 				}
970 970
 			}
971 971
 		}
972
-		if (!$Connection->checkColumnName('stats_registration','stats_airline')) {
972
+		if (!$Connection->checkColumnName('stats_registration', 'stats_airline')) {
973 973
 			// Add forsource to airlines
974 974
 			$query = "ALTER TABLE stats_registration ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
975 975
 			try {
976 976
 				$sth = $Connection->db->prepare($query);
977 977
 				$sth->execute();
978
-			} catch(PDOException $e) {
978
+			} catch (PDOException $e) {
979 979
 				return "error (add stats_airline & filter_name column in stats_registration) : ".$e->getMessage()."\n";
980 980
 			}
981 981
 			// Add unique key
@@ -987,17 +987,17 @@  discard block
 block discarded – undo
987 987
 			try {
988 988
 				$sth = $Connection->db->prepare($query);
989 989
 				$sth->execute();
990
-			} catch(PDOException $e) {
990
+			} catch (PDOException $e) {
991 991
 				return "error (add unique key in stats_registration) : ".$e->getMessage()."\n";
992 992
 			}
993 993
 		}
994
-		if (!$Connection->checkColumnName('stats_callsign','filter_name')) {
994
+		if (!$Connection->checkColumnName('stats_callsign', 'filter_name')) {
995 995
 			// Add forsource to airlines
996 996
 			$query = "ALTER TABLE stats_callsign ADD filter_name VARCHAR(255) NULL DEFAULT ''";
997 997
 			try {
998 998
 				$sth = $Connection->db->prepare($query);
999 999
 				$sth->execute();
1000
-			} catch(PDOException $e) {
1000
+			} catch (PDOException $e) {
1001 1001
 				return "error (add filter_name column in stats_callsign) : ".$e->getMessage()."\n";
1002 1002
 			}
1003 1003
 			// Add unique key
@@ -1009,17 +1009,17 @@  discard block
 block discarded – undo
1009 1009
 			try {
1010 1010
 				$sth = $Connection->db->prepare($query);
1011 1011
 				$sth->execute();
1012
-			} catch(PDOException $e) {
1012
+			} catch (PDOException $e) {
1013 1013
 				return "error (add unique key in stats_callsign) : ".$e->getMessage()."\n";
1014 1014
 			}
1015 1015
 		}
1016
-		if (!$Connection->checkColumnName('stats_airline','filter_name')) {
1016
+		if (!$Connection->checkColumnName('stats_airline', 'filter_name')) {
1017 1017
 			// Add forsource to airlines
1018 1018
 			$query = "ALTER TABLE stats_airline ADD filter_name VARCHAR(255) NULL DEFAULT ''";
1019 1019
 			try {
1020 1020
 				$sth = $Connection->db->prepare($query);
1021 1021
 				$sth->execute();
1022
-			} catch(PDOException $e) {
1022
+			} catch (PDOException $e) {
1023 1023
 				return "error (add filter_name column in stats_airline) : ".$e->getMessage()."\n";
1024 1024
 			}
1025 1025
 			// Add unique key
@@ -1031,7 +1031,7 @@  discard block
 block discarded – undo
1031 1031
 			try {
1032 1032
 				$sth = $Connection->db->prepare($query);
1033 1033
 				$sth->execute();
1034
-			} catch(PDOException $e) {
1034
+			} catch (PDOException $e) {
1035 1035
 				return "error (add unique key in stats_callsign) : ".$e->getMessage()."\n";
1036 1036
 			}
1037 1037
 		}
@@ -1040,7 +1040,7 @@  discard block
 block discarded – undo
1040 1040
 		try {
1041 1041
 			$sth = $Connection->db->prepare($query);
1042 1042
 			$sth->execute();
1043
-		} catch(PDOException $e) {
1043
+		} catch (PDOException $e) {
1044 1044
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1045 1045
 		}
1046 1046
 		return $error;
@@ -1050,13 +1050,13 @@  discard block
 block discarded – undo
1050 1050
 		global $globalDBdriver;
1051 1051
 		$Connection = new Connection();
1052 1052
 		$error = '';
1053
-		if (!$Connection->checkColumnName('stats_owner','stats_airline')) {
1053
+		if (!$Connection->checkColumnName('stats_owner', 'stats_airline')) {
1054 1054
 			// Add forsource to airlines
1055 1055
 			$query = "ALTER TABLE stats_owner ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
1056 1056
 			try {
1057 1057
 				$sth = $Connection->db->prepare($query);
1058 1058
 				$sth->execute();
1059
-			} catch(PDOException $e) {
1059
+			} catch (PDOException $e) {
1060 1060
 				return "error (add stats_airline & filter_name column in stats_owner) : ".$e->getMessage()."\n";
1061 1061
 			}
1062 1062
 			// Add unique key
@@ -1068,17 +1068,17 @@  discard block
 block discarded – undo
1068 1068
 			try {
1069 1069
 				$sth = $Connection->db->prepare($query);
1070 1070
 				$sth->execute();
1071
-			} catch(PDOException $e) {
1071
+			} catch (PDOException $e) {
1072 1072
 				return "error (add unique key in stats_owner) : ".$e->getMessage()."\n";
1073 1073
 			}
1074 1074
 		}
1075
-		if (!$Connection->checkColumnName('stats_pilot','stats_airline')) {
1075
+		if (!$Connection->checkColumnName('stats_pilot', 'stats_airline')) {
1076 1076
 			// Add forsource to airlines
1077 1077
 			$query = "ALTER TABLE stats_pilot ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''";
1078 1078
 			try {
1079 1079
 				$sth = $Connection->db->prepare($query);
1080 1080
 				$sth->execute();
1081
-			} catch(PDOException $e) {
1081
+			} catch (PDOException $e) {
1082 1082
 				return "error (add stats_airline & filter_name column in stats_pilot) : ".$e->getMessage()."\n";
1083 1083
 			}
1084 1084
 			// Add unique key
@@ -1090,7 +1090,7 @@  discard block
 block discarded – undo
1090 1090
 			try {
1091 1091
 				$sth = $Connection->db->prepare($query);
1092 1092
 				$sth->execute();
1093
-			} catch(PDOException $e) {
1093
+			} catch (PDOException $e) {
1094 1094
 				return "error (add unique key in stats_pilot) : ".$e->getMessage()."\n";
1095 1095
 			}
1096 1096
 		}
@@ -1098,7 +1098,7 @@  discard block
 block discarded – undo
1098 1098
 		try {
1099 1099
 			$sth = $Connection->db->prepare($query);
1100 1100
 			$sth->execute();
1101
-		} catch(PDOException $e) {
1101
+		} catch (PDOException $e) {
1102 1102
 			return "error (update schema_version) : ".$e->getMessage()."\n";
1103 1103
 		}
1104 1104
 		return $error;
@@ -1121,7 +1121,7 @@  discard block
 block discarded – undo
1121 1121
 		    try {
1122 1122
             		$sth = $Connection->db->prepare($query);
1123 1123
 		        $sth->execute();
1124
-		    } catch(PDOException $e) {
1124
+		    } catch (PDOException $e) {
1125 1125
 			return "error : ".$e->getMessage()."\n";
1126 1126
     		    }
1127 1127
     		    $result = $sth->fetch(PDO::FETCH_ASSOC);
Please login to merge, or discard this patch.
require/class.Spotter.php 4 patches
Doc Comments   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 	/**
16 16
 	* Get SQL query part for filter used
17 17
 	* @param Array $filter the filter
18
-	* @return Array the SQL part
18
+	* @return string the SQL part
19 19
 	*/
20 20
 	public function getFilter($filter = array(),$where = false,$and = false) {
21 21
 		global $globalFilter;
@@ -8612,6 +8612,7 @@  discard block
 block discarded – undo
8612 8612
 	/**
8613 8613
 	* Counts all hours
8614 8614
 	*
8615
+	* @param string $orderby
8615 8616
 	* @return Array the hour list
8616 8617
 	*
8617 8618
 	*/
@@ -8677,6 +8678,7 @@  discard block
 block discarded – undo
8677 8678
 	/**
8678 8679
 	* Counts all hours
8679 8680
 	*
8681
+	* @param string $orderby
8680 8682
 	* @return Array the hour list
8681 8683
 	*
8682 8684
 	*/
@@ -9501,7 +9503,7 @@  discard block
 block discarded – undo
9501 9503
 	/**
9502 9504
 	* Parses the direction degrees to working
9503 9505
 	*
9504
-	* @param Float $direction the direction in degrees
9506
+	* @param integer $direction the direction in degrees
9505 9507
 	* @return Array the direction information
9506 9508
 	*
9507 9509
 	*/
Please login to merge, or discard this patch.
Indentation   +1266 added lines, -1266 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 = '',$filter = 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;
@@ -1304,11 +1304,11 @@  discard block
 block discarded – undo
1304 1304
 	
1305 1305
 	
1306 1306
 	/**
1307
-	* Gets all the spotter information based on the airline
1308
-	*
1309
-	* @return Array the spotter information
1310
-	*
1311
-	*/
1307
+	 * Gets all the spotter information based on the airline
1308
+	 *
1309
+	 * @return Array the spotter information
1310
+	 *
1311
+	 */
1312 1312
 	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '')
1313 1313
 	{
1314 1314
 		global $global_query;
@@ -1360,11 +1360,11 @@  discard block
 block discarded – undo
1360 1360
 	
1361 1361
 	
1362 1362
 	/**
1363
-	* Gets all the spotter information based on the airport
1364
-	*
1365
-	* @return Array the spotter information
1366
-	*
1367
-	*/
1363
+	 * Gets all the spotter information based on the airport
1364
+	 *
1365
+	 * @return Array the spotter information
1366
+	 *
1367
+	 */
1368 1368
 	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '')
1369 1369
 	{
1370 1370
 		global $global_query;
@@ -1417,11 +1417,11 @@  discard block
 block discarded – undo
1417 1417
 
1418 1418
 
1419 1419
 	/**
1420
-	* Gets all the spotter information based on the date
1421
-	*
1422
-	* @return Array the spotter information
1423
-	*
1424
-	*/
1420
+	 * Gets all the spotter information based on the date
1421
+	 *
1422
+	 * @return Array the spotter information
1423
+	 *
1424
+	 */
1425 1425
 	public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array())
1426 1426
 	{
1427 1427
 		global $global_query, $globalTimezone, $globalDBdriver;
@@ -1498,11 +1498,11 @@  discard block
 block discarded – undo
1498 1498
 
1499 1499
 
1500 1500
 	/**
1501
-	* Gets all the spotter information based on the country name
1502
-	*
1503
-	* @return Array the spotter information
1504
-	*
1505
-	*/
1501
+	 * Gets all the spotter information based on the country name
1502
+	 *
1503
+	 * @return Array the spotter information
1504
+	 *
1505
+	 */
1506 1506
 	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '')
1507 1507
 	{
1508 1508
 		global $global_query;
@@ -1555,11 +1555,11 @@  discard block
 block discarded – undo
1555 1555
 	
1556 1556
 	
1557 1557
 	/**
1558
-	* Gets all the spotter information based on the manufacturer name
1559
-	*
1560
-	* @return Array the spotter information
1561
-	*
1562
-	*/
1558
+	 * Gets all the spotter information based on the manufacturer name
1559
+	 *
1560
+	 * @return Array the spotter information
1561
+	 *
1562
+	 */
1563 1563
 	public function getSpotterDataByManufacturer($aircraft_manufacturer = '', $limit = '', $sort = '')
1564 1564
 	{
1565 1565
 		global $global_query;
@@ -1614,13 +1614,13 @@  discard block
 block discarded – undo
1614 1614
   
1615 1615
   
1616 1616
 	/**
1617
-	* Gets a list of all aircraft that take a route
1618
-	*
1619
-	* @param String $departure_airport_icao ICAO code of departure airport
1620
-	* @param String $arrival_airport_icao ICAO code of arrival airport
1621
-	* @return Array the spotter information
1622
-	*
1623
-	*/
1617
+	 * Gets a list of all aircraft that take a route
1618
+	 *
1619
+	 * @param String $departure_airport_icao ICAO code of departure airport
1620
+	 * @param String $arrival_airport_icao ICAO code of arrival airport
1621
+	 * @return Array the spotter information
1622
+	 *
1623
+	 */
1624 1624
 	public function getSpotterDataByRoute($departure_airport_icao = '', $arrival_airport_icao = '', $limit = '', $sort = '')
1625 1625
 	{
1626 1626
 		global $global_query;
@@ -1686,11 +1686,11 @@  discard block
 block discarded – undo
1686 1686
 	
1687 1687
 	
1688 1688
 	/**
1689
-	* Gets all the spotter information based on the special column in the table
1690
-	*
1691
-	* @return Array the spotter information
1692
-	*
1693
-	*/
1689
+	 * Gets all the spotter information based on the special column in the table
1690
+	 *
1691
+	 * @return Array the spotter information
1692
+	 *
1693
+	 */
1694 1694
 	public function getSpotterDataByHighlight($limit = '', $sort = '', $filter = array())
1695 1695
 	{
1696 1696
 		global $global_query;
@@ -1729,11 +1729,11 @@  discard block
 block discarded – undo
1729 1729
 	}
1730 1730
 
1731 1731
 	/**
1732
-	* Gets all the highlight based on a aircraft registration
1733
-	*
1734
-	* @return String the highlight text
1735
-	*
1736
-	*/
1732
+	 * Gets all the highlight based on a aircraft registration
1733
+	 *
1734
+	 * @return String the highlight text
1735
+	 *
1736
+	 */
1737 1737
 	public function getHighlightByRegistration($registration,$filter = array())
1738 1738
 	{
1739 1739
 		global $global_query;
@@ -1755,13 +1755,13 @@  discard block
 block discarded – undo
1755 1755
 
1756 1756
 	
1757 1757
 	/**
1758
-	* Gets the squawk usage from squawk code
1759
-	*
1760
-	* @param String $squawk squawk code
1761
-	* @param String $country country
1762
-	* @return String usage
1763
-	*
1764
-	*/
1758
+	 * Gets the squawk usage from squawk code
1759
+	 *
1760
+	 * @param String $squawk squawk code
1761
+	 * @param String $country country
1762
+	 * @return String usage
1763
+	 *
1764
+	 */
1765 1765
 	public function getSquawkUsage($squawk = '',$country = 'FR')
1766 1766
 	{
1767 1767
 		
@@ -1782,12 +1782,12 @@  discard block
 block discarded – undo
1782 1782
 	}
1783 1783
 
1784 1784
 	/**
1785
-	* Gets the airport icao from the iata
1786
-	*
1787
-	* @param String $airport_iata the iata code of the airport
1788
-	* @return String airport iata
1789
-	*
1790
-	*/
1785
+	 * Gets the airport icao from the iata
1786
+	 *
1787
+	 * @param String $airport_iata the iata code of the airport
1788
+	 * @return String airport iata
1789
+	 *
1790
+	 */
1791 1791
 	public function getAirportIcao($airport_iata = '')
1792 1792
 	{
1793 1793
 		
@@ -1807,14 +1807,14 @@  discard block
 block discarded – undo
1807 1807
 	}
1808 1808
 
1809 1809
 	/**
1810
-	* Gets the airport distance
1811
-	*
1812
-	* @param String $airport_icao the icao code of the airport
1813
-	* @param Float $latitude the latitude
1814
-	* @param Float $longitude the longitude
1815
-	* @return Float distance to the airport
1816
-	*
1817
-	*/
1810
+	 * Gets the airport distance
1811
+	 *
1812
+	 * @param String $airport_icao the icao code of the airport
1813
+	 * @param Float $latitude the latitude
1814
+	 * @param Float $longitude the longitude
1815
+	 * @return Float distance to the airport
1816
+	 *
1817
+	 */
1818 1818
 	public function getAirportDistance($airport_icao,$latitude,$longitude)
1819 1819
 	{
1820 1820
 		
@@ -1835,12 +1835,12 @@  discard block
 block discarded – undo
1835 1835
 	}
1836 1836
 	
1837 1837
 	/**
1838
-	* Gets the airport info based on the icao
1839
-	*
1840
-	* @param String $airport the icao code of the airport
1841
-	* @return Array airport information
1842
-	*
1843
-	*/
1838
+	 * Gets the airport info based on the icao
1839
+	 *
1840
+	 * @param String $airport the icao code of the airport
1841
+	 * @return Array airport information
1842
+	 *
1843
+	 */
1844 1844
 	public function getAllAirportInfo($airport = '')
1845 1845
 	{
1846 1846
 		
@@ -1886,12 +1886,12 @@  discard block
 block discarded – undo
1886 1886
 	}
1887 1887
 	
1888 1888
 	/**
1889
-	* Gets the airport info based on the country
1890
-	*
1891
-	* @param Array $countries Airports countries
1892
-	* @return Array airport information
1893
-	*
1894
-	*/
1889
+	 * Gets the airport info based on the country
1890
+	 *
1891
+	 * @param Array $countries Airports countries
1892
+	 * @return Array airport information
1893
+	 *
1894
+	 */
1895 1895
 	public function getAllAirportInfobyCountry($countries)
1896 1896
 	{
1897 1897
 		$lst_countries = '';
@@ -1929,12 +1929,12 @@  discard block
 block discarded – undo
1929 1929
 	}
1930 1930
 	
1931 1931
 	/**
1932
-	* Gets airports info based on the coord
1933
-	*
1934
-	* @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
1935
-	* @return Array airport information
1936
-	*
1937
-	*/
1932
+	 * Gets airports info based on the coord
1933
+	 *
1934
+	 * @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
1935
+	 * @return Array airport information
1936
+	 *
1937
+	 */
1938 1938
 	public function getAllAirportInfobyCoord($coord)
1939 1939
 	{
1940 1940
 		global $globalDBdriver;
@@ -1965,12 +1965,12 @@  discard block
 block discarded – undo
1965 1965
 	}
1966 1966
 
1967 1967
 	/**
1968
-	* Gets waypoints info based on the coord
1969
-	*
1970
-	* @param Array $coord waypoints coord
1971
-	* @return Array airport information
1972
-	*
1973
-	*/
1968
+	 * Gets waypoints info based on the coord
1969
+	 *
1970
+	 * @param Array $coord waypoints coord
1971
+	 * @return Array airport information
1972
+	 *
1973
+	 */
1974 1974
 	public function getAllWaypointsInfobyCoord($coord)
1975 1975
 	{
1976 1976
 		if (is_array($coord)) {
@@ -2004,12 +2004,12 @@  discard block
 block discarded – undo
2004 2004
 	
2005 2005
 	
2006 2006
 	/**
2007
-	* Gets the airline info based on the icao code or iata code
2008
-	*
2009
-	* @param String $airline_icao the iata code of the airport
2010
-	* @return Array airport information
2011
-	*
2012
-	*/
2007
+	 * Gets the airline info based on the icao code or iata code
2008
+	 *
2009
+	 * @param String $airline_icao the iata code of the airport
2010
+	 * @return Array airport information
2011
+	 *
2012
+	 */
2013 2013
 	public function getAllAirlineInfo($airline_icao, $fromsource = NULL)
2014 2014
 	{
2015 2015
 		global $globalUseRealAirlines;
@@ -2040,7 +2040,7 @@  discard block
 block discarded – undo
2040 2040
 			} else {
2041 2041
 				$sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource));
2042 2042
 			}
2043
-                        /*
2043
+						/*
2044 2044
 			$airline_array = array();
2045 2045
 			$temp_array = array();
2046 2046
 		
@@ -2072,12 +2072,12 @@  discard block
 block discarded – undo
2072 2072
 	
2073 2073
 	
2074 2074
 	/**
2075
-	* Gets the aircraft info based on the aircraft type
2076
-	*
2077
-	* @param String $aircraft_type the aircraft type
2078
-	* @return Array aircraft information
2079
-	*
2080
-	*/
2075
+	 * Gets the aircraft info based on the aircraft type
2076
+	 *
2077
+	 * @param String $aircraft_type the aircraft type
2078
+	 * @return Array aircraft information
2079
+	 *
2080
+	 */
2081 2081
 	public function getAllAircraftInfo($aircraft_type)
2082 2082
 	{
2083 2083
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2109,12 +2109,12 @@  discard block
 block discarded – undo
2109 2109
 	}
2110 2110
 
2111 2111
 	/**
2112
-	* Gets the aircraft icao based on the aircraft name/type
2113
-	*
2114
-	* @param String $aircraft_type the aircraft type
2115
-	* @return String aircraft information
2116
-	*
2117
-	*/
2112
+	 * Gets the aircraft icao based on the aircraft name/type
2113
+	 *
2114
+	 * @param String $aircraft_type the aircraft type
2115
+	 * @return String aircraft information
2116
+	 *
2117
+	 */
2118 2118
 	public function getAircraftIcao($aircraft_type)
2119 2119
 	{
2120 2120
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2139,12 +2139,12 @@  discard block
 block discarded – undo
2139 2139
 	}
2140 2140
 	
2141 2141
 	/**
2142
-	* Gets the aircraft info based on the aircraft ident
2143
-	*
2144
-	* @param String $aircraft_modes the aircraft ident (hex)
2145
-	* @return String aircraft type
2146
-	*
2147
-	*/
2142
+	 * Gets the aircraft info based on the aircraft ident
2143
+	 *
2144
+	 * @param String $aircraft_modes the aircraft ident (hex)
2145
+	 * @return String aircraft type
2146
+	 *
2147
+	 */
2148 2148
 	public function getAllAircraftType($aircraft_modes)
2149 2149
 	{
2150 2150
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -2162,12 +2162,12 @@  discard block
 block discarded – undo
2162 2162
 	}
2163 2163
 
2164 2164
 	/**
2165
-	* Gets correct aircraft operator corde
2166
-	*
2167
-	* @param String $operator the aircraft operator code (callsign)
2168
-	* @return String aircraft operator code
2169
-	*
2170
-	*/
2165
+	 * Gets correct aircraft operator corde
2166
+	 *
2167
+	 * @param String $operator the aircraft operator code (callsign)
2168
+	 * @return String aircraft operator code
2169
+	 *
2170
+	 */
2171 2171
 	public function getOperator($operator)
2172 2172
 	{
2173 2173
 		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
@@ -2184,16 +2184,16 @@  discard block
 block discarded – undo
2184 2184
 	}
2185 2185
 
2186 2186
 	/**
2187
-	* Gets the aircraft route based on the aircraft callsign
2188
-	*
2189
-	* @param String $callsign the aircraft callsign
2190
-	* @return Array aircraft type
2191
-	*
2192
-	*/
2187
+	 * Gets the aircraft route based on the aircraft callsign
2188
+	 *
2189
+	 * @param String $callsign the aircraft callsign
2190
+	 * @return Array aircraft type
2191
+	 *
2192
+	 */
2193 2193
 	public function getRouteInfo($callsign)
2194 2194
 	{
2195 2195
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2196
-                if ($callsign == '') return array();
2196
+				if ($callsign == '') return array();
2197 2197
 		$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";
2198 2198
 		
2199 2199
 		$sth = $this->db->prepare($query);
@@ -2207,12 +2207,12 @@  discard block
 block discarded – undo
2207 2207
 	}
2208 2208
 	
2209 2209
 	/**
2210
-	* Gets the aircraft info based on the aircraft registration
2211
-	*
2212
-	* @param String $registration the aircraft registration
2213
-	* @return Array aircraft information
2214
-	*
2215
-	*/
2210
+	 * Gets the aircraft info based on the aircraft registration
2211
+	 *
2212
+	 * @param String $registration the aircraft registration
2213
+	 * @return Array aircraft information
2214
+	 *
2215
+	 */
2216 2216
 	public function getAircraftInfoByRegistration($registration)
2217 2217
 	{
2218 2218
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2239,12 +2239,12 @@  discard block
 block discarded – undo
2239 2239
 	}
2240 2240
 	
2241 2241
 	/**
2242
-	* Gets the aircraft owner & base based on the aircraft registration
2243
-	*
2244
-	* @param String $registration the aircraft registration
2245
-	* @return Array aircraft information
2246
-	*
2247
-	*/
2242
+	 * Gets the aircraft owner & base based on the aircraft registration
2243
+	 *
2244
+	 * @param String $registration the aircraft registration
2245
+	 * @return Array aircraft information
2246
+	 *
2247
+	 */
2248 2248
 	public function getAircraftOwnerByRegistration($registration)
2249 2249
 	{
2250 2250
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2261,11 +2261,11 @@  discard block
 block discarded – undo
2261 2261
 	
2262 2262
   
2263 2263
   /**
2264
-	* Gets all flights (but with only little info)
2265
-	*
2266
-	* @return Array basic flight information
2267
-	*
2268
-	*/
2264
+   * Gets all flights (but with only little info)
2265
+   *
2266
+   * @return Array basic flight information
2267
+   *
2268
+   */
2269 2269
 	public function getAllFlightsforSitemap()
2270 2270
 	{
2271 2271
 		//$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 ";
@@ -2273,7 +2273,7 @@  discard block
 block discarded – undo
2273 2273
 		
2274 2274
 		$sth = $this->db->prepare($query);
2275 2275
 		$sth->execute();
2276
-                  /*
2276
+				  /*
2277 2277
 		$flight_array = array();
2278 2278
 		$temp_array = array();
2279 2279
 		
@@ -2295,11 +2295,11 @@  discard block
 block discarded – undo
2295 2295
 	}
2296 2296
   
2297 2297
 	/**
2298
-	* Gets a list of all aircraft manufacturers
2299
-	*
2300
-	* @return Array list of aircraft types
2301
-	*
2302
-	*/
2298
+	 * Gets a list of all aircraft manufacturers
2299
+	 *
2300
+	 * @return Array list of aircraft types
2301
+	 *
2302
+	 */
2303 2303
 	public function getAllManufacturers()
2304 2304
 	{
2305 2305
 		/*
@@ -2328,11 +2328,11 @@  discard block
 block discarded – undo
2328 2328
   
2329 2329
   
2330 2330
   /**
2331
-	* Gets a list of all aircraft types
2332
-	*
2333
-	* @return Array list of aircraft types
2334
-	*
2335
-	*/
2331
+   * Gets a list of all aircraft types
2332
+   *
2333
+   * @return Array list of aircraft types
2334
+   *
2335
+   */
2336 2336
 	public function getAllAircraftTypes($filters = array())
2337 2337
 	{
2338 2338
 		/*
@@ -2365,11 +2365,11 @@  discard block
 block discarded – undo
2365 2365
 	
2366 2366
 	
2367 2367
 	/**
2368
-	* Gets a list of all aircraft registrations
2369
-	*
2370
-	* @return Array list of aircraft registrations
2371
-	*
2372
-	*/
2368
+	 * Gets a list of all aircraft registrations
2369
+	 *
2370
+	 * @return Array list of aircraft registrations
2371
+	 *
2372
+	 */
2373 2373
 	public function getAllAircraftRegistrations($filters = array())
2374 2374
 	{
2375 2375
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2394,12 +2394,12 @@  discard block
 block discarded – undo
2394 2394
 	}
2395 2395
 
2396 2396
 	/**
2397
-	* Gets all source name
2398
-	*
2399
-	* @param String type format of source
2400
-	* @return Array list of source name
2401
-	*
2402
-	*/
2397
+	 * Gets all source name
2398
+	 *
2399
+	 * @param String type format of source
2400
+	 * @return Array list of source name
2401
+	 *
2402
+	 */
2403 2403
 	public function getAllSourceName($type = '',$filters = array())
2404 2404
 	{
2405 2405
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2430,11 +2430,11 @@  discard block
 block discarded – undo
2430 2430
 
2431 2431
 
2432 2432
 	/**
2433
-	* Gets a list of all airline names
2434
-	*
2435
-	* @return Array list of airline names
2436
-	*
2437
-	*/
2433
+	 * Gets a list of all airline names
2434
+	 *
2435
+	 * @return Array list of airline names
2436
+	 *
2437
+	 */
2438 2438
 	public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array())
2439 2439
 	{
2440 2440
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
@@ -2484,11 +2484,11 @@  discard block
 block discarded – undo
2484 2484
 	
2485 2485
 	
2486 2486
 	/**
2487
-	* Gets a list of all airline countries
2488
-	*
2489
-	* @return Array list of airline countries
2490
-	*
2491
-	*/
2487
+	 * Gets a list of all airline countries
2488
+	 *
2489
+	 * @return Array list of airline countries
2490
+	 *
2491
+	 */
2492 2492
 	public function getAllAirlineCountries($filters = array())
2493 2493
 	{
2494 2494
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2516,11 +2516,11 @@  discard block
 block discarded – undo
2516 2516
 	
2517 2517
 	
2518 2518
 	/**
2519
-	* Gets a list of all departure & arrival names
2520
-	*
2521
-	* @return Array list of airport names
2522
-	*
2523
-	*/
2519
+	 * Gets a list of all departure & arrival names
2520
+	 *
2521
+	 * @return Array list of airport names
2522
+	 *
2523
+	 */
2524 2524
 	public function getAllAirportNames($filters = array())
2525 2525
 	{
2526 2526
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2569,11 +2569,11 @@  discard block
 block discarded – undo
2569 2569
 	
2570 2570
 	
2571 2571
 	/**
2572
-	* Gets a list of all departure & arrival airport countries
2573
-	*
2574
-	* @return Array list of airport countries
2575
-	*
2576
-	*/
2572
+	 * Gets a list of all departure & arrival airport countries
2573
+	 *
2574
+	 * @return Array list of airport countries
2575
+	 *
2576
+	 */
2577 2577
 	public function getAllAirportCountries($filters = array())
2578 2578
 	{
2579 2579
 		$airport_array = array();
@@ -2621,11 +2621,11 @@  discard block
 block discarded – undo
2621 2621
 	
2622 2622
 	
2623 2623
 	/**
2624
-	* Gets a list of all countries (airline, departure airport & arrival airport)
2625
-	*
2626
-	* @return Array list of countries
2627
-	*
2628
-	*/
2624
+	 * Gets a list of all countries (airline, departure airport & arrival airport)
2625
+	 *
2626
+	 * @return Array list of countries
2627
+	 *
2628
+	 */
2629 2629
 	public function getAllCountries($filters = array())
2630 2630
 	{
2631 2631
 		$Connection= new Connection($this->db);
@@ -2702,11 +2702,11 @@  discard block
 block discarded – undo
2702 2702
 	
2703 2703
 	
2704 2704
 	/**
2705
-	* Gets a list of all idents/callsigns
2706
-	*
2707
-	* @return Array list of ident/callsign names
2708
-	*
2709
-	*/
2705
+	 * Gets a list of all idents/callsigns
2706
+	 *
2707
+	 * @return Array list of ident/callsign names
2708
+	 *
2709
+	 */
2710 2710
 	public function getAllIdents($filters = array())
2711 2711
 	{
2712 2712
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2730,9 +2730,9 @@  discard block
 block discarded – undo
2730 2730
 	}
2731 2731
 
2732 2732
 	/**
2733
-	* Get a list of flights from airport since 7 days
2734
-	* @return Array number, icao, name and city of airports
2735
-	*/
2733
+	 * Get a list of flights from airport since 7 days
2734
+	 * @return Array number, icao, name and city of airports
2735
+	 */
2736 2736
 
2737 2737
 	public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) {
2738 2738
 		global $globalTimezone, $globalDBdriver;
@@ -2763,9 +2763,9 @@  discard block
 block discarded – undo
2763 2763
 	}
2764 2764
 
2765 2765
 	/**
2766
-	* Get a list of flights from airport since 7 days
2767
-	* @return Array number, icao, name and city of airports
2768
-	*/
2766
+	 * Get a list of flights from airport since 7 days
2767
+	 * @return Array number, icao, name and city of airports
2768
+	 */
2769 2769
 
2770 2770
 	public function getLast7DaysAirportsDepartureByAirlines($airport_icao = '') {
2771 2771
 		global $globalTimezone, $globalDBdriver;
@@ -2795,9 +2795,9 @@  discard block
 block discarded – undo
2795 2795
 	}
2796 2796
 
2797 2797
 	/**
2798
-	* Get a list of flights from detected airport since 7 days
2799
-	* @return Array number, icao, name and city of airports
2800
-	*/
2798
+	 * Get a list of flights from detected airport since 7 days
2799
+	 * @return Array number, icao, name and city of airports
2800
+	 */
2801 2801
 
2802 2802
 	public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) {
2803 2803
 		global $globalTimezone, $globalDBdriver;
@@ -2835,9 +2835,9 @@  discard block
 block discarded – undo
2835 2835
 	}
2836 2836
 
2837 2837
 	/**
2838
-	* Get a list of flights from detected airport since 7 days
2839
-	* @return Array number, icao, name and city of airports
2840
-	*/
2838
+	 * Get a list of flights from detected airport since 7 days
2839
+	 * @return Array number, icao, name and city of airports
2840
+	 */
2841 2841
 
2842 2842
 	public function getLast7DaysDetectedAirportsDepartureByAirlines($airport_icao = '') {
2843 2843
 		global $globalTimezone, $globalDBdriver;
@@ -2879,9 +2879,9 @@  discard block
 block discarded – undo
2879 2879
 
2880 2880
 
2881 2881
 	/**
2882
-	* Get a list of flights to airport since 7 days
2883
-	* @return Array number, icao, name and city of airports
2884
-	*/
2882
+	 * Get a list of flights to airport since 7 days
2883
+	 * @return Array number, icao, name and city of airports
2884
+	 */
2885 2885
 
2886 2886
 	public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) {
2887 2887
 		global $globalTimezone, $globalDBdriver;
@@ -2914,9 +2914,9 @@  discard block
 block discarded – undo
2914 2914
 
2915 2915
 
2916 2916
 	/**
2917
-	* Get a list of flights detected to airport since 7 days
2918
-	* @return Array number, icao, name and city of airports
2919
-	*/
2917
+	 * Get a list of flights detected to airport since 7 days
2918
+	 * @return Array number, icao, name and city of airports
2919
+	 */
2920 2920
 
2921 2921
 	public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) {
2922 2922
 		global $globalTimezone, $globalDBdriver;
@@ -2957,9 +2957,9 @@  discard block
 block discarded – undo
2957 2957
 
2958 2958
 
2959 2959
 	/**
2960
-	* Get a list of flights to airport since 7 days
2961
-	* @return Array number, icao, name and city of airports
2962
-	*/
2960
+	 * Get a list of flights to airport since 7 days
2961
+	 * @return Array number, icao, name and city of airports
2962
+	 */
2963 2963
 
2964 2964
 	public function getLast7DaysAirportsArrivalByAirlines($airport_icao = '') {
2965 2965
 		global $globalTimezone, $globalDBdriver;
@@ -2991,9 +2991,9 @@  discard block
 block discarded – undo
2991 2991
 
2992 2992
 
2993 2993
 	/**
2994
-	* Get a list of flights detected to airport since 7 days
2995
-	* @return Array number, icao, name and city of airports
2996
-	*/
2994
+	 * Get a list of flights detected to airport since 7 days
2995
+	 * @return Array number, icao, name and city of airports
2996
+	 */
2997 2997
 
2998 2998
 	public function getLast7DaysDetectedAirportsArrivalByAirlines($airport_icao = '') {
2999 2999
 		global $globalTimezone, $globalDBdriver;
@@ -3037,11 +3037,11 @@  discard block
 block discarded – undo
3037 3037
 
3038 3038
 
3039 3039
 	/**
3040
-	* Gets a list of all dates
3041
-	*
3042
-	* @return Array list of date names
3043
-	*
3044
-	*/
3040
+	 * Gets a list of all dates
3041
+	 *
3042
+	 * @return Array list of date names
3043
+	 *
3044
+	 */
3045 3045
 	public function getAllDates()
3046 3046
 	{
3047 3047
 		global $globalTimezone, $globalDBdriver;
@@ -3082,11 +3082,11 @@  discard block
 block discarded – undo
3082 3082
 	
3083 3083
 	
3084 3084
 	/**
3085
-	* Gets all route combinations
3086
-	*
3087
-	* @return Array the route list
3088
-	*
3089
-	*/
3085
+	 * Gets all route combinations
3086
+	 *
3087
+	 * @return Array the route list
3088
+	 *
3089
+	 */
3090 3090
 	public function getAllRoutes()
3091 3091
 	{
3092 3092
 		$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 
@@ -3112,13 +3112,13 @@  discard block
 block discarded – undo
3112 3112
 	}
3113 3113
 
3114 3114
 	/**
3115
-	* Update ident spotter data
3116
-	*
3117
-	* @param String $flightaware_id the ID from flightaware
3118
-	* @param String $ident the flight ident
3119
-	* @return String success or false
3120
-	*
3121
-	*/	
3115
+	 * Update ident spotter data
3116
+	 *
3117
+	 * @param String $flightaware_id the ID from flightaware
3118
+	 * @param String $ident the flight ident
3119
+	 * @return String success or false
3120
+	 *
3121
+	 */	
3122 3122
 	public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL)
3123 3123
 	{
3124 3124
 		if (!is_numeric(substr($ident, 0, 3)))
@@ -3139,14 +3139,14 @@  discard block
 block discarded – undo
3139 3139
 		} else {
3140 3140
 			$airline_array = $this->getAllAirlineInfo("NA");
3141 3141
 		}
3142
-                $airline_name = $airline_array[0]['name'];
3143
-                $airline_icao = $airline_array[0]['icao'];
3144
-                $airline_country = $airline_array[0]['country'];
3145
-                $airline_type = $airline_array[0]['type'];
3142
+				$airline_name = $airline_array[0]['name'];
3143
+				$airline_icao = $airline_array[0]['icao'];
3144
+				$airline_country = $airline_array[0]['country'];
3145
+				$airline_type = $airline_array[0]['type'];
3146 3146
 
3147 3147
 
3148 3148
 		$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';
3149
-                $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);
3149
+				$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);
3150 3150
 
3151 3151
 		try {
3152 3152
 			$sth = $this->db->prepare($query);
@@ -3159,19 +3159,19 @@  discard block
 block discarded – undo
3159 3159
 
3160 3160
 	}
3161 3161
 	/**
3162
-	* Update latest spotter data
3163
-	*
3164
-	* @param String $flightaware_id the ID from flightaware
3165
-	* @param String $ident the flight ident
3166
-	* @param String $arrival_airport_icao the arrival airport
3167
-	* @return String success or false
3168
-	*
3169
-	*/	
3162
+	 * Update latest spotter data
3163
+	 *
3164
+	 * @param String $flightaware_id the ID from flightaware
3165
+	 * @param String $ident the flight ident
3166
+	 * @param String $arrival_airport_icao the arrival airport
3167
+	 * @return String success or false
3168
+	 *
3169
+	 */	
3170 3170
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3171 3171
 	{
3172 3172
 		if ($groundspeed == '') $groundspeed = NULL;
3173 3173
 		$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';
3174
-                $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);
3174
+				$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);
3175 3175
 
3176 3176
 		try {
3177 3177
 			$sth = $this->db->prepare($query);
@@ -3185,32 +3185,32 @@  discard block
 block discarded – undo
3185 3185
 	}
3186 3186
 
3187 3187
 	/**
3188
-	* Adds a new spotter data
3189
-	*
3190
-	* @param String $flightaware_id the ID from flightaware
3191
-	* @param String $ident the flight ident
3192
-	* @param String $aircraft_icao the aircraft type
3193
-	* @param String $departure_airport_icao the departure airport
3194
-	* @param String $arrival_airport_icao the arrival airport
3195
-	* @param String $latitude latitude of flight
3196
-	* @param String $longitude latitude of flight
3197
-	* @param String $waypoints waypoints of flight
3198
-	* @param String $altitude altitude of flight
3199
-	* @param String $heading heading of flight
3200
-	* @param String $groundspeed speed of flight
3201
-	* @param String $date date of flight
3202
-	* @param String $departure_airport_time departure time of flight
3203
-	* @param String $arrival_airport_time arrival time of flight
3204
-	* @param String $squawk squawk code of flight
3205
-	* @param String $route_stop route stop of flight
3206
-	* @param String $highlight highlight or not
3207
-	* @param String $ModeS ModesS code of flight
3208
-	* @param String $registration registration code of flight
3209
-	* @param String $pilot_id pilot id of flight (for virtual airlines)
3210
-	* @param String $pilot_name pilot name of flight (for virtual airlines)
3211
-	* @param String $verticalrate vertival rate of flight
3212
-	* @return String success or false
3213
-	*/
3188
+	 * Adds a new spotter data
3189
+	 *
3190
+	 * @param String $flightaware_id the ID from flightaware
3191
+	 * @param String $ident the flight ident
3192
+	 * @param String $aircraft_icao the aircraft type
3193
+	 * @param String $departure_airport_icao the departure airport
3194
+	 * @param String $arrival_airport_icao the arrival airport
3195
+	 * @param String $latitude latitude of flight
3196
+	 * @param String $longitude latitude of flight
3197
+	 * @param String $waypoints waypoints of flight
3198
+	 * @param String $altitude altitude of flight
3199
+	 * @param String $heading heading of flight
3200
+	 * @param String $groundspeed speed of flight
3201
+	 * @param String $date date of flight
3202
+	 * @param String $departure_airport_time departure time of flight
3203
+	 * @param String $arrival_airport_time arrival time of flight
3204
+	 * @param String $squawk squawk code of flight
3205
+	 * @param String $route_stop route stop of flight
3206
+	 * @param String $highlight highlight or not
3207
+	 * @param String $ModeS ModesS code of flight
3208
+	 * @param String $registration registration code of flight
3209
+	 * @param String $pilot_id pilot id of flight (for virtual airlines)
3210
+	 * @param String $pilot_name pilot name of flight (for virtual airlines)
3211
+	 * @param String $verticalrate vertival rate of flight
3212
+	 * @return String success or false
3213
+	 */
3214 3214
 	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 = '')
3215 3215
 	{
3216 3216
 		global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM;
@@ -3424,8 +3424,8 @@  discard block
 block discarded – undo
3424 3424
     
3425 3425
 		if ($globalIVAO && $aircraft_icao != '')
3426 3426
 		{
3427
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3428
-            		else $airline_icao = '';
3427
+					if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3428
+					else $airline_icao = '';
3429 3429
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3430 3430
 			if (!isset($image_array[0]['registration']))
3431 3431
 			{
@@ -3456,48 +3456,48 @@  discard block
 block discarded – undo
3456 3456
 	
3457 3457
 		if (count($airline_array) == 0) 
3458 3458
 		{
3459
-                        $airline_array = $this->getAllAirlineInfo('NA');
3460
-                }
3461
-                if (count($aircraft_array) == 0) 
3462
-                {
3463
-                        $aircraft_array = $this->getAllAircraftInfo('NA');
3464
-                }
3465
-                if (count($departure_airport_array) == 0) 
3466
-                {
3467
-                        $departure_airport_array = $this->getAllAirportInfo('NA');
3468
-                }
3469
-                if (count($arrival_airport_array) == 0) 
3470
-                {
3471
-                        $arrival_airport_array = $this->getAllAirportInfo('NA');
3472
-                }
3473
-                if ($registration == '') $registration = 'NA';
3474
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3475
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3476
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3477
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3478
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3479
-                $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) 
3459
+						$airline_array = $this->getAllAirlineInfo('NA');
3460
+				}
3461
+				if (count($aircraft_array) == 0) 
3462
+				{
3463
+						$aircraft_array = $this->getAllAircraftInfo('NA');
3464
+				}
3465
+				if (count($departure_airport_array) == 0) 
3466
+				{
3467
+						$departure_airport_array = $this->getAllAirportInfo('NA');
3468
+				}
3469
+				if (count($arrival_airport_array) == 0) 
3470
+				{
3471
+						$arrival_airport_array = $this->getAllAirportInfo('NA');
3472
+				}
3473
+				if ($registration == '') $registration = 'NA';
3474
+				if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3475
+				if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3476
+				if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3477
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3478
+				if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3479
+				$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) 
3480 3480
                 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)";
3481 3481
 
3482
-                $airline_name = $airline_array[0]['name'];
3483
-                $airline_icao = $airline_array[0]['icao'];
3484
-                $airline_country = $airline_array[0]['country'];
3485
-                $airline_type = $airline_array[0]['type'];
3482
+				$airline_name = $airline_array[0]['name'];
3483
+				$airline_icao = $airline_array[0]['icao'];
3484
+				$airline_country = $airline_array[0]['country'];
3485
+				$airline_type = $airline_array[0]['type'];
3486 3486
 		if ($airline_type == '') {
3487 3487
 			$timeelapsed = microtime(true);
3488 3488
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3489 3489
 			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3490 3490
 		}
3491 3491
 		if ($airline_type == null) $airline_type = '';
3492
-                $aircraft_type = $aircraft_array[0]['type'];
3493
-                $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3494
-                $departure_airport_name = $departure_airport_array[0]['name'];
3495
-                $departure_airport_city = $departure_airport_array[0]['city'];
3496
-                $departure_airport_country = $departure_airport_array[0]['country'];
3497
-                $arrival_airport_name = $arrival_airport_array[0]['name'];
3498
-                $arrival_airport_city = $arrival_airport_array[0]['city'];
3499
-                $arrival_airport_country = $arrival_airport_array[0]['country'];
3500
-                $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);
3492
+				$aircraft_type = $aircraft_array[0]['type'];
3493
+				$aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3494
+				$departure_airport_name = $departure_airport_array[0]['name'];
3495
+				$departure_airport_city = $departure_airport_array[0]['city'];
3496
+				$departure_airport_country = $departure_airport_array[0]['country'];
3497
+				$arrival_airport_name = $arrival_airport_array[0]['name'];
3498
+				$arrival_airport_city = $arrival_airport_array[0]['city'];
3499
+				$arrival_airport_country = $arrival_airport_array[0]['country'];
3500
+				$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);
3501 3501
 
3502 3502
 		try {
3503 3503
 		        
@@ -3505,7 +3505,7 @@  discard block
 block discarded – undo
3505 3505
 			$sth->execute($query_values);
3506 3506
 			$this->db = null;
3507 3507
 		} catch (PDOException $e) {
3508
-		    return "error : ".$e->getMessage();
3508
+			return "error : ".$e->getMessage();
3509 3509
 		}
3510 3510
 		
3511 3511
 		return "success";
@@ -3514,11 +3514,11 @@  discard block
 block discarded – undo
3514 3514
 	
3515 3515
   
3516 3516
 	/**
3517
-	* Gets the aircraft ident within the last hour
3518
-	*
3519
-	* @return String the ident
3520
-	*
3521
-	*/
3517
+	 * Gets the aircraft ident within the last hour
3518
+	 *
3519
+	 * @return String the ident
3520
+	 *
3521
+	 */
3522 3522
 	public function getIdentFromLastHour($ident)
3523 3523
 	{
3524 3524
 		global $globalDBdriver, $globalTimezone;
@@ -3534,11 +3534,11 @@  discard block
 block discarded – undo
3534 3534
 								AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
3535 3535
 								AND spotter_output.date < now() AT TIME ZONE 'UTC'";
3536 3536
 			$query_data = array(':ident' => $ident);
3537
-    		}
3537
+			}
3538 3538
 		
3539 3539
 		$sth = $this->db->prepare($query);
3540 3540
 		$sth->execute($query_data);
3541
-    		$ident_result='';
3541
+			$ident_result='';
3542 3542
 		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3543 3543
 		{
3544 3544
 			$ident_result = $row['ident'];
@@ -3549,11 +3549,11 @@  discard block
 block discarded – undo
3549 3549
 	
3550 3550
 	
3551 3551
 	/**
3552
-	* Gets the aircraft data from the last 20 seconds
3553
-	*
3554
-	* @return Array the spotter data
3555
-	*
3556
-	*/
3552
+	 * Gets the aircraft data from the last 20 seconds
3553
+	 *
3554
+	 * @return Array the spotter data
3555
+	 *
3556
+	 */
3557 3557
 	public function getRealTimeData($q = '')
3558 3558
 	{
3559 3559
 		global $globalDBdriver;
@@ -3597,11 +3597,11 @@  discard block
 block discarded – undo
3597 3597
 	
3598 3598
 	
3599 3599
 	 /**
3600
-	* Gets all airlines that have flown over
3601
-	*
3602
-	* @return Array the airline list
3603
-	*
3604
-	*/
3600
+	  * Gets all airlines that have flown over
3601
+	  *
3602
+	  * @return Array the airline list
3603
+	  *
3604
+	  */
3605 3605
 	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3606 3606
 	{
3607 3607
 		global $globalDBdriver;
@@ -3615,7 +3615,7 @@  discard block
 block discarded – undo
3615 3615
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3616 3616
 			}
3617 3617
 		}
3618
-                if ($sincedate != '') {
3618
+				if ($sincedate != '') {
3619 3619
 			if ($globalDBdriver == 'mysql') {
3620 3620
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3621 3621
 			} else {
@@ -3642,26 +3642,26 @@  discard block
 block discarded – undo
3642 3642
 	}
3643 3643
 
3644 3644
 	 /**
3645
-	* Gets all pilots that have flown over
3646
-	*
3647
-	* @return Array the pilots list
3648
-	*
3649
-	*/
3645
+	  * Gets all pilots that have flown over
3646
+	  *
3647
+	  * @return Array the pilots list
3648
+	  *
3649
+	  */
3650 3650
 	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3651 3651
 	{
3652 3652
 		global $globalDBdriver;
3653 3653
 		$filter_query = $this->getFilter($filters,true,true);
3654 3654
 		$query  = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count
3655 3655
 		 			FROM spotter_output".$filter_query." spotter_output.pilot_id <> '' ";
3656
-                if ($olderthanmonths > 0) {
3657
-            		if ($globalDBdriver == 'mysql') {
3656
+				if ($olderthanmonths > 0) {
3657
+					if ($globalDBdriver == 'mysql') {
3658 3658
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3659 3659
 			} else {
3660 3660
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3661 3661
 			}
3662 3662
 		}
3663
-                if ($sincedate != '') {
3664
-            		if ($globalDBdriver == 'mysql') {
3663
+				if ($sincedate != '') {
3664
+					if ($globalDBdriver == 'mysql') {
3665 3665
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3666 3666
 			} else {
3667 3667
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3688,25 +3688,25 @@  discard block
 block discarded – undo
3688 3688
 	}
3689 3689
 	
3690 3690
 		 /**
3691
-	* Gets all pilots that have flown over
3692
-	*
3693
-	* @return Array the pilots list
3694
-	*
3695
-	*/
3691
+		  * Gets all pilots that have flown over
3692
+		  *
3693
+		  * @return Array the pilots list
3694
+		  *
3695
+		  */
3696 3696
 	public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
3697 3697
 	{
3698 3698
 		global $globalDBdriver;
3699 3699
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count
3700 3700
 		 			FROM spotter_output WHERE spotter_output.pilot_id <> '' ";
3701
-                if ($olderthanmonths > 0) {
3702
-            		if ($globalDBdriver == 'mysql') {
3701
+				if ($olderthanmonths > 0) {
3702
+					if ($globalDBdriver == 'mysql') {
3703 3703
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3704 3704
 			} else {
3705 3705
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3706 3706
 			}
3707 3707
 		}
3708
-                if ($sincedate != '') {
3709
-            		if ($globalDBdriver == 'mysql') {
3708
+				if ($sincedate != '') {
3709
+					if ($globalDBdriver == 'mysql') {
3710 3710
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3711 3711
 			} else {
3712 3712
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3734,26 +3734,26 @@  discard block
 block discarded – undo
3734 3734
 	}
3735 3735
 	
3736 3736
 	 /**
3737
-	* Gets all owner that have flown over
3738
-	*
3739
-	* @return Array the pilots list
3740
-	*
3741
-	*/
3737
+	  * Gets all owner that have flown over
3738
+	  *
3739
+	  * @return Array the pilots list
3740
+	  *
3741
+	  */
3742 3742
 	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3743 3743
 	{
3744 3744
 		global $globalDBdriver;
3745 3745
 		$filter_query = $this->getFilter($filters,true,true);
3746 3746
 		$query  = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3747 3747
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3748
-                if ($olderthanmonths > 0) {
3749
-            		if ($globalDBdriver == 'mysql') {
3748
+				if ($olderthanmonths > 0) {
3749
+					if ($globalDBdriver == 'mysql') {
3750 3750
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3751 3751
 			} else {
3752 3752
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3753 3753
 			}
3754 3754
 		}
3755
-                if ($sincedate != '') {
3756
-            		if ($globalDBdriver == 'mysql') {
3755
+				if ($sincedate != '') {
3756
+					if ($globalDBdriver == 'mysql') {
3757 3757
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3758 3758
 			} else {
3759 3759
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3779,26 +3779,26 @@  discard block
 block discarded – undo
3779 3779
 	}
3780 3780
 	
3781 3781
 	 /**
3782
-	* Gets all owner that have flown over
3783
-	*
3784
-	* @return Array the pilots list
3785
-	*
3786
-	*/
3782
+	  * Gets all owner that have flown over
3783
+	  *
3784
+	  * @return Array the pilots list
3785
+	  *
3786
+	  */
3787 3787
 	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3788 3788
 	{
3789 3789
 		global $globalDBdriver;
3790 3790
 		$filter_query = $this->getFilter($filters,true,true);
3791 3791
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3792 3792
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3793
-                if ($olderthanmonths > 0) {
3794
-            		if ($globalDBdriver == 'mysql') {
3793
+				if ($olderthanmonths > 0) {
3794
+					if ($globalDBdriver == 'mysql') {
3795 3795
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3796 3796
 			} else {
3797 3797
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3798 3798
 			}
3799 3799
 		}
3800
-                if ($sincedate != '') {
3801
-            		if ($globalDBdriver == 'mysql') {
3800
+				if ($sincedate != '') {
3801
+					if ($globalDBdriver == 'mysql') {
3802 3802
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3803 3803
 			} else {
3804 3804
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3825,11 +3825,11 @@  discard block
 block discarded – undo
3825 3825
 	}
3826 3826
 
3827 3827
 	/**
3828
-	* Gets all airlines that have flown over by aircraft
3829
-	*
3830
-	* @return Array the airline list
3831
-	*
3832
-	*/
3828
+	 * Gets all airlines that have flown over by aircraft
3829
+	 *
3830
+	 * @return Array the airline list
3831
+	 *
3832
+	 */
3833 3833
 	public function countAllAirlinesByAircraft($aircraft_icao,$filters = array())
3834 3834
 	{
3835 3835
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -3861,11 +3861,11 @@  discard block
 block discarded – undo
3861 3861
 
3862 3862
 
3863 3863
 	/**
3864
-	* Gets all airline countries that have flown over by aircraft
3865
-	*
3866
-	* @return Array the airline country list
3867
-	*
3868
-	*/
3864
+	 * Gets all airline countries that have flown over by aircraft
3865
+	 *
3866
+	 * @return Array the airline country list
3867
+	 *
3868
+	 */
3869 3869
 	public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array())
3870 3870
 	{
3871 3871
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -3897,11 +3897,11 @@  discard block
 block discarded – undo
3897 3897
 	
3898 3898
 	
3899 3899
 	/**
3900
-	* Gets all airlines that have flown over by airport
3901
-	*
3902
-	* @return Array the airline list
3903
-	*
3904
-	*/
3900
+	 * Gets all airlines that have flown over by airport
3901
+	 *
3902
+	 * @return Array the airline list
3903
+	 *
3904
+	 */
3905 3905
 	public function countAllAirlinesByAirport($airport_icao,$filters = array())
3906 3906
 	{
3907 3907
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -3932,11 +3932,11 @@  discard block
 block discarded – undo
3932 3932
 
3933 3933
 
3934 3934
 	/**
3935
-	* Gets all airline countries that have flown over by airport icao
3936
-	*
3937
-	* @return Array the airline country list
3938
-	*
3939
-	*/
3935
+	 * Gets all airline countries that have flown over by airport icao
3936
+	 *
3937
+	 * @return Array the airline country list
3938
+	 *
3939
+	 */
3940 3940
 	public function countAllAirlineCountriesByAirport($airport_icao,$filters = array())
3941 3941
 	{
3942 3942
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -3966,11 +3966,11 @@  discard block
 block discarded – undo
3966 3966
 
3967 3967
 
3968 3968
 	/**
3969
-	* Gets all airlines that have flown over by aircraft manufacturer
3970
-	*
3971
-	* @return Array the airline list
3972
-	*
3973
-	*/
3969
+	 * Gets all airlines that have flown over by aircraft manufacturer
3970
+	 *
3971
+	 * @return Array the airline list
3972
+	 *
3973
+	 */
3974 3974
 	public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array())
3975 3975
 	{
3976 3976
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4001,11 +4001,11 @@  discard block
 block discarded – undo
4001 4001
 
4002 4002
 
4003 4003
 	/**
4004
-	* Gets all airline countries that have flown over by aircraft manufacturer
4005
-	*
4006
-	* @return Array the airline country list
4007
-	*
4008
-	*/
4004
+	 * Gets all airline countries that have flown over by aircraft manufacturer
4005
+	 *
4006
+	 * @return Array the airline country list
4007
+	 *
4008
+	 */
4009 4009
 	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array())
4010 4010
 	{
4011 4011
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4034,11 +4034,11 @@  discard block
 block discarded – undo
4034 4034
 
4035 4035
 
4036 4036
 	/**
4037
-	* Gets all airlines that have flown over by date
4038
-	*
4039
-	* @return Array the airline list
4040
-	*
4041
-	*/
4037
+	 * Gets all airlines that have flown over by date
4038
+	 *
4039
+	 * @return Array the airline list
4040
+	 *
4041
+	 */
4042 4042
 	public function countAllAirlinesByDate($date,$filters = array())
4043 4043
 	{
4044 4044
 		global $globalTimezone, $globalDBdriver;
@@ -4082,11 +4082,11 @@  discard block
 block discarded – undo
4082 4082
 	
4083 4083
 	
4084 4084
 	/**
4085
-	* Gets all airline countries that have flown over by date
4086
-	*
4087
-	* @return Array the airline country list
4088
-	*
4089
-	*/
4085
+	 * Gets all airline countries that have flown over by date
4086
+	 *
4087
+	 * @return Array the airline country list
4088
+	 *
4089
+	 */
4090 4090
 	public function countAllAirlineCountriesByDate($date,$filters = array())
4091 4091
 	{
4092 4092
 		global $globalTimezone, $globalDBdriver;
@@ -4129,11 +4129,11 @@  discard block
 block discarded – undo
4129 4129
 
4130 4130
 
4131 4131
 	/**
4132
-	* Gets all airlines that have flown over by ident/callsign
4133
-	*
4134
-	* @return Array the airline list
4135
-	*
4136
-	*/
4132
+	 * Gets all airlines that have flown over by ident/callsign
4133
+	 *
4134
+	 * @return Array the airline list
4135
+	 *
4136
+	 */
4137 4137
 	public function countAllAirlinesByIdent($ident,$filters = array())
4138 4138
 	{
4139 4139
 		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
@@ -4163,11 +4163,11 @@  discard block
 block discarded – undo
4163 4163
 	}
4164 4164
 
4165 4165
 	/**
4166
-	* Gets all airlines that have flown over by route
4167
-	*
4168
-	* @return Array the airline list
4169
-	*
4170
-	*/
4166
+	 * Gets all airlines that have flown over by route
4167
+	 *
4168
+	 * @return Array the airline list
4169
+	 *
4170
+	 */
4171 4171
 	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
4172 4172
 	{
4173 4173
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4199,11 +4199,11 @@  discard block
 block discarded – undo
4199 4199
 	}
4200 4200
 
4201 4201
 	/**
4202
-	* Gets all airline countries that have flown over by route
4203
-	*
4204
-	* @return Array the airline country list
4205
-	*
4206
-	*/
4202
+	 * Gets all airline countries that have flown over by route
4203
+	 *
4204
+	 * @return Array the airline country list
4205
+	 *
4206
+	 */
4207 4207
 	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array())
4208 4208
 	{
4209 4209
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4235,11 +4235,11 @@  discard block
 block discarded – undo
4235 4235
 
4236 4236
 
4237 4237
 	/**
4238
-	* Gets all airlines that have flown over by country
4239
-	*
4240
-	* @return Array the airline list
4241
-	*
4242
-	*/
4238
+	 * Gets all airlines that have flown over by country
4239
+	 *
4240
+	 * @return Array the airline list
4241
+	 *
4242
+	 */
4243 4243
 	public function countAllAirlinesByCountry($country,$filters = array())
4244 4244
 	{
4245 4245
 		$country = filter_var($country,FILTER_SANITIZE_STRING);
@@ -4269,11 +4269,11 @@  discard block
 block discarded – undo
4269 4269
 
4270 4270
 
4271 4271
 	/**
4272
-	* Gets all airline countries that have flown over by country
4273
-	*
4274
-	* @return Array the airline country list
4275
-	*
4276
-	*/
4272
+	 * Gets all airline countries that have flown over by country
4273
+	 *
4274
+	 * @return Array the airline country list
4275
+	 *
4276
+	 */
4277 4277
 	public function countAllAirlineCountriesByCountry($country,$filters = array())
4278 4278
 	{
4279 4279
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4302,11 +4302,11 @@  discard block
 block discarded – undo
4302 4302
 
4303 4303
 
4304 4304
 	/**
4305
-	* Gets all airlines countries
4306
-	*
4307
-	* @return Array the airline country list
4308
-	*
4309
-	*/
4305
+	 * Gets all airlines countries
4306
+	 *
4307
+	 * @return Array the airline country list
4308
+	 *
4309
+	 */
4310 4310
 	public function countAllAirlineCountries($limit = true, $filters = array())
4311 4311
 	{
4312 4312
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4332,11 +4332,11 @@  discard block
 block discarded – undo
4332 4332
 	}
4333 4333
 
4334 4334
 	/**
4335
-	* Gets all number of flight over countries
4336
-	*
4337
-	* @return Array the airline country list
4338
-	*
4339
-	*/
4335
+	 * Gets all number of flight over countries
4336
+	 *
4337
+	 * @return Array the airline country list
4338
+	 *
4339
+	 */
4340 4340
 	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
4341 4341
 	{
4342 4342
 		global $globalDBdriver;
@@ -4351,15 +4351,15 @@  discard block
 block discarded – undo
4351 4351
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
4352 4352
 					FROM countries c, spotter_live s
4353 4353
 					WHERE c.iso2 = s.over_country ";
4354
-                if ($olderthanmonths > 0) {
4354
+				if ($olderthanmonths > 0) {
4355 4355
 			if ($globalDBdriver == 'mysql') {
4356 4356
 				$query .= 'AND spotter_live.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
4357 4357
 			} else {
4358 4358
 				$query .= "AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
4359 4359
 			}
4360 4360
 		}
4361
-                if ($sincedate != '') {
4362
-            		if ($globalDBdriver == 'mysql') {
4361
+				if ($sincedate != '') {
4362
+					if ($globalDBdriver == 'mysql') {
4363 4363
 				$query .= "AND spotter_live.date > '".$sincedate."' ";
4364 4364
 			} else {
4365 4365
 				$query .= "AND spotter_live.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4389,11 +4389,11 @@  discard block
 block discarded – undo
4389 4389
 	
4390 4390
 	
4391 4391
 	/**
4392
-	* Gets all aircraft types that have flown over
4393
-	*
4394
-	* @return Array the aircraft list
4395
-	*
4396
-	*/
4392
+	 * Gets all aircraft types that have flown over
4393
+	 *
4394
+	 * @return Array the aircraft list
4395
+	 *
4396
+	 */
4397 4397
 	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4398 4398
 	{
4399 4399
 		global $globalDBdriver;
@@ -4436,11 +4436,11 @@  discard block
 block discarded – undo
4436 4436
 	}
4437 4437
 
4438 4438
 	/**
4439
-	* Gets all aircraft types that have flown over by airline
4440
-	*
4441
-	* @return Array the aircraft list
4442
-	*
4443
-	*/
4439
+	 * Gets all aircraft types that have flown over by airline
4440
+	 *
4441
+	 * @return Array the aircraft list
4442
+	 *
4443
+	 */
4444 4444
 	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4445 4445
 	{
4446 4446
 		global $globalDBdriver;
@@ -4484,11 +4484,11 @@  discard block
 block discarded – undo
4484 4484
 
4485 4485
 
4486 4486
 	/**
4487
-	* Gets all aircraft registration that have flown over by aircaft icao
4488
-	*
4489
-	* @return Array the aircraft list
4490
-	*
4491
-	*/
4487
+	 * Gets all aircraft registration that have flown over by aircaft icao
4488
+	 *
4489
+	 * @return Array the aircraft list
4490
+	 *
4491
+	 */
4492 4492
 	public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array())
4493 4493
 	{
4494 4494
 		$Image = new Image($this->db);
@@ -4527,11 +4527,11 @@  discard block
 block discarded – undo
4527 4527
 
4528 4528
 
4529 4529
 	/**
4530
-	* Gets all aircraft types that have flown over by airline icao
4531
-	*
4532
-	* @return Array the aircraft list
4533
-	*
4534
-	*/
4530
+	 * Gets all aircraft types that have flown over by airline icao
4531
+	 *
4532
+	 * @return Array the aircraft list
4533
+	 *
4534
+	 */
4535 4535
 	public function countAllAircraftTypesByAirline($airline_icao,$filters = array())
4536 4536
 	{
4537 4537
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4560,11 +4560,11 @@  discard block
 block discarded – undo
4560 4560
 
4561 4561
 
4562 4562
 	/**
4563
-	* Gets all aircraft registration that have flown over by airline icao
4564
-	*
4565
-	* @return Array the aircraft list
4566
-	*
4567
-	*/
4563
+	 * Gets all aircraft registration that have flown over by airline icao
4564
+	 *
4565
+	 * @return Array the aircraft list
4566
+	 *
4567
+	 */
4568 4568
 	public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array())
4569 4569
 	{
4570 4570
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4602,11 +4602,11 @@  discard block
 block discarded – undo
4602 4602
 
4603 4603
 
4604 4604
 	/**
4605
-	* Gets all aircraft manufacturer that have flown over by airline icao
4606
-	*
4607
-	* @return Array the aircraft list
4608
-	*
4609
-	*/
4605
+	 * Gets all aircraft manufacturer that have flown over by airline icao
4606
+	 *
4607
+	 * @return Array the aircraft list
4608
+	 *
4609
+	 */
4610 4610
 	public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array())
4611 4611
 	{
4612 4612
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4634,11 +4634,11 @@  discard block
 block discarded – undo
4634 4634
 
4635 4635
 
4636 4636
 	/**
4637
-	* Gets all aircraft types that have flown over by airline icao
4638
-	*
4639
-	* @return Array the aircraft list
4640
-	*
4641
-	*/
4637
+	 * Gets all aircraft types that have flown over by airline icao
4638
+	 *
4639
+	 * @return Array the aircraft list
4640
+	 *
4641
+	 */
4642 4642
 	public function countAllAircraftTypesByAirport($airport_icao,$filters = array())
4643 4643
 	{
4644 4644
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4667,11 +4667,11 @@  discard block
 block discarded – undo
4667 4667
 
4668 4668
 
4669 4669
 	/**
4670
-	* Gets all aircraft registration that have flown over by airport icao
4671
-	*
4672
-	* @return Array the aircraft list
4673
-	*
4674
-	*/
4670
+	 * Gets all aircraft registration that have flown over by airport icao
4671
+	 *
4672
+	 * @return Array the aircraft list
4673
+	 *
4674
+	 */
4675 4675
 	public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array())
4676 4676
 	{
4677 4677
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4709,11 +4709,11 @@  discard block
 block discarded – undo
4709 4709
 	
4710 4710
 	
4711 4711
 	/**
4712
-	* Gets all aircraft manufacturer that have flown over by airport icao
4713
-	*
4714
-	* @return Array the aircraft list
4715
-	*
4716
-	*/
4712
+	 * Gets all aircraft manufacturer that have flown over by airport icao
4713
+	 *
4714
+	 * @return Array the aircraft list
4715
+	 *
4716
+	 */
4717 4717
 	public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array())
4718 4718
 	{
4719 4719
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4739,11 +4739,11 @@  discard block
 block discarded – undo
4739 4739
 	}
4740 4740
 
4741 4741
 	/**
4742
-	* Gets all aircraft types that have flown over by aircraft manufacturer
4743
-	*
4744
-	* @return Array the aircraft list
4745
-	*
4746
-	*/
4742
+	 * Gets all aircraft types that have flown over by aircraft manufacturer
4743
+	 *
4744
+	 * @return Array the aircraft list
4745
+	 *
4746
+	 */
4747 4747
 	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array())
4748 4748
 	{
4749 4749
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4770,11 +4770,11 @@  discard block
 block discarded – undo
4770 4770
 
4771 4771
 
4772 4772
 	/**
4773
-	* Gets all aircraft registration that have flown over by aircaft manufacturer
4774
-	*
4775
-	* @return Array the aircraft list
4776
-	*
4777
-	*/
4773
+	 * Gets all aircraft registration that have flown over by aircaft manufacturer
4774
+	 *
4775
+	 * @return Array the aircraft list
4776
+	 *
4777
+	 */
4778 4778
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array())
4779 4779
 	{
4780 4780
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4810,11 +4810,11 @@  discard block
 block discarded – undo
4810 4810
 	}
4811 4811
 
4812 4812
 	/**
4813
-	* Gets all aircraft types that have flown over by date
4814
-	*
4815
-	* @return Array the aircraft list
4816
-	*
4817
-	*/
4813
+	 * Gets all aircraft types that have flown over by date
4814
+	 *
4815
+	 * @return Array the aircraft list
4816
+	 *
4817
+	 */
4818 4818
 	public function countAllAircraftTypesByDate($date,$filters = array())
4819 4819
 	{
4820 4820
 		global $globalTimezone, $globalDBdriver;
@@ -4856,11 +4856,11 @@  discard block
 block discarded – undo
4856 4856
 
4857 4857
 
4858 4858
 	/**
4859
-	* Gets all aircraft registration that have flown over by date
4860
-	*
4861
-	* @return Array the aircraft list
4862
-	*
4863
-	*/
4859
+	 * Gets all aircraft registration that have flown over by date
4860
+	 *
4861
+	 * @return Array the aircraft list
4862
+	 *
4863
+	 */
4864 4864
 	public function countAllAircraftRegistrationByDate($date,$filters = array())
4865 4865
 	{
4866 4866
 		global $globalTimezone, $globalDBdriver;
@@ -4911,11 +4911,11 @@  discard block
 block discarded – undo
4911 4911
 
4912 4912
 
4913 4913
 	/**
4914
-	* Gets all aircraft manufacturer that have flown over by date
4915
-	*
4916
-	* @return Array the aircraft manufacturer list
4917
-	*
4918
-	*/
4914
+	 * Gets all aircraft manufacturer that have flown over by date
4915
+	 *
4916
+	 * @return Array the aircraft manufacturer list
4917
+	 *
4918
+	 */
4919 4919
 	public function countAllAircraftManufacturerByDate($date,$filters = array())
4920 4920
 	{
4921 4921
 		global $globalTimezone, $globalDBdriver;
@@ -4957,11 +4957,11 @@  discard block
 block discarded – undo
4957 4957
 
4958 4958
 
4959 4959
 	/**
4960
-	* Gets all aircraft types that have flown over by ident/callsign
4961
-	*
4962
-	* @return Array the aircraft list
4963
-	*
4964
-	*/
4960
+	 * Gets all aircraft types that have flown over by ident/callsign
4961
+	 *
4962
+	 * @return Array the aircraft list
4963
+	 *
4964
+	 */
4965 4965
 	public function countAllAircraftTypesByIdent($ident,$filters = array())
4966 4966
 	{
4967 4967
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4990,11 +4990,11 @@  discard block
 block discarded – undo
4990 4990
 
4991 4991
 
4992 4992
 	/**
4993
-	* Gets all aircraft registration that have flown over by ident/callsign
4994
-	*
4995
-	* @return Array the aircraft list
4996
-	*
4997
-	*/
4993
+	 * Gets all aircraft registration that have flown over by ident/callsign
4994
+	 *
4995
+	 * @return Array the aircraft list
4996
+	 *
4997
+	 */
4998 4998
 	public function countAllAircraftRegistrationByIdent($ident,$filters = array())
4999 4999
 	{
5000 5000
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5034,11 +5034,11 @@  discard block
 block discarded – undo
5034 5034
 
5035 5035
 
5036 5036
 	/**
5037
-	* Gets all aircraft manufacturer that have flown over by ident/callsign
5038
-	*
5039
-	* @return Array the aircraft manufacturer list
5040
-	*
5041
-	*/
5037
+	 * Gets all aircraft manufacturer that have flown over by ident/callsign
5038
+	 *
5039
+	 * @return Array the aircraft manufacturer list
5040
+	 *
5041
+	 */
5042 5042
 	public function countAllAircraftManufacturerByIdent($ident,$filters = array())
5043 5043
 	{
5044 5044
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5064,11 +5064,11 @@  discard block
 block discarded – undo
5064 5064
 
5065 5065
 
5066 5066
 	/**
5067
-	* Gets all aircraft types that have flown over by route
5068
-	*
5069
-	* @return Array the aircraft list
5070
-	*
5071
-	*/
5067
+	 * Gets all aircraft types that have flown over by route
5068
+	 *
5069
+	 * @return Array the aircraft list
5070
+	 *
5071
+	 */
5072 5072
 	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5073 5073
 	{
5074 5074
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5097,11 +5097,11 @@  discard block
 block discarded – undo
5097 5097
 	}
5098 5098
 
5099 5099
 	/**
5100
-	* Gets all aircraft registration that have flown over by route
5101
-	*
5102
-	* @return Array the aircraft list
5103
-	*
5104
-	*/
5100
+	 * Gets all aircraft registration that have flown over by route
5101
+	 *
5102
+	 * @return Array the aircraft list
5103
+	 *
5104
+	 */
5105 5105
 	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5106 5106
 	{
5107 5107
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5143,11 +5143,11 @@  discard block
 block discarded – undo
5143 5143
 	
5144 5144
 	
5145 5145
 	/**
5146
-	* Gets all aircraft manufacturer that have flown over by route
5147
-	*
5148
-	* @return Array the aircraft manufacturer list
5149
-	*
5150
-	*/
5146
+	 * Gets all aircraft manufacturer that have flown over by route
5147
+	 *
5148
+	 * @return Array the aircraft manufacturer list
5149
+	 *
5150
+	 */
5151 5151
 	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5152 5152
 	{
5153 5153
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5181,11 +5181,11 @@  discard block
 block discarded – undo
5181 5181
 	
5182 5182
 	
5183 5183
 	/**
5184
-	* Gets all aircraft types that have flown over by country
5185
-	*
5186
-	* @return Array the aircraft list
5187
-	*
5188
-	*/
5184
+	 * Gets all aircraft types that have flown over by country
5185
+	 *
5186
+	 * @return Array the aircraft list
5187
+	 *
5188
+	 */
5189 5189
 	public function countAllAircraftTypesByCountry($country,$filters = array())
5190 5190
 	{
5191 5191
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5216,11 +5216,11 @@  discard block
 block discarded – undo
5216 5216
 
5217 5217
 
5218 5218
 	/**
5219
-	* Gets all aircraft registration that have flown over by country
5220
-	*
5221
-	* @return Array the aircraft list
5222
-	*
5223
-	*/
5219
+	 * Gets all aircraft registration that have flown over by country
5220
+	 *
5221
+	 * @return Array the aircraft list
5222
+	 *
5223
+	 */
5224 5224
 	public function countAllAircraftRegistrationByCountry($country,$filters = array())
5225 5225
 	{
5226 5226
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5260,11 +5260,11 @@  discard block
 block discarded – undo
5260 5260
 	
5261 5261
 	
5262 5262
 	/**
5263
-	* Gets all aircraft manufacturer that have flown over by country
5264
-	*
5265
-	* @return Array the aircraft manufacturer list
5266
-	*
5267
-	*/
5263
+	 * Gets all aircraft manufacturer that have flown over by country
5264
+	 *
5265
+	 * @return Array the aircraft manufacturer list
5266
+	 *
5267
+	 */
5268 5268
 	public function countAllAircraftManufacturerByCountry($country,$filters = array())
5269 5269
 	{
5270 5270
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5295,17 +5295,17 @@  discard block
 block discarded – undo
5295 5295
 	
5296 5296
 	
5297 5297
 	/**
5298
-	* Gets all aircraft manufacturers that have flown over
5299
-	*
5300
-	* @return Array the aircraft list
5301
-	*
5302
-	*/
5298
+	 * Gets all aircraft manufacturers that have flown over
5299
+	 *
5300
+	 * @return Array the aircraft list
5301
+	 *
5302
+	 */
5303 5303
 	public function countAllAircraftManufacturers($filters = array())
5304 5304
 	{
5305 5305
 		$filter_query = $this->getFilter($filters,true,true);
5306 5306
 		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5307 5307
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
5308
-                $query .= " GROUP BY spotter_output.aircraft_manufacturer
5308
+				$query .= " GROUP BY spotter_output.aircraft_manufacturer
5309 5309
 					ORDER BY aircraft_manufacturer_count DESC
5310 5310
 					LIMIT 10";
5311 5311
       
@@ -5330,11 +5330,11 @@  discard block
 block discarded – undo
5330 5330
 	
5331 5331
 	
5332 5332
 	/**
5333
-	* Gets all aircraft registrations that have flown over
5334
-	*
5335
-	* @return Array the aircraft list
5336
-	*
5337
-	*/
5333
+	 * Gets all aircraft registrations that have flown over
5334
+	 *
5335
+	 * @return Array the aircraft list
5336
+	 *
5337
+	 */
5338 5338
 	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5339 5339
 	{
5340 5340
 		global $globalDBdriver;
@@ -5342,15 +5342,15 @@  discard block
 block discarded – undo
5342 5342
 		$filter_query = $this->getFilter($filters,true,true);
5343 5343
 		$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    
5344 5344
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
5345
-                if ($olderthanmonths > 0) {
5346
-            		if ($globalDBdriver == 'mysql') {
5345
+				if ($olderthanmonths > 0) {
5346
+					if ($globalDBdriver == 'mysql') {
5347 5347
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
5348 5348
 			} else {
5349 5349
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5350 5350
 			}
5351 5351
 		}
5352
-                if ($sincedate != '') {
5353
-            		if ($globalDBdriver == 'mysql') {
5352
+				if ($sincedate != '') {
5353
+					if ($globalDBdriver == 'mysql') {
5354 5354
 				$query .= " AND spotter_output.date > '".$sincedate."'";
5355 5355
 			} else {
5356 5356
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -5359,7 +5359,7 @@  discard block
 block discarded – undo
5359 5359
 
5360 5360
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5361 5361
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5362
-                $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5362
+				$query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5363 5363
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5364 5364
 		
5365 5365
 		$sth = $this->db->prepare($query);
@@ -5390,11 +5390,11 @@  discard block
 block discarded – undo
5390 5390
 
5391 5391
 
5392 5392
 	/**
5393
-	* Gets all aircraft registrations that have flown over
5394
-	*
5395
-	* @return Array the aircraft list
5396
-	*
5397
-	*/
5393
+	 * Gets all aircraft registrations that have flown over
5394
+	 *
5395
+	 * @return Array the aircraft list
5396
+	 *
5397
+	 */
5398 5398
 	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5399 5399
 	{
5400 5400
 		global $globalDBdriver;
@@ -5402,15 +5402,15 @@  discard block
 block discarded – undo
5402 5402
 		$Image = new Image($this->db);
5403 5403
 		$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    
5404 5404
                     FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
5405
-                if ($olderthanmonths > 0) {
5406
-            		if ($globalDBdriver == 'mysql') {
5405
+				if ($olderthanmonths > 0) {
5406
+					if ($globalDBdriver == 'mysql') {
5407 5407
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5408 5408
 			} else {
5409 5409
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5410 5410
 			}
5411 5411
 		}
5412
-                if ($sincedate != '') {
5413
-            		if ($globalDBdriver == 'mysql') {
5412
+				if ($sincedate != '') {
5413
+					if ($globalDBdriver == 'mysql') {
5414 5414
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
5415 5415
 			} else {
5416 5416
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -5419,7 +5419,7 @@  discard block
 block discarded – undo
5419 5419
 
5420 5420
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5421 5421
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5422
-                $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";
5422
+				$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";
5423 5423
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5424 5424
 		
5425 5425
 		$sth = $this->db->prepare($query);
@@ -5451,35 +5451,35 @@  discard block
 block discarded – undo
5451 5451
 	
5452 5452
 	
5453 5453
 	/**
5454
-	* Gets all departure airports of the airplanes that have flown over
5455
-	*
5456
-	* @return Array the airport list
5457
-	*
5458
-	*/
5454
+	 * Gets all departure airports of the airplanes that have flown over
5455
+	 *
5456
+	 * @return Array the airport list
5457
+	 *
5458
+	 */
5459 5459
 	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5460 5460
 	{
5461 5461
 		global $globalDBdriver;
5462 5462
 		$filter_query = $this->getFilter($filters,true,true);
5463 5463
 		$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 
5464 5464
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA'";
5465
-                if ($olderthanmonths > 0) {
5466
-            		if ($globalDBdriver == 'mysql') {
5465
+				if ($olderthanmonths > 0) {
5466
+					if ($globalDBdriver == 'mysql') {
5467 5467
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
5468 5468
 			} else {
5469 5469
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5470 5470
 			}
5471
-                }
5472
-                if ($sincedate != '') {
5473
-            		if ($globalDBdriver == 'mysql') {
5471
+				}
5472
+				if ($sincedate != '') {
5473
+					if ($globalDBdriver == 'mysql') {
5474 5474
 				$query .= " AND spotter_output.date > '".$sincedate."'";
5475 5475
 			} else {
5476 5476
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
5477 5477
 			}
5478 5478
 		}
5479 5479
 
5480
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5481
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5482
-                $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5480
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5481
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5482
+				$query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5483 5483
 				ORDER BY airport_departure_icao_count DESC";
5484 5484
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5485 5485
       
@@ -5503,35 +5503,35 @@  discard block
 block discarded – undo
5503 5503
 	}
5504 5504
 
5505 5505
 	/**
5506
-	* Gets all departure airports of the airplanes that have flown over
5507
-	*
5508
-	* @return Array the airport list
5509
-	*
5510
-	*/
5506
+	 * Gets all departure airports of the airplanes that have flown over
5507
+	 *
5508
+	 * @return Array the airport list
5509
+	 *
5510
+	 */
5511 5511
 	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5512 5512
 	{
5513 5513
 		global $globalDBdriver;
5514 5514
 		$filter_query = $this->getFilter($filters,true,true);
5515 5515
 		$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 
5516 5516
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' ";
5517
-                if ($olderthanmonths > 0) {
5518
-            		if ($globalDBdriver == 'mysql') {
5517
+				if ($olderthanmonths > 0) {
5518
+					if ($globalDBdriver == 'mysql') {
5519 5519
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5520 5520
 			} else {
5521 5521
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5522 5522
 			}
5523
-                }
5524
-                if ($sincedate != '') {
5525
-            		if ($globalDBdriver == 'mysql') {
5523
+				}
5524
+				if ($sincedate != '') {
5525
+					if ($globalDBdriver == 'mysql') {
5526 5526
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
5527 5527
 			} else {
5528 5528
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
5529 5529
 			}
5530 5530
 		}
5531 5531
 
5532
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5533
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5534
-                $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
5532
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5533
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5534
+				$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
5535 5535
 				ORDER BY airport_departure_icao_count DESC";
5536 5536
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5537 5537
       
@@ -5556,37 +5556,37 @@  discard block
 block discarded – undo
5556 5556
 	}
5557 5557
 
5558 5558
 	/**
5559
-	* Gets all detected departure airports of the airplanes that have flown over
5560
-	*
5561
-	* @return Array the airport list
5562
-	*
5563
-	*/
5559
+	 * Gets all detected departure airports of the airplanes that have flown over
5560
+	 *
5561
+	 * @return Array the airport list
5562
+	 *
5563
+	 */
5564 5564
 	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5565 5565
 	{
5566 5566
 		global $globalDBdriver;
5567 5567
 		$filter_query = $this->getFilter($filters,true,true);
5568 5568
 		$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
5569 5569
 				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";
5570
-                if ($olderthanmonths > 0) {
5571
-            		if ($globalDBdriver == 'mysql') {
5570
+				if ($olderthanmonths > 0) {
5571
+					if ($globalDBdriver == 'mysql') {
5572 5572
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
5573 5573
 			} else {
5574 5574
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5575 5575
 			}
5576
-                }
5577
-                if ($sincedate != '') {
5578
-            		if ($globalDBdriver == 'mysql') {
5576
+				}
5577
+				if ($sincedate != '') {
5578
+					if ($globalDBdriver == 'mysql') {
5579 5579
 				$query .= " AND spotter_output.date > '".$sincedate."'";
5580 5580
 			} else {
5581 5581
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
5582 5582
 			}
5583 5583
 		}
5584
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5585
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5586
-                $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5584
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5585
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5586
+				$query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5587 5587
 				ORDER BY airport_departure_icao_count DESC";
5588 5588
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5589
-    		//echo $query;
5589
+			//echo $query;
5590 5590
 		$sth = $this->db->prepare($query);
5591 5591
 		$sth->execute();
5592 5592
       
@@ -5607,35 +5607,35 @@  discard block
 block discarded – undo
5607 5607
 	}
5608 5608
 	
5609 5609
 	/**
5610
-	* Gets all detected departure airports of the airplanes that have flown over
5611
-	*
5612
-	* @return Array the airport list
5613
-	*
5614
-	*/
5610
+	 * Gets all detected departure airports of the airplanes that have flown over
5611
+	 *
5612
+	 * @return Array the airport list
5613
+	 *
5614
+	 */
5615 5615
 	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5616 5616
 	{
5617 5617
 		global $globalDBdriver;
5618 5618
 		$filter_query = $this->getFilter($filters,true,true);
5619 5619
 		$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
5620 5620
 				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 ";
5621
-                if ($olderthanmonths > 0) {
5622
-            		if ($globalDBdriver == 'mysql') {
5621
+				if ($olderthanmonths > 0) {
5622
+					if ($globalDBdriver == 'mysql') {
5623 5623
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5624 5624
 			} else {
5625 5625
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5626 5626
 			}
5627
-                }
5628
-                if ($sincedate != '') {
5629
-            		if ($globalDBdriver == 'mysql') {
5627
+				}
5628
+				if ($sincedate != '') {
5629
+					if ($globalDBdriver == 'mysql') {
5630 5630
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
5631 5631
 			} else {
5632 5632
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
5633 5633
 			}
5634 5634
 		}
5635 5635
 
5636
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5637
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5638
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5636
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5637
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5638
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5639 5639
 				ORDER BY airport_departure_icao_count DESC";
5640 5640
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5641 5641
       
@@ -5660,11 +5660,11 @@  discard block
 block discarded – undo
5660 5660
 	}	
5661 5661
 	
5662 5662
 	/**
5663
-	* Gets all departure airports of the airplanes that have flown over based on an airline icao
5664
-	*
5665
-	* @return Array the airport list
5666
-	*
5667
-	*/
5663
+	 * Gets all departure airports of the airplanes that have flown over based on an airline icao
5664
+	 *
5665
+	 * @return Array the airport list
5666
+	 *
5667
+	 */
5668 5668
 	public function countAllDepartureAirportsByAirline($airline_icao,$filters = array())
5669 5669
 	{
5670 5670
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5698,11 +5698,11 @@  discard block
 block discarded – undo
5698 5698
 	
5699 5699
 	
5700 5700
 	/**
5701
-	* Gets all departure airports by country of the airplanes that have flown over based on an airline icao
5702
-	*
5703
-	* @return Array the airport list
5704
-	*
5705
-	*/
5701
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airline icao
5702
+	 *
5703
+	 * @return Array the airport list
5704
+	 *
5705
+	 */
5706 5706
 	public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array())
5707 5707
 	{
5708 5708
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5733,11 +5733,11 @@  discard block
 block discarded – undo
5733 5733
 	
5734 5734
 	
5735 5735
 	/**
5736
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft icao
5737
-	*
5738
-	* @return Array the airport list
5739
-	*
5740
-	*/
5736
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft icao
5737
+	 *
5738
+	 * @return Array the airport list
5739
+	 *
5740
+	 */
5741 5741
 	public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array())
5742 5742
 	{
5743 5743
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5770,11 +5770,11 @@  discard block
 block discarded – undo
5770 5770
 	
5771 5771
 	
5772 5772
 	/**
5773
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
5774
-	*
5775
-	* @return Array the airport list
5776
-	*
5777
-	*/
5773
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
5774
+	 *
5775
+	 * @return Array the airport list
5776
+	 *
5777
+	 */
5778 5778
 	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array())
5779 5779
 	{
5780 5780
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5804,11 +5804,11 @@  discard block
 block discarded – undo
5804 5804
 	
5805 5805
 	
5806 5806
 	/**
5807
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft registration
5808
-	*
5809
-	* @return Array the airport list
5810
-	*
5811
-	*/
5807
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft registration
5808
+	 *
5809
+	 * @return Array the airport list
5810
+	 *
5811
+	 */
5812 5812
 	public function countAllDepartureAirportsByRegistration($registration,$filters = array())
5813 5813
 	{
5814 5814
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5841,11 +5841,11 @@  discard block
 block discarded – undo
5841 5841
 	
5842 5842
 	
5843 5843
 	/**
5844
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
5845
-	*
5846
-	* @return Array the airport list
5847
-	*
5848
-	*/
5844
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
5845
+	 *
5846
+	 * @return Array the airport list
5847
+	 *
5848
+	 */
5849 5849
 	public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array())
5850 5850
 	{
5851 5851
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5875,11 +5875,11 @@  discard block
 block discarded – undo
5875 5875
 	
5876 5876
 	
5877 5877
 	/**
5878
-	* Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
5879
-	*
5880
-	* @return Array the airport list
5881
-	*
5882
-	*/
5878
+	 * Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
5879
+	 *
5880
+	 * @return Array the airport list
5881
+	 *
5882
+	 */
5883 5883
 	public function countAllDepartureAirportsByAirport($airport_icao,$filters = array())
5884 5884
 	{
5885 5885
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5912,11 +5912,11 @@  discard block
 block discarded – undo
5912 5912
 	
5913 5913
 	
5914 5914
 	/**
5915
-	* Gets all departure airports by country of the airplanes that have flown over based on an airport icao
5916
-	*
5917
-	* @return Array the airport list
5918
-	*
5919
-	*/
5915
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airport icao
5916
+	 *
5917
+	 * @return Array the airport list
5918
+	 *
5919
+	 */
5920 5920
 	public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array())
5921 5921
 	{
5922 5922
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5947,11 +5947,11 @@  discard block
 block discarded – undo
5947 5947
 	
5948 5948
 	
5949 5949
 	/**
5950
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
5951
-	*
5952
-	* @return Array the airport list
5953
-	*
5954
-	*/
5950
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
5951
+	 *
5952
+	 * @return Array the airport list
5953
+	 *
5954
+	 */
5955 5955
 	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array())
5956 5956
 	{
5957 5957
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5984,11 +5984,11 @@  discard block
 block discarded – undo
5984 5984
 	
5985 5985
 	
5986 5986
 	/**
5987
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
5988
-	*
5989
-	* @return Array the airport list
5990
-	*
5991
-	*/
5987
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
5988
+	 *
5989
+	 * @return Array the airport list
5990
+	 *
5991
+	 */
5992 5992
 	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
5993 5993
 	{
5994 5994
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6018,11 +6018,11 @@  discard block
 block discarded – undo
6018 6018
 	
6019 6019
 	
6020 6020
 	/**
6021
-	* Gets all departure airports of the airplanes that have flown over based on a date
6022
-	*
6023
-	* @return Array the airport list
6024
-	*
6025
-	*/
6021
+	 * Gets all departure airports of the airplanes that have flown over based on a date
6022
+	 *
6023
+	 * @return Array the airport list
6024
+	 *
6025
+	 */
6026 6026
 	public function countAllDepartureAirportsByDate($date,$filters = array())
6027 6027
 	{
6028 6028
 		global $globalTimezone, $globalDBdriver;
@@ -6068,11 +6068,11 @@  discard block
 block discarded – undo
6068 6068
 	
6069 6069
 	
6070 6070
 	/**
6071
-	* Gets all departure airports by country of the airplanes that have flown over based on a date
6072
-	*
6073
-	* @return Array the airport list
6074
-	*
6075
-	*/
6071
+	 * Gets all departure airports by country of the airplanes that have flown over based on a date
6072
+	 *
6073
+	 * @return Array the airport list
6074
+	 *
6075
+	 */
6076 6076
 	public function countAllDepartureAirportCountriesByDate($date,$filters = array())
6077 6077
 	{
6078 6078
 		global $globalTimezone, $globalDBdriver;
@@ -6115,11 +6115,11 @@  discard block
 block discarded – undo
6115 6115
 	
6116 6116
 	
6117 6117
 	/**
6118
-	* Gets all departure airports of the airplanes that have flown over based on a ident/callsign
6119
-	*
6120
-	* @return Array the airport list
6121
-	*
6122
-	*/
6118
+	 * Gets all departure airports of the airplanes that have flown over based on a ident/callsign
6119
+	 *
6120
+	 * @return Array the airport list
6121
+	 *
6122
+	 */
6123 6123
 	public function countAllDepartureAirportsByIdent($ident,$filters = array())
6124 6124
 	{
6125 6125
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6153,11 +6153,11 @@  discard block
 block discarded – undo
6153 6153
 	
6154 6154
 	
6155 6155
 	/**
6156
-	* Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
6157
-	*
6158
-	* @return Array the airport list
6159
-	*
6160
-	*/
6156
+	 * Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
6157
+	 *
6158
+	 * @return Array the airport list
6159
+	 *
6160
+	 */
6161 6161
 	public function countAllDepartureAirportCountriesByIdent($ident,$filters = array())
6162 6162
 	{
6163 6163
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6188,11 +6188,11 @@  discard block
 block discarded – undo
6188 6188
 	
6189 6189
 	
6190 6190
 	/**
6191
-	* Gets all departure airports of the airplanes that have flown over based on a country
6192
-	*
6193
-	* @return Array the airport list
6194
-	*
6195
-	*/
6191
+	 * Gets all departure airports of the airplanes that have flown over based on a country
6192
+	 *
6193
+	 * @return Array the airport list
6194
+	 *
6195
+	 */
6196 6196
 	public function countAllDepartureAirportsByCountry($country,$filters = array())
6197 6197
 	{
6198 6198
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6226,11 +6226,11 @@  discard block
 block discarded – undo
6226 6226
 
6227 6227
 
6228 6228
 	/**
6229
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
6230
-	*
6231
-	* @return Array the airport list
6232
-	*
6233
-	*/
6229
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
6230
+	 *
6231
+	 * @return Array the airport list
6232
+	 *
6233
+	 */
6234 6234
 	public function countAllDepartureAirportCountriesByCountry($country,$filters = array())
6235 6235
 	{
6236 6236
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6260,40 +6260,40 @@  discard block
 block discarded – undo
6260 6260
 	
6261 6261
 
6262 6262
 	/**
6263
-	* Gets all arrival airports of the airplanes that have flown over
6264
-	*
6265
-	* @return Array the airport list
6266
-	*
6267
-	*/
6263
+	 * Gets all arrival airports of the airplanes that have flown over
6264
+	 *
6265
+	 * @return Array the airport list
6266
+	 *
6267
+	 */
6268 6268
 	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6269 6269
 	{
6270 6270
 		global $globalDBdriver;
6271 6271
 		$filter_query = $this->getFilter($filters,true,true);
6272 6272
 		$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 
6273 6273
 				FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA'";
6274
-                if ($olderthanmonths > 0) {
6275
-            		if ($globalDBdriver == 'mysql') {
6274
+				if ($olderthanmonths > 0) {
6275
+					if ($globalDBdriver == 'mysql') {
6276 6276
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6277 6277
 			} else {
6278 6278
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6279 6279
 			}
6280
-                if ($sincedate != '') {
6281
-            		if ($globalDBdriver == 'mysql') {
6280
+				if ($sincedate != '') {
6281
+					if ($globalDBdriver == 'mysql') {
6282 6282
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6283 6283
 			} else {
6284 6284
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6285 6285
 			}
6286 6286
 		}
6287
-            		if ($globalDBdriver == 'mysql') {
6287
+					if ($globalDBdriver == 'mysql') {
6288 6288
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6289 6289
 			} else {
6290 6290
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6291 6291
 			}
6292 6292
 		}
6293 6293
 
6294
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6295
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6296
-                $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6294
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6295
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6296
+				$query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6297 6297
 					ORDER BY airport_arrival_icao_count DESC";
6298 6298
 		if ($limit) $query .= " LIMIT 10";
6299 6299
       
@@ -6322,40 +6322,40 @@  discard block
 block discarded – undo
6322 6322
 	}
6323 6323
 
6324 6324
 	/**
6325
-	* Gets all arrival airports of the airplanes that have flown over
6326
-	*
6327
-	* @return Array the airport list
6328
-	*
6329
-	*/
6325
+	 * Gets all arrival airports of the airplanes that have flown over
6326
+	 *
6327
+	 * @return Array the airport list
6328
+	 *
6329
+	 */
6330 6330
 	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6331 6331
 	{
6332 6332
 		global $globalDBdriver;
6333 6333
 		$filter_query = $this->getFilter($filters,true,true);
6334 6334
 		$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 
6335 6335
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' ";
6336
-                if ($olderthanmonths > 0) {
6337
-            		if ($globalDBdriver == 'mysql') {
6336
+				if ($olderthanmonths > 0) {
6337
+					if ($globalDBdriver == 'mysql') {
6338 6338
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6339 6339
 			} else {
6340 6340
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6341 6341
 			}
6342
-                if ($sincedate != '') {
6343
-            		if ($globalDBdriver == 'mysql') {
6342
+				if ($sincedate != '') {
6343
+					if ($globalDBdriver == 'mysql') {
6344 6344
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6345 6345
 			} else {
6346 6346
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6347 6347
 			}
6348 6348
 		}
6349
-            		if ($globalDBdriver == 'mysql') {
6349
+					if ($globalDBdriver == 'mysql') {
6350 6350
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6351 6351
 			} else {
6352 6352
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6353 6353
 			}
6354 6354
 		}
6355 6355
 
6356
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6357
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6358
-                $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
6356
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6357
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6358
+				$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
6359 6359
 					ORDER BY airport_arrival_icao_count DESC";
6360 6360
 		if ($limit) $query .= " LIMIT 10";
6361 6361
       
@@ -6386,39 +6386,39 @@  discard block
 block discarded – undo
6386 6386
 
6387 6387
 
6388 6388
 	/**
6389
-	* Gets all detected arrival airports of the airplanes that have flown over
6390
-	*
6391
-	* @return Array the airport list
6392
-	*
6393
-	*/
6389
+	 * Gets all detected arrival airports of the airplanes that have flown over
6390
+	 *
6391
+	 * @return Array the airport list
6392
+	 *
6393
+	 */
6394 6394
 	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6395 6395
 	{
6396 6396
 		global $globalDBdriver;
6397 6397
 		$filter_query = $this->getFilter($filters,true,true);
6398 6398
 		$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 
6399 6399
 			FROM spotter_output, airport".$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";
6400
-                if ($olderthanmonths > 0) {
6401
-            		if ($globalDBdriver == 'mysql') {
6400
+				if ($olderthanmonths > 0) {
6401
+					if ($globalDBdriver == 'mysql') {
6402 6402
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6403 6403
 			} else {
6404 6404
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6405 6405
 			}
6406
-                if ($sincedate != '') {
6407
-            		if ($globalDBdriver == 'mysql') {
6406
+				if ($sincedate != '') {
6407
+					if ($globalDBdriver == 'mysql') {
6408 6408
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6409 6409
 			} else {
6410 6410
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6411 6411
 			}
6412 6412
 		}
6413
-            		if ($globalDBdriver == 'mysql') {
6413
+					if ($globalDBdriver == 'mysql') {
6414 6414
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6415 6415
 			} else {
6416 6416
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6417 6417
 			}
6418 6418
 		}
6419
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6420
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6421
-                $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6419
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6420
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6421
+				$query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6422 6422
 					ORDER BY airport_arrival_icao_count DESC";
6423 6423
 		if ($limit) $query .= " LIMIT 10";
6424 6424
       
@@ -6447,40 +6447,40 @@  discard block
 block discarded – undo
6447 6447
 	}
6448 6448
 	
6449 6449
 	/**
6450
-	* Gets all detected arrival airports of the airplanes that have flown over
6451
-	*
6452
-	* @return Array the airport list
6453
-	*
6454
-	*/
6450
+	 * Gets all detected arrival airports of the airplanes that have flown over
6451
+	 *
6452
+	 * @return Array the airport list
6453
+	 *
6454
+	 */
6455 6455
 	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6456 6456
 	{
6457 6457
 		global $globalDBdriver;
6458 6458
 		$filter_query = $this->getFilter($filters,true,true);
6459 6459
 		$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 
6460 6460
 			FROM spotter_output, airport".$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 ";
6461
-                if ($olderthanmonths > 0) {
6462
-            		if ($globalDBdriver == 'mysql') {
6461
+				if ($olderthanmonths > 0) {
6462
+					if ($globalDBdriver == 'mysql') {
6463 6463
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6464 6464
 			} else {
6465 6465
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6466 6466
 			}
6467
-                if ($sincedate != '') {
6468
-            		if ($globalDBdriver == 'mysql') {
6467
+				if ($sincedate != '') {
6468
+					if ($globalDBdriver == 'mysql') {
6469 6469
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6470 6470
 			} else {
6471 6471
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6472 6472
 			}
6473 6473
 		}
6474
-            		if ($globalDBdriver == 'mysql') {
6474
+					if ($globalDBdriver == 'mysql') {
6475 6475
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6476 6476
 			} else {
6477 6477
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6478 6478
 			}
6479 6479
 		}
6480 6480
 
6481
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6482
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6483
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6481
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6482
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6483
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6484 6484
 					ORDER BY airport_arrival_icao_count DESC";
6485 6485
 		if ($limit) $query .= " LIMIT 10";
6486 6486
       
@@ -6510,11 +6510,11 @@  discard block
 block discarded – undo
6510 6510
 	}	
6511 6511
 	
6512 6512
 	/**
6513
-	* Gets all arrival airports of the airplanes that have flown over based on an airline icao
6514
-	*
6515
-	* @return Array the airport list
6516
-	*
6517
-	*/
6513
+	 * Gets all arrival airports of the airplanes that have flown over based on an airline icao
6514
+	 *
6515
+	 * @return Array the airport list
6516
+	 *
6517
+	 */
6518 6518
 	public function countAllArrivalAirportsByAirline($airline_icao, $filters = array())
6519 6519
 	{
6520 6520
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6546,11 +6546,11 @@  discard block
 block discarded – undo
6546 6546
 	
6547 6547
 	
6548 6548
 	/**
6549
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
6550
-	*
6551
-	* @return Array the airport list
6552
-	*
6553
-	*/
6549
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
6550
+	 *
6551
+	 * @return Array the airport list
6552
+	 *
6553
+	 */
6554 6554
 	public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array())
6555 6555
 	{
6556 6556
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6581,11 +6581,11 @@  discard block
 block discarded – undo
6581 6581
 	
6582 6582
 	
6583 6583
 	/**
6584
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
6585
-	*
6586
-	* @return Array the airport list
6587
-	*
6588
-	*/
6584
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
6585
+	 *
6586
+	 * @return Array the airport list
6587
+	 *
6588
+	 */
6589 6589
 	public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array())
6590 6590
 	{
6591 6591
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6619,11 +6619,11 @@  discard block
 block discarded – undo
6619 6619
 	
6620 6620
 	
6621 6621
 	/**
6622
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
6623
-	*
6624
-	* @return Array the airport list
6625
-	*
6626
-	*/
6622
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
6623
+	 *
6624
+	 * @return Array the airport list
6625
+	 *
6626
+	 */
6627 6627
 	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array())
6628 6628
 	{
6629 6629
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6653,11 +6653,11 @@  discard block
 block discarded – undo
6653 6653
 	
6654 6654
 	
6655 6655
 	/**
6656
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
6657
-	*
6658
-	* @return Array the airport list
6659
-	*
6660
-	*/
6656
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
6657
+	 *
6658
+	 * @return Array the airport list
6659
+	 *
6660
+	 */
6661 6661
 	public function countAllArrivalAirportsByRegistration($registration,$filters = array())
6662 6662
 	{
6663 6663
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6691,11 +6691,11 @@  discard block
 block discarded – undo
6691 6691
 	
6692 6692
 	
6693 6693
 	/**
6694
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
6695
-	*
6696
-	* @return Array the airport list
6697
-	*
6698
-	*/
6694
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
6695
+	 *
6696
+	 * @return Array the airport list
6697
+	 *
6698
+	 */
6699 6699
 	public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array())
6700 6700
 	{
6701 6701
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6726,11 +6726,11 @@  discard block
 block discarded – undo
6726 6726
 	
6727 6727
 	
6728 6728
 	/**
6729
-	* Gets all arrival airports of the airplanes that have flown over based on an departure airport
6730
-	*
6731
-	* @return Array the airport list
6732
-	*
6733
-	*/
6729
+	 * Gets all arrival airports of the airplanes that have flown over based on an departure airport
6730
+	 *
6731
+	 * @return Array the airport list
6732
+	 *
6733
+	 */
6734 6734
 	public function countAllArrivalAirportsByAirport($airport_icao,$filters = array())
6735 6735
 	{
6736 6736
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6763,11 +6763,11 @@  discard block
 block discarded – undo
6763 6763
 	
6764 6764
 	
6765 6765
 	/**
6766
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
6767
-	*
6768
-	* @return Array the airport list
6769
-	*
6770
-	*/
6766
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
6767
+	 *
6768
+	 * @return Array the airport list
6769
+	 *
6770
+	 */
6771 6771
 	public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array())
6772 6772
 	{
6773 6773
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6797,11 +6797,11 @@  discard block
 block discarded – undo
6797 6797
 	
6798 6798
 	
6799 6799
 	/**
6800
-	* Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
6801
-	*
6802
-	* @return Array the airport list
6803
-	*
6804
-	*/
6800
+	 * Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
6801
+	 *
6802
+	 * @return Array the airport list
6803
+	 *
6804
+	 */
6805 6805
 	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array())
6806 6806
 	{
6807 6807
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6835,11 +6835,11 @@  discard block
 block discarded – undo
6835 6835
 	
6836 6836
 	
6837 6837
 	/**
6838
-	* Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
6839
-	*
6840
-	* @return Array the airport list
6841
-	*
6842
-	*/
6838
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
6839
+	 *
6840
+	 * @return Array the airport list
6841
+	 *
6842
+	 */
6843 6843
 	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
6844 6844
 	{
6845 6845
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6870,11 +6870,11 @@  discard block
 block discarded – undo
6870 6870
 	
6871 6871
 	
6872 6872
 	/**
6873
-	* Gets all arrival airports of the airplanes that have flown over based on a date
6874
-	*
6875
-	* @return Array the airport list
6876
-	*
6877
-	*/
6873
+	 * Gets all arrival airports of the airplanes that have flown over based on a date
6874
+	 *
6875
+	 * @return Array the airport list
6876
+	 *
6877
+	 */
6878 6878
 	public function countAllArrivalAirportsByDate($date,$filters = array())
6879 6879
 	{
6880 6880
 		global $globalTimezone, $globalDBdriver;
@@ -6920,11 +6920,11 @@  discard block
 block discarded – undo
6920 6920
 	
6921 6921
 	
6922 6922
 	/**
6923
-	* Gets all arrival airports by country of the airplanes that have flown over based on a date
6924
-	*
6925
-	* @return Array the airport list
6926
-	*
6927
-	*/
6923
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a date
6924
+	 *
6925
+	 * @return Array the airport list
6926
+	 *
6927
+	 */
6928 6928
 	public function countAllArrivalAirportCountriesByDate($date, $filters = array())
6929 6929
 	{
6930 6930
 		global $globalTimezone, $globalDBdriver;
@@ -6967,11 +6967,11 @@  discard block
 block discarded – undo
6967 6967
 	
6968 6968
 	
6969 6969
 	/**
6970
-	* Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
6971
-	*
6972
-	* @return Array the airport list
6973
-	*
6974
-	*/
6970
+	 * Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
6971
+	 *
6972
+	 * @return Array the airport list
6973
+	 *
6974
+	 */
6975 6975
 	public function countAllArrivalAirportsByIdent($ident,$filters = array())
6976 6976
 	{
6977 6977
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7004,11 +7004,11 @@  discard block
 block discarded – undo
7004 7004
 	
7005 7005
 	
7006 7006
 	/**
7007
-	* Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
7008
-	*
7009
-	* @return Array the airport list
7010
-	*
7011
-	*/
7007
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
7008
+	 *
7009
+	 * @return Array the airport list
7010
+	 *
7011
+	 */
7012 7012
 	public function countAllArrivalAirportCountriesByIdent($ident, $filters = array())
7013 7013
 	{
7014 7014
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7039,11 +7039,11 @@  discard block
 block discarded – undo
7039 7039
 	
7040 7040
 	
7041 7041
 	/**
7042
-	* Gets all arrival airports of the airplanes that have flown over based on a country
7043
-	*
7044
-	* @return Array the airport list
7045
-	*
7046
-	*/
7042
+	 * Gets all arrival airports of the airplanes that have flown over based on a country
7043
+	 *
7044
+	 * @return Array the airport list
7045
+	 *
7046
+	 */
7047 7047
 	public function countAllArrivalAirportsByCountry($country,$filters = array())
7048 7048
 	{
7049 7049
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7076,11 +7076,11 @@  discard block
 block discarded – undo
7076 7076
 	
7077 7077
 	
7078 7078
 	/**
7079
-	* Gets all arrival airports by country of the airplanes that have flown over based on a country
7080
-	*
7081
-	* @return Array the airport list
7082
-	*
7083
-	*/
7079
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a country
7080
+	 *
7081
+	 * @return Array the airport list
7082
+	 *
7083
+	 */
7084 7084
 	public function countAllArrivalAirportCountriesByCountry($country,$filters = array())
7085 7085
 	{
7086 7086
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7111,11 +7111,11 @@  discard block
 block discarded – undo
7111 7111
 
7112 7112
 
7113 7113
 	/**
7114
-	* Counts all airport departure countries
7115
-	*
7116
-	* @return Array the airport departure list
7117
-	*
7118
-	*/
7114
+	 * Counts all airport departure countries
7115
+	 *
7116
+	 * @return Array the airport departure list
7117
+	 *
7118
+	 */
7119 7119
 	public function countAllDepartureCountries($filters = array())
7120 7120
 	{
7121 7121
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7145,11 +7145,11 @@  discard block
 block discarded – undo
7145 7145
 	
7146 7146
 	
7147 7147
 	/**
7148
-	* Counts all airport arrival countries
7149
-	*
7150
-	* @return Array the airport arrival list
7151
-	*
7152
-	*/
7148
+	 * Counts all airport arrival countries
7149
+	 *
7150
+	 * @return Array the airport arrival list
7151
+	 *
7152
+	 */
7153 7153
 	public function countAllArrivalCountries($limit = true,$filters = array())
7154 7154
 	{
7155 7155
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7182,11 +7182,11 @@  discard block
 block discarded – undo
7182 7182
 
7183 7183
 
7184 7184
 	/**
7185
-	* Gets all route combinations
7186
-	*
7187
-	* @return Array the route list
7188
-	*
7189
-	*/
7185
+	 * Gets all route combinations
7186
+	 *
7187
+	 * @return Array the route list
7188
+	 *
7189
+	 */
7190 7190
 	public function countAllRoutes($filters = array())
7191 7191
 	{
7192 7192
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7225,11 +7225,11 @@  discard block
 block discarded – undo
7225 7225
 	
7226 7226
 	
7227 7227
 	/**
7228
-	* Gets all route combinations based on an aircraft
7229
-	*
7230
-	* @return Array the route list
7231
-	*
7232
-	*/
7228
+	 * Gets all route combinations based on an aircraft
7229
+	 *
7230
+	 * @return Array the route list
7231
+	 *
7232
+	 */
7233 7233
 	public function countAllRoutesByAircraft($aircraft_icao,$filters = array())
7234 7234
 	{
7235 7235
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7265,11 +7265,11 @@  discard block
 block discarded – undo
7265 7265
 	
7266 7266
 	
7267 7267
 	/**
7268
-	* Gets all route combinations based on an aircraft registration
7269
-	*
7270
-	* @return Array the route list
7271
-	*
7272
-	*/
7268
+	 * Gets all route combinations based on an aircraft registration
7269
+	 *
7270
+	 * @return Array the route list
7271
+	 *
7272
+	 */
7273 7273
 	public function countAllRoutesByRegistration($registration, $filters = array())
7274 7274
 	{
7275 7275
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7307,11 +7307,11 @@  discard block
 block discarded – undo
7307 7307
 	
7308 7308
 	
7309 7309
 	/**
7310
-	* Gets all route combinations based on an airline
7311
-	*
7312
-	* @return Array the route list
7313
-	*
7314
-	*/
7310
+	 * Gets all route combinations based on an airline
7311
+	 *
7312
+	 * @return Array the route list
7313
+	 *
7314
+	 */
7315 7315
 	public function countAllRoutesByAirline($airline_icao, $filters = array())
7316 7316
 	{
7317 7317
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7349,11 +7349,11 @@  discard block
 block discarded – undo
7349 7349
 	
7350 7350
 	
7351 7351
 	/**
7352
-	* Gets all route combinations based on an airport
7353
-	*
7354
-	* @return Array the route list
7355
-	*
7356
-	*/
7352
+	 * Gets all route combinations based on an airport
7353
+	 *
7354
+	 * @return Array the route list
7355
+	 *
7356
+	 */
7357 7357
 	public function countAllRoutesByAirport($airport_icao, $filters = array())
7358 7358
 	{
7359 7359
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7390,11 +7390,11 @@  discard block
 block discarded – undo
7390 7390
 	
7391 7391
 	
7392 7392
 	/**
7393
-	* Gets all route combinations based on an country
7394
-	*
7395
-	* @return Array the route list
7396
-	*
7397
-	*/
7393
+	 * Gets all route combinations based on an country
7394
+	 *
7395
+	 * @return Array the route list
7396
+	 *
7397
+	 */
7398 7398
 	public function countAllRoutesByCountry($country, $filters = array())
7399 7399
 	{
7400 7400
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7430,11 +7430,11 @@  discard block
 block discarded – undo
7430 7430
 
7431 7431
 
7432 7432
 	/**
7433
-	* Gets all route combinations based on an date
7434
-	*
7435
-	* @return Array the route list
7436
-	*
7437
-	*/
7433
+	 * Gets all route combinations based on an date
7434
+	 *
7435
+	 * @return Array the route list
7436
+	 *
7437
+	 */
7438 7438
 	public function countAllRoutesByDate($date, $filters = array())
7439 7439
 	{
7440 7440
 		global $globalTimezone, $globalDBdriver;
@@ -7484,11 +7484,11 @@  discard block
 block discarded – undo
7484 7484
 	
7485 7485
 	
7486 7486
 	/**
7487
-	* Gets all route combinations based on an ident/callsign
7488
-	*
7489
-	* @return Array the route list
7490
-	*
7491
-	*/
7487
+	 * Gets all route combinations based on an ident/callsign
7488
+	 *
7489
+	 * @return Array the route list
7490
+	 *
7491
+	 */
7492 7492
 	public function countAllRoutesByIdent($ident, $filters = array())
7493 7493
 	{
7494 7494
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7525,11 +7525,11 @@  discard block
 block discarded – undo
7525 7525
 	
7526 7526
 	
7527 7527
 	/**
7528
-	* Gets all route combinations based on an manufacturer
7529
-	*
7530
-	* @return Array the route list
7531
-	*
7532
-	*/
7528
+	 * Gets all route combinations based on an manufacturer
7529
+	 *
7530
+	 * @return Array the route list
7531
+	 *
7532
+	 */
7533 7533
 	public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array())
7534 7534
 	{
7535 7535
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7567,11 +7567,11 @@  discard block
 block discarded – undo
7567 7567
 	
7568 7568
 	
7569 7569
 	/**
7570
-	* Gets all route combinations with waypoints
7571
-	*
7572
-	* @return Array the route list
7573
-	*
7574
-	*/
7570
+	 * Gets all route combinations with waypoints
7571
+	 *
7572
+	 * @return Array the route list
7573
+	 *
7574
+	 */
7575 7575
 	public function countAllRoutesWithWaypoints($filters = array())
7576 7576
 	{
7577 7577
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7608,11 +7608,11 @@  discard block
 block discarded – undo
7608 7608
 	}
7609 7609
 	
7610 7610
 	/**
7611
-	* Gets all callsigns that have flown over
7612
-	*
7613
-	* @return Array the callsign list
7614
-	*
7615
-	*/
7611
+	 * Gets all callsigns that have flown over
7612
+	 *
7613
+	 * @return Array the callsign list
7614
+	 *
7615
+	 */
7616 7616
 	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
7617 7617
 	{
7618 7618
 		global $globalDBdriver;
@@ -7650,11 +7650,11 @@  discard block
 block discarded – undo
7650 7650
 	}
7651 7651
 
7652 7652
 	/**
7653
-	* Gets all callsigns that have flown over
7654
-	*
7655
-	* @return Array the callsign list
7656
-	*
7657
-	*/
7653
+	 * Gets all callsigns that have flown over
7654
+	 *
7655
+	 * @return Array the callsign list
7656
+	 *
7657
+	 */
7658 7658
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
7659 7659
 	{
7660 7660
 		global $globalDBdriver;
@@ -7695,11 +7695,11 @@  discard block
 block discarded – undo
7695 7695
 
7696 7696
 
7697 7697
 	/**
7698
-	* Counts all dates
7699
-	*
7700
-	* @return Array the date list
7701
-	*
7702
-	*/
7698
+	 * Counts all dates
7699
+	 *
7700
+	 * @return Array the date list
7701
+	 *
7702
+	 */
7703 7703
 	public function countAllDates($filters = array())
7704 7704
 	{
7705 7705
 		global $globalTimezone, $globalDBdriver;
@@ -7744,11 +7744,11 @@  discard block
 block discarded – undo
7744 7744
 	}
7745 7745
 	
7746 7746
 	/**
7747
-	* Counts all dates
7748
-	*
7749
-	* @return Array the date list
7750
-	*
7751
-	*/
7747
+	 * Counts all dates
7748
+	 *
7749
+	 * @return Array the date list
7750
+	 *
7751
+	 */
7752 7752
 	public function countAllDatesByAirlines($filters = array())
7753 7753
 	{
7754 7754
 		global $globalTimezone, $globalDBdriver;
@@ -7793,11 +7793,11 @@  discard block
 block discarded – undo
7793 7793
 	}	
7794 7794
 	
7795 7795
 	/**
7796
-	* Counts all dates during the last 7 days
7797
-	*
7798
-	* @return Array the date list
7799
-	*
7800
-	*/
7796
+	 * Counts all dates during the last 7 days
7797
+	 *
7798
+	 * @return Array the date list
7799
+	 *
7800
+	 */
7801 7801
 	public function countAllDatesLast7Days($filters = array())
7802 7802
 	{
7803 7803
 		global $globalTimezone, $globalDBdriver;
@@ -7819,7 +7819,7 @@  discard block
 block discarded – undo
7819 7819
 			$query .= " GROUP BY date_name 
7820 7820
 								ORDER BY date_name ASC";
7821 7821
 			$query_data = array(':offset' => $offset);
7822
-    		}
7822
+			}
7823 7823
 		
7824 7824
 		$sth = $this->db->prepare($query);
7825 7825
 		$sth->execute($query_data);
@@ -7839,11 +7839,11 @@  discard block
 block discarded – undo
7839 7839
 	}
7840 7840
 
7841 7841
 	/**
7842
-	* Counts all dates during the last month
7843
-	*
7844
-	* @return Array the date list
7845
-	*
7846
-	*/
7842
+	 * Counts all dates during the last month
7843
+	 *
7844
+	 * @return Array the date list
7845
+	 *
7846
+	 */
7847 7847
 	public function countAllDatesLastMonth($filters = array())
7848 7848
 	{
7849 7849
 		global $globalTimezone, $globalDBdriver;
@@ -7865,7 +7865,7 @@  discard block
 block discarded – undo
7865 7865
 			$query .= " GROUP BY date_name 
7866 7866
 								ORDER BY date_name ASC";
7867 7867
 			$query_data = array(':offset' => $offset);
7868
-    		}
7868
+			}
7869 7869
 		
7870 7870
 		$sth = $this->db->prepare($query);
7871 7871
 		$sth->execute($query_data);
@@ -7886,11 +7886,11 @@  discard block
 block discarded – undo
7886 7886
 
7887 7887
 
7888 7888
 	/**
7889
-	* Counts all dates during the last month
7890
-	*
7891
-	* @return Array the date list
7892
-	*
7893
-	*/
7889
+	 * Counts all dates during the last month
7890
+	 *
7891
+	 * @return Array the date list
7892
+	 *
7893
+	 */
7894 7894
 	public function countAllDatesLastMonthByAirlines($filters = array())
7895 7895
 	{
7896 7896
 		global $globalTimezone, $globalDBdriver;
@@ -7913,7 +7913,7 @@  discard block
 block discarded – undo
7913 7913
 								GROUP BY spotter_output.airline_icao, date_name 
7914 7914
 								ORDER BY date_name ASC";
7915 7915
 			$query_data = array(':offset' => $offset);
7916
-    		}
7916
+			}
7917 7917
 		
7918 7918
 		$sth = $this->db->prepare($query);
7919 7919
 		$sth->execute($query_data);
@@ -7935,11 +7935,11 @@  discard block
 block discarded – undo
7935 7935
 	
7936 7936
 
7937 7937
 	/**
7938
-	* Counts all month
7939
-	*
7940
-	* @return Array the month list
7941
-	*
7942
-	*/
7938
+	 * Counts all month
7939
+	 *
7940
+	 * @return Array the month list
7941
+	 *
7942
+	 */
7943 7943
 	public function countAllMonths($filters = array())
7944 7944
 	{
7945 7945
 		global $globalTimezone, $globalDBdriver;
@@ -7981,11 +7981,11 @@  discard block
 block discarded – undo
7981 7981
 	}
7982 7982
 
7983 7983
 	/**
7984
-	* Counts all month
7985
-	*
7986
-	* @return Array the month list
7987
-	*
7988
-	*/
7984
+	 * Counts all month
7985
+	 *
7986
+	 * @return Array the month list
7987
+	 *
7988
+	 */
7989 7989
 	public function countAllMonthsByAirlines($filters = array())
7990 7990
 	{
7991 7991
 		global $globalTimezone, $globalDBdriver;
@@ -8030,11 +8030,11 @@  discard block
 block discarded – undo
8030 8030
 	}
8031 8031
 
8032 8032
 	/**
8033
-	* Counts all military month
8034
-	*
8035
-	* @return Array the month list
8036
-	*
8037
-	*/
8033
+	 * Counts all military month
8034
+	 *
8035
+	 * @return Array the month list
8036
+	 *
8037
+	 */
8038 8038
 	public function countAllMilitaryMonths($filters = array())
8039 8039
 	{
8040 8040
 		global $globalTimezone, $globalDBdriver;
@@ -8075,11 +8075,11 @@  discard block
 block discarded – undo
8075 8075
 	}
8076 8076
 	
8077 8077
 	/**
8078
-	* Counts all month owners
8079
-	*
8080
-	* @return Array the month list
8081
-	*
8082
-	*/
8078
+	 * Counts all month owners
8079
+	 *
8080
+	 * @return Array the month list
8081
+	 *
8082
+	 */
8083 8083
 	public function countAllMonthsOwners($filters = array())
8084 8084
 	{
8085 8085
 		global $globalTimezone, $globalDBdriver;
@@ -8121,11 +8121,11 @@  discard block
 block discarded – undo
8121 8121
 	}
8122 8122
 	
8123 8123
 	/**
8124
-	* Counts all month owners
8125
-	*
8126
-	* @return Array the month list
8127
-	*
8128
-	*/
8124
+	 * Counts all month owners
8125
+	 *
8126
+	 * @return Array the month list
8127
+	 *
8128
+	 */
8129 8129
 	public function countAllMonthsOwnersByAirlines($filters = array())
8130 8130
 	{
8131 8131
 		global $globalTimezone, $globalDBdriver;
@@ -8168,11 +8168,11 @@  discard block
 block discarded – undo
8168 8168
 	}
8169 8169
 
8170 8170
 	/**
8171
-	* Counts all month pilot
8172
-	*
8173
-	* @return Array the month list
8174
-	*
8175
-	*/
8171
+	 * Counts all month pilot
8172
+	 *
8173
+	 * @return Array the month list
8174
+	 *
8175
+	 */
8176 8176
 	public function countAllMonthsPilots($filters = array())
8177 8177
 	{
8178 8178
 		global $globalTimezone, $globalDBdriver;
@@ -8214,11 +8214,11 @@  discard block
 block discarded – undo
8214 8214
 	}
8215 8215
 	
8216 8216
 	/**
8217
-	* Counts all month pilot
8218
-	*
8219
-	* @return Array the month list
8220
-	*
8221
-	*/
8217
+	 * Counts all month pilot
8218
+	 *
8219
+	 * @return Array the month list
8220
+	 *
8221
+	 */
8222 8222
 	public function countAllMonthsPilotsByAirlines($filters = array())
8223 8223
 	{
8224 8224
 		global $globalTimezone, $globalDBdriver;
@@ -8261,11 +8261,11 @@  discard block
 block discarded – undo
8261 8261
 	}
8262 8262
 
8263 8263
 	/**
8264
-	* Counts all month airline
8265
-	*
8266
-	* @return Array the month list
8267
-	*
8268
-	*/
8264
+	 * Counts all month airline
8265
+	 *
8266
+	 * @return Array the month list
8267
+	 *
8268
+	 */
8269 8269
 	public function countAllMonthsAirlines($filters = array())
8270 8270
 	{
8271 8271
 		global $globalTimezone, $globalDBdriver;
@@ -8307,11 +8307,11 @@  discard block
 block discarded – undo
8307 8307
 	}
8308 8308
 	
8309 8309
 	/**
8310
-	* Counts all month aircraft
8311
-	*
8312
-	* @return Array the month list
8313
-	*
8314
-	*/
8310
+	 * Counts all month aircraft
8311
+	 *
8312
+	 * @return Array the month list
8313
+	 *
8314
+	 */
8315 8315
 	public function countAllMonthsAircrafts($filters = array())
8316 8316
 	{
8317 8317
 		global $globalTimezone, $globalDBdriver;
@@ -8354,11 +8354,11 @@  discard block
 block discarded – undo
8354 8354
 	
8355 8355
 
8356 8356
 	/**
8357
-	* Counts all month aircraft
8358
-	*
8359
-	* @return Array the month list
8360
-	*
8361
-	*/
8357
+	 * Counts all month aircraft
8358
+	 *
8359
+	 * @return Array the month list
8360
+	 *
8361
+	 */
8362 8362
 	public function countAllMonthsAircraftsByAirlines($filters = array())
8363 8363
 	{
8364 8364
 		global $globalTimezone, $globalDBdriver;
@@ -8401,11 +8401,11 @@  discard block
 block discarded – undo
8401 8401
 	}
8402 8402
 
8403 8403
 	/**
8404
-	* Counts all month real arrival
8405
-	*
8406
-	* @return Array the month list
8407
-	*
8408
-	*/
8404
+	 * Counts all month real arrival
8405
+	 *
8406
+	 * @return Array the month list
8407
+	 *
8408
+	 */
8409 8409
 	public function countAllMonthsRealArrivals($filters = array())
8410 8410
 	{
8411 8411
 		global $globalTimezone, $globalDBdriver;
@@ -8448,11 +8448,11 @@  discard block
 block discarded – undo
8448 8448
 	
8449 8449
 
8450 8450
 	/**
8451
-	* Counts all month real arrival
8452
-	*
8453
-	* @return Array the month list
8454
-	*
8455
-	*/
8451
+	 * Counts all month real arrival
8452
+	 *
8453
+	 * @return Array the month list
8454
+	 *
8455
+	 */
8456 8456
 	public function countAllMonthsRealArrivalsByAirlines($filters = array())
8457 8457
 	{
8458 8458
 		global $globalTimezone, $globalDBdriver;
@@ -8496,11 +8496,11 @@  discard block
 block discarded – undo
8496 8496
 	
8497 8497
 
8498 8498
 	/**
8499
-	* Counts all dates during the last year
8500
-	*
8501
-	* @return Array the date list
8502
-	*
8503
-	*/
8499
+	 * Counts all dates during the last year
8500
+	 *
8501
+	 * @return Array the date list
8502
+	 *
8503
+	 */
8504 8504
 	public function countAllMonthsLastYear($filters)
8505 8505
 	{
8506 8506
 		global $globalTimezone, $globalDBdriver;
@@ -8522,7 +8522,7 @@  discard block
 block discarded – undo
8522 8522
 			$query .= " GROUP BY year_name, month_name
8523 8523
 								ORDER BY year_name, month_name ASC";
8524 8524
 			$query_data = array(':offset' => $offset);
8525
-    		}
8525
+			}
8526 8526
 		
8527 8527
 		$sth = $this->db->prepare($query);
8528 8528
 		$sth->execute($query_data);
@@ -8545,11 +8545,11 @@  discard block
 block discarded – undo
8545 8545
 	
8546 8546
 	
8547 8547
 	/**
8548
-	* Counts all hours
8549
-	*
8550
-	* @return Array the hour list
8551
-	*
8552
-	*/
8548
+	 * Counts all hours
8549
+	 *
8550
+	 * @return Array the hour list
8551
+	 *
8552
+	 */
8553 8553
 	public function countAllHours($orderby,$filters = array())
8554 8554
 	{
8555 8555
 		global $globalTimezone, $globalDBdriver;
@@ -8610,11 +8610,11 @@  discard block
 block discarded – undo
8610 8610
 	}
8611 8611
 	
8612 8612
 	/**
8613
-	* Counts all hours
8614
-	*
8615
-	* @return Array the hour list
8616
-	*
8617
-	*/
8613
+	 * Counts all hours
8614
+	 *
8615
+	 * @return Array the hour list
8616
+	 *
8617
+	 */
8618 8618
 	public function countAllHoursByAirlines($orderby, $filters = array())
8619 8619
 	{
8620 8620
 		global $globalTimezone, $globalDBdriver;
@@ -8677,11 +8677,11 @@  discard block
 block discarded – undo
8677 8677
 
8678 8678
 
8679 8679
 	/**
8680
-	* Counts all hours by airline
8681
-	*
8682
-	* @return Array the hour list
8683
-	*
8684
-	*/
8680
+	 * Counts all hours by airline
8681
+	 *
8682
+	 * @return Array the hour list
8683
+	 *
8684
+	 */
8685 8685
 	public function countAllHoursByAirline($airline_icao, $filters = array())
8686 8686
 	{
8687 8687
 		global $globalTimezone, $globalDBdriver;
@@ -8727,11 +8727,11 @@  discard block
 block discarded – undo
8727 8727
 	
8728 8728
 	
8729 8729
 	/**
8730
-	* Counts all hours by aircraft
8731
-	*
8732
-	* @return Array the hour list
8733
-	*
8734
-	*/
8730
+	 * Counts all hours by aircraft
8731
+	 *
8732
+	 * @return Array the hour list
8733
+	 *
8734
+	 */
8735 8735
 	public function countAllHoursByAircraft($aircraft_icao, $filters = array())
8736 8736
 	{
8737 8737
 		global $globalTimezone, $globalDBdriver;
@@ -8774,11 +8774,11 @@  discard block
 block discarded – undo
8774 8774
 	
8775 8775
 	
8776 8776
 	/**
8777
-	* Counts all hours by aircraft registration
8778
-	*
8779
-	* @return Array the hour list
8780
-	*
8781
-	*/
8777
+	 * Counts all hours by aircraft registration
8778
+	 *
8779
+	 * @return Array the hour list
8780
+	 *
8781
+	 */
8782 8782
 	public function countAllHoursByRegistration($registration, $filters = array())
8783 8783
 	{
8784 8784
 		global $globalTimezone, $globalDBdriver;
@@ -8821,11 +8821,11 @@  discard block
 block discarded – undo
8821 8821
 	
8822 8822
 	
8823 8823
 	/**
8824
-	* Counts all hours by airport
8825
-	*
8826
-	* @return Array the hour list
8827
-	*
8828
-	*/
8824
+	 * Counts all hours by airport
8825
+	 *
8826
+	 * @return Array the hour list
8827
+	 *
8828
+	 */
8829 8829
 	public function countAllHoursByAirport($airport_icao, $filters = array())
8830 8830
 	{
8831 8831
 		global $globalTimezone, $globalDBdriver;
@@ -8869,11 +8869,11 @@  discard block
 block discarded – undo
8869 8869
 	
8870 8870
 	
8871 8871
 	/**
8872
-	* Counts all hours by manufacturer
8873
-	*
8874
-	* @return Array the hour list
8875
-	*
8876
-	*/
8872
+	 * Counts all hours by manufacturer
8873
+	 *
8874
+	 * @return Array the hour list
8875
+	 *
8876
+	 */
8877 8877
 	public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array())
8878 8878
 	{
8879 8879
 		global $globalTimezone, $globalDBdriver;
@@ -8917,11 +8917,11 @@  discard block
 block discarded – undo
8917 8917
 	
8918 8918
 	
8919 8919
 	/**
8920
-	* Counts all hours by date
8921
-	*
8922
-	* @return Array the hour list
8923
-	*
8924
-	*/
8920
+	 * Counts all hours by date
8921
+	 *
8922
+	 * @return Array the hour list
8923
+	 *
8924
+	 */
8925 8925
 	public function countAllHoursByDate($date, $filters = array())
8926 8926
 	{
8927 8927
 		global $globalTimezone, $globalDBdriver;
@@ -8965,11 +8965,11 @@  discard block
 block discarded – undo
8965 8965
 	
8966 8966
 	
8967 8967
 	/**
8968
-	* Counts all hours by a ident/callsign
8969
-	*
8970
-	* @return Array the hour list
8971
-	*
8972
-	*/
8968
+	 * Counts all hours by a ident/callsign
8969
+	 *
8970
+	 * @return Array the hour list
8971
+	 *
8972
+	 */
8973 8973
 	public function countAllHoursByIdent($ident, $filters = array())
8974 8974
 	{
8975 8975
 		global $globalTimezone, $globalDBdriver;
@@ -9014,11 +9014,11 @@  discard block
 block discarded – undo
9014 9014
 	
9015 9015
 	
9016 9016
 	/**
9017
-	* Counts all hours by route
9018
-	*
9019
-	* @return Array the hour list
9020
-	*
9021
-	*/
9017
+	 * Counts all hours by route
9018
+	 *
9019
+	 * @return Array the hour list
9020
+	 *
9021
+	 */
9022 9022
 	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array())
9023 9023
 	{
9024 9024
 		global $globalTimezone, $globalDBdriver;
@@ -9062,11 +9062,11 @@  discard block
 block discarded – undo
9062 9062
 	
9063 9063
 	
9064 9064
 	/**
9065
-	* Counts all hours by country
9066
-	*
9067
-	* @return Array the hour list
9068
-	*
9069
-	*/
9065
+	 * Counts all hours by country
9066
+	 *
9067
+	 * @return Array the hour list
9068
+	 *
9069
+	 */
9070 9070
 	public function countAllHoursByCountry($country, $filters = array())
9071 9071
 	{
9072 9072
 		global $globalTimezone, $globalDBdriver;
@@ -9111,11 +9111,11 @@  discard block
 block discarded – undo
9111 9111
 
9112 9112
 
9113 9113
 	/**
9114
-	* Counts all aircraft that have flown over
9115
-	*
9116
-	* @return Integer the number of aircrafts
9117
-	*
9118
-	*/
9114
+	 * Counts all aircraft that have flown over
9115
+	 *
9116
+	 * @return Integer the number of aircrafts
9117
+	 *
9118
+	 */
9119 9119
 	public function countOverallAircrafts($filters = array())
9120 9120
 	{
9121 9121
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9127,11 +9127,11 @@  discard block
 block discarded – undo
9127 9127
 	}
9128 9128
 
9129 9129
 	/**
9130
-	* Counts all flight that really arrival
9131
-	*
9132
-	* @return Integer the number of aircrafts
9133
-	*
9134
-	*/
9130
+	 * Counts all flight that really arrival
9131
+	 *
9132
+	 * @return Integer the number of aircrafts
9133
+	 *
9134
+	 */
9135 9135
 	public function countOverallArrival($filters = array())
9136 9136
 	{
9137 9137
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9144,11 +9144,11 @@  discard block
 block discarded – undo
9144 9144
 	}
9145 9145
 
9146 9146
 	/**
9147
-	* Counts all pilots that have flown over
9148
-	*
9149
-	* @return Integer the number of pilots
9150
-	*
9151
-	*/
9147
+	 * Counts all pilots that have flown over
9148
+	 *
9149
+	 * @return Integer the number of pilots
9150
+	 *
9151
+	 */
9152 9152
 	public function countOverallPilots($filters = array())
9153 9153
 	{
9154 9154
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9160,11 +9160,11 @@  discard block
 block discarded – undo
9160 9160
 	}
9161 9161
 
9162 9162
 	/**
9163
-	* Counts all owners that have flown over
9164
-	*
9165
-	* @return Integer the number of owners
9166
-	*
9167
-	*/
9163
+	 * Counts all owners that have flown over
9164
+	 *
9165
+	 * @return Integer the number of owners
9166
+	 *
9167
+	 */
9168 9168
 	public function countOverallOwners($filters = array())
9169 9169
 	{
9170 9170
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9177,11 +9177,11 @@  discard block
 block discarded – undo
9177 9177
 	
9178 9178
 	
9179 9179
 	/**
9180
-	* Counts all flights that have flown over
9181
-	*
9182
-	* @return Integer the number of flights
9183
-	*
9184
-	*/
9180
+	 * Counts all flights that have flown over
9181
+	 *
9182
+	 * @return Integer the number of flights
9183
+	 *
9184
+	 */
9185 9185
 	public function countOverallFlights($filters = array())
9186 9186
 	{
9187 9187
 		$query  = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
@@ -9194,11 +9194,11 @@  discard block
 block discarded – undo
9194 9194
 	}
9195 9195
 	
9196 9196
 	/**
9197
-	* Counts all military flights that have flown over
9198
-	*
9199
-	* @return Integer the number of flights
9200
-	*
9201
-	*/
9197
+	 * Counts all military flights that have flown over
9198
+	 *
9199
+	 * @return Integer the number of flights
9200
+	 *
9201
+	 */
9202 9202
 	public function countOverallMilitaryFlights($filters = array())
9203 9203
 	{
9204 9204
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9213,11 +9213,11 @@  discard block
 block discarded – undo
9213 9213
 	
9214 9214
 	
9215 9215
 	/**
9216
-	* Counts all airlines that have flown over
9217
-	*
9218
-	* @return Integer the number of airlines
9219
-	*
9220
-	*/
9216
+	 * Counts all airlines that have flown over
9217
+	 *
9218
+	 * @return Integer the number of airlines
9219
+	 *
9220
+	 */
9221 9221
 	public function countOverallAirlines($filters = array())
9222 9222
 	{
9223 9223
 		$query  = "SELECT COUNT(DISTINCT spotter_output.airline_name) AS airline_count 
@@ -9231,11 +9231,11 @@  discard block
 block discarded – undo
9231 9231
 
9232 9232
   
9233 9233
 	/**
9234
-	* Counts all hours of today
9235
-	*
9236
-	* @return Array the hour list
9237
-	*
9238
-	*/
9234
+	 * Counts all hours of today
9235
+	 *
9236
+	 * @return Array the hour list
9237
+	 *
9238
+	 */
9239 9239
 	public function countAllHoursFromToday($filters = array())
9240 9240
 	{
9241 9241
 		global $globalTimezone, $globalDBdriver;
@@ -9275,11 +9275,11 @@  discard block
 block discarded – undo
9275 9275
 	}
9276 9276
     
9277 9277
 	/**
9278
-	* Gets all the spotter information based on calculated upcoming flights
9279
-	*
9280
-	* @return Array the spotter information
9281
-	*
9282
-	*/
9278
+	 * Gets all the spotter information based on calculated upcoming flights
9279
+	 *
9280
+	 * @return Array the spotter information
9281
+	 *
9282
+	 */
9283 9283
 	public function getUpcomingFlights($limit = '', $sort = '', $filters = array())
9284 9284
 	{
9285 9285
 		global $global_query, $globalDBdriver, $globalTimezone;
@@ -9354,12 +9354,12 @@  discard block
 block discarded – undo
9354 9354
 	}
9355 9355
     
9356 9356
     
9357
-     /**
9358
-	* Gets the Barrie Spotter ID based on the FlightAware ID
9359
-	*
9360
-	* @return Integer the Barrie Spotter ID
9357
+	 /**
9358
+	  * Gets the Barrie Spotter ID based on the FlightAware ID
9359
+	  *
9360
+	  * @return Integer the Barrie Spotter ID
9361 9361
 q	*
9362
-	*/
9362
+	  */
9363 9363
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
9364 9364
 	{
9365 9365
 		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
@@ -9380,13 +9380,13 @@  discard block
 block discarded – undo
9380 9380
   
9381 9381
  
9382 9382
 	/**
9383
-	* Parses a date string
9384
-	*
9385
-	* @param String $dateString the date string
9386
-	* @param String $timezone the timezone of a user
9387
-	* @return Array the time information
9388
-	*
9389
-	*/
9383
+	 * Parses a date string
9384
+	 *
9385
+	 * @param String $dateString the date string
9386
+	 * @param String $timezone the timezone of a user
9387
+	 * @return Array the time information
9388
+	 *
9389
+	 */
9390 9390
 	public function parseDateString($dateString, $timezone = '')
9391 9391
 	{
9392 9392
 		$time_array = array();
@@ -9422,12 +9422,12 @@  discard block
 block discarded – undo
9422 9422
 	
9423 9423
 	
9424 9424
 	/**
9425
-	* Parses the direction degrees to working
9426
-	*
9427
-	* @param Float $direction the direction in degrees
9428
-	* @return Array the direction information
9429
-	*
9430
-	*/
9425
+	 * Parses the direction degrees to working
9426
+	 *
9427
+	 * @param Float $direction the direction in degrees
9428
+	 * @return Array the direction information
9429
+	 *
9430
+	 */
9431 9431
 	public function parseDirection($direction = 0)
9432 9432
 	{
9433 9433
 		if ($direction == '') $direction = 0;
@@ -9506,12 +9506,12 @@  discard block
 block discarded – undo
9506 9506
 	
9507 9507
 	
9508 9508
 	/**
9509
-	* Gets the aircraft registration
9510
-	*
9511
-	* @param String $flightaware_id the flight aware id
9512
-	* @return String the aircraft registration
9513
-	*
9514
-	*/
9509
+	 * Gets the aircraft registration
9510
+	 *
9511
+	 * @param String $flightaware_id the flight aware id
9512
+	 * @return String the aircraft registration
9513
+	 *
9514
+	 */
9515 9515
 	
9516 9516
 	public function getAircraftRegistration($flightaware_id)
9517 9517
 	{
@@ -9540,12 +9540,12 @@  discard block
 block discarded – undo
9540 9540
 
9541 9541
 
9542 9542
 	/**
9543
-	* Gets the aircraft registration from ModeS
9544
-	*
9545
-	* @param String $aircraft_modes the flight ModeS in hex
9546
-	* @return String the aircraft registration
9547
-	*
9548
-	*/
9543
+	 * Gets the aircraft registration from ModeS
9544
+	 *
9545
+	 * @param String $aircraft_modes the flight ModeS in hex
9546
+	 * @return String the aircraft registration
9547
+	 *
9548
+	 */
9549 9549
 	public function getAircraftRegistrationBymodeS($aircraft_modes)
9550 9550
 	{
9551 9551
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -9558,19 +9558,19 @@  discard block
 block discarded – undo
9558 9558
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
9559 9559
 		$sth->closeCursor();
9560 9560
 		if (count($row) > 0) {
9561
-		    //return $row['Registration'];
9562
-		    return $row['registration'];
9561
+			//return $row['Registration'];
9562
+			return $row['registration'];
9563 9563
 		} else return '';
9564 9564
 	
9565 9565
 	}
9566 9566
 
9567 9567
 	/**
9568
-	* Gets the aircraft type from ModeS
9569
-	*
9570
-	* @param String $aircraft_modes the flight ModeS in hex
9571
-	* @return String the aircraft type
9572
-	*
9573
-	*/
9568
+	 * Gets the aircraft type from ModeS
9569
+	 *
9570
+	 * @param String $aircraft_modes the flight ModeS in hex
9571
+	 * @return String the aircraft type
9572
+	 *
9573
+	 */
9574 9574
 	public function getAircraftTypeBymodeS($aircraft_modes)
9575 9575
 	{
9576 9576
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -9583,19 +9583,19 @@  discard block
 block discarded – undo
9583 9583
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
9584 9584
 		$sth->closeCursor();
9585 9585
 		if (count($row) > 0) {
9586
-		    if ($row['type_flight'] == null) return '';
9587
-		    else return $row['type_flight'];
9586
+			if ($row['type_flight'] == null) return '';
9587
+			else return $row['type_flight'];
9588 9588
 		} else return '';
9589 9589
 	
9590 9590
 	}
9591 9591
 
9592 9592
 	/**
9593
-	* Gets Countrie from latitude/longitude
9594
-	*
9595
-	* @param Float $latitude latitute of the flight
9596
-	* @param Float $longitude longitute of the flight
9597
-	* @return String the countrie
9598
-	*/
9593
+	 * Gets Countrie from latitude/longitude
9594
+	 *
9595
+	 * @param Float $latitude latitute of the flight
9596
+	 * @param Float $longitude longitute of the flight
9597
+	 * @return String the countrie
9598
+	 */
9599 9599
 	public function getCountryFromLatitudeLongitude($latitude,$longitude)
9600 9600
 	{
9601 9601
 		global $globalDBdriver, $globalDebug;
@@ -9632,12 +9632,12 @@  discard block
 block discarded – undo
9632 9632
 	}
9633 9633
 
9634 9634
 	/**
9635
-	* converts the registration code using the country prefix
9636
-	*
9637
-	* @param String $registration the aircraft registration
9638
-	* @return String the aircraft registration
9639
-	*
9640
-	*/
9635
+	 * converts the registration code using the country prefix
9636
+	 *
9637
+	 * @param String $registration the aircraft registration
9638
+	 * @return String the aircraft registration
9639
+	 *
9640
+	 */
9641 9641
 	public function convertAircraftRegistration($registration)
9642 9642
 	{
9643 9643
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -9689,12 +9689,12 @@  discard block
 block discarded – undo
9689 9689
 	}
9690 9690
 
9691 9691
 	/**
9692
-	* Country from the registration code
9693
-	*
9694
-	* @param String $registration the aircraft registration
9695
-	* @return String the country
9696
-	*
9697
-	*/
9692
+	 * Country from the registration code
9693
+	 *
9694
+	 * @param String $registration the aircraft registration
9695
+	 * @return String the country
9696
+	 *
9697
+	 */
9698 9698
 	public function countryFromAircraftRegistration($registration)
9699 9699
 	{
9700 9700
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -9713,8 +9713,8 @@  discard block
 block discarded – undo
9713 9713
 				$country = $row['country'];
9714 9714
 			}
9715 9715
 		} else {
9716
-    			$registration_1 = substr($registration, 0, 1);
9717
-		        $registration_2 = substr($registration, 0, 2);
9716
+				$registration_1 = substr($registration, 0, 1);
9717
+				$registration_2 = substr($registration, 0, 2);
9718 9718
 
9719 9719
 			$country = '';
9720 9720
 			//first get the prefix based on two characters
@@ -9750,11 +9750,11 @@  discard block
 block discarded – undo
9750 9750
 	}
9751 9751
 	
9752 9752
 	/**
9753
-	* Set a new highlight value for a flight
9754
-	*
9755
-	* @param String $flightaware_id flightaware_id from spotter_output table
9756
-	* @param String $highlight New highlight value
9757
-	*/
9753
+	 * Set a new highlight value for a flight
9754
+	 *
9755
+	 * @param String $flightaware_id flightaware_id from spotter_output table
9756
+	 * @param String $highlight New highlight value
9757
+	 */
9758 9758
 	public function setHighlightFlight($flightaware_id,$highlight) {
9759 9759
 		
9760 9760
 		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
@@ -9763,12 +9763,12 @@  discard block
 block discarded – undo
9763 9763
 	}
9764 9764
 	
9765 9765
 	/**
9766
-	* Gets the short url from bit.ly
9767
-	*
9768
-	* @param String $url the full url
9769
-	* @return String the bit.ly url
9770
-	*
9771
-	*/
9766
+	 * Gets the short url from bit.ly
9767
+	 *
9768
+	 * @param String $url the full url
9769
+	 * @return String the bit.ly url
9770
+	 *
9771
+	 */
9772 9772
 	public function getBitlyURL($url)
9773 9773
 	{
9774 9774
 		global $globalBitlyAccessToken;
@@ -10057,11 +10057,11 @@  discard block
 block discarded – undo
10057 10057
 			$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 
10058 10058
 	                      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)) 
10059 10059
 	                      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;";
10060
-                } else {
10060
+				} else {
10061 10061
 			$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 
10062 10062
 	                      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)) 
10063 10063
 	                      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;";
10064
-    		}
10064
+			}
10065 10065
 		$sth = $this->db->prepare($query);
10066 10066
 		$sth->execute();
10067 10067
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
Please login to merge, or discard this patch.
Spacing   +993 added lines, -993 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 require_once(dirname(__FILE__).'/class.Image.php');
5 5
 $global_query = "SELECT spotter_output.* FROM spotter_output";
6 6
 
7
-class Spotter{
7
+class Spotter {
8 8
 	public $db;
9 9
 	
10 10
 	public function __construct($dbc = null) {
@@ -17,15 +17,15 @@  discard block
 block discarded – undo
17 17
 	* @param Array $filter the filter
18 18
 	* @return Array the SQL part
19 19
 	*/
20
-	public function getFilter($filter = array(),$where = false,$and = false) {
20
+	public function getFilter($filter = array(), $where = false, $and = false) {
21 21
 		global $globalFilter, $globalStatsFilters, $globalFilterName;
22
-		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) $filter = array_merge($globalStatsFilters[$globalFilterName],$filter);
23
-		if (is_array($globalFilter)) $filter = array_merge($globalFilter,$filter);
22
+		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) $filter = array_merge($globalStatsFilters[$globalFilterName], $filter);
23
+		if (is_array($globalFilter)) $filter = array_merge($globalFilter, $filter);
24 24
 		$filter_query_join = '';
25 25
 		$filter_query_where = '';
26 26
 		if (isset($filter['airlines']) && !empty($filter['airlines'])) {
27 27
 			if ($filter['airlines'][0] != '') {
28
-				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
28
+				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
29 29
 			}
30 30
 		}
31 31
 		
@@ -33,19 +33,19 @@  discard block
 block discarded – undo
33 33
 			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_output.flightaware_id ";
34 34
 		}
35 35
 		if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) {
36
-			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
36
+			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id";
37 37
 		}
38 38
 		if (isset($filter['source']) && !empty($filter['source'])) {
39
-			$filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')";
39
+			$filter_query_where = " WHERE format_source IN ('".implode("','", $filter['source'])."')";
40 40
 		}
41 41
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
42 42
 			$filter_query_where = " WHERE ident = '".$filter['ident']."'";
43 43
 		}
44 44
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
45 45
 			if ($filter_query_where == '') {
46
-				$filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
46
+				$filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
47 47
 			} else {
48
-				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
48
+				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
49 49
 			}
50 50
 		}
51 51
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 			$sth = $this->db->prepare($query.$limitQuery);
94 94
 			$sth->execute($params);
95 95
 		} catch (PDOException $e) {
96
-			printf("Invalid query : %s\nWhole query: %s\n",$e->getMessage(), $query.$limitQuery);
96
+			printf("Invalid query : %s\nWhole query: %s\n", $e->getMessage(), $query.$limitQuery);
97 97
 			exit();
98 98
 		}
99 99
 		
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 		$spotter_array = array();
104 104
 		
105 105
 
106
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
106
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
107 107
 		{
108 108
 			$num_rows++;
109 109
 			$temp_array = array();
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 			if (isset($row['route_stop'])) {
149 149
 				$temp_array['route_stop'] = $row['route_stop'];
150 150
 				if ($row['route_stop'] != '') {
151
-					$allroute = explode(' ',$row['route_stop']);
151
+					$allroute = explode(' ', $row['route_stop']);
152 152
 			
153 153
 					foreach ($allroute as $route) {
154 154
 						$route_airport_array = $this->getAllAirportInfo($route);
@@ -203,11 +203,11 @@  discard block
 block discarded – undo
203 203
 				{
204 204
 					$temp_array['date'] = "about ".$dateArray['hours']." hours ago";
205 205
 				} else {
206
-					$temp_array['date'] = date("M j Y, g:i a",strtotime($row['date']." UTC"));
206
+					$temp_array['date'] = date("M j Y, g:i a", strtotime($row['date']." UTC"));
207 207
 				}
208 208
 				$temp_array['date_minutes_past'] = $dateArray['minutes'];
209
-				$temp_array['date_iso_8601'] = date("c",strtotime($row['date']." UTC"));
210
-				$temp_array['date_rfc_2822'] = date("r",strtotime($row['date']." UTC"));
209
+				$temp_array['date_iso_8601'] = date("c", strtotime($row['date']." UTC"));
210
+				$temp_array['date_rfc_2822'] = date("r", strtotime($row['date']." UTC"));
211 211
 				$temp_array['date_unix'] = strtotime($row['date']." UTC");
212 212
 			}
213 213
 			
@@ -241,9 +241,9 @@  discard block
 block discarded – undo
241 241
 			if (!isset($row['airline_name']) || $row['airline_name'] == '') {
242 242
 				if (!is_numeric(substr($row['ident'], 0, 3))) {
243 243
 					if (is_numeric(substr($row['ident'], 2, 1))) {
244
-						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2),$fromsource);
244
+						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2), $fromsource);
245 245
 					} elseif (is_numeric(substr($row['ident'], 3, 1))) {
246
-						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
246
+						$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource);
247 247
 					} else {
248 248
 						$airline_array = $this->getAllAirlineInfo('NA');
249 249
 					}
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 				$temp_array['airline_type'] = $row['airline_type'];
270 270
 			}
271 271
 			if (isset($temp_array['airline_iata']) && $temp_array['airline_iata'] != '') {
272
-				$acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'],3));
272
+				$acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'], 3));
273 273
 				//$acars_array = ACARS->getLiveAcarsData('BA40YL');
274 274
 				if (count($acars_array) > 0) {
275 275
 					$temp_array['acars'] = $acars_array;
@@ -286,11 +286,11 @@  discard block
 block discarded – undo
286 286
 				$temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg'];
287 287
 			}
288 288
 
289
-			if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
289
+			if ($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
290 290
 			{
291 291
 				if ($globalIVAO) {
292
-					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
293
-					else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
292
+					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('', $temp_array['aircraft_type'], $temp_array['airline_icao']);
293
+					else $image_array = $Image->getSpotterImage('', $temp_array['aircraft_type']);
294 294
 				} else $image_array = $Image->getSpotterImage($temp_array['registration']);
295 295
 				if (count($image_array) > 0) {
296 296
 					$temp_array['image'] = $image_array[0]['image'];
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 			if (isset($row['arrival_airport_time']) && $row['arrival_airport_time'] != '') {
314 314
 				$temp_array['arrival_airport_time'] = $row['arrival_airport_time'];
315 315
 			}
316
-			if ((!isset($globalIVAO) || ! $globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) {
316
+			if ((!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) {
317 317
 				$schedule_array = $Schedule->getSchedule($temp_array['ident']);
318 318
 				//print_r($schedule_array);
319 319
 				if (count($schedule_array) > 0) {
@@ -394,12 +394,12 @@  discard block
 block discarded – undo
394 394
 			if (isset($row['squawk'])) {
395 395
 				$temp_array['squawk'] = $row['squawk'];
396 396
 				if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) {
397
-					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']);
398
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
397
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['country_iso2']);
398
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
399 399
 				} elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) {
400
-					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']);
401
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
402
-				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
400
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['over_country']);
401
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
402
+				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry);
403 403
 			}
404 404
     			
405 405
 			$temp_array['query_number_rows'] = $num_rows;
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 	* @return Array the spotter information
419 419
 	*
420 420
 	*/
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())
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;
424 424
 		require_once(dirname(__FILE__).'/class.Translation.php');
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
 
429 429
 		$query_values = array();
430 430
 		$additional_query = '';
431
-		$filter_query = $this->getFilter($filters,true,true);
431
+		$filter_query = $this->getFilter($filters, true, true);
432 432
 		if ($q != "")
433 433
 		{
434 434
 			if (!is_string($q))
@@ -436,8 +436,8 @@  discard block
 block discarded – undo
436 436
 				return false;
437 437
 			} else {
438 438
 				$q_array = explode(" ", $q);
439
-				foreach ($q_array as $q_item){
440
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
439
+				foreach ($q_array as $q_item) {
440
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
441 441
 					$additional_query .= " AND (";
442 442
 					if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
443 443
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
@@ -469,37 +469,37 @@  discard block
 block discarded – undo
469 469
 
470 470
 		if ($registration != "")
471 471
 		{
472
-			$registration = filter_var($registration,FILTER_SANITIZE_STRING);
472
+			$registration = filter_var($registration, FILTER_SANITIZE_STRING);
473 473
 			if (!is_string($registration))
474 474
 			{
475 475
 				return false;
476 476
 			} else {
477 477
 				$additional_query .= " AND spotter_output.registration = :registration";
478
-				$query_values = array_merge($query_values,array(':registration' => $registration));
478
+				$query_values = array_merge($query_values, array(':registration' => $registration));
479 479
 			}
480 480
 		}
481 481
 
482 482
 		if ($aircraft_icao != "")
483 483
 		{
484
-			$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
484
+			$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
485 485
 			if (!is_string($aircraft_icao))
486 486
 			{
487 487
 				return false;
488 488
 			} else {
489 489
 				$additional_query .= " AND spotter_output.aircraft_icao = :aircraft_icao";
490
-				$query_values = array_merge($query_values,array(':aircraft_icao' => $aircraft_icao));
490
+				$query_values = array_merge($query_values, array(':aircraft_icao' => $aircraft_icao));
491 491
 			}
492 492
 		}
493 493
 
494 494
 		if ($aircraft_manufacturer != "")
495 495
 		{
496
-			$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
496
+			$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
497 497
 			if (!is_string($aircraft_manufacturer))
498 498
 			{
499 499
 				return false;
500 500
 			} else {
501 501
 				$additional_query .= " AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer";
502
-				$query_values = array_merge($query_values,array(':aircraft_manufacturer' => $aircraft_manufacturer));
502
+				$query_values = array_merge($query_values, array(':aircraft_manufacturer' => $aircraft_manufacturer));
503 503
 			}
504 504
 		}
505 505
 
@@ -515,25 +515,25 @@  discard block
 block discarded – undo
515 515
 
516 516
 		if ($airline_icao != "")
517 517
 		{
518
-			$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
518
+			$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
519 519
 			if (!is_string($airline_icao))
520 520
 			{
521 521
 				return false;
522 522
 			} else {
523 523
 				$additional_query .= " AND spotter_output.airline_icao = :airline_icao";
524
-				$query_values = array_merge($query_values,array(':airline_icao' => $airline_icao));
524
+				$query_values = array_merge($query_values, array(':airline_icao' => $airline_icao));
525 525
 			}
526 526
 		}
527 527
 
528 528
 		if ($airline_country != "")
529 529
 		{
530
-			$airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
530
+			$airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING);
531 531
 			if (!is_string($airline_country))
532 532
 			{
533 533
 				return false;
534 534
 			} else {
535 535
 				$additional_query .= " AND spotter_output.airline_country = :airline_country";
536
-				$query_values = array_merge($query_values,array(':airline_country' => $airline_country));
536
+				$query_values = array_merge($query_values, array(':airline_country' => $airline_country));
537 537
 			}
538 538
 		}
539 539
 
@@ -560,31 +560,31 @@  discard block
 block discarded – undo
560 560
 
561 561
 		if ($airport != "")
562 562
 		{
563
-			$airport = filter_var($airport,FILTER_SANITIZE_STRING);
563
+			$airport = filter_var($airport, FILTER_SANITIZE_STRING);
564 564
 			if (!is_string($airport))
565 565
 			{
566 566
 				return false;
567 567
 			} else {
568 568
 				$additional_query .= " AND (spotter_output.departure_airport_icao = :airport OR spotter_output.arrival_airport_icao = :airport)";
569
-				$query_values = array_merge($query_values,array(':airport' => $airport));
569
+				$query_values = array_merge($query_values, array(':airport' => $airport));
570 570
 			}
571 571
 		}
572 572
 
573 573
 		if ($airport_country != "")
574 574
 		{
575
-			$airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
575
+			$airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING);
576 576
 			if (!is_string($airport_country))
577 577
 			{
578 578
 				return false;
579 579
 			} else {
580 580
 				$additional_query .= " AND (spotter_output.departure_airport_country = :airport_country OR spotter_output.arrival_airport_country = :airport_country)";
581
-				$query_values = array_merge($query_values,array(':airport_country' => $airport_country));
581
+				$query_values = array_merge($query_values, array(':airport_country' => $airport_country));
582 582
 			}
583 583
 		}
584 584
     
585 585
 		if ($callsign != "")
586 586
 		{
587
-			$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
587
+			$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
588 588
 			if (!is_string($callsign))
589 589
 			{
590 590
 				return false;
@@ -592,79 +592,79 @@  discard block
 block discarded – undo
592 592
 				$translate = $Translation->ident2icao($callsign);
593 593
 				if ($translate != $callsign) {
594 594
 					$additional_query .= " AND (spotter_output.ident = :callsign OR spotter_output.ident = :translate)";
595
-					$query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate));
595
+					$query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate));
596 596
 				} else {
597 597
 					$additional_query .= " AND spotter_output.ident = :callsign";
598
-					$query_values = array_merge($query_values,array(':callsign' => $callsign));
598
+					$query_values = array_merge($query_values, array(':callsign' => $callsign));
599 599
 				}
600 600
 			}
601 601
 		}
602 602
 
603 603
 		if ($owner != "")
604 604
 		{
605
-			$owner = filter_var($owner,FILTER_SANITIZE_STRING);
605
+			$owner = filter_var($owner, FILTER_SANITIZE_STRING);
606 606
 			if (!is_string($owner))
607 607
 			{
608 608
 				return false;
609 609
 			} else {
610 610
 				$additional_query .= " AND spotter_output.owner_name = :owner";
611
-				$query_values = array_merge($query_values,array(':owner' => $owner));
611
+				$query_values = array_merge($query_values, array(':owner' => $owner));
612 612
 			}
613 613
 		}
614 614
 
615 615
 		if ($pilot_name != "")
616 616
 		{
617
-			$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
617
+			$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
618 618
 			if (!is_string($pilot_name))
619 619
 			{
620 620
 				return false;
621 621
 			} else {
622 622
 				$additional_query .= " AND spotter_output.pilot_name = :pilot_name";
623
-				$query_values = array_merge($query_values,array(':pilot_name' => $pilot_name));
623
+				$query_values = array_merge($query_values, array(':pilot_name' => $pilot_name));
624 624
 			}
625 625
 		}
626 626
 
627 627
 		if ($pilot_id != "")
628 628
 		{
629
-			$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT);
629
+			$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT);
630 630
 			if (!is_string($pilot_id))
631 631
 			{
632 632
 				return false;
633 633
 			} else {
634 634
 				$additional_query .= " AND spotter_output.pilot_id = :pilot_id";
635
-				$query_values = array_merge($query_values,array(':pilot_id' => $pilot_id));
635
+				$query_values = array_merge($query_values, array(':pilot_id' => $pilot_id));
636 636
 			}
637 637
 		}
638 638
 
639 639
 		if ($departure_airport_route != "")
640 640
 		{
641
-			$departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
641
+			$departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING);
642 642
 			if (!is_string($departure_airport_route))
643 643
 			{
644 644
 				return false;
645 645
 			} else {
646 646
 				$additional_query .= " AND spotter_output.departure_airport_icao = :departure_airport_route";
647
-				$query_values = array_merge($query_values,array(':departure_airport_route' => $departure_airport_route));
647
+				$query_values = array_merge($query_values, array(':departure_airport_route' => $departure_airport_route));
648 648
 			}
649 649
 		}
650 650
 
651 651
 		if ($arrival_airport_route != "")
652 652
 		{
653
-			$arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
653
+			$arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING);
654 654
 			if (!is_string($arrival_airport_route))
655 655
 			{
656 656
 				return false;
657 657
 			} else {
658 658
 				$additional_query .= " AND spotter_output.arrival_airport_icao = :arrival_airport_route";
659
-				$query_values = array_merge($query_values,array(':arrival_airport_route' => $arrival_airport_route));
659
+				$query_values = array_merge($query_values, array(':arrival_airport_route' => $arrival_airport_route));
660 660
 			}
661 661
 		}
662 662
 
663 663
 		if ($altitude != "")
664 664
 		{
665 665
 			$altitude_array = explode(",", $altitude);
666
-			$altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
667
-			$altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
666
+			$altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
667
+			$altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
668 668
 
669 669
 			if ($altitude_array[1] != "")
670 670
 			{                
@@ -680,8 +680,8 @@  discard block
 block discarded – undo
680 680
 		if ($date_posted != "")
681 681
 		{
682 682
 			$date_array = explode(",", $date_posted);
683
-			$date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING);
684
-			$date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING);
683
+			$date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING);
684
+			$date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING);
685 685
 
686 686
 			if ($globalTimezone != '') {
687 687
 				date_default_timezone_set($globalTimezone);
@@ -712,8 +712,8 @@  discard block
 block discarded – undo
712 712
 		{
713 713
 			$limit_array = explode(",", $limit);
714 714
 			
715
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
716
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
715
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
716
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
717 717
 			
718 718
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
719 719
 			{
@@ -742,23 +742,23 @@  discard block
 block discarded – undo
742 742
 
743 743
 
744 744
 		if ($origLat != "" && $origLon != "" && $dist != "") {
745
-			$dist = number_format($dist*0.621371,2,'.',''); // convert km to mile
745
+			$dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile
746 746
 
747 747
 			if ($globalDBdriver == 'mysql') {
748
-				$query="SELECT spotter_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2))) as distance 
748
+				$query = "SELECT spotter_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2))) as distance 
749 749
 						FROM spotter_archive,spotter_output".$filter_query." spotter_output.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND spotter_archive.longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and spotter_archive.latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
750 750
 						AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2)))) < $dist".$orderby_query;
751 751
 			} else {
752
-				$query="SELECT spotter_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance 
752
+				$query = "SELECT spotter_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance 
753 753
 						FROM spotter_archive,spotter_output".$filter_query." spotter_output.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND CAST(spotter_archive.longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(spotter_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
754 754
 						AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2)))) < $dist".$filter_query.$orderby_query;
755 755
 			}
756 756
 		} else {		
757
-			$query  = "SELECT spotter_output.* FROM spotter_output".$filter_query." spotter_output.ident <> '' 
757
+			$query = "SELECT spotter_output.* FROM spotter_output".$filter_query." spotter_output.ident <> '' 
758 758
 					".$additional_query."
759 759
 					".$orderby_query;
760 760
 		}
761
-		$spotter_array = $this->getDataFromDB($query, $query_values,$limit_query);
761
+		$spotter_array = $this->getDataFromDB($query, $query_values, $limit_query);
762 762
 		return $spotter_array;
763 763
 	}
764 764
 	
@@ -781,8 +781,8 @@  discard block
 block discarded – undo
781 781
 		{
782 782
 			$limit_array = explode(",", $limit);
783 783
 			
784
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
785
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
784
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
785
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
786 786
 			
787 787
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
788 788
 			{
@@ -799,9 +799,9 @@  discard block
 block discarded – undo
799 799
 			$orderby_query = " ORDER BY spotter_output.date DESC";
800 800
 		}
801 801
 
802
-		$query  = $global_query.$filter_query." ".$orderby_query;
802
+		$query = $global_query.$filter_query." ".$orderby_query;
803 803
 
804
-		$spotter_array = $this->getDataFromDB($query, array(),$limit_query);
804
+		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
805 805
 
806 806
 		return $spotter_array;
807 807
 	}
@@ -847,34 +847,34 @@  discard block
 block discarded – undo
847 847
 			{
848 848
 				return false;
849 849
 			} else {
850
-				if ($interval == "30m"){
850
+				if ($interval == "30m") {
851 851
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) <= $this_output.date ';
852
-				} else if ($interval == "1h"){
852
+				} else if ($interval == "1h") {
853 853
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) <= $this_output.date ';
854
-				} else if ($interval == "3h"){
854
+				} else if ($interval == "3h") {
855 855
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 3 HOUR) <= $this_output.date ';
856
-				} else if ($interval == "6h"){
856
+				} else if ($interval == "6h") {
857 857
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 6 HOUR) <= $this_output.date ';
858
-				} else if ($interval == "12h"){
858
+				} else if ($interval == "12h") {
859 859
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 HOUR) <= $this_output.date ';
860
-				} else if ($interval == "24h"){
860
+				} else if ($interval == "24h") {
861 861
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 24 HOUR) <= $this_output.date ';
862
-				} else if ($interval == "7d"){
862
+				} else if ($interval == "7d") {
863 863
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) <= $this_output.date ';
864
-				} else if ($interval == "30d"){
864
+				} else if ($interval == "30d") {
865 865
 					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 DAY) <= $this_output.date ';
866 866
 				} 
867 867
 			}
868 868
 		}
869 869
 
870
-		$query  = "SELECT spotter_output.*, ( 6371 * acos( cos( radians($lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians($lng) ) + sin( radians($lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_output 
870
+		$query = "SELECT spotter_output.*, ( 6371 * acos( cos( radians($lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians($lng) ) + sin( radians($lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_output 
871 871
                    WHERE spotter_output.latitude <> '' 
872 872
 				   AND spotter_output.longitude <> '' 
873 873
                    ".$additional_query."
874 874
                    HAVING distance < :radius  
875 875
 				   ORDER BY distance";
876 876
 
877
-		$spotter_array = $this->getDataFromDB($query, array(':radius' => $radius),$limit_query);
877
+		$spotter_array = $this->getDataFromDB($query, array(':radius' => $radius), $limit_query);
878 878
 
879 879
 		return $spotter_array;
880 880
 	}
@@ -886,21 +886,21 @@  discard block
 block discarded – undo
886 886
 	* @return Array the spotter information
887 887
 	*
888 888
 	*/
889
-	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array())
889
+	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '', $filter = array())
890 890
 	{
891 891
 		global $global_query;
892 892
 		
893 893
 		date_default_timezone_set('UTC');
894 894
 
895
-		$filter_query = $this->getFilter($filter,true,true);
895
+		$filter_query = $this->getFilter($filter, true, true);
896 896
 
897 897
 		$limit_query = '';
898 898
 		if ($limit != "")
899 899
 		{
900 900
 			$limit_array = explode(",", $limit);
901 901
 			
902
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
903
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
902
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
903
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
904 904
 			
905 905
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
906 906
 			{
@@ -917,7 +917,7 @@  discard block
 block discarded – undo
917 917
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
918 918
 		}
919 919
 
920
-		$query  = $global_query." ".$filter_query." spotter_output.aircraft_name <> '' GROUP BY spotter_output.aircraft_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
920
+		$query = $global_query." ".$filter_query." spotter_output.aircraft_name <> '' GROUP BY spotter_output.aircraft_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
921 921
 
922 922
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
923 923
 
@@ -936,15 +936,15 @@  discard block
 block discarded – undo
936 936
 		global $global_query;
937 937
 		
938 938
 		date_default_timezone_set('UTC');
939
-		$filter_query = $this->getFilter($filter,true,true);
939
+		$filter_query = $this->getFilter($filter, true, true);
940 940
 
941 941
 		$limit_query = '';
942 942
 		if ($limit != "")
943 943
 		{
944 944
 			$limit_array = explode(",", $limit);
945 945
 			
946
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
947
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
946
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
947
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
948 948
 			
949 949
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
950 950
 			{
@@ -961,7 +961,7 @@  discard block
 block discarded – undo
961 961
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
962 962
 		}
963 963
 
964
-		$query  = $global_query." ".$filter_query." spotter_output.registration <> '' GROUP BY spotter_output.registration,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
964
+		$query = $global_query." ".$filter_query." spotter_output.registration <> '' GROUP BY spotter_output.registration,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
965 965
 
966 966
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
967 967
 
@@ -975,20 +975,20 @@  discard block
 block discarded – undo
975 975
 	* @return Array the spotter information
976 976
 	*
977 977
 	*/
978
-	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array())
978
+	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '', $filter = array())
979 979
 	{
980 980
 		global $global_query;
981 981
 		
982 982
 		date_default_timezone_set('UTC');
983
-		$filter_query = $this->getFilter($filter,true,true);
983
+		$filter_query = $this->getFilter($filter, true, true);
984 984
 		
985 985
 		$limit_query = '';
986 986
 		if ($limit != "")
987 987
 		{
988 988
 			$limit_array = explode(",", $limit);
989 989
 			
990
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
991
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
990
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
991
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
992 992
 			
993 993
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
994 994
 			{
@@ -1005,7 +1005,7 @@  discard block
 block discarded – undo
1005 1005
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1006 1006
 		}
1007 1007
 
1008
-		$query  = $global_query." ".$filter_query." spotter_output.airline_name <> '' GROUP BY spotter_output.airline_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1008
+		$query = $global_query." ".$filter_query." spotter_output.airline_name <> '' GROUP BY spotter_output.airline_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1009 1009
 
1010 1010
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1011 1011
 
@@ -1025,7 +1025,7 @@  discard block
 block discarded – undo
1025 1025
 		
1026 1026
 		date_default_timezone_set('UTC');
1027 1027
 		
1028
-		$filter_query = $this->getFilter($filter,true,true);
1028
+		$filter_query = $this->getFilter($filter, true, true);
1029 1029
 		
1030 1030
 		$limit_query = '';
1031 1031
 		
@@ -1033,8 +1033,8 @@  discard block
 block discarded – undo
1033 1033
 		{
1034 1034
 			$limit_array = explode(",", $limit);
1035 1035
 			
1036
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1037
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1036
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1037
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1038 1038
 			
1039 1039
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1040 1040
 			{
@@ -1051,7 +1051,7 @@  discard block
 block discarded – undo
1051 1051
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1052 1052
 		}
1053 1053
 
1054
-		$query  = $global_query." ".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' GROUP BY spotter_output.departure_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1054
+		$query = $global_query." ".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' GROUP BY spotter_output.departure_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1055 1055
 
1056 1056
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1057 1057
 
@@ -1070,14 +1070,14 @@  discard block
 block discarded – undo
1070 1070
 		global $global_query;
1071 1071
 		
1072 1072
 		date_default_timezone_set('UTC');
1073
-		$filter_query = $this->getFilter($filter,true,true);
1073
+		$filter_query = $this->getFilter($filter, true, true);
1074 1074
 		$limit_query = '';
1075 1075
 		if ($limit != "")
1076 1076
 		{
1077 1077
 			$limit_array = explode(",", $limit);
1078 1078
 			
1079
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1080
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1079
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1080
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1081 1081
 			
1082 1082
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1083 1083
 			{
@@ -1094,7 +1094,7 @@  discard block
 block discarded – undo
1094 1094
 			$orderby_query = " ORDER BY spotter_output.date DESC ";
1095 1095
 		}
1096 1096
 
1097
-		$query  = $global_query.$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' GROUP BY spotter_output.arrival_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1097
+		$query = $global_query.$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' GROUP BY spotter_output.arrival_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query;
1098 1098
 
1099 1099
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1100 1100
 
@@ -1118,9 +1118,9 @@  discard block
 block discarded – undo
1118 1118
 		$query_values = array(':id' => $id);
1119 1119
 
1120 1120
 		//$query  = $global_query." WHERE spotter_output.ident <> '' ".$additional_query." ";
1121
-		$query  = $global_query." WHERE ".$additional_query." ";
1121
+		$query = $global_query." WHERE ".$additional_query." ";
1122 1122
 
1123
-		$spotter_array = $this->getDataFromDB($query,$query_values);
1123
+		$spotter_array = $this->getDataFromDB($query, $query_values);
1124 1124
 
1125 1125
 		return $spotter_array;
1126 1126
 	}
@@ -1158,8 +1158,8 @@  discard block
 block discarded – undo
1158 1158
 		{
1159 1159
 			$limit_array = explode(",", $limit);
1160 1160
 			
1161
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1162
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1161
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1162
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1163 1163
 			
1164 1164
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1165 1165
 			{
@@ -1200,7 +1200,7 @@  discard block
 block discarded – undo
1200 1200
 		$query_values = array();
1201 1201
 		$limit_query = '';
1202 1202
 		$additional_query = '';
1203
-		$filter_query = $this->getFilter($filter,true,true);
1203
+		$filter_query = $this->getFilter($filter, true, true);
1204 1204
 		
1205 1205
 		if ($aircraft_type != "")
1206 1206
 		{
@@ -1217,8 +1217,8 @@  discard block
 block discarded – undo
1217 1217
 		{
1218 1218
 			$limit_array = explode(",", $limit);
1219 1219
 			
1220
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1221
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1220
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1221
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1222 1222
 			
1223 1223
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1224 1224
 			{
@@ -1258,7 +1258,7 @@  discard block
 block discarded – undo
1258 1258
 		$query_values = array();
1259 1259
 		$limit_query = '';
1260 1260
 		$additional_query = '';
1261
-		$filter_query = $this->getFilter($filter,true,true);
1261
+		$filter_query = $this->getFilter($filter, true, true);
1262 1262
 		
1263 1263
 		if ($registration != "")
1264 1264
 		{
@@ -1275,8 +1275,8 @@  discard block
 block discarded – undo
1275 1275
 		{
1276 1276
 			$limit_array = explode(",", $limit);
1277 1277
 			
1278
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1279
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1278
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1279
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1280 1280
 			
1281 1281
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1282 1282
 			{
@@ -1309,7 +1309,7 @@  discard block
 block discarded – undo
1309 1309
 	* @return Array the spotter information
1310 1310
 	*
1311 1311
 	*/
1312
-	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array())
1312
+	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '', $filters = array())
1313 1313
 	{
1314 1314
 		global $global_query;
1315 1315
 		
@@ -1318,7 +1318,7 @@  discard block
 block discarded – undo
1318 1318
 		$query_values = array();
1319 1319
 		$limit_query = '';
1320 1320
 		$additional_query = '';
1321
-		$filter_query = $this->getFilter($filters,true,true);
1321
+		$filter_query = $this->getFilter($filters, true, true);
1322 1322
 		
1323 1323
 		if ($airline != "")
1324 1324
 		{
@@ -1335,8 +1335,8 @@  discard block
 block discarded – undo
1335 1335
 		{
1336 1336
 			$limit_array = explode(",", $limit);
1337 1337
 			
1338
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1339
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1338
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1339
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1340 1340
 			
1341 1341
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1342 1342
 			{
@@ -1366,7 +1366,7 @@  discard block
 block discarded – undo
1366 1366
 	* @return Array the spotter information
1367 1367
 	*
1368 1368
 	*/
1369
-	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1369
+	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '', $filters = array())
1370 1370
 	{
1371 1371
 		global $global_query;
1372 1372
 		
@@ -1374,7 +1374,7 @@  discard block
 block discarded – undo
1374 1374
 		$query_values = array();
1375 1375
 		$limit_query = '';
1376 1376
 		$additional_query = '';
1377
-		$filter_query = $this->getFilter($filters,true,true);
1377
+		$filter_query = $this->getFilter($filters, true, true);
1378 1378
 		
1379 1379
 		if ($airport != "")
1380 1380
 		{
@@ -1391,8 +1391,8 @@  discard block
 block discarded – undo
1391 1391
 		{
1392 1392
 			$limit_array = explode(",", $limit);
1393 1393
 			
1394
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1395
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1394
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1395
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1396 1396
 			
1397 1397
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1398 1398
 			{
@@ -1424,7 +1424,7 @@  discard block
 block discarded – undo
1424 1424
 	* @return Array the spotter information
1425 1425
 	*
1426 1426
 	*/
1427
-	public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array())
1427
+	public function getSpotterDataByDate($date = '', $limit = '', $sort = '', $filter = array())
1428 1428
 	{
1429 1429
 		global $global_query, $globalTimezone, $globalDBdriver;
1430 1430
 		
@@ -1432,7 +1432,7 @@  discard block
 block discarded – undo
1432 1432
 		$limit_query = '';
1433 1433
 		$additional_query = '';
1434 1434
 
1435
-		$filter_query = $this->getFilter($filter,true,true);
1435
+		$filter_query = $this->getFilter($filter, true, true);
1436 1436
 		
1437 1437
 		if ($date != "")
1438 1438
 		{
@@ -1458,8 +1458,8 @@  discard block
 block discarded – undo
1458 1458
 		{
1459 1459
 			$limit_array = explode(",", $limit);
1460 1460
 			
1461
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1462
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1461
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1462
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1463 1463
 			
1464 1464
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1465 1465
 			{
@@ -1489,7 +1489,7 @@  discard block
 block discarded – undo
1489 1489
 	* @return Array the spotter information
1490 1490
 	*
1491 1491
 	*/
1492
-	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array())
1492
+	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '', $filters = array())
1493 1493
 	{
1494 1494
 		global $global_query;
1495 1495
 		
@@ -1498,7 +1498,7 @@  discard block
 block discarded – undo
1498 1498
 		$query_values = array();
1499 1499
 		$limit_query = '';
1500 1500
 		$additional_query = '';
1501
-		$filter_query = $this->getFilter($filters,true,true);
1501
+		$filter_query = $this->getFilter($filters, true, true);
1502 1502
 		if ($country != "")
1503 1503
 		{
1504 1504
 			if (!is_string($country))
@@ -1515,8 +1515,8 @@  discard block
 block discarded – undo
1515 1515
 		{
1516 1516
 			$limit_array = explode(",", $limit);
1517 1517
 			
1518
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1519
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1518
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1519
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1520 1520
 			
1521 1521
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1522 1522
 			{
@@ -1556,7 +1556,7 @@  discard block
 block discarded – undo
1556 1556
 		$query_values = array();
1557 1557
 		$additional_query = '';
1558 1558
 		$limit_query = '';
1559
-		$filter_query = $this->getFilter($filters,true,true);
1559
+		$filter_query = $this->getFilter($filters, true, true);
1560 1560
 		
1561 1561
 		if ($aircraft_manufacturer != "")
1562 1562
 		{
@@ -1573,8 +1573,8 @@  discard block
 block discarded – undo
1573 1573
 		{
1574 1574
 			$limit_array = explode(",", $limit);
1575 1575
 			
1576
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1577
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1576
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1577
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1578 1578
 			
1579 1579
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1580 1580
 			{
@@ -1616,14 +1616,14 @@  discard block
 block discarded – undo
1616 1616
 		$query_values = array();
1617 1617
 		$additional_query = '';
1618 1618
 		$limit_query = '';
1619
-		$filter_query = $this->getFilter($filters,true,true);
1619
+		$filter_query = $this->getFilter($filters, true, true);
1620 1620
 		if ($departure_airport_icao != "")
1621 1621
 		{
1622 1622
 			if (!is_string($departure_airport_icao))
1623 1623
 			{
1624 1624
 				return false;
1625 1625
 			} else {
1626
-				$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
1626
+				$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
1627 1627
 				$additional_query .= " AND (spotter_output.departure_airport_icao = :departure_airport_icao)";
1628 1628
 				$query_values = array(':departure_airport_icao' => $departure_airport_icao);
1629 1629
 			}
@@ -1635,9 +1635,9 @@  discard block
 block discarded – undo
1635 1635
 			{
1636 1636
 				return false;
1637 1637
 			} else {
1638
-				$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
1638
+				$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
1639 1639
 				$additional_query .= " AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)";
1640
-				$query_values = array_merge($query_values,array(':arrival_airport_icao' => $arrival_airport_icao));
1640
+				$query_values = array_merge($query_values, array(':arrival_airport_icao' => $arrival_airport_icao));
1641 1641
 			}
1642 1642
 		}
1643 1643
 		
@@ -1645,8 +1645,8 @@  discard block
 block discarded – undo
1645 1645
 		{
1646 1646
 			$limit_array = explode(",", $limit);
1647 1647
 			
1648
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1649
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1648
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1649
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1650 1650
 			
1651 1651
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1652 1652
 			{
@@ -1685,15 +1685,15 @@  discard block
 block discarded – undo
1685 1685
 		global $global_query;
1686 1686
 		
1687 1687
 		date_default_timezone_set('UTC');
1688
-		$filter_query = $this->getFilter($filter,true,true);
1688
+		$filter_query = $this->getFilter($filter, true, true);
1689 1689
 		$limit_query = '';
1690 1690
 		
1691 1691
 		if ($limit != "")
1692 1692
 		{
1693 1693
 			$limit_array = explode(",", $limit);
1694 1694
 			
1695
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1696
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1695
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1696
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1697 1697
 			
1698 1698
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1699 1699
 			{
@@ -1710,7 +1710,7 @@  discard block
 block discarded – undo
1710 1710
 			$orderby_query = " ORDER BY spotter_output.date DESC";
1711 1711
 		}
1712 1712
 
1713
-		$query  = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query;
1713
+		$query = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query;
1714 1714
 
1715 1715
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1716 1716
 
@@ -1723,19 +1723,19 @@  discard block
 block discarded – undo
1723 1723
 	* @return String the highlight text
1724 1724
 	*
1725 1725
 	*/
1726
-	public function getHighlightByRegistration($registration,$filter = array())
1726
+	public function getHighlightByRegistration($registration, $filter = array())
1727 1727
 	{
1728 1728
 		global $global_query;
1729 1729
 		
1730 1730
 		date_default_timezone_set('UTC');
1731
-		$filter_query = $this->getFilter($filter,true,true);
1732
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
1731
+		$filter_query = $this->getFilter($filter, true, true);
1732
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
1733 1733
 		
1734
-		$query  = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration";
1734
+		$query = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration";
1735 1735
 		$sth = $this->db->prepare($query);
1736 1736
 		$sth->execute(array(':registration' => $registration));
1737 1737
 
1738
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1738
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1739 1739
 		{
1740 1740
 			$highlight = $row['highlight'];
1741 1741
 		}
@@ -1751,14 +1751,14 @@  discard block
 block discarded – undo
1751 1751
 	* @return String usage
1752 1752
 	*
1753 1753
 	*/
1754
-	public function getSquawkUsage($squawk = '',$country = 'FR')
1754
+	public function getSquawkUsage($squawk = '', $country = 'FR')
1755 1755
 	{
1756 1756
 		
1757
-		$squawk = filter_var($squawk,FILTER_SANITIZE_STRING);
1758
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
1757
+		$squawk = filter_var($squawk, FILTER_SANITIZE_STRING);
1758
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
1759 1759
 
1760 1760
 		$query  = "SELECT squawk.* FROM squawk WHERE squawk.code = :squawk AND squawk.country = :country LIMIT 1";
1761
-		$query_values = array(':squawk' => ltrim($squawk,'0'), ':country' => $country);
1761
+		$query_values = array(':squawk' => ltrim($squawk, '0'), ':country' => $country);
1762 1762
 		
1763 1763
 		$sth = $this->db->prepare($query);
1764 1764
 		$sth->execute($query_values);
@@ -1780,9 +1780,9 @@  discard block
 block discarded – undo
1780 1780
 	public function getAirportIcao($airport_iata = '')
1781 1781
 	{
1782 1782
 		
1783
-		$airport_iata = filter_var($airport_iata,FILTER_SANITIZE_STRING);
1783
+		$airport_iata = filter_var($airport_iata, FILTER_SANITIZE_STRING);
1784 1784
 
1785
-		$query  = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1";
1785
+		$query = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1";
1786 1786
 		$query_values = array(':airport' => $airport_iata);
1787 1787
 		
1788 1788
 		$sth = $this->db->prepare($query);
@@ -1804,12 +1804,12 @@  discard block
 block discarded – undo
1804 1804
 	* @return Float distance to the airport
1805 1805
 	*
1806 1806
 	*/
1807
-	public function getAirportDistance($airport_icao,$latitude,$longitude)
1807
+	public function getAirportDistance($airport_icao, $latitude, $longitude)
1808 1808
 	{
1809 1809
 		
1810
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
1810
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
1811 1811
 
1812
-		$query  = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1";
1812
+		$query = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1";
1813 1813
 		$query_values = array(':airport' => $airport_icao);
1814 1814
 		$sth = $this->db->prepare($query);
1815 1815
 		$sth->execute($query_values);
@@ -1819,7 +1819,7 @@  discard block
 block discarded – undo
1819 1819
 			$airport_latitude = $row['latitude'];
1820 1820
 			$airport_longitude = $row['longitude'];
1821 1821
 			$Common = new Common();
1822
-			return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude);
1822
+			return $Common->distance($latitude, $longitude, $airport_latitude, $airport_longitude);
1823 1823
 		} else return '';
1824 1824
 	}
1825 1825
 	
@@ -1833,11 +1833,11 @@  discard block
 block discarded – undo
1833 1833
 	public function getAllAirportInfo($airport = '')
1834 1834
 	{
1835 1835
 		
1836
-		$airport = filter_var($airport,FILTER_SANITIZE_STRING);
1836
+		$airport = filter_var($airport, FILTER_SANITIZE_STRING);
1837 1837
 
1838 1838
 		$query_values = array();
1839 1839
 		if ($airport == 'NA') {
1840
-			return array(array('name' => 'Not available','city' => 'N/A', 'country' => 'N/A','iata' => 'NA','icao' => 'NA','altitude' => NULL,'latitude' => 0,'longitude' => 0,'type' => 'NA','home_link' => '','wikipedia_link' => '','image_thumb' => '', 'image' => ''));
1840
+			return array(array('name' => 'Not available', 'city' => 'N/A', 'country' => 'N/A', 'iata' => 'NA', 'icao' => 'NA', 'altitude' => NULL, 'latitude' => 0, 'longitude' => 0, 'type' => 'NA', 'home_link' => '', 'wikipedia_link' => '', 'image_thumb' => '', 'image' => ''));
1841 1841
 		} elseif ($airport == '') {
1842 1842
 			$query  = "SELECT airport.name, airport.city, airport.country, airport.iata, airport.icao, airport.latitude, airport.longitude, airport.altitude, airport.type, airport.home_link, airport.wikipedia_link, airport.image_thumb, airport.image FROM airport";
1843 1843
 		} else {
@@ -1885,14 +1885,14 @@  discard block
 block discarded – undo
1885 1885
 	{
1886 1886
 		$lst_countries = '';
1887 1887
 		foreach ($countries as $country) {
1888
-			$country = filter_var($country,FILTER_SANITIZE_STRING);
1888
+			$country = filter_var($country, FILTER_SANITIZE_STRING);
1889 1889
 			if ($lst_countries == '') {
1890 1890
 				$lst_countries = "'".$country."'";
1891 1891
 			} else {
1892 1892
 				$lst_countries .= ",'".$country."'";
1893 1893
 			}
1894 1894
 		}
1895
-		$query  = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")";
1895
+		$query = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")";
1896 1896
 		
1897 1897
 		$sth = $this->db->prepare($query);
1898 1898
 		$sth->execute();
@@ -1900,7 +1900,7 @@  discard block
 block discarded – undo
1900 1900
 		$airport_array = array();
1901 1901
 		$temp_array = array();
1902 1902
 		
1903
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1903
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1904 1904
 		{
1905 1905
 			$temp_array['name'] = $row['name'];
1906 1906
 			$temp_array['city'] = $row['city'];
@@ -1928,10 +1928,10 @@  discard block
 block discarded – undo
1928 1928
 	{
1929 1929
 		global $globalDBdriver;
1930 1930
 		if (is_array($coord)) {
1931
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1932
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1933
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1934
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1931
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1932
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1933
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1934
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1935 1935
 		} else return array();
1936 1936
 		if ($globalDBdriver == 'mysql') {
1937 1937
 			$query  = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'";
@@ -1943,7 +1943,7 @@  discard block
 block discarded – undo
1943 1943
     
1944 1944
 		$airport_array = array();
1945 1945
 		
1946
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1946
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1947 1947
 		{
1948 1948
 			$temp_array = $row;
1949 1949
 
@@ -1963,13 +1963,13 @@  discard block
 block discarded – undo
1963 1963
 	public function getAllWaypointsInfobyCoord($coord)
1964 1964
 	{
1965 1965
 		if (is_array($coord)) {
1966
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1967
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1968
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1969
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1966
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1967
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1968
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1969
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1970 1970
 		} else return array();
1971 1971
 		//$query  = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
1972
-		$query  = "SELECT waypoints.* FROM waypoints WHERE (waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") OR (waypoints.latitude_end BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_end BETWEEN ".$minlong." AND ".$maxlong.")";
1972
+		$query = "SELECT waypoints.* FROM waypoints WHERE (waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") OR (waypoints.latitude_end BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_end BETWEEN ".$minlong." AND ".$maxlong.")";
1973 1973
 		//$query  = "SELECT waypoints.* FROM waypoints";
1974 1974
 		//$query  = "SELECT waypoints.* FROM waypoints INNER JOIN (SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") w ON w.name_end = waypoints.name_begin OR w.name_begin = waypoints.name_begin OR w.name_begin = waypoints.name_end OR w.name_end = waypoints.name_end";
1975 1975
 		//$query = "SELECT * FROM waypoints LEFT JOIN waypoints w ON waypoints.name_end = w.name_begin WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
@@ -1981,7 +1981,7 @@  discard block
 block discarded – undo
1981 1981
     
1982 1982
 		$waypoints_array = array();
1983 1983
 		
1984
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1984
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1985 1985
 		{
1986 1986
 			$temp_array = $row;
1987 1987
 
@@ -2003,10 +2003,10 @@  discard block
 block discarded – undo
2003 2003
 	{
2004 2004
 		global $globalUseRealAirlines;
2005 2005
 		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2006
-		$airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING));
2006
+		$airline_icao = strtoupper(filter_var($airline_icao, FILTER_SANITIZE_STRING));
2007 2007
 		if ($airline_icao == 'NA') {
2008 2008
 			$airline_array = array();
2009
-			$airline_array[] = array('name' => 'Not Available','iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>'');
2009
+			$airline_array[] = array('name' => 'Not Available', 'iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>'');
2010 2010
 			return $airline_array;
2011 2011
 		} else {
2012 2012
 			if (strlen($airline_icao) == 2) {
@@ -2027,7 +2027,7 @@  discard block
 block discarded – undo
2027 2027
 			if ($fromsource === NULL) {
2028 2028
 				$sth->execute(array(':airline_icao' => $airline_icao));
2029 2029
 			} else {
2030
-				$sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource));
2030
+				$sth->execute(array(':airline_icao' => $airline_icao, ':fromsource' => $fromsource));
2031 2031
 			}
2032 2032
                         /*
2033 2033
 			$airline_array = array();
@@ -2069,12 +2069,12 @@  discard block
 block discarded – undo
2069 2069
 	*/
2070 2070
 	public function getAllAircraftInfo($aircraft_type)
2071 2071
 	{
2072
-		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
2072
+		$aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING);
2073 2073
 
2074 2074
 		if ($aircraft_type == 'NA') {
2075
-			return array(array('icao' => 'NA','type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL));
2075
+			return array(array('icao' => 'NA', 'type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL));
2076 2076
 		}
2077
-		$query  = "SELECT aircraft.icao, aircraft.type,aircraft.manufacturer,aircraft.aircraft_shadow FROM aircraft WHERE aircraft.icao = :aircraft_type";
2077
+		$query = "SELECT aircraft.icao, aircraft.type,aircraft.manufacturer,aircraft.aircraft_shadow FROM aircraft WHERE aircraft.icao = :aircraft_type";
2078 2078
 		
2079 2079
 		$sth = $this->db->prepare($query);
2080 2080
 		$sth->execute(array(':aircraft_type' => $aircraft_type));
@@ -2106,7 +2106,7 @@  discard block
 block discarded – undo
2106 2106
 	*/
2107 2107
 	public function getAircraftIcao($aircraft_type)
2108 2108
 	{
2109
-		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
2109
+		$aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING);
2110 2110
 		$all_aircraft = array('737-300' => 'B733',
2111 2111
 				'777-200' => 'B772',
2112 2112
 				'777-200ER' => 'B772',
@@ -2118,10 +2118,10 @@  discard block
 block discarded – undo
2118 2118
 				'A380' => 'A388');
2119 2119
 		if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type];
2120 2120
 
2121
-		$query  = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2121
+		$query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2122 2122
 		$aircraft_type = strtoupper($aircraft_type);
2123 2123
 		$sth = $this->db->prepare($query);
2124
-		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,));
2124
+		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%', ':aircraft_type' => $aircraft_type,));
2125 2125
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2126 2126
 		if (isset($result[0]['icao'])) return $result[0]['icao'];
2127 2127
 		else return '';
@@ -2136,9 +2136,9 @@  discard block
 block discarded – undo
2136 2136
 	*/
2137 2137
 	public function getAllAircraftType($aircraft_modes)
2138 2138
 	{
2139
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
2139
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
2140 2140
 
2141
-		$query  = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1";
2141
+		$query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1";
2142 2142
 		
2143 2143
 		$sth = $this->db->prepare($query);
2144 2144
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -2159,8 +2159,8 @@  discard block
 block discarded – undo
2159 2159
 	*/
2160 2160
 	public function getOperator($operator)
2161 2161
 	{
2162
-		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
2163
-		$query  = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1";
2162
+		$operator = filter_var($operator, FILTER_SANITIZE_STRING);
2163
+		$query = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1";
2164 2164
 		
2165 2165
 		$sth = $this->db->prepare($query);
2166 2166
 		$sth->execute(array(':operator' => $operator));
@@ -2181,9 +2181,9 @@  discard block
 block discarded – undo
2181 2181
 	*/
2182 2182
 	public function getRouteInfo($callsign)
2183 2183
 	{
2184
-		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2184
+		$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
2185 2185
                 if ($callsign == '') return array();
2186
-		$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";
2186
+		$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";
2187 2187
 		
2188 2188
 		$sth = $this->db->prepare($query);
2189 2189
 		$sth->execute(array(':callsign' => $callsign));
@@ -2204,9 +2204,9 @@  discard block
 block discarded – undo
2204 2204
 	*/
2205 2205
 	public function getAircraftInfoByRegistration($registration)
2206 2206
 	{
2207
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2207
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2208 2208
 
2209
-		$query  = "SELECT spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_icao FROM spotter_output WHERE spotter_output.registration = :registration";
2209
+		$query = "SELECT spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_icao FROM spotter_output WHERE spotter_output.registration = :registration";
2210 2210
 		
2211 2211
 		$sth = $this->db->prepare($query);
2212 2212
 		$sth->execute(array(':registration' => $registration));
@@ -2214,7 +2214,7 @@  discard block
 block discarded – undo
2214 2214
 		$aircraft_array = array();
2215 2215
 		$temp_array = array();
2216 2216
 		
2217
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2217
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2218 2218
 		{
2219 2219
 			$temp_array['airline_icao'] = $row['airline_icao'];
2220 2220
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -2236,7 +2236,7 @@  discard block
 block discarded – undo
2236 2236
 	*/
2237 2237
 	public function getAircraftOwnerByRegistration($registration)
2238 2238
 	{
2239
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2239
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2240 2240
 		$Connection = new Connection($this->db);
2241 2241
 		if ($Connection->tableExists('aircraft_owner')) {
2242 2242
 			$query  = "SELECT aircraft_owner.base, aircraft_owner.owner, aircraft_owner.date_first_reg FROM aircraft_owner WHERE registration = :registration LIMIT 1";
@@ -2258,7 +2258,7 @@  discard block
 block discarded – undo
2258 2258
 	public function getAllFlightsforSitemap()
2259 2259
 	{
2260 2260
 		//$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 ";
2261
-		$query  = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0";
2261
+		$query = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0";
2262 2262
 		
2263 2263
 		$sth = $this->db->prepare($query);
2264 2264
 		$sth->execute();
@@ -2305,7 +2305,7 @@  discard block
 block discarded – undo
2305 2305
 		$manufacturer_array = array();
2306 2306
 		$temp_array = array();
2307 2307
 		
2308
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2308
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2309 2309
 		{
2310 2310
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
2311 2311
 
@@ -2331,7 +2331,7 @@  discard block
 block discarded – undo
2331 2331
 								ORDER BY spotter_output.aircraft_name ASC";
2332 2332
 								
2333 2333
 		*/
2334
-		$filter_query = $this->getFilter($filters,true,true);
2334
+		$filter_query = $this->getFilter($filters, true, true);
2335 2335
 		$query = "SELECT DISTINCT icao AS aircraft_icao, type AS aircraft_name, manufacturer AS aircraft_manufacturer FROM aircraft".$filter_query." icao <> '' ORDER BY aircraft_manufacturer ASC";
2336 2336
 		
2337 2337
 		$sth = $this->db->prepare($query);
@@ -2340,7 +2340,7 @@  discard block
 block discarded – undo
2340 2340
 		$aircraft_array = array();
2341 2341
 		$temp_array = array();
2342 2342
 		
2343
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2343
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2344 2344
 		{
2345 2345
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
2346 2346
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
@@ -2361,8 +2361,8 @@  discard block
 block discarded – undo
2361 2361
 	*/
2362 2362
 	public function getAllAircraftRegistrations($filters = array())
2363 2363
 	{
2364
-		$filter_query = $this->getFilter($filters,true,true);
2365
-		$query  = "SELECT DISTINCT spotter_output.registration 
2364
+		$filter_query = $this->getFilter($filters, true, true);
2365
+		$query = "SELECT DISTINCT spotter_output.registration 
2366 2366
 				FROM spotter_output".$filter_query." spotter_output.registration <> '' 
2367 2367
 				ORDER BY spotter_output.registration ASC";
2368 2368
 
@@ -2372,7 +2372,7 @@  discard block
 block discarded – undo
2372 2372
 		$aircraft_array = array();
2373 2373
 		$temp_array = array();
2374 2374
 		
2375
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2375
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2376 2376
 		{
2377 2377
 			$temp_array['registration'] = $row['registration'];
2378 2378
 
@@ -2389,11 +2389,11 @@  discard block
 block discarded – undo
2389 2389
 	* @return Array list of source name
2390 2390
 	*
2391 2391
 	*/
2392
-	public function getAllSourceName($type = '',$filters = array())
2392
+	public function getAllSourceName($type = '', $filters = array())
2393 2393
 	{
2394
-		$filter_query = $this->getFilter($filters,true,true);
2394
+		$filter_query = $this->getFilter($filters, true, true);
2395 2395
 		$query_values = array();
2396
-		$query  = "SELECT DISTINCT spotter_output.source_name 
2396
+		$query = "SELECT DISTINCT spotter_output.source_name 
2397 2397
 				FROM spotter_output".$filter_query." spotter_output.source_name <> ''";
2398 2398
 		if ($type != '') {
2399 2399
 			$query_values = array(':type' => $type);
@@ -2408,7 +2408,7 @@  discard block
 block discarded – undo
2408 2408
 		$source_array = array();
2409 2409
 		$temp_array = array();
2410 2410
 		
2411
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2411
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2412 2412
 		{
2413 2413
 			$temp_array['source_name'] = $row['source_name'];
2414 2414
 			$source_array[] = $temp_array;
@@ -2424,11 +2424,11 @@  discard block
 block discarded – undo
2424 2424
 	* @return Array list of airline names
2425 2425
 	*
2426 2426
 	*/
2427
-	public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array())
2427
+	public function getAllAirlineNames($airline_type = '', $forsource = NULL, $filters = array())
2428 2428
 	{
2429
-		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
2430
-		$filter_query = $this->getFilter($filters,true,true);
2431
-		$airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
2429
+		global $globalAirlinesSource, $globalVATSIM, $globalIVAO;
2430
+		$filter_query = $this->getFilter($filters, true, true);
2431
+		$airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING);
2432 2432
 		if ($airline_type == '' || $airline_type == 'all') {
2433 2433
 			/*
2434 2434
 			$query  = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
@@ -2447,7 +2447,7 @@  discard block
 block discarded – undo
2447 2447
 				$query_data = array(':forsource' => $forsource);
2448 2448
 			}
2449 2449
 		} else {
2450
-			$query  = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
2450
+			$query = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
2451 2451
 					FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
2452 2452
 					AND spotter_output.airline_type = :airline_type 
2453 2453
 					ORDER BY spotter_output.airline_icao ASC";
@@ -2460,7 +2460,7 @@  discard block
 block discarded – undo
2460 2460
 		$airline_array = array();
2461 2461
 		$temp_array = array();
2462 2462
 		
2463
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2463
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2464 2464
 		{
2465 2465
 			$temp_array['airline_icao'] = $row['airline_icao'];
2466 2466
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -2480,8 +2480,8 @@  discard block
 block discarded – undo
2480 2480
 	*/
2481 2481
 	public function getAllAirlineCountries($filters = array())
2482 2482
 	{
2483
-		$filter_query = $this->getFilter($filters,true,true);
2484
-		$query  = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2483
+		$filter_query = $this->getFilter($filters, true, true);
2484
+		$query = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2485 2485
 				FROM spotter_output".$filter_query." spotter_output.airline_country <> '' 
2486 2486
 				ORDER BY spotter_output.airline_country ASC";
2487 2487
 		
@@ -2492,7 +2492,7 @@  discard block
 block discarded – undo
2492 2492
 		$airline_array = array();
2493 2493
 		$temp_array = array();
2494 2494
 		
2495
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2495
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2496 2496
 		{
2497 2497
 			$temp_array['airline_country'] = $row['airline_country'];
2498 2498
 
@@ -2512,9 +2512,9 @@  discard block
 block discarded – undo
2512 2512
 	*/
2513 2513
 	public function getAllAirportNames($filters = array())
2514 2514
 	{
2515
-		$filter_query = $this->getFilter($filters,true,true);
2515
+		$filter_query = $this->getFilter($filters, true, true);
2516 2516
 		$airport_array = array();
2517
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao AS airport_icao, spotter_output.departure_airport_name AS airport_name, spotter_output.departure_airport_city AS airport_city, spotter_output.departure_airport_country AS airport_country
2517
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao AS airport_icao, spotter_output.departure_airport_name AS airport_name, spotter_output.departure_airport_city AS airport_city, spotter_output.departure_airport_country AS airport_country
2518 2518
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_icao <> '' AND spotter_output.departure_airport_icao <> 'NA' 
2519 2519
 				ORDER BY spotter_output.departure_airport_city ASC";
2520 2520
 		
@@ -2523,7 +2523,7 @@  discard block
 block discarded – undo
2523 2523
 		$sth->execute();
2524 2524
 
2525 2525
 		$temp_array = array();
2526
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2526
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2527 2527
 		{
2528 2528
 			$temp_array['airport_icao'] = $row['airport_icao'];
2529 2529
 			$temp_array['airport_name'] = $row['airport_name'];
@@ -2533,14 +2533,14 @@  discard block
 block discarded – undo
2533 2533
 			$airport_array[$row['airport_city'].",".$row['airport_name']] = $temp_array;
2534 2534
 		}
2535 2535
 
2536
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao AS airport_icao, spotter_output.arrival_airport_name AS airport_name, spotter_output.arrival_airport_city AS airport_city, spotter_output.arrival_airport_country AS airport_country
2536
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao AS airport_icao, spotter_output.arrival_airport_name AS airport_name, spotter_output.arrival_airport_city AS airport_city, spotter_output.arrival_airport_country AS airport_country
2537 2537
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> '' AND spotter_output.arrival_airport_icao <> 'NA' 
2538 2538
 								ORDER BY spotter_output.arrival_airport_city ASC";
2539 2539
 					
2540 2540
 		$sth = $this->db->prepare($query);
2541 2541
 		$sth->execute();
2542 2542
 
2543
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2543
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2544 2544
 			{
2545 2545
 		//	if ($airport_array[$row['airport_city'].",".$row['airport_name']]['airport_icao'] != $row['airport_icao'])
2546 2546
 		//	{
@@ -2580,21 +2580,21 @@  discard block
 block discarded – undo
2580 2580
    
2581 2581
 		$temp_array = array();
2582 2582
 		
2583
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2583
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2584 2584
 		{
2585 2585
 			$temp_array['airport_country'] = $row['airport_country'];
2586 2586
 
2587 2587
 			$airport_array[$row['airport_country']] = $temp_array;
2588 2588
 		}
2589
-		$filter_query = $this->getFilter($filters,true,true);
2590
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2589
+		$filter_query = $this->getFilter($filters, true, true);
2590
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2591 2591
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' 
2592 2592
 								ORDER BY spotter_output.arrival_airport_country ASC";
2593 2593
 					
2594 2594
 		$sth = $this->db->prepare($query);
2595 2595
 		$sth->execute();
2596 2596
 		
2597
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2597
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2598 2598
 		{
2599 2599
 			if (isset($airport_array[$row['airport_country']]['airport_country']) && $airport_array[$row['airport_country']]['airport_country'] != $row['airport_country'])
2600 2600
 			{
@@ -2617,9 +2617,9 @@  discard block
 block discarded – undo
2617 2617
 	*/
2618 2618
 	public function getAllCountries($filters = array())
2619 2619
 	{
2620
-		$Connection= new Connection($this->db);
2620
+		$Connection = new Connection($this->db);
2621 2621
 		if ($Connection->tableExists('countries')) {
2622
-			$query  = "SELECT countries.name AS airport_country
2622
+			$query = "SELECT countries.name AS airport_country
2623 2623
 				FROM countries
2624 2624
 				ORDER BY countries.name ASC";
2625 2625
 			$sth = $this->db->prepare($query);
@@ -2628,14 +2628,14 @@  discard block
 block discarded – undo
2628 2628
 			$temp_array = array();
2629 2629
 			$country_array = array();
2630 2630
 		
2631
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
2631
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2632 2632
 			{
2633 2633
 				$temp_array['country'] = $row['airport_country'];
2634 2634
 				$country_array[$row['airport_country']] = $temp_array;
2635 2635
 			}
2636 2636
 		} else {
2637
-			$filter_query = $this->getFilter($filters,true,true);
2638
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country
2637
+			$filter_query = $this->getFilter($filters, true, true);
2638
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country
2639 2639
 								FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' 
2640 2640
 								ORDER BY spotter_output.departure_airport_country ASC";
2641 2641
 
@@ -2644,20 +2644,20 @@  discard block
 block discarded – undo
2644 2644
    
2645 2645
 			$temp_array = array();
2646 2646
 			$country_array = array();
2647
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
2647
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2648 2648
 			{
2649 2649
 				$temp_array['country'] = $row['airport_country'];
2650 2650
 				$country_array[$row['airport_country']] = $temp_array;
2651 2651
 			}
2652 2652
 
2653
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2653
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2654 2654
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' 
2655 2655
 								ORDER BY spotter_output.arrival_airport_country ASC";
2656 2656
 					
2657 2657
 		$sth = $this->db->prepare($query);
2658 2658
 		$sth->execute();
2659 2659
 		
2660
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2660
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2661 2661
 		{
2662 2662
 			if ($country_array[$row['airport_country']]['country'] != $row['airport_country'])
2663 2663
 			{
@@ -2667,14 +2667,14 @@  discard block
 block discarded – undo
2667 2667
 			}
2668 2668
 		}
2669 2669
 		
2670
-		$query  = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2670
+		$query = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2671 2671
 								FROM spotter_output".$filter_query." spotter_output.airline_country <> '' 
2672 2672
 								ORDER BY spotter_output.airline_country ASC";
2673 2673
 					
2674 2674
 		$sth = $this->db->prepare($query);
2675 2675
 		$sth->execute();
2676 2676
 		
2677
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2677
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2678 2678
 		{
2679 2679
 			if (isset($country_array[$row['airline_country']]['country']) && $country_array[$row['airline_country']]['country'] != $row['airline_country'])
2680 2680
 			{
@@ -2698,8 +2698,8 @@  discard block
 block discarded – undo
2698 2698
 	*/
2699 2699
 	public function getAllIdents($filters = array())
2700 2700
 	{
2701
-		$filter_query = $this->getFilter($filters,true,true);
2702
-		$query  = "SELECT DISTINCT spotter_output.ident
2701
+		$filter_query = $this->getFilter($filters, true, true);
2702
+		$query = "SELECT DISTINCT spotter_output.ident
2703 2703
 								FROM spotter_output".$filter_query." spotter_output.ident <> '' 
2704 2704
 								ORDER BY spotter_output.date ASC LIMIT 700 OFFSET 0";
2705 2705
 
@@ -2709,7 +2709,7 @@  discard block
 block discarded – undo
2709 2709
 		$ident_array = array();
2710 2710
 		$temp_array = array();
2711 2711
 		
2712
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2712
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2713 2713
 		{
2714 2714
 			$temp_array['ident'] = $row['ident'];
2715 2715
 			$ident_array[] = $temp_array;
@@ -2723,9 +2723,9 @@  discard block
 block discarded – undo
2723 2723
 	* @return Array number, icao, name and city of airports
2724 2724
 	*/
2725 2725
 
2726
-	public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) {
2726
+	public function getLast7DaysAirportsDeparture($airport_icao = '', $filters = array()) {
2727 2727
 		global $globalTimezone, $globalDBdriver;
2728
-		$filter_query = $this->getFilter($filters,true,true);
2728
+		$filter_query = $this->getFilter($filters, true, true);
2729 2729
 		if ($globalTimezone != '') {
2730 2730
 			date_default_timezone_set($globalTimezone);
2731 2731
 			$datetime = new DateTime();
@@ -2790,7 +2790,7 @@  discard block
 block discarded – undo
2790 2790
 
2791 2791
 	public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) {
2792 2792
 		global $globalTimezone, $globalDBdriver;
2793
-		$filter_query = $this->getFilter($filters,true,true);
2793
+		$filter_query = $this->getFilter($filters, true, true);
2794 2794
 		if ($globalTimezone != '') {
2795 2795
 			date_default_timezone_set($globalTimezone);
2796 2796
 			$datetime = new DateTime();
@@ -2874,7 +2874,7 @@  discard block
 block discarded – undo
2874 2874
 
2875 2875
 	public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) {
2876 2876
 		global $globalTimezone, $globalDBdriver;
2877
-		$filter_query = $this->getFilter($filters,true,true);
2877
+		$filter_query = $this->getFilter($filters, true, true);
2878 2878
 		if ($globalTimezone != '') {
2879 2879
 			date_default_timezone_set($globalTimezone);
2880 2880
 			$datetime = new DateTime();
@@ -2907,9 +2907,9 @@  discard block
 block discarded – undo
2907 2907
 	* @return Array number, icao, name and city of airports
2908 2908
 	*/
2909 2909
 
2910
-	public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) {
2910
+	public function getLast7DaysDetectedAirportsArrival($airport_icao = '', $filters = array()) {
2911 2911
 		global $globalTimezone, $globalDBdriver;
2912
-		$filter_query = $this->getFilter($filters,true,true);
2912
+		$filter_query = $this->getFilter($filters, true, true);
2913 2913
 		if ($globalTimezone != '') {
2914 2914
 			date_default_timezone_set($globalTimezone);
2915 2915
 			$datetime = new DateTime();
@@ -3041,12 +3041,12 @@  discard block
 block discarded – undo
3041 3041
 		} else $offset = '+00:00';
3042 3042
 
3043 3043
 		if ($globalDBdriver == 'mysql') {
3044
-			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
3044
+			$query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
3045 3045
 								FROM spotter_output
3046 3046
 								WHERE spotter_output.date <> '' 
3047 3047
 								ORDER BY spotter_output.date ASC LIMIT 0,200";
3048 3048
 		} else {
3049
-			$query  = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
3049
+			$query = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
3050 3050
 								FROM spotter_output
3051 3051
 								WHERE spotter_output.date <> '' 
3052 3052
 								ORDER BY spotter_output.date ASC LIMIT 0,200";
@@ -3058,7 +3058,7 @@  discard block
 block discarded – undo
3058 3058
 		$date_array = array();
3059 3059
 		$temp_array = array();
3060 3060
 		
3061
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3061
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3062 3062
 		{
3063 3063
 			$temp_array['date'] = $row['date'];
3064 3064
 
@@ -3078,7 +3078,7 @@  discard block
 block discarded – undo
3078 3078
 	*/
3079 3079
 	public function getAllRoutes()
3080 3080
 	{
3081
-		$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 
3081
+		$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 
3082 3082
 				FROM spotter_output
3083 3083
 				WHERE spotter_output.ident <> '' 
3084 3084
 				GROUP BY route
@@ -3089,7 +3089,7 @@  discard block
 block discarded – undo
3089 3089
 
3090 3090
 		$routes_array = array();
3091 3091
 		$temp_array = array();
3092
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3092
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3093 3093
 		{
3094 3094
 			$temp_array['route'] = $row['route'];
3095 3095
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -3108,21 +3108,21 @@  discard block
 block discarded – undo
3108 3108
 	* @return String success or false
3109 3109
 	*
3110 3110
 	*/	
3111
-	public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL)
3111
+	public function updateIdentSpotterData($flightaware_id = '', $ident = '', $fromsource = NULL)
3112 3112
 	{
3113 3113
 		if (!is_numeric(substr($ident, 0, 3)))
3114 3114
 		{
3115 3115
 			if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) {
3116
-				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource);
3116
+				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource);
3117 3117
 			} elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) {
3118
-				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource);
3118
+				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource);
3119 3119
 			} else {
3120 3120
 				$airline_array = $this->getAllAirlineInfo("NA");
3121 3121
 			}
3122 3122
 			if (count($airline_array) == 0) {
3123 3123
 				$airline_array = $this->getAllAirlineInfo("NA");
3124 3124
 			}
3125
-			if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3125
+			if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") {
3126 3126
 				$airline_array = $this->getAllAirlineInfo("NA");
3127 3127
 			}
3128 3128
 		} else {
@@ -3135,7 +3135,7 @@  discard block
 block discarded – undo
3135 3135
 
3136 3136
 
3137 3137
 		$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';
3138
-                $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);
3138
+                $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 3139
 
3140 3140
 		try {
3141 3141
 			$sth = $this->db->prepare($query);
@@ -3156,11 +3156,11 @@  discard block
 block discarded – undo
3156 3156
 	* @return String success or false
3157 3157
 	*
3158 3158
 	*/	
3159
-	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3159
+	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '', $arrival_airport_time = '')
3160 3160
 	{
3161 3161
 		if ($groundspeed == '') $groundspeed = NULL;
3162 3162
 		$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';
3163
-                $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);
3163
+                $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 3164
 
3165 3165
 		try {
3166 3166
 			$sth = $this->db->prepare($query);
@@ -3200,7 +3200,7 @@  discard block
 block discarded – undo
3200 3200
 	* @param String $verticalrate vertival rate of flight
3201 3201
 	* @return String success or false
3202 3202
 	*/
3203
-	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 = '')
3203
+	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 = '')
3204 3204
 	{
3205 3205
 		global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM;
3206 3206
 		
@@ -3224,13 +3224,13 @@  discard block
 block discarded – undo
3224 3224
 				if ($ModeS != '') {
3225 3225
 					$timeelapsed = microtime(true);
3226 3226
 					$registration = $this->getAircraftRegistrationBymodeS($ModeS);
3227
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3227
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3228 3228
 				} else {
3229
-					$myhex = explode('-',$flightaware_id);
3229
+					$myhex = explode('-', $flightaware_id);
3230 3230
 					if (count($myhex) > 0) {
3231 3231
 						$timeelapsed = microtime(true);
3232 3232
 						$registration = $this->getAircraftRegistrationBymodeS($myhex[0]);
3233
-						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3233
+						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3234 3234
 					}
3235 3235
 				}
3236 3236
 			}
@@ -3252,24 +3252,24 @@  discard block
 block discarded – undo
3252 3252
 				{
3253 3253
 					$timeelapsed = microtime(true);
3254 3254
 					if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) {
3255
-						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource);
3255
+						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource);
3256 3256
 					} elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) {
3257
-						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource);
3257
+						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource);
3258 3258
 					} else {
3259 3259
 						$airline_array = $this->getAllAirlineInfo("NA");
3260 3260
 					}
3261 3261
 					if (count($airline_array) == 0) {
3262 3262
 						$airline_array = $this->getAllAirlineInfo("NA");
3263 3263
 					}
3264
-					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3264
+					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") {
3265 3265
 						$airline_array = $this->getAllAirlineInfo("NA");
3266 3266
 					}
3267
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3267
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3268 3268
 
3269 3269
 				} else {
3270 3270
 					$timeelapsed = microtime(true);
3271 3271
 					$airline_array = $this->getAllAirlineInfo("NA");
3272
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3272
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3273 3273
 				}
3274 3274
 			}
3275 3275
 		} else $airline_array = array();
@@ -3286,27 +3286,27 @@  discard block
 block discarded – undo
3286 3286
 				{
3287 3287
 					$timeelapsed = microtime(true);
3288 3288
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3289
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3289
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3290 3290
 				} else {
3291 3291
 					$timeelapsed = microtime(true);
3292 3292
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3293
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3293
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3294 3294
 				}
3295 3295
 			}
3296 3296
 		} else {
3297 3297
 			if ($ModeS != '') {
3298 3298
 				$timeelapsed = microtime(true);
3299 3299
 				$aircraft_icao = $this->getAllAircraftType($ModeS);
3300
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3300
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3301 3301
 				if ($aircraft_icao == "" || $aircraft_icao == "XXXX")
3302 3302
 				{
3303 3303
 					$timeelapsed = microtime(true);
3304 3304
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3305
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3305
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3306 3306
 				} else {
3307 3307
 					$timeelapsed = microtime(true);
3308 3308
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3309
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3309
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3310 3310
 				}
3311 3311
 			}
3312 3312
 		}
@@ -3321,7 +3321,7 @@  discard block
 block discarded – undo
3321 3321
 			} else {
3322 3322
 				$timeelapsed = microtime(true);
3323 3323
 				$departure_airport_array = $this->getAllAirportInfo($departure_airport_icao);
3324
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3324
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3325 3325
 			}
3326 3326
 		}
3327 3327
 		
@@ -3335,7 +3335,7 @@  discard block
 block discarded – undo
3335 3335
 			} else {
3336 3336
 				$timeelapsed = microtime(true);
3337 3337
 				$arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao);
3338
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3338
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3339 3339
 			}
3340 3340
 		}
3341 3341
 
@@ -3399,7 +3399,7 @@  discard block
 block discarded – undo
3399 3399
 		{
3400 3400
 			$timeelapsed = microtime(true);
3401 3401
 			$image_array = $Image->getSpotterImage($registration);
3402
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3402
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3403 3403
 			if (!isset($image_array[0]['registration']))
3404 3404
 			{
3405 3405
 				//echo "Add image !!!! \n";
@@ -3407,7 +3407,7 @@  discard block
 block discarded – undo
3407 3407
 			}
3408 3408
 			$timeelapsed = microtime(true);
3409 3409
 			$owner_info = $this->getAircraftOwnerByRegistration($registration);
3410
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3410
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3411 3411
 			if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner']));
3412 3412
 		}
3413 3413
     
@@ -3415,33 +3415,33 @@  discard block
 block discarded – undo
3415 3415
 		{
3416 3416
             		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3417 3417
             		else $airline_icao = '';
3418
-			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3418
+			$image_array = $Image->getSpotterImage('', $aircraft_icao, $airline_icao);
3419 3419
 			if (!isset($image_array[0]['registration']))
3420 3420
 			{
3421 3421
 				//echo "Add image !!!! \n";
3422
-				$Image->addSpotterImage('',$aircraft_icao,$airline_icao);
3422
+				$Image->addSpotterImage('', $aircraft_icao, $airline_icao);
3423 3423
 			}
3424 3424
 		}
3425 3425
     
3426
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
3427
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
3428
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
3429
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
3430
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
3431
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
3432
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3433
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3434
-		$waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING);
3435
-		$altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3436
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
3437
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3438
-		$squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT);
3439
-		$route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING);
3440
-		$ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING);
3441
-		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING);
3442
-		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
3443
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
3444
-		$verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT);
3426
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
3427
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
3428
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
3429
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
3430
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
3431
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
3432
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3433
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3434
+		$waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING);
3435
+		$altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3436
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
3437
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3438
+		$squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT);
3439
+		$route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING);
3440
+		$ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING);
3441
+		$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING);
3442
+		$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
3443
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
3444
+		$verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT);
3445 3445
 	
3446 3446
 		if (count($airline_array) == 0) 
3447 3447
 		{
@@ -3465,7 +3465,7 @@  discard block
 block discarded – undo
3465 3465
                 if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3466 3466
                 if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3467 3467
                 if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3468
-                $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) 
3468
+                $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) 
3469 3469
                 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)";
3470 3470
 
3471 3471
                 $airline_name = $airline_array[0]['name'];
@@ -3475,7 +3475,7 @@  discard block
 block discarded – undo
3475 3475
 		if ($airline_type == '') {
3476 3476
 			$timeelapsed = microtime(true);
3477 3477
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3478
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3478
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3479 3479
 		}
3480 3480
 		if ($airline_type == null) $airline_type = '';
3481 3481
                 $aircraft_type = $aircraft_array[0]['type'];
@@ -3486,7 +3486,7 @@  discard block
 block discarded – undo
3486 3486
                 $arrival_airport_name = $arrival_airport_array[0]['name'];
3487 3487
                 $arrival_airport_city = $arrival_airport_array[0]['city'];
3488 3488
                 $arrival_airport_country = $arrival_airport_array[0]['country'];
3489
-                $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);
3489
+                $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);
3490 3490
 
3491 3491
 		try {
3492 3492
 		        
@@ -3512,13 +3512,13 @@  discard block
 block discarded – undo
3512 3512
 	{
3513 3513
 		global $globalDBdriver, $globalTimezone;
3514 3514
 		if ($globalDBdriver == 'mysql') {
3515
-			$query  = "SELECT spotter_output.ident FROM spotter_output 
3515
+			$query = "SELECT spotter_output.ident FROM spotter_output 
3516 3516
 								WHERE spotter_output.ident = :ident 
3517 3517
 								AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
3518 3518
 								AND spotter_output.date < UTC_TIMESTAMP()";
3519 3519
 			$query_data = array(':ident' => $ident);
3520 3520
 		} else {
3521
-			$query  = "SELECT spotter_output.ident FROM spotter_output 
3521
+			$query = "SELECT spotter_output.ident FROM spotter_output 
3522 3522
 								WHERE spotter_output.ident = :ident 
3523 3523
 								AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
3524 3524
 								AND spotter_output.date < now() AT TIME ZONE 'UTC'";
@@ -3527,8 +3527,8 @@  discard block
 block discarded – undo
3527 3527
 		
3528 3528
 		$sth = $this->db->prepare($query);
3529 3529
 		$sth->execute($query_data);
3530
-    		$ident_result='';
3531
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3530
+    		$ident_result = '';
3531
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3532 3532
 		{
3533 3533
 			$ident_result = $row['ident'];
3534 3534
 		}
@@ -3554,8 +3554,8 @@  discard block
 block discarded – undo
3554 3554
 				return false;
3555 3555
 			} else {
3556 3556
 				$q_array = explode(" ", $q);
3557
-				foreach ($q_array as $q_item){
3558
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
3557
+				foreach ($q_array as $q_item) {
3558
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
3559 3559
 					$additional_query .= " AND (";
3560 3560
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
3561 3561
 					$additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR ";
@@ -3570,11 +3570,11 @@  discard block
 block discarded – undo
3570 3570
 			}
3571 3571
 		}
3572 3572
 		if ($globalDBdriver == 'mysql') {
3573
-			$query  = "SELECT spotter_output.* FROM spotter_output 
3573
+			$query = "SELECT spotter_output.* FROM spotter_output 
3574 3574
 				WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." 
3575 3575
 				AND spotter_output.date < UTC_TIMESTAMP()";
3576 3576
 		} else {
3577
-			$query  = "SELECT spotter_output.* FROM spotter_output 
3577
+			$query = "SELECT spotter_output.* FROM spotter_output 
3578 3578
 				WHERE spotter_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." 
3579 3579
 				AND spotter_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
3580 3580
 		}
@@ -3591,11 +3591,11 @@  discard block
 block discarded – undo
3591 3591
 	* @return Array the airline list
3592 3592
 	*
3593 3593
 	*/
3594
-	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3594
+	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
3595 3595
 	{
3596 3596
 		global $globalDBdriver;
3597
-		$filter_query = $this->getFilter($filters,true,true);
3598
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3597
+		$filter_query = $this->getFilter($filters, true, true);
3598
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3599 3599
 		 			FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.airline_icao <> 'NA' ";
3600 3600
 		if ($olderthanmonths > 0) {
3601 3601
 			if ($globalDBdriver == 'mysql') {
@@ -3619,7 +3619,7 @@  discard block
 block discarded – undo
3619 3619
  
3620 3620
 		$airline_array = array();
3621 3621
 		$temp_array = array();
3622
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3622
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3623 3623
 		{
3624 3624
 			$temp_array['airline_name'] = $row['airline_name'];
3625 3625
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -3636,11 +3636,11 @@  discard block
 block discarded – undo
3636 3636
 	* @return Array the pilots list
3637 3637
 	*
3638 3638
 	*/
3639
-	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3639
+	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
3640 3640
 	{
3641 3641
 		global $globalDBdriver;
3642
-		$filter_query = $this->getFilter($filters,true,true);
3643
-		$query  = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count
3642
+		$filter_query = $this->getFilter($filters, true, true);
3643
+		$query = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count
3644 3644
 		 			FROM spotter_output".$filter_query." spotter_output.pilot_id <> '' ";
3645 3645
                 if ($olderthanmonths > 0) {
3646 3646
             		if ($globalDBdriver == 'mysql') {
@@ -3666,7 +3666,7 @@  discard block
 block discarded – undo
3666 3666
 		$airline_array = array();
3667 3667
 		$temp_array = array();
3668 3668
         
3669
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3669
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3670 3670
 		{
3671 3671
 			$temp_array['pilot_name'] = $row['pilot_name'];
3672 3672
 			$temp_array['pilot_id'] = $row['pilot_id'];
@@ -3685,7 +3685,7 @@  discard block
 block discarded – undo
3685 3685
 	public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
3686 3686
 	{
3687 3687
 		global $globalDBdriver;
3688
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count
3688
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count
3689 3689
 		 			FROM spotter_output WHERE spotter_output.pilot_id <> '' ";
3690 3690
                 if ($olderthanmonths > 0) {
3691 3691
             		if ($globalDBdriver == 'mysql') {
@@ -3711,7 +3711,7 @@  discard block
 block discarded – undo
3711 3711
 		$airline_array = array();
3712 3712
 		$temp_array = array();
3713 3713
         
3714
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3714
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3715 3715
 		{
3716 3716
 			$temp_array['pilot_name'] = $row['pilot_name'];
3717 3717
 			$temp_array['pilot_id'] = $row['pilot_id'];
@@ -3728,11 +3728,11 @@  discard block
 block discarded – undo
3728 3728
 	* @return Array the pilots list
3729 3729
 	*
3730 3730
 	*/
3731
-	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3731
+	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
3732 3732
 	{
3733 3733
 		global $globalDBdriver;
3734
-		$filter_query = $this->getFilter($filters,true,true);
3735
-		$query  = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3734
+		$filter_query = $this->getFilter($filters, true, true);
3735
+		$query = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3736 3736
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3737 3737
                 if ($olderthanmonths > 0) {
3738 3738
             		if ($globalDBdriver == 'mysql') {
@@ -3758,7 +3758,7 @@  discard block
 block discarded – undo
3758 3758
 		$airline_array = array();
3759 3759
 		$temp_array = array();
3760 3760
         
3761
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3761
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3762 3762
 		{
3763 3763
 			$temp_array['owner_name'] = $row['owner_name'];
3764 3764
 			$temp_array['owner_count'] = $row['owner_count'];
@@ -3773,11 +3773,11 @@  discard block
 block discarded – undo
3773 3773
 	* @return Array the pilots list
3774 3774
 	*
3775 3775
 	*/
3776
-	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3776
+	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
3777 3777
 	{
3778 3778
 		global $globalDBdriver;
3779
-		$filter_query = $this->getFilter($filters,true,true);
3780
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3779
+		$filter_query = $this->getFilter($filters, true, true);
3780
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3781 3781
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3782 3782
                 if ($olderthanmonths > 0) {
3783 3783
             		if ($globalDBdriver == 'mysql') {
@@ -3803,7 +3803,7 @@  discard block
 block discarded – undo
3803 3803
 		$airline_array = array();
3804 3804
 		$temp_array = array();
3805 3805
         
3806
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3806
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3807 3807
 		{
3808 3808
 			$temp_array['owner_name'] = $row['owner_name'];
3809 3809
 			$temp_array['owner_count'] = $row['owner_count'];
@@ -3819,11 +3819,11 @@  discard block
 block discarded – undo
3819 3819
 	* @return Array the airline list
3820 3820
 	*
3821 3821
 	*/
3822
-	public function countAllAirlinesByAircraft($aircraft_icao,$filters = array())
3822
+	public function countAllAirlinesByAircraft($aircraft_icao, $filters = array())
3823 3823
 	{
3824
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
3825
-		$filter_query = $this->getFilter($filters,true,true);
3826
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3824
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
3825
+		$filter_query = $this->getFilter($filters, true, true);
3826
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3827 3827
 		 	    FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
3828 3828
 			    GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country 
3829 3829
 			    ORDER BY airline_count DESC";
@@ -3835,7 +3835,7 @@  discard block
 block discarded – undo
3835 3835
 		$airline_array = array();
3836 3836
 		$temp_array = array();
3837 3837
         
3838
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3838
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3839 3839
 		{
3840 3840
 			$temp_array['airline_name'] = $row['airline_name'];
3841 3841
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -3855,11 +3855,11 @@  discard block
 block discarded – undo
3855 3855
 	* @return Array the airline country list
3856 3856
 	*
3857 3857
 	*/
3858
-	public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array())
3858
+	public function countAllAirlineCountriesByAircraft($aircraft_icao, $filters = array())
3859 3859
 	{
3860
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
3861
-		$filter_query = $this->getFilter($filters,true,true);
3862
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
3860
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
3861
+		$filter_query = $this->getFilter($filters, true, true);
3862
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
3863 3863
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
3864 3864
                     GROUP BY spotter_output.airline_country
3865 3865
 					ORDER BY airline_country_count DESC
@@ -3872,7 +3872,7 @@  discard block
 block discarded – undo
3872 3872
 		$airline_country_array = array();
3873 3873
 		$temp_array = array();
3874 3874
         
3875
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3875
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3876 3876
 		{
3877 3877
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
3878 3878
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -3891,11 +3891,11 @@  discard block
 block discarded – undo
3891 3891
 	* @return Array the airline list
3892 3892
 	*
3893 3893
 	*/
3894
-	public function countAllAirlinesByAirport($airport_icao,$filters = array())
3894
+	public function countAllAirlinesByAirport($airport_icao, $filters = array())
3895 3895
 	{
3896
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
3897
-		$filter_query = $this->getFilter($filters,true,true);
3898
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3896
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
3897
+		$filter_query = $this->getFilter($filters, true, true);
3898
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3899 3899
 		    FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao ) 
3900 3900
                     GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country
3901 3901
 		    ORDER BY airline_count DESC";
@@ -3907,7 +3907,7 @@  discard block
 block discarded – undo
3907 3907
 		$airline_array = array();
3908 3908
 		$temp_array = array();
3909 3909
         
3910
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3910
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3911 3911
 		{
3912 3912
 			$temp_array['airline_name'] = $row['airline_name'];
3913 3913
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -3926,11 +3926,11 @@  discard block
 block discarded – undo
3926 3926
 	* @return Array the airline country list
3927 3927
 	*
3928 3928
 	*/
3929
-	public function countAllAirlineCountriesByAirport($airport_icao,$filters = array())
3929
+	public function countAllAirlineCountriesByAirport($airport_icao, $filters = array())
3930 3930
 	{
3931
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
3932
-		$filter_query = $this->getFilter($filters,true,true);
3933
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
3931
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
3932
+		$filter_query = $this->getFilter($filters, true, true);
3933
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
3934 3934
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao )
3935 3935
 					GROUP BY spotter_output.airline_country
3936 3936
 					ORDER BY airline_country_count DESC
@@ -3943,7 +3943,7 @@  discard block
 block discarded – undo
3943 3943
 		$airline_country_array = array();
3944 3944
 		$temp_array = array();
3945 3945
         
3946
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3946
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3947 3947
 		{
3948 3948
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
3949 3949
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -3960,11 +3960,11 @@  discard block
 block discarded – undo
3960 3960
 	* @return Array the airline list
3961 3961
 	*
3962 3962
 	*/
3963
-	public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array())
3963
+	public function countAllAirlinesByManufacturer($aircraft_manufacturer, $filters = array())
3964 3964
 	{
3965
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
3966
-		$filter_query = $this->getFilter($filters,true,true);
3967
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3965
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
3966
+		$filter_query = $this->getFilter($filters, true, true);
3967
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3968 3968
 		 			FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
3969 3969
 					GROUP BY spotter_output.airline_name
3970 3970
 					ORDER BY airline_count DESC";
@@ -3975,7 +3975,7 @@  discard block
 block discarded – undo
3975 3975
 		$airline_array = array();
3976 3976
 		$temp_array = array();
3977 3977
         
3978
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3978
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3979 3979
 		{
3980 3980
 			$temp_array['airline_name'] = $row['airline_name'];
3981 3981
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -3995,11 +3995,11 @@  discard block
 block discarded – undo
3995 3995
 	* @return Array the airline country list
3996 3996
 	*
3997 3997
 	*/
3998
-	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array())
3998
+	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer, $filters = array())
3999 3999
 	{
4000
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4001
-		$filter_query = $this->getFilter($filters,true,true);
4002
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4000
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4001
+		$filter_query = $this->getFilter($filters, true, true);
4002
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4003 4003
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
4004 4004
 					GROUP BY spotter_output.airline_country
4005 4005
 					ORDER BY airline_country_count DESC
@@ -4012,7 +4012,7 @@  discard block
 block discarded – undo
4012 4012
 		$airline_country_array = array();
4013 4013
 		$temp_array = array();
4014 4014
         
4015
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4015
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4016 4016
 		{
4017 4017
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4018 4018
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4028,11 +4028,11 @@  discard block
 block discarded – undo
4028 4028
 	* @return Array the airline list
4029 4029
 	*
4030 4030
 	*/
4031
-	public function countAllAirlinesByDate($date,$filters = array())
4031
+	public function countAllAirlinesByDate($date, $filters = array())
4032 4032
 	{
4033 4033
 		global $globalTimezone, $globalDBdriver;
4034
-		$filter_query = $this->getFilter($filters,true,true);
4035
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4034
+		$filter_query = $this->getFilter($filters, true, true);
4035
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4036 4036
 		if ($globalTimezone != '') {
4037 4037
 			date_default_timezone_set($globalTimezone);
4038 4038
 			$datetime = new DateTime($date);
@@ -4040,12 +4040,12 @@  discard block
 block discarded – undo
4040 4040
 		} else $offset = '+00:00';
4041 4041
 
4042 4042
 		if ($globalDBdriver == 'mysql') {
4043
-			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4043
+			$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4044 4044
 		 			FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4045 4045
 					GROUP BY spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country 
4046 4046
 					ORDER BY airline_count DESC";
4047 4047
 		} else {
4048
-			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4048
+			$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4049 4049
 		 			FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4050 4050
 					GROUP BY spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country
4051 4051
 					ORDER BY airline_count DESC";
@@ -4056,7 +4056,7 @@  discard block
 block discarded – undo
4056 4056
 
4057 4057
 		$airline_array = array();
4058 4058
 		$temp_array = array();
4059
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4059
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4060 4060
 		{
4061 4061
 			$temp_array['airline_name'] = $row['airline_name'];
4062 4062
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4076,11 +4076,11 @@  discard block
 block discarded – undo
4076 4076
 	* @return Array the airline country list
4077 4077
 	*
4078 4078
 	*/
4079
-	public function countAllAirlineCountriesByDate($date,$filters = array())
4079
+	public function countAllAirlineCountriesByDate($date, $filters = array())
4080 4080
 	{
4081 4081
 		global $globalTimezone, $globalDBdriver;
4082
-		$filter_query = $this->getFilter($filters,true,true);
4083
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4082
+		$filter_query = $this->getFilter($filters, true, true);
4083
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4084 4084
 		if ($globalTimezone != '') {
4085 4085
 			date_default_timezone_set($globalTimezone);
4086 4086
 			$datetime = new DateTime($date);
@@ -4088,13 +4088,13 @@  discard block
 block discarded – undo
4088 4088
 		} else $offset = '+00:00';
4089 4089
 		
4090 4090
 		if ($globalDBdriver == 'mysql') {
4091
-			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4091
+			$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4092 4092
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4093 4093
 					GROUP BY spotter_output.airline_country
4094 4094
 					ORDER BY airline_country_count DESC
4095 4095
 					LIMIT 10 OFFSET 0";
4096 4096
 		} else {
4097
-			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4097
+			$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4098 4098
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4099 4099
 					GROUP BY spotter_output.airline_country
4100 4100
 					ORDER BY airline_country_count DESC
@@ -4106,7 +4106,7 @@  discard block
 block discarded – undo
4106 4106
  
4107 4107
 		$airline_country_array = array();
4108 4108
 		$temp_array = array();
4109
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4109
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4110 4110
 		{
4111 4111
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4112 4112
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4123,11 +4123,11 @@  discard block
 block discarded – undo
4123 4123
 	* @return Array the airline list
4124 4124
 	*
4125 4125
 	*/
4126
-	public function countAllAirlinesByIdent($ident,$filters = array())
4126
+	public function countAllAirlinesByIdent($ident, $filters = array())
4127 4127
 	{
4128
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
4129
-		$filter_query = $this->getFilter($filters,true,true);
4130
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4128
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
4129
+		$filter_query = $this->getFilter($filters, true, true);
4130
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4131 4131
 		 		FROM spotter_output".$filter_query." spotter_output.ident = :ident  
4132 4132
 				GROUP BY spotter_output.airline_name
4133 4133
 				ORDER BY airline_count DESC";
@@ -4139,7 +4139,7 @@  discard block
 block discarded – undo
4139 4139
 		$airline_array = array();
4140 4140
 		$temp_array = array();
4141 4141
         
4142
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4142
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4143 4143
 		{
4144 4144
 			$temp_array['airline_name'] = $row['airline_name'];
4145 4145
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4157,25 +4157,25 @@  discard block
 block discarded – undo
4157 4157
 	* @return Array the airline list
4158 4158
 	*
4159 4159
 	*/
4160
-	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
4160
+	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
4161 4161
 	{
4162
-		$filter_query = $this->getFilter($filters,true,true);
4163
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
4164
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
4162
+		$filter_query = $this->getFilter($filters, true, true);
4163
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
4164
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
4165 4165
 
4166
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4166
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4167 4167
 		 			FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) 
4168 4168
 					GROUP BY spotter_output.airline_name
4169 4169
 					ORDER BY airline_count DESC";
4170 4170
       
4171 4171
 		
4172 4172
 		$sth = $this->db->prepare($query);
4173
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
4173
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
4174 4174
       
4175 4175
 		$airline_array = array();
4176 4176
 		$temp_array = array();
4177 4177
         
4178
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4178
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4179 4179
 		{
4180 4180
 			$temp_array['airline_name'] = $row['airline_name'];
4181 4181
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4193,13 +4193,13 @@  discard block
 block discarded – undo
4193 4193
 	* @return Array the airline country list
4194 4194
 	*
4195 4195
 	*/
4196
-	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array())
4196
+	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
4197 4197
 	{
4198
-		$filter_query = $this->getFilter($filters,true,true);
4199
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
4200
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
4198
+		$filter_query = $this->getFilter($filters, true, true);
4199
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
4200
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
4201 4201
       
4202
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4202
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4203 4203
 		 		FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) 
4204 4204
 				GROUP BY spotter_output.airline_country
4205 4205
 				ORDER BY airline_country_count DESC
@@ -4207,11 +4207,11 @@  discard block
 block discarded – undo
4207 4207
       
4208 4208
 		
4209 4209
 		$sth = $this->db->prepare($query);
4210
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
4210
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
4211 4211
       
4212 4212
 		$airline_country_array = array();
4213 4213
 		$temp_array = array();
4214
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4214
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4215 4215
 		{
4216 4216
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4217 4217
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4229,11 +4229,11 @@  discard block
 block discarded – undo
4229 4229
 	* @return Array the airline list
4230 4230
 	*
4231 4231
 	*/
4232
-	public function countAllAirlinesByCountry($country,$filters = array())
4232
+	public function countAllAirlinesByCountry($country, $filters = array())
4233 4233
 	{
4234
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
4235
-		$filter_query = $this->getFilter($filters,true,true);
4236
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4234
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
4235
+		$filter_query = $this->getFilter($filters, true, true);
4236
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4237 4237
 		 	    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country  
4238 4238
 			    GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country 
4239 4239
 			    ORDER BY airline_count DESC";
@@ -4244,7 +4244,7 @@  discard block
 block discarded – undo
4244 4244
 
4245 4245
 		$airline_array = array();
4246 4246
 		$temp_array = array();
4247
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4247
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4248 4248
 		{
4249 4249
 			$temp_array['airline_name'] = $row['airline_name'];
4250 4250
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4263,11 +4263,11 @@  discard block
 block discarded – undo
4263 4263
 	* @return Array the airline country list
4264 4264
 	*
4265 4265
 	*/
4266
-	public function countAllAirlineCountriesByCountry($country,$filters = array())
4266
+	public function countAllAirlineCountriesByCountry($country, $filters = array())
4267 4267
 	{
4268
-		$filter_query = $this->getFilter($filters,true,true);
4269
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
4270
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4268
+		$filter_query = $this->getFilter($filters, true, true);
4269
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
4270
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4271 4271
 		 		FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
4272 4272
 				GROUP BY spotter_output.airline_country
4273 4273
 				ORDER BY airline_country_count DESC
@@ -4279,7 +4279,7 @@  discard block
 block discarded – undo
4279 4279
 
4280 4280
 		$airline_country_array = array();
4281 4281
 		$temp_array = array();
4282
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4282
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4283 4283
 		{
4284 4284
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4285 4285
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4298,8 +4298,8 @@  discard block
 block discarded – undo
4298 4298
 	*/
4299 4299
 	public function countAllAirlineCountries($limit = true, $filters = array())
4300 4300
 	{
4301
-		$filter_query = $this->getFilter($filters,true,true);
4302
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4301
+		$filter_query = $this->getFilter($filters, true, true);
4302
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4303 4303
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA' 
4304 4304
 					GROUP BY spotter_output.airline_country
4305 4305
 					ORDER BY airline_country_count DESC";
@@ -4310,7 +4310,7 @@  discard block
 block discarded – undo
4310 4310
 
4311 4311
 		$airline_array = array();
4312 4312
 		$temp_array = array();
4313
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4313
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4314 4314
 		{
4315 4315
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4316 4316
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4326,11 +4326,11 @@  discard block
 block discarded – undo
4326 4326
 	* @return Array the airline country list
4327 4327
 	*
4328 4328
 	*/
4329
-	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
4329
+	public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '')
4330 4330
 	{
4331 4331
 		global $globalDBdriver;
4332 4332
 		//$filter_query = $this->getFilter($filters,true,true);
4333
-		$Connection= new Connection($this->db);
4333
+		$Connection = new Connection($this->db);
4334 4334
 		if (!$Connection->tableExists('countries')) return array();
4335 4335
 		/*
4336 4336
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
@@ -4365,7 +4365,7 @@  discard block
 block discarded – undo
4365 4365
 		$flight_array = array();
4366 4366
 		$temp_array = array();
4367 4367
         
4368
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4368
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4369 4369
 		{
4370 4370
 			$temp_array['flight_count'] = $row['nb'];
4371 4371
 			$temp_array['flight_country'] = $row['name'];
@@ -4383,12 +4383,12 @@  discard block
 block discarded – undo
4383 4383
 	* @return Array the aircraft list
4384 4384
 	*
4385 4385
 	*/
4386
-	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4386
+	public function countAllAircraftTypes($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
4387 4387
 	{
4388 4388
 		global $globalDBdriver;
4389
-		$filter_query = $this->getFilter($filters,true,true);
4389
+		$filter_query = $this->getFilter($filters, true, true);
4390 4390
 
4391
-		$query  = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4391
+		$query = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4392 4392
 		    FROM spotter_output ".$filter_query." spotter_output.aircraft_name  <> '' AND spotter_output.aircraft_icao  <> ''";
4393 4393
 		if ($olderthanmonths > 0) {
4394 4394
 			if ($globalDBdriver == 'mysql') {
@@ -4413,7 +4413,7 @@  discard block
 block discarded – undo
4413 4413
 
4414 4414
 		$aircraft_array = array();
4415 4415
 		$temp_array = array();
4416
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4416
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4417 4417
 		{
4418 4418
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4419 4419
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4430,11 +4430,11 @@  discard block
 block discarded – undo
4430 4430
 	* @return Array the aircraft list
4431 4431
 	*
4432 4432
 	*/
4433
-	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4433
+	public function countAllAircraftTypesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
4434 4434
 	{
4435 4435
 		global $globalDBdriver;
4436
-		$filter_query = $this->getFilter($filters,true,true);
4437
-		$query  = "SELECT spotter_output.airline_icao, spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4436
+		$filter_query = $this->getFilter($filters, true, true);
4437
+		$query = "SELECT spotter_output.airline_icao, spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4438 4438
 		    FROM spotter_output".$filter_query." spotter_output.aircraft_name  <> '' AND spotter_output.aircraft_icao  <> '' AND spotter_output.airline_icao <>'' AND spotter_output.airline_icao <> 'NA' ";
4439 4439
 		if ($olderthanmonths > 0) {
4440 4440
 			if ($globalDBdriver == 'mysql') {
@@ -4459,7 +4459,7 @@  discard block
 block discarded – undo
4459 4459
 
4460 4460
 		$aircraft_array = array();
4461 4461
 		$temp_array = array();
4462
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4462
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4463 4463
 		{
4464 4464
 			$temp_array['airline_icao'] = $row['airline_icao'];
4465 4465
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -4478,13 +4478,13 @@  discard block
 block discarded – undo
4478 4478
 	* @return Array the aircraft list
4479 4479
 	*
4480 4480
 	*/
4481
-	public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array())
4481
+	public function countAllAircraftRegistrationByAircraft($aircraft_icao, $filters = array())
4482 4482
 	{
4483 4483
 		$Image = new Image($this->db);
4484
-		$filter_query = $this->getFilter($filters,true,true);
4485
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
4484
+		$filter_query = $this->getFilter($filters, true, true);
4485
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
4486 4486
 
4487
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
4487
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
4488 4488
 				FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_icao = :aircraft_icao  
4489 4489
 				GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
4490 4490
 				ORDER BY registration_count DESC";
@@ -4495,14 +4495,14 @@  discard block
 block discarded – undo
4495 4495
 		$aircraft_array = array();
4496 4496
 		$temp_array = array();
4497 4497
         
4498
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4498
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4499 4499
 		{
4500 4500
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4501 4501
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4502 4502
 			$temp_array['registration'] = $row['registration'];
4503 4503
 			$temp_array['airline_name'] = $row['airline_name'];
4504 4504
 			$temp_array['image_thumbnail'] = "";
4505
-			if($row['registration'] != "")
4505
+			if ($row['registration'] != "")
4506 4506
 			{
4507 4507
 				$image_array = $Image->getSpotterImage($row['registration']);
4508 4508
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4521,11 +4521,11 @@  discard block
 block discarded – undo
4521 4521
 	* @return Array the aircraft list
4522 4522
 	*
4523 4523
 	*/
4524
-	public function countAllAircraftTypesByAirline($airline_icao,$filters = array())
4524
+	public function countAllAircraftTypesByAirline($airline_icao, $filters = array())
4525 4525
 	{
4526
-		$filter_query = $this->getFilter($filters,true,true);
4527
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
4528
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4526
+		$filter_query = $this->getFilter($filters, true, true);
4527
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
4528
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4529 4529
 			    FROM spotter_output".$filter_query." spotter_output.aircraft_icao <> '' AND spotter_output.airline_icao = :airline_icao 
4530 4530
 			    GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
4531 4531
 			    ORDER BY aircraft_icao_count DESC";
@@ -4536,7 +4536,7 @@  discard block
 block discarded – undo
4536 4536
 		$aircraft_array = array();
4537 4537
 		$temp_array = array();
4538 4538
 
4539
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4539
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4540 4540
 		{
4541 4541
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4542 4542
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4554,13 +4554,13 @@  discard block
 block discarded – undo
4554 4554
 	* @return Array the aircraft list
4555 4555
 	*
4556 4556
 	*/
4557
-	public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array())
4557
+	public function countAllAircraftRegistrationByAirline($airline_icao, $filters = array())
4558 4558
 	{
4559
-		$filter_query = $this->getFilter($filters,true,true);
4559
+		$filter_query = $this->getFilter($filters, true, true);
4560 4560
 		$Image = new Image($this->db);
4561
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
4561
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
4562 4562
 
4563
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name 
4563
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name 
4564 4564
 			    FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.airline_icao = :airline_icao 
4565 4565
 			    GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name
4566 4566
 			    ORDER BY registration_count DESC";
@@ -4570,14 +4570,14 @@  discard block
 block discarded – undo
4570 4570
 
4571 4571
 		$aircraft_array = array();
4572 4572
 		$temp_array = array();
4573
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4573
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4574 4574
 		{
4575 4575
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4576 4576
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4577 4577
 			$temp_array['registration'] = $row['registration'];
4578 4578
 			$temp_array['airline_name'] = $row['airline_name'];
4579 4579
 			$temp_array['image_thumbnail'] = "";
4580
-			if($row['registration'] != "")
4580
+			if ($row['registration'] != "")
4581 4581
 			{
4582 4582
 				$image_array = $Image->getSpotterImage($row['registration']);
4583 4583
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4596,11 +4596,11 @@  discard block
 block discarded – undo
4596 4596
 	* @return Array the aircraft list
4597 4597
 	*
4598 4598
 	*/
4599
-	public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array())
4599
+	public function countAllAircraftManufacturerByAirline($airline_icao, $filters = array())
4600 4600
 	{
4601
-		$filter_query = $this->getFilter($filters,true,true);
4602
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
4603
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4601
+		$filter_query = $this->getFilter($filters, true, true);
4602
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
4603
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4604 4604
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.airline_icao = :airline_icao 
4605 4605
 				GROUP BY spotter_output.aircraft_manufacturer 
4606 4606
 				ORDER BY aircraft_manufacturer_count DESC";
@@ -4611,7 +4611,7 @@  discard block
 block discarded – undo
4611 4611
 		$aircraft_array = array();
4612 4612
 		$temp_array = array();
4613 4613
 
4614
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4614
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4615 4615
 		{
4616 4616
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
4617 4617
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -4628,12 +4628,12 @@  discard block
 block discarded – undo
4628 4628
 	* @return Array the aircraft list
4629 4629
 	*
4630 4630
 	*/
4631
-	public function countAllAircraftTypesByAirport($airport_icao,$filters = array())
4631
+	public function countAllAircraftTypesByAirport($airport_icao, $filters = array())
4632 4632
 	{
4633
-		$filter_query = $this->getFilter($filters,true,true);
4634
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4633
+		$filter_query = $this->getFilter($filters, true, true);
4634
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4635 4635
 
4636
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4636
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4637 4637
 				FROM spotter_output".$filter_query." spotter_output.aircraft_icao <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) 
4638 4638
 				GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
4639 4639
 				ORDER BY aircraft_icao_count DESC";
@@ -4643,7 +4643,7 @@  discard block
 block discarded – undo
4643 4643
 
4644 4644
 		$aircraft_array = array();
4645 4645
 		$temp_array = array();
4646
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4646
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4647 4647
 		{
4648 4648
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4649 4649
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4661,13 +4661,13 @@  discard block
 block discarded – undo
4661 4661
 	* @return Array the aircraft list
4662 4662
 	*
4663 4663
 	*/
4664
-	public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array())
4664
+	public function countAllAircraftRegistrationByAirport($airport_icao, $filters = array())
4665 4665
 	{
4666
-		$filter_query = $this->getFilter($filters,true,true);
4666
+		$filter_query = $this->getFilter($filters, true, true);
4667 4667
 		$Image = new Image($this->db);
4668
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4668
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4669 4669
 
4670
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
4670
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
4671 4671
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)   
4672 4672
                     GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
4673 4673
 		    ORDER BY registration_count DESC";
@@ -4677,14 +4677,14 @@  discard block
 block discarded – undo
4677 4677
 
4678 4678
 		$aircraft_array = array();
4679 4679
 		$temp_array = array();
4680
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4680
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4681 4681
 		{
4682 4682
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4683 4683
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4684 4684
 			$temp_array['registration'] = $row['registration'];
4685 4685
 			$temp_array['airline_name'] = $row['airline_name'];
4686 4686
 			$temp_array['image_thumbnail'] = "";
4687
-			if($row['registration'] != "")
4687
+			if ($row['registration'] != "")
4688 4688
 			{
4689 4689
 				$image_array = $Image->getSpotterImage($row['registration']);
4690 4690
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4702,11 +4702,11 @@  discard block
 block discarded – undo
4702 4702
 	* @return Array the aircraft list
4703 4703
 	*
4704 4704
 	*/
4705
-	public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array())
4705
+	public function countAllAircraftManufacturerByAirport($airport_icao, $filters = array())
4706 4706
 	{
4707
-		$filter_query = $this->getFilter($filters,true,true);
4708
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4709
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4707
+		$filter_query = $this->getFilter($filters, true, true);
4708
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4709
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4710 4710
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)  
4711 4711
                     GROUP BY spotter_output.aircraft_manufacturer 
4712 4712
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -4717,7 +4717,7 @@  discard block
 block discarded – undo
4717 4717
 
4718 4718
 		$aircraft_array = array();
4719 4719
 		$temp_array = array();
4720
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4720
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4721 4721
 		{
4722 4722
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
4723 4723
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -4732,12 +4732,12 @@  discard block
 block discarded – undo
4732 4732
 	* @return Array the aircraft list
4733 4733
 	*
4734 4734
 	*/
4735
-	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array())
4735
+	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer, $filters = array())
4736 4736
 	{
4737
-		$filter_query = $this->getFilter($filters,true,true);
4738
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4737
+		$filter_query = $this->getFilter($filters, true, true);
4738
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4739 4739
 
4740
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4740
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4741 4741
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
4742 4742
                     GROUP BY spotter_output.aircraft_name 
4743 4743
 					ORDER BY aircraft_icao_count DESC";
@@ -4746,7 +4746,7 @@  discard block
 block discarded – undo
4746 4746
 		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer));
4747 4747
 		$aircraft_array = array();
4748 4748
 		$temp_array = array();
4749
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4749
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4750 4750
 		{
4751 4751
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4752 4752
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4765,11 +4765,11 @@  discard block
 block discarded – undo
4765 4765
 	*/
4766 4766
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array())
4767 4767
 	{
4768
-		$filter_query = $this->getFilter($filters,true,true);
4768
+		$filter_query = $this->getFilter($filters, true, true);
4769 4769
 		$Image = new Image($this->db);
4770
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4770
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4771 4771
 
4772
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name   
4772
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name   
4773 4773
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer   
4774 4774
                     GROUP BY spotter_output.registration 
4775 4775
 					ORDER BY registration_count DESC";
@@ -4779,14 +4779,14 @@  discard block
 block discarded – undo
4779 4779
 		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer));
4780 4780
 		$aircraft_array = array();
4781 4781
 		$temp_array = array();
4782
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4782
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4783 4783
 		{
4784 4784
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4785 4785
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4786 4786
 			$temp_array['registration'] = $row['registration'];
4787 4787
 			$temp_array['airline_name'] = $row['airline_name'];
4788 4788
 			$temp_array['image_thumbnail'] = "";
4789
-			if($row['registration'] != "")
4789
+			if ($row['registration'] != "")
4790 4790
 			{
4791 4791
 				$image_array = $Image->getSpotterImage($row['registration']);
4792 4792
 				$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4803,11 +4803,11 @@  discard block
 block discarded – undo
4803 4803
 	* @return Array the aircraft list
4804 4804
 	*
4805 4805
 	*/
4806
-	public function countAllAircraftTypesByDate($date,$filters = array())
4806
+	public function countAllAircraftTypesByDate($date, $filters = array())
4807 4807
 	{
4808 4808
 		global $globalTimezone, $globalDBdriver;
4809
-		$filter_query = $this->getFilter($filters,true,true);
4810
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4809
+		$filter_query = $this->getFilter($filters, true, true);
4810
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4811 4811
 		if ($globalTimezone != '') {
4812 4812
 			date_default_timezone_set($globalTimezone);
4813 4813
 			$datetime = new DateTime($date);
@@ -4815,12 +4815,12 @@  discard block
 block discarded – undo
4815 4815
 		} else $offset = '+00:00';
4816 4816
 
4817 4817
 		if ($globalDBdriver == 'mysql') {
4818
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4818
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4819 4819
 					FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
4820 4820
 					GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
4821 4821
 					ORDER BY aircraft_icao_count DESC";
4822 4822
 		} else {
4823
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4823
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4824 4824
 					FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date
4825 4825
 					GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
4826 4826
 					ORDER BY aircraft_icao_count DESC";
@@ -4831,7 +4831,7 @@  discard block
 block discarded – undo
4831 4831
 
4832 4832
 		$aircraft_array = array();
4833 4833
 		$temp_array = array();
4834
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4834
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4835 4835
 		{
4836 4836
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4837 4837
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4849,12 +4849,12 @@  discard block
 block discarded – undo
4849 4849
 	* @return Array the aircraft list
4850 4850
 	*
4851 4851
 	*/
4852
-	public function countAllAircraftRegistrationByDate($date,$filters = array())
4852
+	public function countAllAircraftRegistrationByDate($date, $filters = array())
4853 4853
 	{
4854 4854
 		global $globalTimezone, $globalDBdriver;
4855
-		$filter_query = $this->getFilter($filters,true,true);
4855
+		$filter_query = $this->getFilter($filters, true, true);
4856 4856
 		$Image = new Image($this->db);
4857
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4857
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4858 4858
 		if ($globalTimezone != '') {
4859 4859
 			date_default_timezone_set($globalTimezone);
4860 4860
 			$datetime = new DateTime($date);
@@ -4862,12 +4862,12 @@  discard block
 block discarded – undo
4862 4862
 		} else $offset = '+00:00';
4863 4863
 
4864 4864
 		if ($globalDBdriver == 'mysql') {
4865
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name 
4865
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name 
4866 4866
 					FROM spotter_output".$filter_query." spotter_output.registration <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4867 4867
 					GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
4868 4868
 					ORDER BY registration_count DESC";
4869 4869
 		} else {
4870
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name    
4870
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name    
4871 4871
 					FROM spotter_output".$filter_query." spotter_output.registration <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4872 4872
 					GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
4873 4873
 					ORDER BY registration_count DESC";
@@ -4878,14 +4878,14 @@  discard block
 block discarded – undo
4878 4878
 
4879 4879
 		$aircraft_array = array();
4880 4880
 		$temp_array = array();
4881
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4881
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4882 4882
 		{
4883 4883
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4884 4884
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4885 4885
 			$temp_array['registration'] = $row['registration'];
4886 4886
 			$temp_array['airline_name'] = $row['airline_name'];
4887 4887
 			$temp_array['image_thumbnail'] = "";
4888
-			if($row['registration'] != "")
4888
+			if ($row['registration'] != "")
4889 4889
 			{
4890 4890
 				$image_array = $Image->getSpotterImage($row['registration']);
4891 4891
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4904,11 +4904,11 @@  discard block
 block discarded – undo
4904 4904
 	* @return Array the aircraft manufacturer list
4905 4905
 	*
4906 4906
 	*/
4907
-	public function countAllAircraftManufacturerByDate($date,$filters = array())
4907
+	public function countAllAircraftManufacturerByDate($date, $filters = array())
4908 4908
 	{
4909 4909
 		global $globalTimezone, $globalDBdriver;
4910
-		$filter_query = $this->getFilter($filters,true,true);
4911
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4910
+		$filter_query = $this->getFilter($filters, true, true);
4911
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4912 4912
 		if ($globalTimezone != '') {
4913 4913
 			date_default_timezone_set($globalTimezone);
4914 4914
 			$datetime = new DateTime($date);
@@ -4916,12 +4916,12 @@  discard block
 block discarded – undo
4916 4916
 		} else $offset = '+00:00';
4917 4917
 
4918 4918
 		if ($globalDBdriver == 'mysql') {
4919
-			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4919
+			$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4920 4920
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4921 4921
 				GROUP BY spotter_output.aircraft_manufacturer 
4922 4922
 				ORDER BY aircraft_manufacturer_count DESC";
4923 4923
 		} else {
4924
-			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4924
+			$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4925 4925
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4926 4926
 				GROUP BY spotter_output.aircraft_manufacturer 
4927 4927
 				ORDER BY aircraft_manufacturer_count DESC";
@@ -4933,7 +4933,7 @@  discard block
 block discarded – undo
4933 4933
 		$aircraft_array = array();
4934 4934
 		$temp_array = array();
4935 4935
 
4936
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4936
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4937 4937
 		{
4938 4938
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
4939 4939
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -4950,11 +4950,11 @@  discard block
 block discarded – undo
4950 4950
 	* @return Array the aircraft list
4951 4951
 	*
4952 4952
 	*/
4953
-	public function countAllAircraftTypesByIdent($ident,$filters = array())
4953
+	public function countAllAircraftTypesByIdent($ident, $filters = array())
4954 4954
 	{
4955
-		$filter_query = $this->getFilter($filters,true,true);
4956
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
4957
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4955
+		$filter_query = $this->getFilter($filters, true, true);
4956
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
4957
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4958 4958
 				FROM spotter_output".$filter_query." spotter_output.ident = :ident 
4959 4959
 				GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao
4960 4960
 				ORDER BY aircraft_icao_count DESC";
@@ -4965,7 +4965,7 @@  discard block
 block discarded – undo
4965 4965
 		$aircraft_array = array();
4966 4966
 		$temp_array = array();
4967 4967
 
4968
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4968
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4969 4969
 		{
4970 4970
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4971 4971
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4983,13 +4983,13 @@  discard block
 block discarded – undo
4983 4983
 	* @return Array the aircraft list
4984 4984
 	*
4985 4985
 	*/
4986
-	public function countAllAircraftRegistrationByIdent($ident,$filters = array())
4986
+	public function countAllAircraftRegistrationByIdent($ident, $filters = array())
4987 4987
 	{
4988
-		$filter_query = $this->getFilter($filters,true,true);
4988
+		$filter_query = $this->getFilter($filters, true, true);
4989 4989
 		$Image = new Image($this->db);
4990
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
4990
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
4991 4991
 
4992
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
4992
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
4993 4993
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.ident = :ident   
4994 4994
                     GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name
4995 4995
 		    ORDER BY registration_count DESC";
@@ -5001,14 +5001,14 @@  discard block
 block discarded – undo
5001 5001
 		$aircraft_array = array();
5002 5002
 		$temp_array = array();
5003 5003
         
5004
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5004
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5005 5005
 		{
5006 5006
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5007 5007
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5008 5008
 			$temp_array['registration'] = $row['registration'];
5009 5009
 			$temp_array['airline_name'] = $row['airline_name'];
5010 5010
 			$temp_array['image_thumbnail'] = "";
5011
-			if($row['registration'] != "")
5011
+			if ($row['registration'] != "")
5012 5012
 			{
5013 5013
 				$image_array = $Image->getSpotterImage($row['registration']);
5014 5014
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5027,11 +5027,11 @@  discard block
 block discarded – undo
5027 5027
 	* @return Array the aircraft manufacturer list
5028 5028
 	*
5029 5029
 	*/
5030
-	public function countAllAircraftManufacturerByIdent($ident,$filters = array())
5030
+	public function countAllAircraftManufacturerByIdent($ident, $filters = array())
5031 5031
 	{
5032
-		$filter_query = $this->getFilter($filters,true,true);
5033
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5034
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5032
+		$filter_query = $this->getFilter($filters, true, true);
5033
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5034
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5035 5035
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.ident = :ident  
5036 5036
                     GROUP BY spotter_output.aircraft_manufacturer 
5037 5037
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -5041,7 +5041,7 @@  discard block
 block discarded – undo
5041 5041
 		$sth->execute(array(':ident' => $ident));
5042 5042
 		$aircraft_array = array();
5043 5043
 		$temp_array = array();
5044
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5044
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5045 5045
 		{
5046 5046
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5047 5047
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5057,24 +5057,24 @@  discard block
 block discarded – undo
5057 5057
 	* @return Array the aircraft list
5058 5058
 	*
5059 5059
 	*/
5060
-	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5060
+	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
5061 5061
 	{
5062
-		$filter_query = $this->getFilter($filters,true,true);
5063
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5064
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5062
+		$filter_query = $this->getFilter($filters, true, true);
5063
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5064
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5065 5065
 		
5066 5066
 
5067
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5067
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5068 5068
                     FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
5069 5069
                     GROUP BY spotter_output.aircraft_name 
5070 5070
 					ORDER BY aircraft_icao_count DESC";
5071 5071
  
5072 5072
 		
5073 5073
 		$sth = $this->db->prepare($query);
5074
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5074
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5075 5075
 		$aircraft_array = array();
5076 5076
 		$temp_array = array();
5077
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5077
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5078 5078
 		{
5079 5079
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5080 5080
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5090,33 +5090,33 @@  discard block
 block discarded – undo
5090 5090
 	* @return Array the aircraft list
5091 5091
 	*
5092 5092
 	*/
5093
-	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5093
+	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
5094 5094
 	{
5095
-		$filter_query = $this->getFilter($filters,true,true);
5095
+		$filter_query = $this->getFilter($filters, true, true);
5096 5096
 		$Image = new Image($this->db);
5097
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5098
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5097
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5098
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5099 5099
 
5100
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name   
5100
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name   
5101 5101
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)   
5102 5102
                     GROUP BY spotter_output.registration 
5103 5103
 					ORDER BY registration_count DESC";
5104 5104
 
5105 5105
 		
5106 5106
 		$sth = $this->db->prepare($query);
5107
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5107
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5108 5108
       
5109 5109
 		$aircraft_array = array();
5110 5110
 		$temp_array = array();
5111 5111
         
5112
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5112
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5113 5113
 		{
5114 5114
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5115 5115
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5116 5116
 			$temp_array['registration'] = $row['registration'];
5117 5117
 			$temp_array['airline_name'] = $row['airline_name'];
5118 5118
 			$temp_array['image_thumbnail'] = "";
5119
-			if($row['registration'] != "")
5119
+			if ($row['registration'] != "")
5120 5120
 			{
5121 5121
 				$image_array = $Image->getSpotterImage($row['registration']);
5122 5122
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5136,25 +5136,25 @@  discard block
 block discarded – undo
5136 5136
 	* @return Array the aircraft manufacturer list
5137 5137
 	*
5138 5138
 	*/
5139
-	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5139
+	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
5140 5140
 	{
5141
-		$filter_query = $this->getFilter($filters,true,true);
5142
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5143
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5141
+		$filter_query = $this->getFilter($filters, true, true);
5142
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5143
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5144 5144
 
5145
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5145
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5146 5146
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) 
5147 5147
                     GROUP BY spotter_output.aircraft_manufacturer 
5148 5148
 					ORDER BY aircraft_manufacturer_count DESC";
5149 5149
 
5150 5150
 		
5151 5151
 		$sth = $this->db->prepare($query);
5152
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5152
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5153 5153
       
5154 5154
 		$aircraft_array = array();
5155 5155
 		$temp_array = array();
5156 5156
         
5157
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5157
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5158 5158
 		{
5159 5159
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5160 5160
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5174,11 +5174,11 @@  discard block
 block discarded – undo
5174 5174
 	* @return Array the aircraft list
5175 5175
 	*
5176 5176
 	*/
5177
-	public function countAllAircraftTypesByCountry($country,$filters = array())
5177
+	public function countAllAircraftTypesByCountry($country, $filters = array())
5178 5178
 	{
5179
-		$filter_query = $this->getFilter($filters,true,true);
5180
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
5181
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5179
+		$filter_query = $this->getFilter($filters, true, true);
5180
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
5181
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5182 5182
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
5183 5183
 			    GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5184 5184
 			    ORDER BY aircraft_icao_count DESC";
@@ -5190,7 +5190,7 @@  discard block
 block discarded – undo
5190 5190
 		$aircraft_array = array();
5191 5191
 		$temp_array = array();
5192 5192
         
5193
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5193
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5194 5194
 		{
5195 5195
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5196 5196
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5209,12 +5209,12 @@  discard block
 block discarded – undo
5209 5209
 	* @return Array the aircraft list
5210 5210
 	*
5211 5211
 	*/
5212
-	public function countAllAircraftRegistrationByCountry($country,$filters = array())
5212
+	public function countAllAircraftRegistrationByCountry($country, $filters = array())
5213 5213
 	{
5214
-		$filter_query = $this->getFilter($filters,true,true);
5214
+		$filter_query = $this->getFilter($filters, true, true);
5215 5215
 		$Image = new Image($this->db);
5216
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
5217
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name 
5216
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
5217
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name 
5218 5218
 			    FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country)    
5219 5219
 			    GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
5220 5220
 			    ORDER BY registration_count DESC";
@@ -5226,14 +5226,14 @@  discard block
 block discarded – undo
5226 5226
 		$aircraft_array = array();
5227 5227
 		$temp_array = array();
5228 5228
         
5229
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5229
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5230 5230
 		{
5231 5231
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5232 5232
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5233 5233
 			$temp_array['registration'] = $row['registration'];
5234 5234
 			$temp_array['airline_name'] = $row['airline_name'];
5235 5235
 			$temp_array['image_thumbnail'] = "";
5236
-			if($row['registration'] != "")
5236
+			if ($row['registration'] != "")
5237 5237
 			{
5238 5238
 				$image_array = $Image->getSpotterImage($row['registration']);
5239 5239
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5253,11 +5253,11 @@  discard block
 block discarded – undo
5253 5253
 	* @return Array the aircraft manufacturer list
5254 5254
 	*
5255 5255
 	*/
5256
-	public function countAllAircraftManufacturerByCountry($country,$filters = array())
5256
+	public function countAllAircraftManufacturerByCountry($country, $filters = array())
5257 5257
 	{
5258
-		$filter_query = $this->getFilter($filters,true,true);
5259
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
5260
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5258
+		$filter_query = $this->getFilter($filters, true, true);
5259
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
5260
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5261 5261
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country) 
5262 5262
                     GROUP BY spotter_output.aircraft_manufacturer 
5263 5263
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -5269,7 +5269,7 @@  discard block
 block discarded – undo
5269 5269
 		$aircraft_array = array();
5270 5270
 		$temp_array = array();
5271 5271
         
5272
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5272
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5273 5273
 		{
5274 5274
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5275 5275
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5290,8 +5290,8 @@  discard block
 block discarded – undo
5290 5290
 	*/
5291 5291
 	public function countAllAircraftManufacturers($filters = array())
5292 5292
 	{
5293
-		$filter_query = $this->getFilter($filters,true,true);
5294
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5293
+		$filter_query = $this->getFilter($filters, true, true);
5294
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5295 5295
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
5296 5296
                 $query .= " GROUP BY spotter_output.aircraft_manufacturer
5297 5297
 					ORDER BY aircraft_manufacturer_count DESC
@@ -5304,7 +5304,7 @@  discard block
 block discarded – undo
5304 5304
 		$manufacturer_array = array();
5305 5305
 		$temp_array = array();
5306 5306
         
5307
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5307
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5308 5308
 		{
5309 5309
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5310 5310
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5323,12 +5323,12 @@  discard block
 block discarded – undo
5323 5323
 	* @return Array the aircraft list
5324 5324
 	*
5325 5325
 	*/
5326
-	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5326
+	public function countAllAircraftRegistrations($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5327 5327
 	{
5328 5328
 		global $globalDBdriver;
5329 5329
 		$Image = new Image($this->db);
5330
-		$filter_query = $this->getFilter($filters,true,true);
5331
-		$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    
5330
+		$filter_query = $this->getFilter($filters, true, true);
5331
+		$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    
5332 5332
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
5333 5333
                 if ($olderthanmonths > 0) {
5334 5334
             		if ($globalDBdriver == 'mysql') {
@@ -5356,7 +5356,7 @@  discard block
 block discarded – undo
5356 5356
 		$aircraft_array = array();
5357 5357
 		$temp_array = array();
5358 5358
         
5359
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5359
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5360 5360
 		{
5361 5361
 			$temp_array['registration'] = $row['registration'];
5362 5362
 			$temp_array['aircraft_registration_count'] = $row['aircraft_registration_count'];
@@ -5364,7 +5364,7 @@  discard block
 block discarded – undo
5364 5364
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5365 5365
 			$temp_array['airline_name'] = $row['airline_name'];
5366 5366
 			$temp_array['image_thumbnail'] = "";
5367
-			if($row['registration'] != "")
5367
+			if ($row['registration'] != "")
5368 5368
 			{
5369 5369
 				$image_array = $Image->getSpotterImage($row['registration']);
5370 5370
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5383,12 +5383,12 @@  discard block
 block discarded – undo
5383 5383
 	* @return Array the aircraft list
5384 5384
 	*
5385 5385
 	*/
5386
-	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5386
+	public function countAllAircraftRegistrationsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5387 5387
 	{
5388 5388
 		global $globalDBdriver;
5389
-		$filter_query = $this->getFilter($filters,true,true);
5389
+		$filter_query = $this->getFilter($filters, true, true);
5390 5390
 		$Image = new Image($this->db);
5391
-		$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    
5391
+		$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    
5392 5392
                     FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
5393 5393
                 if ($olderthanmonths > 0) {
5394 5394
             		if ($globalDBdriver == 'mysql') {
@@ -5416,7 +5416,7 @@  discard block
 block discarded – undo
5416 5416
 		$aircraft_array = array();
5417 5417
 		$temp_array = array();
5418 5418
         
5419
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5419
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5420 5420
 		{
5421 5421
 			$temp_array['registration'] = $row['registration'];
5422 5422
 			$temp_array['aircraft_registration_count'] = $row['aircraft_registration_count'];
@@ -5425,7 +5425,7 @@  discard block
 block discarded – undo
5425 5425
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5426 5426
 			$temp_array['airline_name'] = $row['airline_name'];
5427 5427
 			$temp_array['image_thumbnail'] = "";
5428
-			if($row['registration'] != "")
5428
+			if ($row['registration'] != "")
5429 5429
 			{
5430 5430
 				$image_array = $Image->getSpotterImage($row['registration']);
5431 5431
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5444,11 +5444,11 @@  discard block
 block discarded – undo
5444 5444
 	* @return Array the airport list
5445 5445
 	*
5446 5446
 	*/
5447
-	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5447
+	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5448 5448
 	{
5449 5449
 		global $globalDBdriver;
5450
-		$filter_query = $this->getFilter($filters,true,true);
5451
-		$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 
5450
+		$filter_query = $this->getFilter($filters, true, true);
5451
+		$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 
5452 5452
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA'";
5453 5453
                 if ($olderthanmonths > 0) {
5454 5454
             		if ($globalDBdriver == 'mysql') {
@@ -5477,7 +5477,7 @@  discard block
 block discarded – undo
5477 5477
 		$airport_array = array();
5478 5478
 		$temp_array = array();
5479 5479
         
5480
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5480
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5481 5481
 		{
5482 5482
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5483 5483
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5496,11 +5496,11 @@  discard block
 block discarded – undo
5496 5496
 	* @return Array the airport list
5497 5497
 	*
5498 5498
 	*/
5499
-	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5499
+	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5500 5500
 	{
5501 5501
 		global $globalDBdriver;
5502
-		$filter_query = $this->getFilter($filters,true,true);
5503
-		$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 
5502
+		$filter_query = $this->getFilter($filters, true, true);
5503
+		$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 
5504 5504
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' ";
5505 5505
                 if ($olderthanmonths > 0) {
5506 5506
             		if ($globalDBdriver == 'mysql') {
@@ -5529,7 +5529,7 @@  discard block
 block discarded – undo
5529 5529
 		$airport_array = array();
5530 5530
 		$temp_array = array();
5531 5531
         
5532
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5532
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5533 5533
 		{
5534 5534
 			$temp_array['airline_icao'] = $row['airline_icao'];
5535 5535
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -5549,11 +5549,11 @@  discard block
 block discarded – undo
5549 5549
 	* @return Array the airport list
5550 5550
 	*
5551 5551
 	*/
5552
-	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5552
+	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5553 5553
 	{
5554 5554
 		global $globalDBdriver;
5555
-		$filter_query = $this->getFilter($filters,true,true);
5556
-		$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
5555
+		$filter_query = $this->getFilter($filters, true, true);
5556
+		$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
5557 5557
 				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";
5558 5558
                 if ($olderthanmonths > 0) {
5559 5559
             		if ($globalDBdriver == 'mysql') {
@@ -5581,7 +5581,7 @@  discard block
 block discarded – undo
5581 5581
 		$airport_array = array();
5582 5582
 		$temp_array = array();
5583 5583
         
5584
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5584
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5585 5585
 		{
5586 5586
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5587 5587
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5600,11 +5600,11 @@  discard block
 block discarded – undo
5600 5600
 	* @return Array the airport list
5601 5601
 	*
5602 5602
 	*/
5603
-	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5603
+	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5604 5604
 	{
5605 5605
 		global $globalDBdriver;
5606
-		$filter_query = $this->getFilter($filters,true,true);
5607
-		$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
5606
+		$filter_query = $this->getFilter($filters, true, true);
5607
+		$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
5608 5608
 				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 ";
5609 5609
                 if ($olderthanmonths > 0) {
5610 5610
             		if ($globalDBdriver == 'mysql') {
@@ -5633,7 +5633,7 @@  discard block
 block discarded – undo
5633 5633
 		$airport_array = array();
5634 5634
 		$temp_array = array();
5635 5635
         
5636
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5636
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5637 5637
 		{
5638 5638
 			$temp_array['airline_icao'] = $row['airline_icao'];
5639 5639
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -5653,11 +5653,11 @@  discard block
 block discarded – undo
5653 5653
 	* @return Array the airport list
5654 5654
 	*
5655 5655
 	*/
5656
-	public function countAllDepartureAirportsByAirline($airline_icao,$filters = array())
5656
+	public function countAllDepartureAirportsByAirline($airline_icao, $filters = array())
5657 5657
 	{
5658
-		$filter_query = $this->getFilter($filters,true,true);
5659
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5660
-		$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 
5658
+		$filter_query = $this->getFilter($filters, true, true);
5659
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5660
+		$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 
5661 5661
 			    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.airline_icao = :airline_icao 
5662 5662
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5663 5663
 			    ORDER BY airport_departure_icao_count DESC";
@@ -5669,7 +5669,7 @@  discard block
 block discarded – undo
5669 5669
 		$airport_array = array();
5670 5670
 		$temp_array = array();
5671 5671
         
5672
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5672
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5673 5673
 		{
5674 5674
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5675 5675
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5691,11 +5691,11 @@  discard block
 block discarded – undo
5691 5691
 	* @return Array the airport list
5692 5692
 	*
5693 5693
 	*/
5694
-	public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array())
5694
+	public function countAllDepartureAirportCountriesByAirline($airline_icao, $filters = array())
5695 5695
 	{
5696
-		$filter_query = $this->getFilter($filters,true,true);
5697
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5698
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5696
+		$filter_query = $this->getFilter($filters, true, true);
5697
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5698
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5699 5699
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.airline_icao = :airline_icao 
5700 5700
                     GROUP BY spotter_output.departure_airport_country
5701 5701
 					ORDER BY airport_departure_country_count DESC";
@@ -5707,7 +5707,7 @@  discard block
 block discarded – undo
5707 5707
 		$airport_array = array();
5708 5708
 		$temp_array = array();
5709 5709
         
5710
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5710
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5711 5711
 		{
5712 5712
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
5713 5713
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -5726,11 +5726,11 @@  discard block
 block discarded – undo
5726 5726
 	* @return Array the airport list
5727 5727
 	*
5728 5728
 	*/
5729
-	public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array())
5729
+	public function countAllDepartureAirportsByAircraft($aircraft_icao, $filters = array())
5730 5730
 	{
5731
-		$filter_query = $this->getFilter($filters,true,true);
5732
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
5733
-		$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 
5731
+		$filter_query = $this->getFilter($filters, true, true);
5732
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
5733
+		$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 
5734 5734
 			    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.aircraft_icao = :aircraft_icao 
5735 5735
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5736 5736
 			    ORDER BY airport_departure_icao_count DESC";
@@ -5742,7 +5742,7 @@  discard block
 block discarded – undo
5742 5742
 		$airport_array = array();
5743 5743
 		$temp_array = array();
5744 5744
         
5745
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5745
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5746 5746
 		{
5747 5747
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5748 5748
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5763,11 +5763,11 @@  discard block
 block discarded – undo
5763 5763
 	* @return Array the airport list
5764 5764
 	*
5765 5765
 	*/
5766
-	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array())
5766
+	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao, $filters = array())
5767 5767
 	{
5768
-		$filter_query = $this->getFilter($filters,true,true);
5769
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
5770
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5768
+		$filter_query = $this->getFilter($filters, true, true);
5769
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
5770
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5771 5771
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
5772 5772
                     GROUP BY spotter_output.departure_airport_country
5773 5773
 					ORDER BY airport_departure_country_count DESC";
@@ -5779,7 +5779,7 @@  discard block
 block discarded – undo
5779 5779
 		$airport_array = array();
5780 5780
 		$temp_array = array();
5781 5781
         
5782
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5782
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5783 5783
 		{
5784 5784
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
5785 5785
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -5797,11 +5797,11 @@  discard block
 block discarded – undo
5797 5797
 	* @return Array the airport list
5798 5798
 	*
5799 5799
 	*/
5800
-	public function countAllDepartureAirportsByRegistration($registration,$filters = array())
5800
+	public function countAllDepartureAirportsByRegistration($registration, $filters = array())
5801 5801
 	{
5802
-		$filter_query = $this->getFilter($filters,true,true);
5803
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
5804
-		$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 
5802
+		$filter_query = $this->getFilter($filters, true, true);
5803
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
5804
+		$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 
5805 5805
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.registration = :registration 
5806 5806
                     GROUP BY spotter_output.departure_airport_icao
5807 5807
 					ORDER BY airport_departure_icao_count DESC";
@@ -5813,7 +5813,7 @@  discard block
 block discarded – undo
5813 5813
 		$airport_array = array();
5814 5814
 		$temp_array = array();
5815 5815
         
5816
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5816
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5817 5817
 		{
5818 5818
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5819 5819
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5834,11 +5834,11 @@  discard block
 block discarded – undo
5834 5834
 	* @return Array the airport list
5835 5835
 	*
5836 5836
 	*/
5837
-	public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array())
5837
+	public function countAllDepartureAirportCountriesByRegistration($registration, $filters = array())
5838 5838
 	{
5839
-		$filter_query = $this->getFilter($filters,true,true);
5840
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
5841
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5839
+		$filter_query = $this->getFilter($filters, true, true);
5840
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
5841
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5842 5842
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.registration = :registration 
5843 5843
                     GROUP BY spotter_output.departure_airport_country
5844 5844
 					ORDER BY airport_departure_country_count DESC";
@@ -5850,7 +5850,7 @@  discard block
 block discarded – undo
5850 5850
 		$airport_array = array();
5851 5851
 		$temp_array = array();
5852 5852
         
5853
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5853
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5854 5854
 		{
5855 5855
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
5856 5856
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -5868,11 +5868,11 @@  discard block
 block discarded – undo
5868 5868
 	* @return Array the airport list
5869 5869
 	*
5870 5870
 	*/
5871
-	public function countAllDepartureAirportsByAirport($airport_icao,$filters = array())
5871
+	public function countAllDepartureAirportsByAirport($airport_icao, $filters = array())
5872 5872
 	{
5873
-		$filter_query = $this->getFilter($filters,true,true);
5874
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
5875
-		$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 
5873
+		$filter_query = $this->getFilter($filters, true, true);
5874
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
5875
+		$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 
5876 5876
 			    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao = :airport_icao 
5877 5877
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5878 5878
 			    ORDER BY airport_departure_icao_count DESC";
@@ -5884,7 +5884,7 @@  discard block
 block discarded – undo
5884 5884
 		$airport_array = array();
5885 5885
 		$temp_array = array();
5886 5886
         
5887
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5887
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5888 5888
 		{
5889 5889
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5890 5890
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5905,11 +5905,11 @@  discard block
 block discarded – undo
5905 5905
 	* @return Array the airport list
5906 5906
 	*
5907 5907
 	*/
5908
-	public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array())
5908
+	public function countAllDepartureAirportCountriesByAirport($airport_icao, $filters = array())
5909 5909
 	{
5910
-		$filter_query = $this->getFilter($filters,true,true);
5911
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
5912
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5910
+		$filter_query = $this->getFilter($filters, true, true);
5911
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
5912
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5913 5913
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.arrival_airport_icao = :airport_icao 
5914 5914
                     GROUP BY spotter_output.departure_airport_country
5915 5915
 					ORDER BY airport_departure_country_count DESC";
@@ -5921,7 +5921,7 @@  discard block
 block discarded – undo
5921 5921
 		$airport_array = array();
5922 5922
 		$temp_array = array();
5923 5923
         
5924
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5924
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5925 5925
 		{
5926 5926
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
5927 5927
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -5940,11 +5940,11 @@  discard block
 block discarded – undo
5940 5940
 	* @return Array the airport list
5941 5941
 	*
5942 5942
 	*/
5943
-	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array())
5943
+	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer, $filters = array())
5944 5944
 	{
5945
-		$filter_query = $this->getFilter($filters,true,true);
5946
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
5947
-		$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 
5945
+		$filter_query = $this->getFilter($filters, true, true);
5946
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
5947
+		$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 
5948 5948
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
5949 5949
                     GROUP BY spotter_output.departure_airport_icao
5950 5950
 					ORDER BY airport_departure_icao_count DESC";
@@ -5956,7 +5956,7 @@  discard block
 block discarded – undo
5956 5956
 		$airport_array = array();
5957 5957
 		$temp_array = array();
5958 5958
         
5959
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5959
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5960 5960
 		{
5961 5961
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5962 5962
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5977,11 +5977,11 @@  discard block
 block discarded – undo
5977 5977
 	* @return Array the airport list
5978 5978
 	*
5979 5979
 	*/
5980
-	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
5980
+	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array())
5981 5981
 	{
5982
-		$filter_query = $this->getFilter($filters,true,true);
5983
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
5984
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5982
+		$filter_query = $this->getFilter($filters, true, true);
5983
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
5984
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5985 5985
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
5986 5986
                     GROUP BY spotter_output.departure_airport_country
5987 5987
 					ORDER BY airport_departure_country_count DESC";
@@ -5993,7 +5993,7 @@  discard block
 block discarded – undo
5993 5993
 		$airport_array = array();
5994 5994
 		$temp_array = array();
5995 5995
         
5996
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5996
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5997 5997
 		{
5998 5998
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
5999 5999
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6011,11 +6011,11 @@  discard block
 block discarded – undo
6011 6011
 	* @return Array the airport list
6012 6012
 	*
6013 6013
 	*/
6014
-	public function countAllDepartureAirportsByDate($date,$filters = array())
6014
+	public function countAllDepartureAirportsByDate($date, $filters = array())
6015 6015
 	{
6016 6016
 		global $globalTimezone, $globalDBdriver;
6017
-		$filter_query = $this->getFilter($filters,true,true);
6018
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
6017
+		$filter_query = $this->getFilter($filters, true, true);
6018
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
6019 6019
 		if ($globalTimezone != '') {
6020 6020
 			date_default_timezone_set($globalTimezone);
6021 6021
 			$datetime = new DateTime($date);
@@ -6023,12 +6023,12 @@  discard block
 block discarded – undo
6023 6023
 		} else $offset = '+00:00';
6024 6024
 
6025 6025
 		if ($globalDBdriver == 'mysql') {
6026
-			$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 
6026
+			$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 
6027 6027
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
6028 6028
 					GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6029 6029
 					ORDER BY airport_departure_icao_count DESC";
6030 6030
 		} else {
6031
-			$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 
6031
+			$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 
6032 6032
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date
6033 6033
 					GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6034 6034
 					ORDER BY airport_departure_icao_count DESC";
@@ -6040,7 +6040,7 @@  discard block
 block discarded – undo
6040 6040
 		$airport_array = array();
6041 6041
 		$temp_array = array();
6042 6042
         
6043
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6043
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6044 6044
 		{
6045 6045
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6046 6046
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6061,11 +6061,11 @@  discard block
 block discarded – undo
6061 6061
 	* @return Array the airport list
6062 6062
 	*
6063 6063
 	*/
6064
-	public function countAllDepartureAirportCountriesByDate($date,$filters = array())
6064
+	public function countAllDepartureAirportCountriesByDate($date, $filters = array())
6065 6065
 	{
6066 6066
 		global $globalTimezone, $globalDBdriver;
6067
-		$filter_query = $this->getFilter($filters,true,true);
6068
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
6067
+		$filter_query = $this->getFilter($filters, true, true);
6068
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
6069 6069
 		if ($globalTimezone != '') {
6070 6070
 			date_default_timezone_set($globalTimezone);
6071 6071
 			$datetime = new DateTime($date);
@@ -6073,12 +6073,12 @@  discard block
 block discarded – undo
6073 6073
 		} else $offset = '+00:00';
6074 6074
 
6075 6075
 		if ($globalDBdriver == 'mysql') {
6076
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6076
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6077 6077
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
6078 6078
 					GROUP BY spotter_output.departure_airport_country
6079 6079
 					ORDER BY airport_departure_country_count DESC";
6080 6080
 		} else {
6081
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6081
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6082 6082
 					FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
6083 6083
 					GROUP BY spotter_output.departure_airport_country
6084 6084
 					ORDER BY airport_departure_country_count DESC";
@@ -6090,7 +6090,7 @@  discard block
 block discarded – undo
6090 6090
 		$airport_array = array();
6091 6091
 		$temp_array = array();
6092 6092
         
6093
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6093
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6094 6094
 		{
6095 6095
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6096 6096
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6108,11 +6108,11 @@  discard block
 block discarded – undo
6108 6108
 	* @return Array the airport list
6109 6109
 	*
6110 6110
 	*/
6111
-	public function countAllDepartureAirportsByIdent($ident,$filters = array())
6111
+	public function countAllDepartureAirportsByIdent($ident, $filters = array())
6112 6112
 	{
6113
-		$filter_query = $this->getFilter($filters,true,true);
6114
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
6115
-		$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 
6113
+		$filter_query = $this->getFilter($filters, true, true);
6114
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
6115
+		$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 
6116 6116
 		    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.ident = :ident 
6117 6117
                     GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6118 6118
 		    ORDER BY airport_departure_icao_count DESC";
@@ -6124,7 +6124,7 @@  discard block
 block discarded – undo
6124 6124
 		$airport_array = array();
6125 6125
 		$temp_array = array();
6126 6126
         
6127
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6127
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6128 6128
 		{
6129 6129
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6130 6130
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6146,11 +6146,11 @@  discard block
 block discarded – undo
6146 6146
 	* @return Array the airport list
6147 6147
 	*
6148 6148
 	*/
6149
-	public function countAllDepartureAirportCountriesByIdent($ident,$filters = array())
6149
+	public function countAllDepartureAirportCountriesByIdent($ident, $filters = array())
6150 6150
 	{
6151
-		$filter_query = $this->getFilter($filters,true,true);
6152
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
6153
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6151
+		$filter_query = $this->getFilter($filters, true, true);
6152
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
6153
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6154 6154
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.ident = :ident 
6155 6155
                     GROUP BY spotter_output.departure_airport_country
6156 6156
 					ORDER BY airport_departure_country_count DESC";
@@ -6162,7 +6162,7 @@  discard block
 block discarded – undo
6162 6162
 		$airport_array = array();
6163 6163
 		$temp_array = array();
6164 6164
         
6165
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6165
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6166 6166
 		{
6167 6167
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6168 6168
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6181,12 +6181,12 @@  discard block
 block discarded – undo
6181 6181
 	* @return Array the airport list
6182 6182
 	*
6183 6183
 	*/
6184
-	public function countAllDepartureAirportsByCountry($country,$filters = array())
6184
+	public function countAllDepartureAirportsByCountry($country, $filters = array())
6185 6185
 	{
6186
-		$filter_query = $this->getFilter($filters,true,true);
6187
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
6186
+		$filter_query = $this->getFilter($filters, true, true);
6187
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
6188 6188
 
6189
-		$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 
6189
+		$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 
6190 6190
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
6191 6191
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6192 6192
 			    ORDER BY airport_departure_icao_count DESC";
@@ -6198,7 +6198,7 @@  discard block
 block discarded – undo
6198 6198
 		$airport_array = array();
6199 6199
 		$temp_array = array();
6200 6200
         
6201
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6201
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6202 6202
 		{
6203 6203
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6204 6204
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6219,11 +6219,11 @@  discard block
 block discarded – undo
6219 6219
 	* @return Array the airport list
6220 6220
 	*
6221 6221
 	*/
6222
-	public function countAllDepartureAirportCountriesByCountry($country,$filters = array())
6222
+	public function countAllDepartureAirportCountriesByCountry($country, $filters = array())
6223 6223
 	{
6224
-		$filter_query = $this->getFilter($filters,true,true);
6225
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
6226
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6224
+		$filter_query = $this->getFilter($filters, true, true);
6225
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
6226
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6227 6227
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
6228 6228
                     GROUP BY spotter_output.departure_airport_country
6229 6229
 					ORDER BY airport_departure_country_count DESC";
@@ -6235,7 +6235,7 @@  discard block
 block discarded – undo
6235 6235
 		$airport_array = array();
6236 6236
 		$temp_array = array();
6237 6237
         
6238
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6238
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6239 6239
 		{
6240 6240
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6241 6241
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6253,11 +6253,11 @@  discard block
 block discarded – undo
6253 6253
 	* @return Array the airport list
6254 6254
 	*
6255 6255
 	*/
6256
-	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6256
+	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
6257 6257
 	{
6258 6258
 		global $globalDBdriver;
6259
-		$filter_query = $this->getFilter($filters,true,true);
6260
-		$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 
6259
+		$filter_query = $this->getFilter($filters, true, true);
6260
+		$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 
6261 6261
 				FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA'";
6262 6262
                 if ($olderthanmonths > 0) {
6263 6263
             		if ($globalDBdriver == 'mysql') {
@@ -6292,7 +6292,7 @@  discard block
 block discarded – undo
6292 6292
 		$airport_array = array();
6293 6293
 		$temp_array = array();
6294 6294
         
6295
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6295
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6296 6296
 		{
6297 6297
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6298 6298
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6315,11 +6315,11 @@  discard block
 block discarded – undo
6315 6315
 	* @return Array the airport list
6316 6316
 	*
6317 6317
 	*/
6318
-	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6318
+	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
6319 6319
 	{
6320 6320
 		global $globalDBdriver;
6321
-		$filter_query = $this->getFilter($filters,true,true);
6322
-		$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 
6321
+		$filter_query = $this->getFilter($filters, true, true);
6322
+		$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 
6323 6323
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' ";
6324 6324
                 if ($olderthanmonths > 0) {
6325 6325
             		if ($globalDBdriver == 'mysql') {
@@ -6354,7 +6354,7 @@  discard block
 block discarded – undo
6354 6354
 		$airport_array = array();
6355 6355
 		$temp_array = array();
6356 6356
         
6357
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6357
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6358 6358
 		{
6359 6359
 			$temp_array['airline_icao'] = $row['airline_icao'];
6360 6360
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
@@ -6379,11 +6379,11 @@  discard block
 block discarded – undo
6379 6379
 	* @return Array the airport list
6380 6380
 	*
6381 6381
 	*/
6382
-	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6382
+	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
6383 6383
 	{
6384 6384
 		global $globalDBdriver;
6385
-		$filter_query = $this->getFilter($filters,true,true);
6386
-		$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 
6385
+		$filter_query = $this->getFilter($filters, true, true);
6386
+		$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 
6387 6387
 			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";
6388 6388
                 if ($olderthanmonths > 0) {
6389 6389
             		if ($globalDBdriver == 'mysql') {
@@ -6417,7 +6417,7 @@  discard block
 block discarded – undo
6417 6417
 		$airport_array = array();
6418 6418
 		$temp_array = array();
6419 6419
         
6420
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6420
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6421 6421
 		{
6422 6422
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6423 6423
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6440,11 +6440,11 @@  discard block
 block discarded – undo
6440 6440
 	* @return Array the airport list
6441 6441
 	*
6442 6442
 	*/
6443
-	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6443
+	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
6444 6444
 	{
6445 6445
 		global $globalDBdriver;
6446
-		$filter_query = $this->getFilter($filters,true,true);
6447
-		$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 
6446
+		$filter_query = $this->getFilter($filters, true, true);
6447
+		$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 
6448 6448
 			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 ";
6449 6449
                 if ($olderthanmonths > 0) {
6450 6450
             		if ($globalDBdriver == 'mysql') {
@@ -6479,7 +6479,7 @@  discard block
 block discarded – undo
6479 6479
 		$airport_array = array();
6480 6480
 		$temp_array = array();
6481 6481
         
6482
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6482
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6483 6483
 		{
6484 6484
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6485 6485
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6505,9 +6505,9 @@  discard block
 block discarded – undo
6505 6505
 	*/
6506 6506
 	public function countAllArrivalAirportsByAirline($airline_icao, $filters = array())
6507 6507
 	{
6508
-		$filter_query = $this->getFilter($filters,true,true);
6509
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
6510
-		$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 
6508
+		$filter_query = $this->getFilter($filters, true, true);
6509
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
6510
+		$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 
6511 6511
 			    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.airline_icao = :airline_icao 
6512 6512
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6513 6513
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -6518,7 +6518,7 @@  discard block
 block discarded – undo
6518 6518
 		$airport_array = array();
6519 6519
 		$temp_array = array();
6520 6520
         
6521
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6521
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6522 6522
 		{
6523 6523
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6524 6524
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6539,12 +6539,12 @@  discard block
 block discarded – undo
6539 6539
 	* @return Array the airport list
6540 6540
 	*
6541 6541
 	*/
6542
-	public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array())
6542
+	public function countAllArrivalAirportCountriesByAirline($airline_icao, $filters = array())
6543 6543
 	{
6544
-		$filter_query = $this->getFilter($filters,true,true);
6545
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
6544
+		$filter_query = $this->getFilter($filters, true, true);
6545
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
6546 6546
 					
6547
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6547
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6548 6548
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.airline_icao = :airline_icao 
6549 6549
                     GROUP BY spotter_output.arrival_airport_country
6550 6550
 					ORDER BY airport_arrival_country_count DESC";
@@ -6556,7 +6556,7 @@  discard block
 block discarded – undo
6556 6556
 		$airport_array = array();
6557 6557
 		$temp_array = array();
6558 6558
         
6559
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6559
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6560 6560
 		{
6561 6561
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6562 6562
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6574,11 +6574,11 @@  discard block
 block discarded – undo
6574 6574
 	* @return Array the airport list
6575 6575
 	*
6576 6576
 	*/
6577
-	public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array())
6577
+	public function countAllArrivalAirportsByAircraft($aircraft_icao, $filters = array())
6578 6578
 	{
6579
-		$filter_query = $this->getFilter($filters,true,true);
6580
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
6581
-		$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 
6579
+		$filter_query = $this->getFilter($filters, true, true);
6580
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
6581
+		$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 
6582 6582
 			    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.aircraft_icao = :aircraft_icao 
6583 6583
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6584 6584
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -6590,7 +6590,7 @@  discard block
 block discarded – undo
6590 6590
 		$airport_array = array();
6591 6591
 		$temp_array = array();
6592 6592
         
6593
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6593
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6594 6594
 		{
6595 6595
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6596 6596
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6612,11 +6612,11 @@  discard block
 block discarded – undo
6612 6612
 	* @return Array the airport list
6613 6613
 	*
6614 6614
 	*/
6615
-	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array())
6615
+	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao, $filters = array())
6616 6616
 	{
6617
-		$filter_query = $this->getFilter($filters,true,true);
6618
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
6619
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6617
+		$filter_query = $this->getFilter($filters, true, true);
6618
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
6619
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6620 6620
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
6621 6621
                     GROUP BY spotter_output.arrival_airport_country
6622 6622
 					ORDER BY airport_arrival_country_count DESC";
@@ -6628,7 +6628,7 @@  discard block
 block discarded – undo
6628 6628
 		$airport_array = array();
6629 6629
 		$temp_array = array();
6630 6630
         
6631
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6631
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6632 6632
 		{
6633 6633
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6634 6634
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6646,12 +6646,12 @@  discard block
 block discarded – undo
6646 6646
 	* @return Array the airport list
6647 6647
 	*
6648 6648
 	*/
6649
-	public function countAllArrivalAirportsByRegistration($registration,$filters = array())
6649
+	public function countAllArrivalAirportsByRegistration($registration, $filters = array())
6650 6650
 	{
6651
-		$filter_query = $this->getFilter($filters,true,true);
6652
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
6651
+		$filter_query = $this->getFilter($filters, true, true);
6652
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
6653 6653
 
6654
-		$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 
6654
+		$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 
6655 6655
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.registration = :registration 
6656 6656
                     GROUP BY spotter_output.arrival_airport_icao
6657 6657
 					ORDER BY airport_arrival_icao_count DESC";
@@ -6663,7 +6663,7 @@  discard block
 block discarded – undo
6663 6663
 		$airport_array = array();
6664 6664
 		$temp_array = array();
6665 6665
         
6666
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6666
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6667 6667
 		{
6668 6668
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6669 6669
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6684,11 +6684,11 @@  discard block
 block discarded – undo
6684 6684
 	* @return Array the airport list
6685 6685
 	*
6686 6686
 	*/
6687
-	public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array())
6687
+	public function countAllArrivalAirportCountriesByRegistration($registration, $filters = array())
6688 6688
 	{
6689
-		$filter_query = $this->getFilter($filters,true,true);
6690
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
6691
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6689
+		$filter_query = $this->getFilter($filters, true, true);
6690
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
6691
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6692 6692
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.registration = :registration 
6693 6693
                     GROUP BY spotter_output.arrival_airport_country
6694 6694
 					ORDER BY airport_arrival_country_count DESC";
@@ -6700,7 +6700,7 @@  discard block
 block discarded – undo
6700 6700
 		$airport_array = array();
6701 6701
 		$temp_array = array();
6702 6702
         
6703
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6703
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6704 6704
 		{
6705 6705
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6706 6706
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6719,11 +6719,11 @@  discard block
 block discarded – undo
6719 6719
 	* @return Array the airport list
6720 6720
 	*
6721 6721
 	*/
6722
-	public function countAllArrivalAirportsByAirport($airport_icao,$filters = array())
6722
+	public function countAllArrivalAirportsByAirport($airport_icao, $filters = array())
6723 6723
 	{
6724
-		$filter_query = $this->getFilter($filters,true,true);
6725
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
6726
-		$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 
6724
+		$filter_query = $this->getFilter($filters, true, true);
6725
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
6726
+		$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 
6727 6727
 			    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.departure_airport_icao = :airport_icao 
6728 6728
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6729 6729
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -6735,7 +6735,7 @@  discard block
 block discarded – undo
6735 6735
 		$airport_array = array();
6736 6736
 		$temp_array = array();
6737 6737
         
6738
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6738
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6739 6739
 		{
6740 6740
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6741 6741
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6756,11 +6756,11 @@  discard block
 block discarded – undo
6756 6756
 	* @return Array the airport list
6757 6757
 	*
6758 6758
 	*/
6759
-	public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array())
6759
+	public function countAllArrivalAirportCountriesByAirport($airport_icao, $filters = array())
6760 6760
 	{
6761
-		$filter_query = $this->getFilter($filters,true,true);
6762
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
6763
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6761
+		$filter_query = $this->getFilter($filters, true, true);
6762
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
6763
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6764 6764
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.departure_airport_icao = :airport_icao 
6765 6765
                     GROUP BY spotter_output.arrival_airport_country
6766 6766
 					ORDER BY airport_arrival_country_count DESC";
@@ -6772,7 +6772,7 @@  discard block
 block discarded – undo
6772 6772
 		$airport_array = array();
6773 6773
 		$temp_array = array();
6774 6774
         
6775
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6775
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6776 6776
 		{
6777 6777
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6778 6778
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6790,11 +6790,11 @@  discard block
 block discarded – undo
6790 6790
 	* @return Array the airport list
6791 6791
 	*
6792 6792
 	*/
6793
-	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array())
6793
+	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer, $filters = array())
6794 6794
 	{
6795
-		$filter_query = $this->getFilter($filters,true,true);
6796
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
6797
-		$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 
6795
+		$filter_query = $this->getFilter($filters, true, true);
6796
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
6797
+		$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 
6798 6798
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
6799 6799
                     GROUP BY spotter_output.arrival_airport_icao
6800 6800
 					ORDER BY airport_arrival_icao_count DESC";
@@ -6806,7 +6806,7 @@  discard block
 block discarded – undo
6806 6806
 		$airport_array = array();
6807 6807
 		$temp_array = array();
6808 6808
         
6809
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6809
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6810 6810
 		{
6811 6811
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6812 6812
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6828,11 +6828,11 @@  discard block
 block discarded – undo
6828 6828
 	* @return Array the airport list
6829 6829
 	*
6830 6830
 	*/
6831
-	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
6831
+	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array())
6832 6832
 	{
6833
-		$filter_query = $this->getFilter($filters,true,true);
6834
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
6835
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6833
+		$filter_query = $this->getFilter($filters, true, true);
6834
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
6835
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6836 6836
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
6837 6837
                     GROUP BY spotter_output.arrival_airport_country
6838 6838
 					ORDER BY airport_arrival_country_count DESC";
@@ -6844,7 +6844,7 @@  discard block
 block discarded – undo
6844 6844
 		$airport_array = array();
6845 6845
 		$temp_array = array();
6846 6846
         
6847
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6847
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6848 6848
 		{
6849 6849
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6850 6850
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6863,11 +6863,11 @@  discard block
 block discarded – undo
6863 6863
 	* @return Array the airport list
6864 6864
 	*
6865 6865
 	*/
6866
-	public function countAllArrivalAirportsByDate($date,$filters = array())
6866
+	public function countAllArrivalAirportsByDate($date, $filters = array())
6867 6867
 	{
6868 6868
 		global $globalTimezone, $globalDBdriver;
6869
-		$filter_query = $this->getFilter($filters,true,true);
6870
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
6869
+		$filter_query = $this->getFilter($filters, true, true);
6870
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
6871 6871
 		if ($globalTimezone != '') {
6872 6872
 			date_default_timezone_set($globalTimezone);
6873 6873
 			$datetime = new DateTime($date);
@@ -6875,12 +6875,12 @@  discard block
 block discarded – undo
6875 6875
 		} else $offset = '+00:00';
6876 6876
 
6877 6877
 		if ($globalDBdriver == 'mysql') {
6878
-			$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 
6878
+			$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 
6879 6879
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date  
6880 6880
 					GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6881 6881
 					ORDER BY airport_arrival_icao_count DESC";
6882 6882
 		} else {
6883
-			$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 
6883
+			$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 
6884 6884
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date  
6885 6885
 					GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6886 6886
 					ORDER BY airport_arrival_icao_count DESC";
@@ -6892,7 +6892,7 @@  discard block
 block discarded – undo
6892 6892
 		$airport_array = array();
6893 6893
 		$temp_array = array();
6894 6894
         
6895
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6895
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6896 6896
 		{
6897 6897
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6898 6898
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6916,8 +6916,8 @@  discard block
 block discarded – undo
6916 6916
 	public function countAllArrivalAirportCountriesByDate($date, $filters = array())
6917 6917
 	{
6918 6918
 		global $globalTimezone, $globalDBdriver;
6919
-		$filter_query = $this->getFilter($filters,true,true);
6920
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
6919
+		$filter_query = $this->getFilter($filters, true, true);
6920
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
6921 6921
 		if ($globalTimezone != '') {
6922 6922
 			date_default_timezone_set($globalTimezone);
6923 6923
 			$datetime = new DateTime($date);
@@ -6925,12 +6925,12 @@  discard block
 block discarded – undo
6925 6925
 		} else $offset = '+00:00';
6926 6926
 
6927 6927
 		if ($globalDBdriver == 'mysql') {
6928
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6928
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6929 6929
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
6930 6930
 					GROUP BY spotter_output.arrival_airport_country
6931 6931
 					ORDER BY airport_arrival_country_count DESC";
6932 6932
 		} else {
6933
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6933
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6934 6934
 					FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
6935 6935
 					GROUP BY spotter_output.arrival_airport_country
6936 6936
 					ORDER BY airport_arrival_country_count DESC";
@@ -6942,7 +6942,7 @@  discard block
 block discarded – undo
6942 6942
 		$airport_array = array();
6943 6943
 		$temp_array = array();
6944 6944
         
6945
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6945
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6946 6946
 		{
6947 6947
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6948 6948
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6960,11 +6960,11 @@  discard block
 block discarded – undo
6960 6960
 	* @return Array the airport list
6961 6961
 	*
6962 6962
 	*/
6963
-	public function countAllArrivalAirportsByIdent($ident,$filters = array())
6963
+	public function countAllArrivalAirportsByIdent($ident, $filters = array())
6964 6964
 	{
6965
-		$filter_query = $this->getFilter($filters,true,true);
6966
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
6967
-		$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 
6965
+		$filter_query = $this->getFilter($filters, true, true);
6966
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
6967
+		$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 
6968 6968
 		    FROM spotter_output".$filter_query." WHERE spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.ident = :ident  
6969 6969
                     GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6970 6970
 		    ORDER BY airport_arrival_icao_count DESC";
@@ -6976,7 +6976,7 @@  discard block
 block discarded – undo
6976 6976
 		$airport_array = array();
6977 6977
 		$temp_array = array();
6978 6978
         
6979
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6979
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6980 6980
 		{
6981 6981
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6982 6982
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6999,9 +6999,9 @@  discard block
 block discarded – undo
6999 6999
 	*/
7000 7000
 	public function countAllArrivalAirportCountriesByIdent($ident, $filters = array())
7001 7001
 	{
7002
-		$filter_query = $this->getFilter($filters,true,true);
7003
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7004
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7002
+		$filter_query = $this->getFilter($filters, true, true);
7003
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7004
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7005 7005
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.ident = :ident 
7006 7006
                     GROUP BY spotter_output.arrival_airport_country
7007 7007
 					ORDER BY airport_arrival_country_count DESC";
@@ -7013,7 +7013,7 @@  discard block
 block discarded – undo
7013 7013
 		$airport_array = array();
7014 7014
 		$temp_array = array();
7015 7015
         
7016
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7016
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7017 7017
 		{
7018 7018
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7019 7019
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7032,11 +7032,11 @@  discard block
 block discarded – undo
7032 7032
 	* @return Array the airport list
7033 7033
 	*
7034 7034
 	*/
7035
-	public function countAllArrivalAirportsByCountry($country,$filters = array())
7035
+	public function countAllArrivalAirportsByCountry($country, $filters = array())
7036 7036
 	{
7037
-		$filter_query = $this->getFilter($filters,true,true);
7038
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7039
-		$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 
7037
+		$filter_query = $this->getFilter($filters, true, true);
7038
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7039
+		$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 
7040 7040
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country  
7041 7041
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7042 7042
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -7048,7 +7048,7 @@  discard block
 block discarded – undo
7048 7048
 		$airport_array = array();
7049 7049
 		$temp_array = array();
7050 7050
         
7051
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7051
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7052 7052
 		{
7053 7053
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7054 7054
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7069,11 +7069,11 @@  discard block
 block discarded – undo
7069 7069
 	* @return Array the airport list
7070 7070
 	*
7071 7071
 	*/
7072
-	public function countAllArrivalAirportCountriesByCountry($country,$filters = array())
7072
+	public function countAllArrivalAirportCountriesByCountry($country, $filters = array())
7073 7073
 	{
7074
-		$filter_query = $this->getFilter($filters,true,true);
7075
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7076
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7074
+		$filter_query = $this->getFilter($filters, true, true);
7075
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7076
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7077 7077
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
7078 7078
                     GROUP BY spotter_output.arrival_airport_country
7079 7079
 					ORDER BY airport_arrival_country_count DESC";
@@ -7085,7 +7085,7 @@  discard block
 block discarded – undo
7085 7085
 		$airport_array = array();
7086 7086
 		$temp_array = array();
7087 7087
         
7088
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7088
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7089 7089
 		{
7090 7090
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7091 7091
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7106,7 +7106,7 @@  discard block
 block discarded – undo
7106 7106
 	*/
7107 7107
 	public function countAllDepartureCountries($filters = array())
7108 7108
 	{
7109
-		$filter_query = $this->getFilter($filters,true,true);
7109
+		$filter_query = $this->getFilter($filters, true, true);
7110 7110
 		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7111 7111
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.departure_airport_icao <> 'NA'";
7112 7112
 		$query .= " GROUP BY spotter_output.departure_airport_country
@@ -7120,7 +7120,7 @@  discard block
 block discarded – undo
7120 7120
 		$airport_array = array();
7121 7121
 		$temp_array = array();
7122 7122
         
7123
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7123
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7124 7124
 		{
7125 7125
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
7126 7126
 			$temp_array['airport_departure_country'] = $row['departure_airport_country'];
@@ -7138,9 +7138,9 @@  discard block
 block discarded – undo
7138 7138
 	* @return Array the airport arrival list
7139 7139
 	*
7140 7140
 	*/
7141
-	public function countAllArrivalCountries($limit = true,$filters = array())
7141
+	public function countAllArrivalCountries($limit = true, $filters = array())
7142 7142
 	{
7143
-		$filter_query = $this->getFilter($filters,true,true);
7143
+		$filter_query = $this->getFilter($filters, true, true);
7144 7144
 		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7145 7145
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA'";
7146 7146
 		$query .= " GROUP BY spotter_output.arrival_airport_country
@@ -7154,7 +7154,7 @@  discard block
 block discarded – undo
7154 7154
 		$airport_array = array();
7155 7155
 		$temp_array = array();
7156 7156
         
7157
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7157
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7158 7158
 		{
7159 7159
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
7160 7160
 			$temp_array['airport_arrival_country'] = $row['arrival_airport_country'];
@@ -7177,8 +7177,8 @@  discard block
 block discarded – undo
7177 7177
 	*/
7178 7178
 	public function countAllRoutes($filters = array())
7179 7179
 	{
7180
-		$filter_query = $this->getFilter($filters,true,true);
7181
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7180
+		$filter_query = $this->getFilter($filters, true, true);
7181
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7182 7182
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> 'NA'
7183 7183
                     GROUP BY route,spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
7184 7184
                     ORDER BY route_count DESC
@@ -7191,7 +7191,7 @@  discard block
 block discarded – undo
7191 7191
 		$routes_array = array();
7192 7192
 		$temp_array = array();
7193 7193
         
7194
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7194
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7195 7195
 		{
7196 7196
 			$temp_array['route_count'] = $row['route_count'];
7197 7197
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7218,11 +7218,11 @@  discard block
 block discarded – undo
7218 7218
 	* @return Array the route list
7219 7219
 	*
7220 7220
 	*/
7221
-	public function countAllRoutesByAircraft($aircraft_icao,$filters = array())
7221
+	public function countAllRoutesByAircraft($aircraft_icao, $filters = array())
7222 7222
 	{
7223
-		$filter_query = $this->getFilter($filters,true,true);
7224
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
7225
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7223
+		$filter_query = $this->getFilter($filters, true, true);
7224
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
7225
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7226 7226
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
7227 7227
 			    GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7228 7228
 			    ORDER BY route_count DESC";
@@ -7233,7 +7233,7 @@  discard block
 block discarded – undo
7233 7233
 		$routes_array = array();
7234 7234
 		$temp_array = array();
7235 7235
         
7236
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7236
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7237 7237
 		{
7238 7238
 			$temp_array['route_count'] = $row['route_count'];
7239 7239
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7260,9 +7260,9 @@  discard block
 block discarded – undo
7260 7260
 	*/
7261 7261
 	public function countAllRoutesByRegistration($registration, $filters = array())
7262 7262
 	{
7263
-		$filter_query = $this->getFilter($filters,true,true);
7263
+		$filter_query = $this->getFilter($filters, true, true);
7264 7264
 		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
7265
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7265
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7266 7266
 			FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.registration = :registration 
7267 7267
                     GROUP BY route
7268 7268
                     ORDER BY route_count DESC";
@@ -7274,7 +7274,7 @@  discard block
 block discarded – undo
7274 7274
 		$routes_array = array();
7275 7275
 		$temp_array = array();
7276 7276
         
7277
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7277
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7278 7278
 		{
7279 7279
 			$temp_array['route_count'] = $row['route_count'];
7280 7280
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7302,9 +7302,9 @@  discard block
 block discarded – undo
7302 7302
 	*/
7303 7303
 	public function countAllRoutesByAirline($airline_icao, $filters = array())
7304 7304
 	{
7305
-		$filter_query = $this->getFilter($filters,true,true);
7306
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
7307
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7305
+		$filter_query = $this->getFilter($filters, true, true);
7306
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
7307
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7308 7308
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao = :airline_icao 
7309 7309
 			    GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7310 7310
 			    ORDER BY route_count DESC";
@@ -7316,7 +7316,7 @@  discard block
 block discarded – undo
7316 7316
 		$routes_array = array();
7317 7317
 		$temp_array = array();
7318 7318
         
7319
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7319
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7320 7320
 		{
7321 7321
 			$temp_array['route_count'] = $row['route_count'];
7322 7322
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7344,9 +7344,9 @@  discard block
 block discarded – undo
7344 7344
 	*/
7345 7345
 	public function countAllRoutesByAirport($airport_icao, $filters = array())
7346 7346
 	{
7347
-		$filter_query = $this->getFilter($filters,true,true);
7348
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
7349
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7347
+		$filter_query = $this->getFilter($filters, true, true);
7348
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
7349
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7350 7350
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
7351 7351
 			    GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7352 7352
 			    ORDER BY route_count DESC";
@@ -7357,7 +7357,7 @@  discard block
 block discarded – undo
7357 7357
 		$routes_array = array();
7358 7358
 		$temp_array = array();
7359 7359
         
7360
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7360
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7361 7361
 		{
7362 7362
 			$temp_array['route_count'] = $row['route_count'];
7363 7363
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7385,9 +7385,9 @@  discard block
 block discarded – undo
7385 7385
 	*/
7386 7386
 	public function countAllRoutesByCountry($country, $filters = array())
7387 7387
 	{
7388
-		$filter_query = $this->getFilter($filters,true,true);
7389
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7390
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7388
+		$filter_query = $this->getFilter($filters, true, true);
7389
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7390
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7391 7391
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
7392 7392
 			    GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7393 7393
 			    ORDER BY route_count DESC";
@@ -7398,7 +7398,7 @@  discard block
 block discarded – undo
7398 7398
 		$routes_array = array();
7399 7399
 		$temp_array = array();
7400 7400
         
7401
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7401
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7402 7402
 		{
7403 7403
 			$temp_array['route_count'] = $row['route_count'];
7404 7404
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7426,8 +7426,8 @@  discard block
 block discarded – undo
7426 7426
 	public function countAllRoutesByDate($date, $filters = array())
7427 7427
 	{
7428 7428
 		global $globalTimezone, $globalDBdriver;
7429
-		$filter_query = $this->getFilter($filters,true,true);
7430
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
7429
+		$filter_query = $this->getFilter($filters, true, true);
7430
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
7431 7431
 		if ($globalTimezone != '') {
7432 7432
 			date_default_timezone_set($globalTimezone);
7433 7433
 			$datetime = new DateTime($date);
@@ -7435,12 +7435,12 @@  discard block
 block discarded – undo
7435 7435
 		} else $offset = '+00:00';
7436 7436
 		
7437 7437
 		if ($globalDBdriver == 'mysql') {
7438
-			$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7438
+			$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7439 7439
 				    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date  
7440 7440
 				    GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7441 7441
 				    ORDER BY route_count DESC";
7442 7442
 		} else {
7443
-			$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7443
+			$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7444 7444
 				    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date  
7445 7445
 				    GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7446 7446
 				    ORDER BY route_count DESC";
@@ -7452,7 +7452,7 @@  discard block
 block discarded – undo
7452 7452
 		$routes_array = array();
7453 7453
 		$temp_array = array();
7454 7454
         
7455
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7455
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7456 7456
 		{
7457 7457
 			$temp_array['route_count'] = $row['route_count'];
7458 7458
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7479,9 +7479,9 @@  discard block
 block discarded – undo
7479 7479
 	*/
7480 7480
 	public function countAllRoutesByIdent($ident, $filters = array())
7481 7481
 	{
7482
-		$filter_query = $this->getFilter($filters,true,true);
7483
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7484
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7482
+		$filter_query = $this->getFilter($filters, true, true);
7483
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7484
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7485 7485
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.ident = :ident   
7486 7486
                     GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7487 7487
                     ORDER BY route_count DESC";
@@ -7493,7 +7493,7 @@  discard block
 block discarded – undo
7493 7493
 		$routes_array = array();
7494 7494
 		$temp_array = array();
7495 7495
         
7496
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7496
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7497 7497
 		{
7498 7498
 			$temp_array['route_count'] = $row['route_count'];
7499 7499
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7520,9 +7520,9 @@  discard block
 block discarded – undo
7520 7520
 	*/
7521 7521
 	public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array())
7522 7522
 	{
7523
-		$filter_query = $this->getFilter($filters,true,true);
7524
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
7525
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7523
+		$filter_query = $this->getFilter($filters, true, true);
7524
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
7525
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7526 7526
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer   
7527 7527
                     GROUP BY route
7528 7528
                     ORDER BY route_count DESC";
@@ -7534,7 +7534,7 @@  discard block
 block discarded – undo
7534 7534
 		$routes_array = array();
7535 7535
 		$temp_array = array();
7536 7536
         
7537
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7537
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7538 7538
 		{
7539 7539
 			$temp_array['route_count'] = $row['route_count'];
7540 7540
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7562,8 +7562,8 @@  discard block
 block discarded – undo
7562 7562
 	*/
7563 7563
 	public function countAllRoutesWithWaypoints($filters = array())
7564 7564
 	{
7565
-		$filter_query = $this->getFilter($filters,true,true);
7566
-		$query  = "SELECT DISTINCT spotter_output.waypoints AS route, count(spotter_output.waypoints) AS route_count, spotter_output.spotter_id, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7565
+		$filter_query = $this->getFilter($filters, true, true);
7566
+		$query = "SELECT DISTINCT spotter_output.waypoints AS route, count(spotter_output.waypoints) AS route_count, spotter_output.spotter_id, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
7567 7567
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.waypoints <> '' 
7568 7568
                     GROUP BY route, spotter_output.spotter_id, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
7569 7569
                     ORDER BY route_count DESC
@@ -7576,7 +7576,7 @@  discard block
 block discarded – undo
7576 7576
 		$routes_array = array();
7577 7577
 		$temp_array = array();
7578 7578
         
7579
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7579
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7580 7580
 		{
7581 7581
 			$temp_array['spotter_id'] = $row['spotter_id'];
7582 7582
 			$temp_array['route_count'] = $row['route_count'];
@@ -7601,11 +7601,11 @@  discard block
 block discarded – undo
7601 7601
 	* @return Array the callsign list
7602 7602
 	*
7603 7603
 	*/
7604
-	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
7604
+	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
7605 7605
 	{
7606 7606
 		global $globalDBdriver;
7607
-		$filter_query = $this->getFilter($filters,true,true);
7608
-		$query  = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
7607
+		$filter_query = $this->getFilter($filters, true, true);
7608
+		$query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
7609 7609
                     FROM spotter_output".$filter_query." spotter_output.ident <> '' ";
7610 7610
 		 if ($olderthanmonths > 0) {
7611 7611
 			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
@@ -7624,7 +7624,7 @@  discard block
 block discarded – undo
7624 7624
 		$callsign_array = array();
7625 7625
 		$temp_array = array();
7626 7626
         
7627
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7627
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7628 7628
 		{
7629 7629
 			$temp_array['callsign_icao'] = $row['ident'];
7630 7630
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -7646,8 +7646,8 @@  discard block
 block discarded – undo
7646 7646
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
7647 7647
 	{
7648 7648
 		global $globalDBdriver;
7649
-		$filter_query = $this->getFilter($filters,true,true);
7650
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
7649
+		$filter_query = $this->getFilter($filters, true, true);
7650
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
7651 7651
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''  AND spotter_output.airline_icao <> '' ";
7652 7652
 		 if ($olderthanmonths > 0) {
7653 7653
 			if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
@@ -7666,7 +7666,7 @@  discard block
 block discarded – undo
7666 7666
 		$callsign_array = array();
7667 7667
 		$temp_array = array();
7668 7668
         
7669
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7669
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7670 7670
 		{
7671 7671
 			$temp_array['callsign_icao'] = $row['ident'];
7672 7672
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -7720,7 +7720,7 @@  discard block
 block discarded – undo
7720 7720
 		$date_array = array();
7721 7721
 		$temp_array = array();
7722 7722
         
7723
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7723
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7724 7724
 		{
7725 7725
 			$temp_array['date_name'] = $row['date_name'];
7726 7726
 			$temp_array['date_count'] = $row['date_count'];
@@ -7745,15 +7745,15 @@  discard block
 block discarded – undo
7745 7745
 			$datetime = new DateTime();
7746 7746
 			$offset = $datetime->format('P');
7747 7747
 		} else $offset = '+00:00';
7748
-		$filter_query = $this->getFilter($filters,true,true);
7748
+		$filter_query = $this->getFilter($filters, true, true);
7749 7749
 		if ($globalDBdriver == 'mysql') {
7750
-			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7750
+			$query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7751 7751
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
7752 7752
 								GROUP BY spotter_output.airline_icao, date_name 
7753 7753
 								ORDER BY date_count DESC
7754 7754
 								LIMIT 10 OFFSET 0";
7755 7755
 		} else {
7756
-			$query  = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count
7756
+			$query = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count
7757 7757
 								FROM spotter_output 
7758 7758
 								WHERE spotter_output.airline_icao <> '' 
7759 7759
 								GROUP BY spotter_output.airline_icao, date_name 
@@ -7768,7 +7768,7 @@  discard block
 block discarded – undo
7768 7768
 		$date_array = array();
7769 7769
 		$temp_array = array();
7770 7770
         
7771
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7771
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7772 7772
 		{
7773 7773
 			$temp_array['date_name'] = $row['date_name'];
7774 7774
 			$temp_array['date_count'] = $row['date_count'];
@@ -7794,7 +7794,7 @@  discard block
 block discarded – undo
7794 7794
 			$datetime = new DateTime();
7795 7795
 			$offset = $datetime->format('P');
7796 7796
 		} else $offset = '+00:00';
7797
-		$filter_query = $this->getFilter($filters,true,true);
7797
+		$filter_query = $this->getFilter($filters, true, true);
7798 7798
 		if ($globalDBdriver == 'mysql') {
7799 7799
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7800 7800
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)";
@@ -7815,7 +7815,7 @@  discard block
 block discarded – undo
7815 7815
 		$date_array = array();
7816 7816
 		$temp_array = array();
7817 7817
         
7818
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7818
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7819 7819
 		{
7820 7820
 			$temp_array['date_name'] = $row['date_name'];
7821 7821
 			$temp_array['date_count'] = $row['date_count'];
@@ -7840,7 +7840,7 @@  discard block
 block discarded – undo
7840 7840
 			$datetime = new DateTime();
7841 7841
 			$offset = $datetime->format('P');
7842 7842
 		} else $offset = '+00:00';
7843
-		$filter_query = $this->getFilter($filters,true,true);
7843
+		$filter_query = $this->getFilter($filters, true, true);
7844 7844
 		if ($globalDBdriver == 'mysql') {
7845 7845
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7846 7846
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)";
@@ -7861,7 +7861,7 @@  discard block
 block discarded – undo
7861 7861
 		$date_array = array();
7862 7862
 		$temp_array = array();
7863 7863
         
7864
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7864
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7865 7865
 		{
7866 7866
 			$temp_array['date_name'] = $row['date_name'];
7867 7867
 			$temp_array['date_count'] = $row['date_count'];
@@ -7882,7 +7882,7 @@  discard block
 block discarded – undo
7882 7882
 	public function countAllDatesLastMonthByAirlines($filters = array())
7883 7883
 	{
7884 7884
 		global $globalTimezone, $globalDBdriver;
7885
-		$filter_query = $this->getFilter($filters,true,true);
7885
+		$filter_query = $this->getFilter($filters, true, true);
7886 7886
 		if ($globalTimezone != '') {
7887 7887
 			date_default_timezone_set($globalTimezone);
7888 7888
 			$datetime = new DateTime();
@@ -7890,13 +7890,13 @@  discard block
 block discarded – undo
7890 7890
 		} else $offset = '+00:00';
7891 7891
 		
7892 7892
 		if ($globalDBdriver == 'mysql') {
7893
-			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7893
+			$query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7894 7894
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)
7895 7895
 								GROUP BY spotter_output.airline_icao, date_name 
7896 7896
 								ORDER BY spotter_output.date ASC";
7897 7897
 			$query_data = array(':offset' => $offset);
7898 7898
 		} else {
7899
-			$query  = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count
7899
+			$query = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count
7900 7900
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= CURRENT_TIMESTAMP AT TIME ZONE INTERVAL :offset - INTERVAL '1 MONTHS'
7901 7901
 								GROUP BY spotter_output.airline_icao, date_name 
7902 7902
 								ORDER BY date_name ASC";
@@ -7909,7 +7909,7 @@  discard block
 block discarded – undo
7909 7909
 		$date_array = array();
7910 7910
 		$temp_array = array();
7911 7911
         
7912
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7912
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7913 7913
 		{
7914 7914
 			$temp_array['date_name'] = $row['date_name'];
7915 7915
 			$temp_array['date_count'] = $row['date_count'];
@@ -7956,7 +7956,7 @@  discard block
 block discarded – undo
7956 7956
 		$date_array = array();
7957 7957
 		$temp_array = array();
7958 7958
         
7959
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7959
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7960 7960
 		{
7961 7961
 			$temp_array['month_name'] = $row['month_name'];
7962 7962
 			$temp_array['year_name'] = $row['year_name'];
@@ -7977,7 +7977,7 @@  discard block
 block discarded – undo
7977 7977
 	public function countAllMonthsByAirlines($filters = array())
7978 7978
 	{
7979 7979
 		global $globalTimezone, $globalDBdriver;
7980
-		$filter_query = $this->getFilter($filters,true,true);
7980
+		$filter_query = $this->getFilter($filters, true, true);
7981 7981
 		if ($globalTimezone != '') {
7982 7982
 			date_default_timezone_set($globalTimezone);
7983 7983
 			$datetime = new DateTime();
@@ -7985,12 +7985,12 @@  discard block
 block discarded – undo
7985 7985
 		} else $offset = '+00:00';
7986 7986
 
7987 7987
 		if ($globalDBdriver == 'mysql') {
7988
-			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
7988
+			$query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
7989 7989
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
7990 7990
 								GROUP BY spotter_output.airline_icao, year_name, month_name 
7991 7991
 								ORDER BY date_count DESC";
7992 7992
 		} else {
7993
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count
7993
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count
7994 7994
 								FROM spotter_output 
7995 7995
 								WHERE spotter_output.airline_icao <> '' 
7996 7996
 								GROUP BY spotter_output.airline_icao, year_name, month_name 
@@ -8004,7 +8004,7 @@  discard block
 block discarded – undo
8004 8004
 		$date_array = array();
8005 8005
 		$temp_array = array();
8006 8006
         
8007
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8007
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8008 8008
 		{
8009 8009
 			$temp_array['month_name'] = $row['month_name'];
8010 8010
 			$temp_array['year_name'] = $row['year_name'];
@@ -8031,14 +8031,14 @@  discard block
 block discarded – undo
8031 8031
 			$datetime = new DateTime();
8032 8032
 			$offset = $datetime->format('P');
8033 8033
 		} else $offset = '+00:00';
8034
-		$filter_query = $this->getFilter($filters,true,true);
8034
+		$filter_query = $this->getFilter($filters, true, true);
8035 8035
 		if ($globalDBdriver == 'mysql') {
8036
-			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
8036
+			$query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
8037 8037
 								FROM spotter_output".$filter_query." spotter_output.airline_type = 'military'
8038 8038
 								GROUP BY year_name, month_name 
8039 8039
 								ORDER BY date_count DESC";
8040 8040
 		} else {
8041
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count
8041
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count
8042 8042
 								FROM spotter_output".$filter_query." spotter_output.airline_type = 'military'
8043 8043
 								GROUP BY year_name, month_name 
8044 8044
 								ORDER BY date_count DESC";
@@ -8050,7 +8050,7 @@  discard block
 block discarded – undo
8050 8050
 		$date_array = array();
8051 8051
 		$temp_array = array();
8052 8052
         
8053
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8053
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8054 8054
 		{
8055 8055
 			$temp_array['month_name'] = $row['month_name'];
8056 8056
 			$temp_array['year_name'] = $row['year_name'];
@@ -8076,15 +8076,15 @@  discard block
 block discarded – undo
8076 8076
 			$datetime = new DateTime();
8077 8077
 			$offset = $datetime->format('P');
8078 8078
 		} else $offset = '+00:00';
8079
-		$filter_query = $this->getFilter($filters,true,true);
8079
+		$filter_query = $this->getFilter($filters, true, true);
8080 8080
 
8081 8081
 		if ($globalDBdriver == 'mysql') {
8082
-			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count
8082
+			$query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count
8083 8083
 								FROM spotter_output".$filter_query." owner_name <> ''
8084 8084
 								GROUP BY year_name, month_name
8085 8085
 								ORDER BY date_count DESC";
8086 8086
 		} else {
8087
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count
8087
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count
8088 8088
 								FROM spotter_output".$filter_query." owner_name <> ''
8089 8089
 								GROUP BY year_name, month_name
8090 8090
 								ORDER BY date_count DESC";
@@ -8096,7 +8096,7 @@  discard block
 block discarded – undo
8096 8096
 		$date_array = array();
8097 8097
 		$temp_array = array();
8098 8098
         
8099
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8099
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8100 8100
 		{
8101 8101
 			$temp_array['month_name'] = $row['month_name'];
8102 8102
 			$temp_array['year_name'] = $row['year_name'];
@@ -8117,7 +8117,7 @@  discard block
 block discarded – undo
8117 8117
 	public function countAllMonthsOwnersByAirlines($filters = array())
8118 8118
 	{
8119 8119
 		global $globalTimezone, $globalDBdriver;
8120
-		$filter_query = $this->getFilter($filters,true,true);
8120
+		$filter_query = $this->getFilter($filters, true, true);
8121 8121
 		if ($globalTimezone != '') {
8122 8122
 			date_default_timezone_set($globalTimezone);
8123 8123
 			$datetime = new DateTime();
@@ -8125,12 +8125,12 @@  discard block
 block discarded – undo
8125 8125
 		} else $offset = '+00:00';
8126 8126
 
8127 8127
 		if ($globalDBdriver == 'mysql') {
8128
-			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count
8128
+			$query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count
8129 8129
 								FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' 
8130 8130
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8131 8131
 								ORDER BY date_count DESC";
8132 8132
 		} else {
8133
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count
8133
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count
8134 8134
 								FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' 
8135 8135
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8136 8136
 								ORDER BY date_count DESC";
@@ -8142,7 +8142,7 @@  discard block
 block discarded – undo
8142 8142
 		$date_array = array();
8143 8143
 		$temp_array = array();
8144 8144
         
8145
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8145
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8146 8146
 		{
8147 8147
 			$temp_array['month_name'] = $row['month_name'];
8148 8148
 			$temp_array['year_name'] = $row['year_name'];
@@ -8169,15 +8169,15 @@  discard block
 block discarded – undo
8169 8169
 			$datetime = new DateTime();
8170 8170
 			$offset = $datetime->format('P');
8171 8171
 		} else $offset = '+00:00';
8172
-		$filter_query = $this->getFilter($filters,true,true);
8172
+		$filter_query = $this->getFilter($filters, true, true);
8173 8173
 
8174 8174
 		if ($globalDBdriver == 'mysql') {
8175
-			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count
8175
+			$query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count
8176 8176
 								FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL
8177 8177
 								GROUP BY year_name, month_name
8178 8178
 								ORDER BY date_count DESC";
8179 8179
 		} else {
8180
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count
8180
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count
8181 8181
 								FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL
8182 8182
 								GROUP BY year_name, month_name
8183 8183
 								ORDER BY date_count DESC";
@@ -8189,7 +8189,7 @@  discard block
 block discarded – undo
8189 8189
 		$date_array = array();
8190 8190
 		$temp_array = array();
8191 8191
         
8192
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8192
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8193 8193
 		{
8194 8194
 			$temp_array['month_name'] = $row['month_name'];
8195 8195
 			$temp_array['year_name'] = $row['year_name'];
@@ -8210,7 +8210,7 @@  discard block
 block discarded – undo
8210 8210
 	public function countAllMonthsPilotsByAirlines($filters = array())
8211 8211
 	{
8212 8212
 		global $globalTimezone, $globalDBdriver;
8213
-		$filter_query = $this->getFilter($filters,true,true);
8213
+		$filter_query = $this->getFilter($filters, true, true);
8214 8214
 		if ($globalTimezone != '') {
8215 8215
 			date_default_timezone_set($globalTimezone);
8216 8216
 			$datetime = new DateTime();
@@ -8218,12 +8218,12 @@  discard block
 block discarded – undo
8218 8218
 		} else $offset = '+00:00';
8219 8219
 
8220 8220
 		if ($globalDBdriver == 'mysql') {
8221
-			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count
8221
+			$query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count
8222 8222
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL
8223 8223
 								GROUP BY spotter_output.airline_icao,year_name, month_name
8224 8224
 								ORDER BY date_count DESC";
8225 8225
 		} else {
8226
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count
8226
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count
8227 8227
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL
8228 8228
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8229 8229
 								ORDER BY date_count DESC";
@@ -8235,7 +8235,7 @@  discard block
 block discarded – undo
8235 8235
 		$date_array = array();
8236 8236
 		$temp_array = array();
8237 8237
         
8238
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8238
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8239 8239
 		{
8240 8240
 			$temp_array['month_name'] = $row['month_name'];
8241 8241
 			$temp_array['year_name'] = $row['year_name'];
@@ -8257,7 +8257,7 @@  discard block
 block discarded – undo
8257 8257
 	public function countAllMonthsAirlines($filters = array())
8258 8258
 	{
8259 8259
 		global $globalTimezone, $globalDBdriver;
8260
-		$filter_query = $this->getFilter($filters,true,true);
8260
+		$filter_query = $this->getFilter($filters, true, true);
8261 8261
 		if ($globalTimezone != '') {
8262 8262
 			date_default_timezone_set($globalTimezone);
8263 8263
 			$datetime = new DateTime();
@@ -8265,12 +8265,12 @@  discard block
 block discarded – undo
8265 8265
 		} else $offset = '+00:00';
8266 8266
 
8267 8267
 		if ($globalDBdriver == 'mysql') {
8268
-			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct airline_icao) as date_count
8268
+			$query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct airline_icao) as date_count
8269 8269
 								FROM spotter_output".$filter_query." airline_icao <> '' 
8270 8270
 								GROUP BY year_name, month_name
8271 8271
 								ORDER BY date_count DESC";
8272 8272
 		} else {
8273
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct airline_icao) as date_count
8273
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct airline_icao) as date_count
8274 8274
 								FROM spotter_output".$filter_query." airline_icao <> '' 
8275 8275
 								GROUP BY year_name, month_name
8276 8276
 								ORDER BY date_count DESC";
@@ -8282,7 +8282,7 @@  discard block
 block discarded – undo
8282 8282
 		$date_array = array();
8283 8283
 		$temp_array = array();
8284 8284
         
8285
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8285
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8286 8286
 		{
8287 8287
 			$temp_array['month_name'] = $row['month_name'];
8288 8288
 			$temp_array['year_name'] = $row['year_name'];
@@ -8308,15 +8308,15 @@  discard block
 block discarded – undo
8308 8308
 			$datetime = new DateTime();
8309 8309
 			$offset = $datetime->format('P');
8310 8310
 		} else $offset = '+00:00';
8311
-		$filter_query = $this->getFilter($filters,true,true);
8311
+		$filter_query = $this->getFilter($filters, true, true);
8312 8312
 
8313 8313
 		if ($globalDBdriver == 'mysql') {
8314
-			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count
8314
+			$query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count
8315 8315
 								FROM spotter_output".$filter_query." aircraft_icao <> '' 
8316 8316
 								GROUP BY year_name, month_name
8317 8317
 								ORDER BY date_count DESC";
8318 8318
 		} else {
8319
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count
8319
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count
8320 8320
 								FROM spotter_output".$filter_query." aircraft_icao <> '' 
8321 8321
 								GROUP BY year_name, month_name
8322 8322
 								ORDER BY date_count DESC";
@@ -8328,7 +8328,7 @@  discard block
 block discarded – undo
8328 8328
 		$date_array = array();
8329 8329
 		$temp_array = array();
8330 8330
         
8331
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8331
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8332 8332
 		{
8333 8333
 			$temp_array['month_name'] = $row['month_name'];
8334 8334
 			$temp_array['year_name'] = $row['year_name'];
@@ -8350,7 +8350,7 @@  discard block
 block discarded – undo
8350 8350
 	public function countAllMonthsAircraftsByAirlines($filters = array())
8351 8351
 	{
8352 8352
 		global $globalTimezone, $globalDBdriver;
8353
-		$filter_query = $this->getFilter($filters,true,true);
8353
+		$filter_query = $this->getFilter($filters, true, true);
8354 8354
 		if ($globalTimezone != '') {
8355 8355
 			date_default_timezone_set($globalTimezone);
8356 8356
 			$datetime = new DateTime();
@@ -8358,12 +8358,12 @@  discard block
 block discarded – undo
8358 8358
 		} else $offset = '+00:00';
8359 8359
 
8360 8360
 		if ($globalDBdriver == 'mysql') {
8361
-			$query  = "SELECT spotter_output.airline_icao,YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count
8361
+			$query = "SELECT spotter_output.airline_icao,YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count
8362 8362
 								FROM spotter_output".$filter_query." aircraft_icao <> ''  AND spotter_output.airline_icao <> '' 
8363 8363
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8364 8364
 								ORDER BY date_count DESC";
8365 8365
 		} else {
8366
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count
8366
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count
8367 8367
 								FROM spotter_output".$filter_query." aircraft_icao <> '' AND spotter_output.airline_icao <> '' 
8368 8368
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8369 8369
 								ORDER BY date_count DESC";
@@ -8375,7 +8375,7 @@  discard block
 block discarded – undo
8375 8375
 		$date_array = array();
8376 8376
 		$temp_array = array();
8377 8377
         
8378
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8378
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8379 8379
 		{
8380 8380
 			$temp_array['month_name'] = $row['month_name'];
8381 8381
 			$temp_array['year_name'] = $row['year_name'];
@@ -8402,15 +8402,15 @@  discard block
 block discarded – undo
8402 8402
 			$datetime = new DateTime();
8403 8403
 			$offset = $datetime->format('P');
8404 8404
 		} else $offset = '+00:00';
8405
-		$filter_query = $this->getFilter($filters,true,true);
8405
+		$filter_query = $this->getFilter($filters, true, true);
8406 8406
 
8407 8407
 		if ($globalDBdriver == 'mysql') {
8408
-			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count
8408
+			$query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count
8409 8409
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' 
8410 8410
 								GROUP BY year_name, month_name
8411 8411
 								ORDER BY date_count DESC";
8412 8412
 		} else {
8413
-			$query  = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count
8413
+			$query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count
8414 8414
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' 
8415 8415
 								GROUP BY year_name, month_name
8416 8416
 								ORDER BY date_count DESC";
@@ -8422,7 +8422,7 @@  discard block
 block discarded – undo
8422 8422
 		$date_array = array();
8423 8423
 		$temp_array = array();
8424 8424
         
8425
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8425
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8426 8426
 		{
8427 8427
 			$temp_array['month_name'] = $row['month_name'];
8428 8428
 			$temp_array['year_name'] = $row['year_name'];
@@ -8444,7 +8444,7 @@  discard block
 block discarded – undo
8444 8444
 	public function countAllMonthsRealArrivalsByAirlines($filters = array())
8445 8445
 	{
8446 8446
 		global $globalTimezone, $globalDBdriver;
8447
-		$filter_query = $this->getFilter($filters,true,true);
8447
+		$filter_query = $this->getFilter($filters, true, true);
8448 8448
 		if ($globalTimezone != '') {
8449 8449
 			date_default_timezone_set($globalTimezone);
8450 8450
 			$datetime = new DateTime();
@@ -8452,12 +8452,12 @@  discard block
 block discarded – undo
8452 8452
 		} else $offset = '+00:00';
8453 8453
 
8454 8454
 		if ($globalDBdriver == 'mysql') {
8455
-			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count
8455
+			$query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count
8456 8456
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' 
8457 8457
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8458 8458
 								ORDER BY date_count DESC";
8459 8459
 		} else {
8460
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count
8460
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count
8461 8461
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' 
8462 8462
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8463 8463
 								ORDER BY date_count DESC";
@@ -8469,7 +8469,7 @@  discard block
 block discarded – undo
8469 8469
 		$date_array = array();
8470 8470
 		$temp_array = array();
8471 8471
         
8472
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8472
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8473 8473
 		{
8474 8474
 			$temp_array['month_name'] = $row['month_name'];
8475 8475
 			$temp_array['year_name'] = $row['year_name'];
@@ -8497,7 +8497,7 @@  discard block
 block discarded – undo
8497 8497
 			$datetime = new DateTime();
8498 8498
 			$offset = $datetime->format('P');
8499 8499
 		} else $offset = '+00:00';
8500
-		$filter_query = $this->getFilter($filters,true,true);
8500
+		$filter_query = $this->getFilter($filters, true, true);
8501 8501
 		if ($globalDBdriver == 'mysql') {
8502 8502
 			$query  = "SELECT MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count
8503 8503
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)";
@@ -8518,7 +8518,7 @@  discard block
 block discarded – undo
8518 8518
 		$date_array = array();
8519 8519
 		$temp_array = array();
8520 8520
         
8521
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8521
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8522 8522
 		{
8523 8523
 			$temp_array['year_name'] = $row['year_name'];
8524 8524
 			$temp_array['month_name'] = $row['month_name'];
@@ -8538,7 +8538,7 @@  discard block
 block discarded – undo
8538 8538
 	* @return Array the hour list
8539 8539
 	*
8540 8540
 	*/
8541
-	public function countAllHours($orderby,$filters = array())
8541
+	public function countAllHours($orderby, $filters = array())
8542 8542
 	{
8543 8543
 		global $globalTimezone, $globalDBdriver;
8544 8544
 		if ($globalTimezone != '') {
@@ -8586,7 +8586,7 @@  discard block
 block discarded – undo
8586 8586
 		$hour_array = array();
8587 8587
 		$temp_array = array();
8588 8588
         
8589
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8589
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8590 8590
 		{
8591 8591
 			$temp_array['hour_name'] = $row['hour_name'];
8592 8592
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8606,7 +8606,7 @@  discard block
 block discarded – undo
8606 8606
 	public function countAllHoursByAirlines($orderby, $filters = array())
8607 8607
 	{
8608 8608
 		global $globalTimezone, $globalDBdriver;
8609
-		$filter_query = $this->getFilter($filters,true,true);
8609
+		$filter_query = $this->getFilter($filters, true, true);
8610 8610
 		if ($globalTimezone != '') {
8611 8611
 			date_default_timezone_set($globalTimezone);
8612 8612
 			$datetime = new DateTime();
@@ -8624,7 +8624,7 @@  discard block
 block discarded – undo
8624 8624
 		}
8625 8625
 		
8626 8626
 		if ($globalDBdriver == 'mysql') {
8627
-			$query  = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8627
+			$query = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8628 8628
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
8629 8629
 								GROUP BY spotter_output.airline_icao, hour_name 
8630 8630
 								".$orderby_sql;
@@ -8637,7 +8637,7 @@  discard block
 block discarded – undo
8637 8637
   */    
8638 8638
 		$query_data = array(':offset' => $offset);
8639 8639
 		} else {
8640
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8640
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8641 8641
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
8642 8642
 								GROUP BY spotter_output.airline_icao, hour_name 
8643 8643
 								".$orderby_sql;
@@ -8650,7 +8650,7 @@  discard block
 block discarded – undo
8650 8650
 		$hour_array = array();
8651 8651
 		$temp_array = array();
8652 8652
         
8653
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8653
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8654 8654
 		{
8655 8655
 			$temp_array['hour_name'] = $row['hour_name'];
8656 8656
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8673,34 +8673,34 @@  discard block
 block discarded – undo
8673 8673
 	public function countAllHoursByAirline($airline_icao, $filters = array())
8674 8674
 	{
8675 8675
 		global $globalTimezone, $globalDBdriver;
8676
-		$filter_query = $this->getFilter($filters,true,true);
8676
+		$filter_query = $this->getFilter($filters, true, true);
8677 8677
 		if ($globalTimezone != '') {
8678 8678
 			date_default_timezone_set($globalTimezone);
8679 8679
 			$datetime = new DateTime();
8680 8680
 			$offset = $datetime->format('P');
8681 8681
 		} else $offset = '+00:00';
8682 8682
 
8683
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
8683
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
8684 8684
 
8685 8685
 		if ($globalDBdriver == 'mysql') {
8686
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8686
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8687 8687
 								FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao
8688 8688
 								GROUP BY hour_name 
8689 8689
 								ORDER BY hour_name ASC";
8690 8690
 		} else {
8691
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8691
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8692 8692
 								FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao
8693 8693
 								GROUP BY hour_name 
8694 8694
 								ORDER BY hour_name ASC";
8695 8695
 		}
8696 8696
 		
8697 8697
 		$sth = $this->db->prepare($query);
8698
-		$sth->execute(array(':airline_icao' => $airline_icao,':offset' => $offset));
8698
+		$sth->execute(array(':airline_icao' => $airline_icao, ':offset' => $offset));
8699 8699
       
8700 8700
 		$hour_array = array();
8701 8701
 		$temp_array = array();
8702 8702
         
8703
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8703
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8704 8704
 		{
8705 8705
 			$temp_array['hour_name'] = $row['hour_name'];
8706 8706
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8723,8 +8723,8 @@  discard block
 block discarded – undo
8723 8723
 	public function countAllHoursByAircraft($aircraft_icao, $filters = array())
8724 8724
 	{
8725 8725
 		global $globalTimezone, $globalDBdriver;
8726
-		$filter_query = $this->getFilter($filters,true,true);
8727
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
8726
+		$filter_query = $this->getFilter($filters, true, true);
8727
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
8728 8728
 		if ($globalTimezone != '') {
8729 8729
 			date_default_timezone_set($globalTimezone);
8730 8730
 			$datetime = new DateTime();
@@ -8732,24 +8732,24 @@  discard block
 block discarded – undo
8732 8732
 		} else $offset = '+00:00';
8733 8733
 
8734 8734
 		if ($globalDBdriver == 'mysql') {
8735
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8735
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8736 8736
 								FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao
8737 8737
 								GROUP BY hour_name 
8738 8738
 								ORDER BY hour_name ASC";
8739 8739
 		} else {
8740
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8740
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8741 8741
 								FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao
8742 8742
 								GROUP BY hour_name 
8743 8743
 								ORDER BY hour_name ASC";
8744 8744
 		}
8745 8745
 		
8746 8746
 		$sth = $this->db->prepare($query);
8747
-		$sth->execute(array(':aircraft_icao' => $aircraft_icao,':offset' => $offset));
8747
+		$sth->execute(array(':aircraft_icao' => $aircraft_icao, ':offset' => $offset));
8748 8748
       
8749 8749
 		$hour_array = array();
8750 8750
 		$temp_array = array();
8751 8751
         
8752
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8752
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8753 8753
 		{
8754 8754
 			$temp_array['hour_name'] = $row['hour_name'];
8755 8755
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8770,8 +8770,8 @@  discard block
 block discarded – undo
8770 8770
 	public function countAllHoursByRegistration($registration, $filters = array())
8771 8771
 	{
8772 8772
 		global $globalTimezone, $globalDBdriver;
8773
-		$filter_query = $this->getFilter($filters,true,true);
8774
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
8773
+		$filter_query = $this->getFilter($filters, true, true);
8774
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
8775 8775
 		if ($globalTimezone != '') {
8776 8776
 			date_default_timezone_set($globalTimezone);
8777 8777
 			$datetime = new DateTime();
@@ -8779,24 +8779,24 @@  discard block
 block discarded – undo
8779 8779
 		} else $offset = '+00:00';
8780 8780
 
8781 8781
 		if ($globalDBdriver == 'mysql') {
8782
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8782
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8783 8783
 								FROM spotter_output".$filter_query." spotter_output.registration = :registration
8784 8784
 								GROUP BY hour_name 
8785 8785
 								ORDER BY hour_name ASC";
8786 8786
 		} else {
8787
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8787
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8788 8788
 								FROM spotter_output".$filter_query." spotter_output.registration = :registration
8789 8789
 								GROUP BY hour_name 
8790 8790
 								ORDER BY hour_name ASC";
8791 8791
 		}
8792 8792
 		
8793 8793
 		$sth = $this->db->prepare($query);
8794
-		$sth->execute(array(':registration' => $registration,':offset' => $offset));
8794
+		$sth->execute(array(':registration' => $registration, ':offset' => $offset));
8795 8795
       
8796 8796
 		$hour_array = array();
8797 8797
 		$temp_array = array();
8798 8798
         
8799
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8799
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8800 8800
 		{
8801 8801
 			$temp_array['hour_name'] = $row['hour_name'];
8802 8802
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8817,8 +8817,8 @@  discard block
 block discarded – undo
8817 8817
 	public function countAllHoursByAirport($airport_icao, $filters = array())
8818 8818
 	{
8819 8819
 		global $globalTimezone, $globalDBdriver;
8820
-		$filter_query = $this->getFilter($filters,true,true);
8821
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
8820
+		$filter_query = $this->getFilter($filters, true, true);
8821
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
8822 8822
 		if ($globalTimezone != '') {
8823 8823
 			date_default_timezone_set($globalTimezone);
8824 8824
 			$datetime = new DateTime();
@@ -8826,24 +8826,24 @@  discard block
 block discarded – undo
8826 8826
 		} else $offset = '+00:00';
8827 8827
 
8828 8828
 		if ($globalDBdriver == 'mysql') {
8829
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8829
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8830 8830
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
8831 8831
 								GROUP BY hour_name 
8832 8832
 								ORDER BY hour_name ASC";
8833 8833
 		} else {
8834
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8834
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8835 8835
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
8836 8836
 								GROUP BY hour_name 
8837 8837
 								ORDER BY hour_name ASC";
8838 8838
 		}
8839 8839
 		
8840 8840
 		$sth = $this->db->prepare($query);
8841
-		$sth->execute(array(':airport_icao' => $airport_icao,':offset' => $offset));
8841
+		$sth->execute(array(':airport_icao' => $airport_icao, ':offset' => $offset));
8842 8842
       
8843 8843
 		$hour_array = array();
8844 8844
 		$temp_array = array();
8845 8845
         
8846
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8846
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8847 8847
 		{
8848 8848
 			$temp_array['hour_name'] = $row['hour_name'];
8849 8849
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8862,11 +8862,11 @@  discard block
 block discarded – undo
8862 8862
 	* @return Array the hour list
8863 8863
 	*
8864 8864
 	*/
8865
-	public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array())
8865
+	public function countAllHoursByManufacturer($aircraft_manufacturer, $filters = array())
8866 8866
 	{
8867 8867
 		global $globalTimezone, $globalDBdriver;
8868
-		$filter_query = $this->getFilter($filters,true,true);
8869
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
8868
+		$filter_query = $this->getFilter($filters, true, true);
8869
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
8870 8870
 		if ($globalTimezone != '') {
8871 8871
 			date_default_timezone_set($globalTimezone);
8872 8872
 			$datetime = new DateTime();
@@ -8874,24 +8874,24 @@  discard block
 block discarded – undo
8874 8874
 		} else $offset = '+00:00';
8875 8875
 
8876 8876
 		if ($globalDBdriver == 'mysql') {
8877
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8877
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8878 8878
 								FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
8879 8879
 								GROUP BY hour_name 
8880 8880
 								ORDER BY hour_name ASC";
8881 8881
 		} else {
8882
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8882
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8883 8883
 								FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
8884 8884
 								GROUP BY hour_name 
8885 8885
 								ORDER BY hour_name ASC";
8886 8886
 		}
8887 8887
 		
8888 8888
 		$sth = $this->db->prepare($query);
8889
-		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer,':offset' => $offset));
8889
+		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer, ':offset' => $offset));
8890 8890
       
8891 8891
 		$hour_array = array();
8892 8892
 		$temp_array = array();
8893 8893
         
8894
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8894
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8895 8895
 		{
8896 8896
 			$temp_array['hour_name'] = $row['hour_name'];
8897 8897
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8913,8 +8913,8 @@  discard block
 block discarded – undo
8913 8913
 	public function countAllHoursByDate($date, $filters = array())
8914 8914
 	{
8915 8915
 		global $globalTimezone, $globalDBdriver;
8916
-		$filter_query = $this->getFilter($filters,true,true);
8917
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
8916
+		$filter_query = $this->getFilter($filters, true, true);
8917
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
8918 8918
 		if ($globalTimezone != '') {
8919 8919
 			date_default_timezone_set($globalTimezone);
8920 8920
 			$datetime = new DateTime($date);
@@ -8922,12 +8922,12 @@  discard block
 block discarded – undo
8922 8922
 		} else $offset = '+00:00';
8923 8923
 
8924 8924
 		if ($globalDBdriver == 'mysql') {
8925
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8925
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8926 8926
 								FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
8927 8927
 								GROUP BY hour_name 
8928 8928
 								ORDER BY hour_name ASC";
8929 8929
 		} else {
8930
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8930
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8931 8931
 								FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date
8932 8932
 								GROUP BY hour_name 
8933 8933
 								ORDER BY hour_name ASC";
@@ -8939,7 +8939,7 @@  discard block
 block discarded – undo
8939 8939
 		$hour_array = array();
8940 8940
 		$temp_array = array();
8941 8941
         
8942
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8942
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8943 8943
 		{
8944 8944
 			$temp_array['hour_name'] = $row['hour_name'];
8945 8945
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8961,8 +8961,8 @@  discard block
 block discarded – undo
8961 8961
 	public function countAllHoursByIdent($ident, $filters = array())
8962 8962
 	{
8963 8963
 		global $globalTimezone, $globalDBdriver;
8964
-		$filter_query = $this->getFilter($filters,true,true);
8965
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
8964
+		$filter_query = $this->getFilter($filters, true, true);
8965
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
8966 8966
 		if ($globalTimezone != '') {
8967 8967
 			date_default_timezone_set($globalTimezone);
8968 8968
 			$datetime = new DateTime();
@@ -8970,12 +8970,12 @@  discard block
 block discarded – undo
8970 8970
 		} else $offset = '+00:00';
8971 8971
 
8972 8972
 		if ($globalDBdriver == 'mysql') {
8973
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8973
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8974 8974
 								FROM spotter_output".$filter_query." spotter_output.ident = :ident 
8975 8975
 								GROUP BY hour_name 
8976 8976
 								ORDER BY hour_name ASC";
8977 8977
 		} else {
8978
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8978
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8979 8979
 								FROM spotter_output".$filter_query." spotter_output.ident = :ident 
8980 8980
 								GROUP BY hour_name 
8981 8981
 								ORDER BY hour_name ASC";
@@ -8983,12 +8983,12 @@  discard block
 block discarded – undo
8983 8983
       
8984 8984
 		
8985 8985
 		$sth = $this->db->prepare($query);
8986
-		$sth->execute(array(':ident' => $ident,':offset' => $offset));
8986
+		$sth->execute(array(':ident' => $ident, ':offset' => $offset));
8987 8987
       
8988 8988
 		$hour_array = array();
8989 8989
 		$temp_array = array();
8990 8990
         
8991
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8991
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8992 8992
 		{
8993 8993
 			$temp_array['hour_name'] = $row['hour_name'];
8994 8994
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9007,12 +9007,12 @@  discard block
 block discarded – undo
9007 9007
 	* @return Array the hour list
9008 9008
 	*
9009 9009
 	*/
9010
-	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array())
9010
+	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
9011 9011
 	{
9012 9012
 		global $globalTimezone, $globalDBdriver;
9013
-		$filter_query = $this->getFilter($filters,true,true);
9014
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
9015
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
9013
+		$filter_query = $this->getFilter($filters, true, true);
9014
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
9015
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
9016 9016
 		if ($globalTimezone != '') {
9017 9017
 			date_default_timezone_set($globalTimezone);
9018 9018
 			$datetime = new DateTime();
@@ -9020,24 +9020,24 @@  discard block
 block discarded – undo
9020 9020
 		} else $offset = '+00:00';
9021 9021
 
9022 9022
 		if ($globalDBdriver == 'mysql') {
9023
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9023
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9024 9024
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
9025 9025
 								GROUP BY hour_name 
9026 9026
 								ORDER BY hour_name ASC";
9027 9027
 		} else {
9028
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9028
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9029 9029
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
9030 9030
 								GROUP BY hour_name 
9031 9031
 								ORDER BY hour_name ASC";
9032 9032
 		}
9033 9033
 		
9034 9034
 		$sth = $this->db->prepare($query);
9035
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':offset' => $offset));
9035
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':offset' => $offset));
9036 9036
       
9037 9037
 		$hour_array = array();
9038 9038
 		$temp_array = array();
9039 9039
         
9040
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9040
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9041 9041
 		{
9042 9042
 			$temp_array['hour_name'] = $row['hour_name'];
9043 9043
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9058,8 +9058,8 @@  discard block
 block discarded – undo
9058 9058
 	public function countAllHoursByCountry($country, $filters = array())
9059 9059
 	{
9060 9060
 		global $globalTimezone, $globalDBdriver;
9061
-		$filter_query = $this->getFilter($filters,true,true);
9062
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
9061
+		$filter_query = $this->getFilter($filters, true, true);
9062
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
9063 9063
 		if ($globalTimezone != '') {
9064 9064
 			date_default_timezone_set($globalTimezone);
9065 9065
 			$datetime = new DateTime();
@@ -9067,24 +9067,24 @@  discard block
 block discarded – undo
9067 9067
 		} else $offset = '+00:00';
9068 9068
 
9069 9069
 		if ($globalDBdriver == 'mysql') {
9070
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9070
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9071 9071
 								FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
9072 9072
 								GROUP BY hour_name 
9073 9073
 								ORDER BY hour_name ASC";
9074 9074
 		} else {
9075
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9075
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9076 9076
 								FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
9077 9077
 								GROUP BY hour_name 
9078 9078
 								ORDER BY hour_name ASC";
9079 9079
 		}
9080 9080
 		
9081 9081
 		$sth = $this->db->prepare($query);
9082
-		$sth->execute(array(':country' => $country,':offset' => $offset));
9082
+		$sth->execute(array(':country' => $country, ':offset' => $offset));
9083 9083
       
9084 9084
 		$hour_array = array();
9085 9085
 		$temp_array = array();
9086 9086
         
9087
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9087
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9088 9088
 		{
9089 9089
 			$temp_array['hour_name'] = $row['hour_name'];
9090 9090
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9106,8 +9106,8 @@  discard block
 block discarded – undo
9106 9106
 	*/
9107 9107
 	public function countOverallAircrafts($filters = array())
9108 9108
 	{
9109
-		$filter_query = $this->getFilter($filters,true,true);
9110
-		$query  = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count  
9109
+		$filter_query = $this->getFilter($filters, true, true);
9110
+		$query = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count  
9111 9111
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''";
9112 9112
 		$sth = $this->db->prepare($query);
9113 9113
 		$sth->execute();
@@ -9122,8 +9122,8 @@  discard block
 block discarded – undo
9122 9122
 	*/
9123 9123
 	public function countOverallArrival($filters = array())
9124 9124
 	{
9125
-		$filter_query = $this->getFilter($filters,true,true);
9126
-		$query  = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count  
9125
+		$filter_query = $this->getFilter($filters, true, true);
9126
+		$query = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count  
9127 9127
                     FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> ''";
9128 9128
 		
9129 9129
 		$sth = $this->db->prepare($query);
@@ -9139,8 +9139,8 @@  discard block
 block discarded – undo
9139 9139
 	*/
9140 9140
 	public function countOverallPilots($filters = array())
9141 9141
 	{
9142
-		$filter_query = $this->getFilter($filters,true,true);
9143
-		$query  = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count  
9142
+		$filter_query = $this->getFilter($filters, true, true);
9143
+		$query = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count  
9144 9144
                     FROM spotter_output".$filter_query." spotter_output.pilot_id <> ''";
9145 9145
 		$sth = $this->db->prepare($query);
9146 9146
 		$sth->execute();
@@ -9155,8 +9155,8 @@  discard block
 block discarded – undo
9155 9155
 	*/
9156 9156
 	public function countOverallOwners($filters = array())
9157 9157
 	{
9158
-		$filter_query = $this->getFilter($filters,true,true);
9159
-		$query  = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count  
9158
+		$filter_query = $this->getFilter($filters, true, true);
9159
+		$query = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count  
9160 9160
                     FROM spotter_output".$filter_query." spotter_output.owner_name <> ''";
9161 9161
 		$sth = $this->db->prepare($query);
9162 9162
 		$sth->execute();
@@ -9189,8 +9189,8 @@  discard block
 block discarded – undo
9189 9189
 	*/
9190 9190
 	public function countOverallMilitaryFlights($filters = array())
9191 9191
 	{
9192
-		$filter_query = $this->getFilter($filters,true,true);
9193
-		$query  = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
9192
+		$filter_query = $this->getFilter($filters, true, true);
9193
+		$query = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
9194 9194
                     FROM airlines,spotter_output".$filter_query." spotter_output.airline_icao = airlines.icao AND airlines.type = 'military'";
9195 9195
       
9196 9196
 		$sth = $this->db->prepare($query);
@@ -9227,7 +9227,7 @@  discard block
 block discarded – undo
9227 9227
 	public function countAllHoursFromToday($filters = array())
9228 9228
 	{
9229 9229
 		global $globalTimezone, $globalDBdriver;
9230
-		$filter_query = $this->getFilter($filters,true,true);
9230
+		$filter_query = $this->getFilter($filters, true, true);
9231 9231
 		if ($globalTimezone != '') {
9232 9232
 			date_default_timezone_set($globalTimezone);
9233 9233
 			$datetime = new DateTime();
@@ -9235,12 +9235,12 @@  discard block
 block discarded – undo
9235 9235
 		} else $offset = '+00:00';
9236 9236
 
9237 9237
 		if ($globalDBdriver == 'mysql') {
9238
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9238
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9239 9239
 								FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = CURDATE()
9240 9240
 								GROUP BY hour_name 
9241 9241
 								ORDER BY hour_name ASC";
9242 9242
 		} else {
9243
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9243
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9244 9244
 								FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date)
9245 9245
 								GROUP BY hour_name 
9246 9246
 								ORDER BY hour_name ASC";
@@ -9252,7 +9252,7 @@  discard block
 block discarded – undo
9252 9252
 		$hour_array = array();
9253 9253
 		$temp_array = array();
9254 9254
         
9255
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9255
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9256 9256
 		{
9257 9257
 			$temp_array['hour_name'] = $row['hour_name'];
9258 9258
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9271,14 +9271,14 @@  discard block
 block discarded – undo
9271 9271
 	public function getUpcomingFlights($limit = '', $sort = '', $filters = array())
9272 9272
 	{
9273 9273
 		global $global_query, $globalDBdriver, $globalTimezone;
9274
-		$filter_query = $this->getFilter($filters,true,true);
9274
+		$filter_query = $this->getFilter($filters, true, true);
9275 9275
 		date_default_timezone_set('UTC');
9276 9276
 		$limit_query = '';
9277 9277
 		if ($limit != "")
9278 9278
 		{
9279 9279
 			$limit_array = explode(",", $limit);
9280
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
9281
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
9280
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
9281
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
9282 9282
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
9283 9283
 			{
9284 9284
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
@@ -9331,7 +9331,7 @@  discard block
 block discarded – undo
9331 9331
 			    GROUP BY spotter_output.ident,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time, to_char(spotter_output.date,'HH')
9332 9332
 			    HAVING count(spotter_output.ident) > 5$orderby_query";
9333 9333
 			//echo $query;
9334
-			$spotter_array = $this->getDataFromDB($query.$limit_query,array(':timezone' => $globalTimezone));
9334
+			$spotter_array = $this->getDataFromDB($query.$limit_query, array(':timezone' => $globalTimezone));
9335 9335
 			/*
9336 9336
 			$sth = $this->db->prepare($query);
9337 9337
 			$sth->execute(array(':timezone' => $globalTimezone));
@@ -9350,9 +9350,9 @@  discard block
 block discarded – undo
9350 9350
 	*/
9351 9351
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
9352 9352
 	{
9353
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
9353
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
9354 9354
 
9355
-		$query  = "SELECT spotter_output.spotter_id
9355
+		$query = "SELECT spotter_output.spotter_id
9356 9356
 								FROM spotter_output 
9357 9357
 								WHERE spotter_output.flightaware_id = '".$flightaware_id."'";
9358 9358
         
@@ -9360,7 +9360,7 @@  discard block
 block discarded – undo
9360 9360
 		$sth = $this->db->prepare($query);
9361 9361
 		$sth->execute();
9362 9362
 
9363
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9363
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9364 9364
 		{
9365 9365
 			return $row['spotter_id'];
9366 9366
 		}
@@ -9385,23 +9385,23 @@  discard block
 block discarded – undo
9385 9385
 		}
9386 9386
 		
9387 9387
 		$current_date = date("Y-m-d H:i:s");
9388
-		$date = date("Y-m-d H:i:s",strtotime($dateString." UTC"));
9388
+		$date = date("Y-m-d H:i:s", strtotime($dateString." UTC"));
9389 9389
 		
9390 9390
 		$diff = abs(strtotime($current_date) - strtotime($date));
9391 9391
 
9392
-		$time_array['years'] = floor($diff / (365*60*60*24)); 
9392
+		$time_array['years'] = floor($diff/(365*60*60*24)); 
9393 9393
 		$years = $time_array['years'];
9394 9394
 		
9395
-		$time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
9395
+		$time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24));
9396 9396
 		$months = $time_array['months'];
9397 9397
 		
9398
-		$time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
9398
+		$time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24));
9399 9399
 		$days = $time_array['days'];
9400
-		$time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60));
9400
+		$time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60));
9401 9401
 		$hours = $time_array['hours'];
9402
-		$time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60);
9402
+		$time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60);
9403 9403
 		$minutes = $time_array['minutes'];
9404
-		$time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
9404
+		$time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
9405 9405
 		
9406 9406
 		return $time_array;	
9407 9407
 	}	
@@ -9427,63 +9427,63 @@  discard block
 block discarded – undo
9427 9427
 			$temp_array['direction_degree'] = $direction;
9428 9428
 			$temp_array['direction_shortname'] = "N";
9429 9429
 			$temp_array['direction_fullname'] = "North";
9430
-		} elseif ($direction >= 22.5 && $direction < 45){
9430
+		} elseif ($direction >= 22.5 && $direction < 45) {
9431 9431
 			$temp_array['direction_degree'] = $direction;
9432 9432
 			$temp_array['direction_shortname'] = "NNE";
9433 9433
 			$temp_array['direction_fullname'] = "North-Northeast";
9434
-		} elseif ($direction >= 45 && $direction < 67.5){
9434
+		} elseif ($direction >= 45 && $direction < 67.5) {
9435 9435
 			$temp_array['direction_degree'] = $direction;
9436 9436
 			$temp_array['direction_shortname'] = "NE";
9437 9437
 			$temp_array['direction_fullname'] = "Northeast";
9438
-		} elseif ($direction >= 67.5 && $direction < 90){
9438
+		} elseif ($direction >= 67.5 && $direction < 90) {
9439 9439
 			$temp_array['direction_degree'] = $direction;
9440 9440
 			$temp_array['direction_shortname'] = "ENE";
9441 9441
 			$temp_array['direction_fullname'] = "East-Northeast";
9442
-		} elseif ($direction >= 90 && $direction < 112.5){
9442
+		} elseif ($direction >= 90 && $direction < 112.5) {
9443 9443
 			$temp_array['direction_degree'] = $direction;
9444 9444
 			$temp_array['direction_shortname'] = "E";
9445 9445
 			$temp_array['direction_fullname'] = "East";
9446
-		} elseif ($direction >= 112.5 && $direction < 135){
9446
+		} elseif ($direction >= 112.5 && $direction < 135) {
9447 9447
 			$temp_array['direction_degree'] = $direction;
9448 9448
 			$temp_array['direction_shortname'] = "ESE";
9449 9449
 			$temp_array['direction_fullname'] = "East-Southeast";
9450
-		} elseif ($direction >= 135 && $direction < 157.5){
9450
+		} elseif ($direction >= 135 && $direction < 157.5) {
9451 9451
 			$temp_array['direction_degree'] = $direction;
9452 9452
 			$temp_array['direction_shortname'] = "SE";
9453 9453
 			$temp_array['direction_fullname'] = "Southeast";
9454
-		} elseif ($direction >= 157.5 && $direction < 180){
9454
+		} elseif ($direction >= 157.5 && $direction < 180) {
9455 9455
 			$temp_array['direction_degree'] = $direction;
9456 9456
 			$temp_array['direction_shortname'] = "SSE";
9457 9457
 			$temp_array['direction_fullname'] = "South-Southeast";
9458
-		} elseif ($direction >= 180 && $direction < 202.5){
9458
+		} elseif ($direction >= 180 && $direction < 202.5) {
9459 9459
 			$temp_array['direction_degree'] = $direction;
9460 9460
 			$temp_array['direction_shortname'] = "S";
9461 9461
 			$temp_array['direction_fullname'] = "South";
9462
-		} elseif ($direction >= 202.5 && $direction < 225){
9462
+		} elseif ($direction >= 202.5 && $direction < 225) {
9463 9463
 			$temp_array['direction_degree'] = $direction;
9464 9464
 			$temp_array['direction_shortname'] = "SSW";
9465 9465
 			$temp_array['direction_fullname'] = "South-Southwest";
9466
-		} elseif ($direction >= 225 && $direction < 247.5){
9466
+		} elseif ($direction >= 225 && $direction < 247.5) {
9467 9467
 			$temp_array['direction_degree'] = $direction;
9468 9468
 			$temp_array['direction_shortname'] = "SW";
9469 9469
 			$temp_array['direction_fullname'] = "Southwest";
9470
-		} elseif ($direction >= 247.5 && $direction < 270){
9470
+		} elseif ($direction >= 247.5 && $direction < 270) {
9471 9471
 			$temp_array['direction_degree'] = $direction;
9472 9472
 			$temp_array['direction_shortname'] = "WSW";
9473 9473
 			$temp_array['direction_fullname'] = "West-Southwest";
9474
-		} elseif ($direction >= 270 && $direction < 292.5){
9474
+		} elseif ($direction >= 270 && $direction < 292.5) {
9475 9475
 			$temp_array['direction_degree'] = $direction;
9476 9476
 			$temp_array['direction_shortname'] = "W";
9477 9477
 			$temp_array['direction_fullname'] = "West";
9478
-		} elseif ($direction >= 292.5 && $direction < 315){
9478
+		} elseif ($direction >= 292.5 && $direction < 315) {
9479 9479
 			$temp_array['direction_degree'] = $direction;
9480 9480
 			$temp_array['direction_shortname'] = "WNW";
9481 9481
 			$temp_array['direction_fullname'] = "West-Northwest";
9482
-		} elseif ($direction >= 315 && $direction < 337.5){
9482
+		} elseif ($direction >= 315 && $direction < 337.5) {
9483 9483
 			$temp_array['direction_degree'] = $direction;
9484 9484
 			$temp_array['direction_shortname'] = "NW";
9485 9485
 			$temp_array['direction_fullname'] = "Northwest";
9486
-		} elseif ($direction >= 337.5 && $direction < 360){
9486
+		} elseif ($direction >= 337.5 && $direction < 360) {
9487 9487
 			$temp_array['direction_degree'] = $direction;
9488 9488
 			$temp_array['direction_shortname'] = "NNW";
9489 9489
 			$temp_array['direction_fullname'] = "North-Northwest";
@@ -9536,9 +9536,9 @@  discard block
 block discarded – undo
9536 9536
 	*/
9537 9537
 	public function getAircraftRegistrationBymodeS($aircraft_modes)
9538 9538
 	{
9539
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
9539
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
9540 9540
 	
9541
-		$query  = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1";
9541
+		$query = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1";
9542 9542
 		
9543 9543
 		$sth = $this->db->prepare($query);
9544 9544
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -9561,9 +9561,9 @@  discard block
 block discarded – undo
9561 9561
 	*/
9562 9562
 	public function getAircraftTypeBymodeS($aircraft_modes)
9563 9563
 	{
9564
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
9564
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
9565 9565
 	
9566
-		$query  = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1";
9566
+		$query = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1";
9567 9567
 		
9568 9568
 		$sth = $this->db->prepare($query);
9569 9569
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -9584,11 +9584,11 @@  discard block
 block discarded – undo
9584 9584
 	* @param Float $longitude longitute of the flight
9585 9585
 	* @return String the countrie
9586 9586
 	*/
9587
-	public function getCountryFromLatitudeLongitude($latitude,$longitude)
9587
+	public function getCountryFromLatitudeLongitude($latitude, $longitude)
9588 9588
 	{
9589 9589
 		global $globalDBdriver, $globalDebug;
9590
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
9591
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
9590
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
9591
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
9592 9592
 	
9593 9593
 		$Connection = new Connection($this->db);
9594 9594
 		if (!$Connection->tableExists('countries')) return '';
@@ -9628,19 +9628,19 @@  discard block
 block discarded – undo
9628 9628
 	*/
9629 9629
 	public function convertAircraftRegistration($registration)
9630 9630
 	{
9631
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
9631
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
9632 9632
 		$registration_prefix = '';
9633 9633
 		$registration_1 = substr($registration, 0, 1);
9634 9634
 		$registration_2 = substr($registration, 0, 2);
9635 9635
 
9636 9636
 		//first get the prefix based on two characters
9637
-		$query  = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2";
9637
+		$query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2";
9638 9638
       
9639 9639
 		
9640 9640
 		$sth = $this->db->prepare($query);
9641 9641
 		$sth->execute(array(':registration_2' => $registration_2));
9642 9642
         
9643
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9643
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9644 9644
 		{
9645 9645
 			$registration_prefix = $row['registration_prefix'];
9646 9646
 		}
@@ -9648,11 +9648,11 @@  discard block
 block discarded – undo
9648 9648
 		//if we didn't find a two chracter prefix lets just search the one with one character
9649 9649
 		if ($registration_prefix == '')
9650 9650
 		{
9651
-			$query  = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1";
9651
+			$query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1";
9652 9652
 			$sth = $this->db->prepare($query);
9653 9653
 			$sth->execute(array(':registration_1' => $registration_1));
9654 9654
 	        
9655
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
9655
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9656 9656
 			{
9657 9657
 				$registration_prefix = $row['registration_prefix'];
9658 9658
 			}
@@ -9666,7 +9666,7 @@  discard block
 block discarded – undo
9666 9666
 			} else {
9667 9667
 				$registration = preg_replace("/^(.{1})/", "$1-", $registration);
9668 9668
 			}
9669
-		} else if(strlen($registration_prefix) == 2){
9669
+		} else if (strlen($registration_prefix) == 2) {
9670 9670
 			if (0 === strpos($registration, 'N')) {
9671 9671
 				$registration = preg_replace("/^(.{2})/", "$1", $registration);
9672 9672
 			} else {
@@ -9685,17 +9685,17 @@  discard block
 block discarded – undo
9685 9685
 	*/
9686 9686
 	public function countryFromAircraftRegistration($registration)
9687 9687
 	{
9688
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
9688
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
9689 9689
 		
9690 9690
 		$registration_prefix = '';
9691
-		$registration_test = explode('-',$registration);
9691
+		$registration_test = explode('-', $registration);
9692 9692
 		$country = '';
9693 9693
 		if ($registration_test[0] != $registration) {
9694 9694
 			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
9695 9695
 	      
9696 9696
 			$sth = $this->db->prepare($query);
9697 9697
 			$sth->execute(array(':registration_1' => $registration_test[0]));
9698
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
9698
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9699 9699
 			{
9700 9700
 				//$registration_prefix = $row['registration_prefix'];
9701 9701
 				$country = $row['country'];
@@ -9706,13 +9706,13 @@  discard block
 block discarded – undo
9706 9706
 
9707 9707
 			$country = '';
9708 9708
 			//first get the prefix based on two characters
9709
-			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
9709
+			$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
9710 9710
       
9711 9711
 			
9712 9712
 			$sth = $this->db->prepare($query);
9713 9713
 			$sth->execute(array(':registration_2' => $registration_2));
9714 9714
         
9715
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
9715
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9716 9716
 			{
9717 9717
 				$registration_prefix = $row['registration_prefix'];
9718 9718
 				$country = $row['country'];
@@ -9721,12 +9721,12 @@  discard block
 block discarded – undo
9721 9721
 			//if we didn't find a two chracter prefix lets just search the one with one character
9722 9722
 			if ($registration_prefix == "")
9723 9723
 			{
9724
-				$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
9724
+				$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
9725 9725
 	      
9726 9726
 				$sth = $this->db->prepare($query);
9727 9727
 				$sth->execute(array(':registration_1' => $registration_1));
9728 9728
 	        
9729
-				while($row = $sth->fetch(PDO::FETCH_ASSOC))
9729
+				while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9730 9730
 				{
9731 9731
 					//$registration_prefix = $row['registration_prefix'];
9732 9732
 					$country = $row['country'];
@@ -9743,9 +9743,9 @@  discard block
 block discarded – undo
9743 9743
 	* @param String $flightaware_id flightaware_id from spotter_output table
9744 9744
 	* @param String $highlight New highlight value
9745 9745
 	*/
9746
-	public function setHighlightFlight($flightaware_id,$highlight) {
9746
+	public function setHighlightFlight($flightaware_id, $highlight) {
9747 9747
 		
9748
-		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
9748
+		$query = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
9749 9749
 		$sth = $this->db->prepare($query);
9750 9750
 		$sth->execute(array(':flightaware_id' => $flightaware_id, ':highlight' => $highlight));
9751 9751
 	}
@@ -9774,7 +9774,7 @@  discard block
 block discarded – undo
9774 9774
 		
9775 9775
 		$bitly_data = json_decode($bitly_data);
9776 9776
 		$bitly_url = '';
9777
-		if ($bitly_data->status_txt = "OK"){
9777
+		if ($bitly_data->status_txt = "OK") {
9778 9778
 			$bitly_url = $bitly_data->data->url;
9779 9779
 		}
9780 9780
 
@@ -9784,7 +9784,7 @@  discard block
 block discarded – undo
9784 9784
 
9785 9785
 	public function getOrderBy()
9786 9786
 	{
9787
-		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_output.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_output.date DESC"),"distance_asc" => array("key" => "distance_asc","value" => "Distance - ASC","sql" => "ORDER BY distance ASC"),"distance_desc" => array("key" => "distance_desc","value" => "Distance - DESC","sql" => "ORDER BY distance DESC"));
9787
+		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_output.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_output.date DESC"), "distance_asc" => array("key" => "distance_asc", "value" => "Distance - ASC", "sql" => "ORDER BY distance ASC"), "distance_desc" => array("key" => "distance_desc", "value" => "Distance - DESC", "sql" => "ORDER BY distance DESC"));
9788 9788
 		
9789 9789
 		return $orderby;
9790 9790
 		
@@ -9918,14 +9918,14 @@  discard block
 block discarded – undo
9918 9918
 		}
9919 9919
 		$sth = $this->db->prepare($query);
9920 9920
 		$sth->execute();
9921
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9921
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9922 9922
 		{
9923 9923
 			$departure_airport_array = $this->getAllAirportInfo($row['fromairport_icao']);
9924 9924
 			$arrival_airport_array = $this->getAllAirportInfo($row['toairport_icao']);
9925 9925
 			if (count($departure_airport_array) > 0 && count($arrival_airport_array) > 0) {
9926
-				$update_query="UPDATE spotter_output SET departure_airport_icao = :fromicao, arrival_airport_icao = :toicao, departure_airport_name = :departure_airport_name, departure_airport_city = :departure_airport_city, departure_airport_country = :departure_airport_country, arrival_airport_name = :arrival_airport_name, arrival_airport_city = :arrival_airport_city, arrival_airport_country = :arrival_airport_country WHERE spotter_id = :spotter_id";
9926
+				$update_query = "UPDATE spotter_output SET departure_airport_icao = :fromicao, arrival_airport_icao = :toicao, departure_airport_name = :departure_airport_name, departure_airport_city = :departure_airport_city, departure_airport_country = :departure_airport_country, arrival_airport_name = :arrival_airport_name, arrival_airport_city = :arrival_airport_city, arrival_airport_country = :arrival_airport_country WHERE spotter_id = :spotter_id";
9927 9927
 				$sthu = $this->db->prepare($update_query);
9928
-				$sthu->execute(array(':fromicao' => $row['fromairport_icao'],':toicao' => $row['toairport_icao'],':spotter_id' => $row['spotter_id'],':departure_airport_name' => $departure_airport_array[0]['name'],':departure_airport_city' => $departure_airport_array[0]['city'],':departure_airport_country' => $departure_airport_array[0]['country'],':arrival_airport_name' => $arrival_airport_array[0]['name'],':arrival_airport_city' => $arrival_airport_array[0]['city'],':arrival_airport_country' => $arrival_airport_array[0]['country']));
9928
+				$sthu->execute(array(':fromicao' => $row['fromairport_icao'], ':toicao' => $row['toairport_icao'], ':spotter_id' => $row['spotter_id'], ':departure_airport_name' => $departure_airport_array[0]['name'], ':departure_airport_city' => $departure_airport_array[0]['city'], ':departure_airport_country' => $departure_airport_array[0]['country'], ':arrival_airport_name' => $arrival_airport_array[0]['name'], ':arrival_airport_city' => $arrival_airport_array[0]['city'], ':arrival_airport_country' => $arrival_airport_array[0]['country']));
9929 9929
 			}
9930 9930
 		}
9931 9931
 		
@@ -9938,7 +9938,7 @@  discard block
 block discarded – undo
9938 9938
 		}
9939 9939
 		$sth = $this->db->prepare($query);
9940 9940
 		$sth->execute();
9941
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9941
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9942 9942
 		{
9943 9943
 			if (is_numeric(substr($row['ident'], -1, 1)))
9944 9944
 			{
@@ -9947,11 +9947,11 @@  discard block
 block discarded – undo
9947 9947
 				elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
9948 9948
 				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
9949 9949
 				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
9950
-				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
9950
+				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource);
9951 9951
 				if (isset($airline_array[0]['name'])) {
9952
-					$update_query  = "UPDATE spotter_output SET spotter_output.airline_name = :airline_name, spotter_output.airline_icao = :airline_icao, spotter_output.airline_country = :airline_country, spotter_output.airline_type = :airline_type WHERE spotter_output.spotter_id = :spotter_id";
9952
+					$update_query = "UPDATE spotter_output SET spotter_output.airline_name = :airline_name, spotter_output.airline_icao = :airline_icao, spotter_output.airline_country = :airline_country, spotter_output.airline_type = :airline_type WHERE spotter_output.spotter_id = :spotter_id";
9953 9953
 					$sthu = $this->db->prepare($update_query);
9954
-					$sthu->execute(array(':airline_name' => $airline_array[0]['name'],':airline_icao' => $airline_array[0]['icao'], ':airline_country' => $airline_array[0]['country'], ':airline_type' => $airline_array[0]['type'], ':spotter_id' => $row['spotter_id']));
9954
+					$sthu->execute(array(':airline_name' => $airline_array[0]['name'], ':airline_icao' => $airline_array[0]['icao'], ':airline_country' => $airline_array[0]['country'], ':airline_type' => $airline_array[0]['type'], ':spotter_id' => $row['spotter_id']));
9955 9955
 				}
9956 9956
 			}
9957 9957
 		}
@@ -9971,18 +9971,18 @@  discard block
 block discarded – undo
9971 9971
 		}
9972 9972
 		$sth = $this->db->prepare($query);
9973 9973
 		$sth->execute();
9974
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9974
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9975 9975
 		{
9976 9976
 			if ($row['aircraft_icao'] != '') {
9977 9977
 				$aircraft_name = $this->getAllAircraftInfo($row['aircraft_icao']);
9978
-				if ($row['registration'] != ""){
9978
+				if ($row['registration'] != "") {
9979 9979
 					$image_array = $Image->getSpotterImage($row['registration']);
9980 9980
 					if (count($image_array) == 0) {
9981 9981
 						$Image->addSpotterImage($row['registration']);
9982 9982
 					}
9983 9983
 				}
9984 9984
 				if (count($aircraft_name) > 0) {
9985
-					$update_query  = "UPDATE spotter_output SET spotter_output.aircraft_name = :aircraft_name, spotter_output.aircraft_manufacturer = :aircraft_manufacturer WHERE spotter_output.spotter_id = :spotter_id";
9985
+					$update_query = "UPDATE spotter_output SET spotter_output.aircraft_name = :aircraft_name, spotter_output.aircraft_manufacturer = :aircraft_manufacturer WHERE spotter_output.spotter_id = :spotter_id";
9986 9986
 					$sthu = $this->db->prepare($update_query);
9987 9987
 					$sthu->execute(array(':aircraft_name' => $aircraft_name[0]['type'], ':aircraft_manufacturer' => $aircraft_name[0]['manufacturer'], ':spotter_id' => $row['spotter_id']));
9988 9988
 				}
@@ -9997,10 +9997,10 @@  discard block
 block discarded – undo
9997 9997
 		$query = "SELECT spotter_output.spotter_id, spotter_output.last_latitude, spotter_output.last_longitude, spotter_output.last_altitude, spotter_output.arrival_airport_icao, spotter_output.real_arrival_airport_icao FROM spotter_output";
9998 9998
 		$sth = $this->db->prepare($query);
9999 9999
 		$sth->execute();
10000
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10000
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10001 10001
 		{
10002 10002
 			if ($row['last_latitude'] != '' && $row['last_longitude'] != '') {
10003
-				$closestAirports = $this->closestAirports($row['last_latitude'],$row['last_longitude'],$globalClosestMinDist);
10003
+				$closestAirports = $this->closestAirports($row['last_latitude'], $row['last_longitude'], $globalClosestMinDist);
10004 10004
 				$airport_icao = '';
10005 10005
 				 if (isset($closestAirports[0])) {
10006 10006
 					if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) {
@@ -10014,7 +10014,7 @@  discard block
 block discarded – undo
10014 10014
 								break;
10015 10015
 							}
10016 10016
 						}
10017
-					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) {
10017
+					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100 + 1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude'] + 5000))) {
10018 10018
 						$airport_icao = $closestAirports[0]['icao'];
10019 10019
 						if ($globalDebug) echo "\o/ NP --++ Find arrival airport. Airport ICAO : ".$airport_icao." !  Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n";
10020 10020
 					} else {
@@ -10025,28 +10025,28 @@  discard block
 block discarded – undo
10025 10025
 				}
10026 10026
 				if ($row['real_arrival_airport_icao'] != $airport_icao) {
10027 10027
 					if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n";
10028
-					$update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
10028
+					$update_query = "UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
10029 10029
 					$sthu = $this->db->prepare($update_query);
10030
-					$sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id']));
10030
+					$sthu->execute(array(':airport_icao' => $airport_icao, ':spotter_id' => $row['spotter_id']));
10031 10031
 				}
10032 10032
 			}
10033 10033
 		}
10034 10034
 	}
10035 10035
 	
10036
-	public function closestAirports($origLat,$origLon,$dist = 10) {
10036
+	public function closestAirports($origLat, $origLon, $dist = 10) {
10037 10037
 		global $globalDBdriver;
10038
-		$dist = number_format($dist*0.621371,2,'.',''); // convert km to mile
10038
+		$dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile
10039 10039
 /*
10040 10040
 		$query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - abs(latitude))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(abs(latitude)*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance 
10041 10041
                       FROM airport WHERE longitude between ($origLon-$dist/abs(cos(radians($origLat))*69)) and ($origLon+$dist/abs(cos(radians($origLat))*69)) and latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
10042 10042
                       having distance < $dist ORDER BY distance limit 100;";
10043 10043
 */
10044 10044
 		if ($globalDBdriver == 'mysql') {
10045
-			$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 
10045
+			$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 
10046 10046
 	                      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)) 
10047 10047
 	                      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;";
10048 10048
                 } else {
10049
-			$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 
10049
+			$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 
10050 10050
 	                      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)) 
10051 10051
 	                      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;";
10052 10052
     		}
Please login to merge, or discard this patch.
Braces   +667 added lines, -231 removed lines patch added patch discarded remove patch
@@ -19,8 +19,12 @@  discard block
 block discarded – undo
19 19
 	*/
20 20
 	public function getFilter($filter = array(),$where = false,$and = false) {
21 21
 		global $globalFilter, $globalStatsFilters, $globalFilterName;
22
-		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) $filter = array_merge($globalStatsFilters[$globalFilterName],$filter);
23
-		if (is_array($globalFilter)) $filter = array_merge($globalFilter,$filter);
22
+		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
23
+			$filter = array_merge($globalStatsFilters[$globalFilterName],$filter);
24
+		}
25
+		if (is_array($globalFilter)) {
26
+			$filter = array_merge($globalFilter,$filter);
27
+		}
24 28
 		$filter_query_join = '';
25 29
 		$filter_query_where = '';
26 30
 		if (isset($filter['airlines']) && !empty($filter['airlines'])) {
@@ -48,8 +52,11 @@  discard block
 block discarded – undo
48 52
 				$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
49 53
 			}
50 54
 		}
51
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
52
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
55
+		if ($filter_query_where == '' && $where) {
56
+			$filter_query_where = ' WHERE';
57
+		} elseif ($filter_query_where != '' && $and) {
58
+			$filter_query_where .= ' AND';
59
+		}
53 60
 		$filter_query = $filter_query_join.$filter_query_where;
54 61
 		return $filter_query;
55 62
 	}
@@ -69,10 +76,18 @@  discard block
 block discarded – undo
69 76
 		$Image = new Image($this->db);
70 77
 		$Schedule = new Schedule($this->db);
71 78
 		$ACARS = new ACARS($this->db);
72
-		if (!isset($globalIVAO)) $globalIVAO = FALSE;
73
-		if (!isset($globalVATSIM)) $globalVATSIM = FALSE;
74
-		if (!isset($globalphpVMS)) $globalphpVMS = FALSE;
75
-		if (!isset($globalVAM)) $globalVAM = FALSE;
79
+		if (!isset($globalIVAO)) {
80
+			$globalIVAO = FALSE;
81
+		}
82
+		if (!isset($globalVATSIM)) {
83
+			$globalVATSIM = FALSE;
84
+		}
85
+		if (!isset($globalphpVMS)) {
86
+			$globalphpVMS = FALSE;
87
+		}
88
+		if (!isset($globalVAM)) {
89
+			$globalVAM = FALSE;
90
+		}
76 91
 		date_default_timezone_set('UTC');
77 92
 		
78 93
 		if (!is_string($query))
@@ -119,21 +134,35 @@  discard block
 block discarded – undo
119 134
 			} else {
120 135
 				$temp_array['spotter_id'] = '';
121 136
 			}
122
-			if (isset($row['flightaware_id'])) $temp_array['flightaware_id'] = $row['flightaware_id'];
123
-			if (isset($row['modes'])) $temp_array['modes'] = $row['modes'];
137
+			if (isset($row['flightaware_id'])) {
138
+				$temp_array['flightaware_id'] = $row['flightaware_id'];
139
+			}
140
+			if (isset($row['modes'])) {
141
+				$temp_array['modes'] = $row['modes'];
142
+			}
124 143
 			$temp_array['ident'] = $row['ident'];
125 144
 			if (isset($row['registration']) && $row['registration'] != '') {
126 145
 				$temp_array['registration'] = $row['registration'];
127 146
 			} elseif (isset($temp_array['modes'])) {
128 147
 				$temp_array['registration'] = $this->getAircraftRegistrationBymodeS($temp_array['modes']);
129
-			} else $temp_array['registration'] = '';
130
-			if (isset($row['aircraft_icao'])) $temp_array['aircraft_type'] = $row['aircraft_icao'];
148
+			} else {
149
+				$temp_array['registration'] = '';
150
+			}
151
+			if (isset($row['aircraft_icao'])) {
152
+				$temp_array['aircraft_type'] = $row['aircraft_icao'];
153
+			}
131 154
 			
132 155
 			$temp_array['departure_airport'] = $row['departure_airport_icao'];
133 156
 			$temp_array['arrival_airport'] = $row['arrival_airport_icao'];
134
-			if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao'];
135
-			if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude'];
136
-			if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude'];
157
+			if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) {
158
+				$temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao'];
159
+			}
160
+			if (isset($row['latitude'])) {
161
+				$temp_array['latitude'] = $row['latitude'];
162
+			}
163
+			if (isset($row['longitude'])) {
164
+				$temp_array['longitude'] = $row['longitude'];
165
+			}
137 166
 			/*
138 167
 			if (Connection->tableExists('countries')) {
139 168
 				$country_info = $this->getCountryFromLatitudeLongitude($temp_array['latitude'],$temp_array['longitude']);
@@ -143,8 +172,12 @@  discard block
 block discarded – undo
143 172
 				}
144 173
 			}
145 174
 			*/
146
-			if (isset($row['waypoints'])) $temp_array['waypoints'] = $row['waypoints'];
147
-			if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source'];
175
+			if (isset($row['waypoints'])) {
176
+				$temp_array['waypoints'] = $row['waypoints'];
177
+			}
178
+			if (isset($row['format_source'])) {
179
+				$temp_array['format_source'] = $row['format_source'];
180
+			}
148 181
 			if (isset($row['route_stop'])) {
149 182
 				$temp_array['route_stop'] = $row['route_stop'];
150 183
 				if ($row['route_stop'] != '') {
@@ -163,13 +196,19 @@  discard block
 block discarded – undo
163 196
 					}
164 197
 				}
165 198
 			}
166
-			if (isset($row['altitude'])) $temp_array['altitude'] = $row['altitude'];
199
+			if (isset($row['altitude'])) {
200
+				$temp_array['altitude'] = $row['altitude'];
201
+			}
167 202
 			if (isset($row['heading'])) {
168 203
 				$temp_array['heading'] = $row['heading'];
169 204
 				$heading_direction = $this->parseDirection($row['heading']);
170
-				if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
205
+				if (isset($heading_direction[0]['direction_fullname'])) {
206
+					$temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
207
+				}
208
+			}
209
+			if (isset($row['ground_speed'])) {
210
+				$temp_array['ground_speed'] = $row['ground_speed'];
171 211
 			}
172
-			if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed'];
173 212
 			$temp_array['image'] = "";
174 213
 			$temp_array['image_thumbnail'] = "";
175 214
 			$temp_array['image_source'] = "";
@@ -177,7 +216,9 @@  discard block
 block discarded – undo
177 216
  
178 217
 			if (isset($row['highlight'])) {
179 218
 				$temp_array['highlight'] = $row['highlight'];
180
-			} else $temp_array['highlight'] = '';
219
+			} else {
220
+				$temp_array['highlight'] = '';
221
+			}
181 222
 			
182 223
 			if (isset($row['date'])) {
183 224
 				$dateArray = $this->parseDateString($row['date']);
@@ -225,7 +266,9 @@  discard block
 block discarded – undo
225 266
 				
226 267
 					if ($aircraft_array[0]['aircraft_shadow'] != NULL) {
227 268
 						$temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow'];
228
-					} else $temp_array['aircraft_shadow'] = 'default.png';
269
+					} else {
270
+						$temp_array['aircraft_shadow'] = 'default.png';
271
+					}
229 272
                                 } else {
230 273
                             		$temp_array['aircraft_shadow'] = 'default.png';
231 274
 					$temp_array['aircraft_name'] = 'N/A';
@@ -233,11 +276,17 @@  discard block
 block discarded – undo
233 276
                             	}
234 277
 			}
235 278
 			$fromsource = NULL;
236
-			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
237
-			elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
238
-			elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
239
-			elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
240
-			elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
279
+			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
280
+				$fromsource = $globalAirlinesSource;
281
+			} elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') {
282
+				$fromsource = 'vatsim';
283
+			} elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') {
284
+				$fromsource = 'ivao';
285
+			} elseif (isset($globalVATSIM) && $globalVATSIM) {
286
+				$fromsource = 'vatsim';
287
+			} elseif (isset($globalIVAO) && $globalIVAO) {
288
+				$fromsource = 'ivao';
289
+			}
241 290
 			if (!isset($row['airline_name']) || $row['airline_name'] == '') {
242 291
 				if (!is_numeric(substr($row['ident'], 0, 3))) {
243 292
 					if (is_numeric(substr($row['ident'], 2, 1))) {
@@ -260,12 +309,18 @@  discard block
 block discarded – undo
260 309
 				}
261 310
 			} else {
262 311
 				$temp_array['airline_icao'] = $row['airline_icao'];
263
-				if (isset($row['airline_iata'])) $temp_array['airline_iata'] = $row['airline_iata'];
264
-				else $temp_array['airline_iata'] = '';
312
+				if (isset($row['airline_iata'])) {
313
+					$temp_array['airline_iata'] = $row['airline_iata'];
314
+				} else {
315
+					$temp_array['airline_iata'] = '';
316
+				}
265 317
 				$temp_array['airline_name'] = $row['airline_name'];
266 318
 				$temp_array['airline_country'] = $row['airline_country'];
267
-				if (isset($row['airline_callsign'])) $temp_array['airline_callsign'] = $row['airline_callsign'];
268
-				else $temp_array['airline_callsign'] = 'N/A';
319
+				if (isset($row['airline_callsign'])) {
320
+					$temp_array['airline_callsign'] = $row['airline_callsign'];
321
+				} else {
322
+					$temp_array['airline_callsign'] = 'N/A';
323
+				}
269 324
 				$temp_array['airline_type'] = $row['airline_type'];
270 325
 			}
271 326
 			if (isset($temp_array['airline_iata']) && $temp_array['airline_iata'] != '') {
@@ -281,7 +336,9 @@  discard block
 block discarded – undo
281 336
 			}
282 337
 			if ($temp_array['registration'] != "" && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && !isset($temp_array['aircraft_owner'])) {
283 338
 				$owner_info = $this->getAircraftOwnerByRegistration($temp_array['registration']);
284
-				if ($owner_info['owner'] != '') $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner']));
339
+				if ($owner_info['owner'] != '') {
340
+					$temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner']));
341
+				}
285 342
 				$temp_array['aircraft_base'] = $owner_info['base'];
286 343
 				$temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg'];
287 344
 			}
@@ -289,9 +346,14 @@  discard block
 block discarded – undo
289 346
 			if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != ''))
290 347
 			{
291 348
 				if ($globalIVAO) {
292
-					if (isset($temp_array['airline_icao']))	$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
293
-					else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
294
-				} else $image_array = $Image->getSpotterImage($temp_array['registration']);
349
+					if (isset($temp_array['airline_icao'])) {
350
+						$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']);
351
+					} else {
352
+						$image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']);
353
+					}
354
+				} else {
355
+					$image_array = $Image->getSpotterImage($temp_array['registration']);
356
+				}
295 357
 				if (count($image_array) > 0) {
296 358
 					$temp_array['image'] = $image_array[0]['image'];
297 359
 					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -341,7 +403,9 @@  discard block
 block discarded – undo
341 403
 			//if ($row['departure_airport_icao'] != '' && $row['departure_airport_name'] == '') {
342 404
 			if ($row['departure_airport_icao'] != '') {
343 405
 				$departure_airport_array = $this->getAllAirportInfo($row['departure_airport_icao']);
344
-				if (!isset($departure_airport_array[0]['name'])) $departure_airport_array = $this->getAllAirportInfo('NA');
406
+				if (!isset($departure_airport_array[0]['name'])) {
407
+					$departure_airport_array = $this->getAllAirportInfo('NA');
408
+				}
345 409
 			/*
346 410
 			} elseif ($row['departure_airport_name'] != '') {
347 411
 				$temp_array['departure_airport_name'] = $row['departure_airport_name'];
@@ -349,7 +413,9 @@  discard block
 block discarded – undo
349 413
 				$temp_array['departure_airport_country'] = $row['departure_airport_country'];
350 414
 				$temp_array['departure_airport_icao'] = $row['departure_airport_icao'];
351 415
 			*/
352
-			} else $departure_airport_array = $this->getAllAirportInfo('NA');
416
+			} else {
417
+				$departure_airport_array = $this->getAllAirportInfo('NA');
418
+			}
353 419
 			if (isset($departure_airport_array[0]['name'])) {
354 420
 				$temp_array['departure_airport_name'] = $departure_airport_array[0]['name'];
355 421
 				$temp_array['departure_airport_city'] = $departure_airport_array[0]['city'];
@@ -369,8 +435,12 @@  discard block
 block discarded – undo
369 435
 			
370 436
 			if ($row['arrival_airport_icao'] != '') {
371 437
 				$arrival_airport_array = $this->getAllAirportInfo($row['arrival_airport_icao']);
372
-				if (count($arrival_airport_array) == 0) $arrival_airport_array = $this->getAllAirportInfo('NA');
373
-			} else $arrival_airport_array = $this->getAllAirportInfo('NA');
438
+				if (count($arrival_airport_array) == 0) {
439
+					$arrival_airport_array = $this->getAllAirportInfo('NA');
440
+				}
441
+			} else {
442
+				$arrival_airport_array = $this->getAllAirportInfo('NA');
443
+			}
374 444
 			if (isset($arrival_airport_array[0]['name'])) {
375 445
 				$temp_array['arrival_airport_name'] = $arrival_airport_array[0]['name'];
376 446
 				$temp_array['arrival_airport_city'] = $arrival_airport_array[0]['city'];
@@ -386,27 +456,45 @@  discard block
 block discarded – undo
386 456
 				$temp_array['arrival_airport_time'] = $row['arrival_airport_time'];
387 457
 			}
388 458
 			*/
389
-			if (isset($row['pilot_id']) && $row['pilot_id'] != '') $temp_array['pilot_id'] = $row['pilot_id'];
390
-			if (isset($row['pilot_name']) && $row['pilot_name'] != '') $temp_array['pilot_name'] = $row['pilot_name'];
391
-			if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name'];
392
-			if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country'];
393
-			if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance'];
459
+			if (isset($row['pilot_id']) && $row['pilot_id'] != '') {
460
+				$temp_array['pilot_id'] = $row['pilot_id'];
461
+			}
462
+			if (isset($row['pilot_name']) && $row['pilot_name'] != '') {
463
+				$temp_array['pilot_name'] = $row['pilot_name'];
464
+			}
465
+			if (isset($row['source_name']) && $row['source_name'] != '') {
466
+				$temp_array['source_name'] = $row['source_name'];
467
+			}
468
+			if (isset($row['over_country']) && $row['over_country'] != '') {
469
+				$temp_array['over_country'] = $row['over_country'];
470
+			}
471
+			if (isset($row['distance']) && $row['distance'] != '') {
472
+				$temp_array['distance'] = $row['distance'];
473
+			}
394 474
 			if (isset($row['squawk'])) {
395 475
 				$temp_array['squawk'] = $row['squawk'];
396 476
 				if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) {
397 477
 					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']);
398
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
478
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) {
479
+						$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
480
+					}
399 481
 				} elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) {
400 482
 					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']);
401
-					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
402
-				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
483
+					if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) {
484
+						$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
485
+					}
486
+				} elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) {
487
+					$temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry);
488
+				}
403 489
 			}
404 490
     			
405 491
 			$temp_array['query_number_rows'] = $num_rows;
406 492
 			
407 493
 			$spotter_array[] = $temp_array;
408 494
 		}
409
-		if ($num_rows == 0) return array();
495
+		if ($num_rows == 0) {
496
+			return array();
497
+		}
410 498
 		$spotter_array[0]['query_number_rows'] = $num_rows;
411 499
 		return $spotter_array;
412 500
 	}	
@@ -439,7 +527,9 @@  discard block
 block discarded – undo
439 527
 				foreach ($q_array as $q_item){
440 528
 					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
441 529
 					$additional_query .= " AND (";
442
-					if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
530
+					if (is_int($q_item)) {
531
+						$additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR ";
532
+					}
443 533
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
444 534
 					$additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR ";
445 535
 					$additional_query .= "(spotter_output.aircraft_manufacturer like '%".$q_item."%') OR ";
@@ -460,7 +550,9 @@  discard block
 block discarded – undo
460 550
 					$additional_query .= "(spotter_output.pilot_name like '%".$q_item."%') OR ";
461 551
 					$additional_query .= "(spotter_output.ident like '%".$q_item."%') OR ";
462 552
 					$translate = $Translation->ident2icao($q_item);
463
-					if ($translate != $q_item) $additional_query .= "(spotter_output.ident like '%".$translate."%') OR ";
553
+					if ($translate != $q_item) {
554
+						$additional_query .= "(spotter_output.ident like '%".$translate."%') OR ";
555
+					}
464 556
 					$additional_query .= "(spotter_output.highlight like '%".$q_item."%')";
465 557
 					$additional_query .= ")";
466 558
 				}
@@ -687,7 +779,9 @@  discard block
 block discarded – undo
687 779
 				date_default_timezone_set($globalTimezone);
688 780
 				$datetime = new DateTime();
689 781
 				$offset = $datetime->format('P');
690
-			} else $offset = '+00:00';
782
+			} else {
783
+				$offset = '+00:00';
784
+			}
691 785
 
692 786
 			if ($date_array[1] != "")
693 787
 			{
@@ -719,8 +813,12 @@  discard block
 block discarded – undo
719 813
 			{
720 814
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
721 815
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
722
-			} else $limit_query = "";
723
-		} else $limit_query = "";
816
+			} else {
817
+				$limit_query = "";
818
+			}
819
+		} else {
820
+			$limit_query = "";
821
+		}
724 822
 
725 823
 
726 824
 		if ($sort != "")
@@ -788,8 +886,12 @@  discard block
 block discarded – undo
788 886
 			{
789 887
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
790 888
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
791
-			} else $limit_query = "";
792
-		} else $limit_query = "";
889
+			} else {
890
+				$limit_query = "";
891
+			}
892
+		} else {
893
+			$limit_query = "";
894
+		}
793 895
 		
794 896
 		if ($sort != "")
795 897
 		{
@@ -1113,7 +1215,9 @@  discard block
 block discarded – undo
1113 1215
 		global $global_query;
1114 1216
 		
1115 1217
 		date_default_timezone_set('UTC');
1116
-		if ($id == '') return array();
1218
+		if ($id == '') {
1219
+			return array();
1220
+		}
1117 1221
 		$additional_query = "spotter_output.spotter_id = :id";
1118 1222
 		$query_values = array(':id' => $id);
1119 1223
 
@@ -1739,7 +1843,9 @@  discard block
 block discarded – undo
1739 1843
 		{
1740 1844
 			$highlight = $row['highlight'];
1741 1845
 		}
1742
-		if (isset($highlight)) return $highlight;
1846
+		if (isset($highlight)) {
1847
+			return $highlight;
1848
+		}
1743 1849
 	}
1744 1850
 
1745 1851
 	
@@ -1767,7 +1873,9 @@  discard block
 block discarded – undo
1767 1873
 		$sth->closeCursor();
1768 1874
 		if (count($row) > 0) {
1769 1875
 			return $row['usage'];
1770
-		} else return '';
1876
+		} else {
1877
+			return '';
1878
+		}
1771 1879
 	}
1772 1880
 
1773 1881
 	/**
@@ -1792,7 +1900,9 @@  discard block
 block discarded – undo
1792 1900
 		$sth->closeCursor();
1793 1901
 		if (count($row) > 0) {
1794 1902
 			return $row['icao'];
1795
-		} else return '';
1903
+		} else {
1904
+			return '';
1905
+		}
1796 1906
 	}
1797 1907
 
1798 1908
 	/**
@@ -1820,7 +1930,9 @@  discard block
 block discarded – undo
1820 1930
 			$airport_longitude = $row['longitude'];
1821 1931
 			$Common = new Common();
1822 1932
 			return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude);
1823
-		} else return '';
1933
+		} else {
1934
+			return '';
1935
+		}
1824 1936
 	}
1825 1937
 	
1826 1938
 	/**
@@ -1932,7 +2044,9 @@  discard block
 block discarded – undo
1932 2044
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1933 2045
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1934 2046
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1935
-		} else return array();
2047
+		} else {
2048
+			return array();
2049
+		}
1936 2050
 		if ($globalDBdriver == 'mysql') {
1937 2051
 			$query  = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'";
1938 2052
 		} else {
@@ -1967,7 +2081,9 @@  discard block
 block discarded – undo
1967 2081
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1968 2082
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1969 2083
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1970
-		} else return array();
2084
+		} else {
2085
+			return array();
2086
+		}
1971 2087
 		//$query  = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
1972 2088
 		$query  = "SELECT waypoints.* FROM waypoints WHERE (waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") OR (waypoints.latitude_end BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_end BETWEEN ".$minlong." AND ".$maxlong.")";
1973 2089
 		//$query  = "SELECT waypoints.* FROM waypoints";
@@ -2002,7 +2118,9 @@  discard block
 block discarded – undo
2002 2118
 	public function getAllAirlineInfo($airline_icao, $fromsource = NULL)
2003 2119
 	{
2004 2120
 		global $globalUseRealAirlines;
2005
-		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2121
+		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) {
2122
+			$fromsource = NULL;
2123
+		}
2006 2124
 		$airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING));
2007 2125
 		if ($airline_icao == 'NA') {
2008 2126
 			$airline_array = array();
@@ -2052,7 +2170,9 @@  discard block
 block discarded – undo
2052 2170
 				$sth->execute(array(':fromsource' => $fromsource));
2053 2171
 				$row = $sth->fetch(PDO::FETCH_ASSOC);
2054 2172
 				$sth->closeCursor();
2055
-				if ($row['nb'] == 0) $result = $this->getAllAirlineInfo($airline_icao);
2173
+				if ($row['nb'] == 0) {
2174
+					$result = $this->getAllAirlineInfo($airline_icao);
2175
+				}
2056 2176
 			}
2057 2177
 			return $result;
2058 2178
 		}
@@ -2116,15 +2236,20 @@  discard block
 block discarded – undo
2116 2236
 				'A320-211' => 'A320',
2117 2237
 				'747-8i' => 'B748',
2118 2238
 				'A380' => 'A388');
2119
-		if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type];
2239
+		if (isset($all_aircraft[$aircraft_type])) {
2240
+			return $all_aircraft[$aircraft_type];
2241
+		}
2120 2242
 
2121 2243
 		$query  = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2122 2244
 		$aircraft_type = strtoupper($aircraft_type);
2123 2245
 		$sth = $this->db->prepare($query);
2124 2246
 		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,));
2125 2247
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2126
-		if (isset($result[0]['icao'])) return $result[0]['icao'];
2127
-		else return '';
2248
+		if (isset($result[0]['icao'])) {
2249
+			return $result[0]['icao'];
2250
+		} else {
2251
+			return '';
2252
+		}
2128 2253
 	}
2129 2254
 	
2130 2255
 	/**
@@ -2147,7 +2272,9 @@  discard block
 block discarded – undo
2147 2272
 		$sth->closeCursor();
2148 2273
 		if (isset($row['icaotypecode'])) {
2149 2274
 			return $row['icaotypecode'];
2150
-		} else return '';
2275
+		} else {
2276
+			return '';
2277
+		}
2151 2278
 	}
2152 2279
 
2153 2280
 	/**
@@ -2169,7 +2296,9 @@  discard block
 block discarded – undo
2169 2296
 		$sth->closeCursor();
2170 2297
 		if (isset($row['operator_correct'])) {
2171 2298
 			return $row['operator_correct'];
2172
-		} else return $operator;
2299
+		} else {
2300
+			return $operator;
2301
+		}
2173 2302
 	}
2174 2303
 
2175 2304
 	/**
@@ -2182,7 +2311,9 @@  discard block
 block discarded – undo
2182 2311
 	public function getRouteInfo($callsign)
2183 2312
 	{
2184 2313
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2185
-                if ($callsign == '') return array();
2314
+                if ($callsign == '') {
2315
+                	return array();
2316
+                }
2186 2317
 		$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";
2187 2318
 		
2188 2319
 		$sth = $this->db->prepare($query);
@@ -2192,7 +2323,9 @@  discard block
 block discarded – undo
2192 2323
 		$sth->closeCursor();
2193 2324
 		if (count($row) > 0) {
2194 2325
 			return $row;
2195
-		} else return array();
2326
+		} else {
2327
+			return array();
2328
+		}
2196 2329
 	}
2197 2330
 	
2198 2331
 	/**
@@ -2245,7 +2378,9 @@  discard block
 block discarded – undo
2245 2378
 			$result = $sth->fetch(PDO::FETCH_ASSOC);
2246 2379
 			$sth->closeCursor();
2247 2380
 			return $result;
2248
-		} else return array();
2381
+		} else {
2382
+			return array();
2383
+		}
2249 2384
 	}
2250 2385
 	
2251 2386
   
@@ -2402,8 +2537,11 @@  discard block
 block discarded – undo
2402 2537
 		$query .= " ORDER BY spotter_output.source_name ASC";
2403 2538
 
2404 2539
 		$sth = $this->db->prepare($query);
2405
-		if (!empty($query_values)) $sth->execute($query_values);
2406
-		else $sth->execute();
2540
+		if (!empty($query_values)) {
2541
+			$sth->execute($query_values);
2542
+		} else {
2543
+			$sth->execute();
2544
+		}
2407 2545
 
2408 2546
 		$source_array = array();
2409 2547
 		$temp_array = array();
@@ -2436,9 +2574,13 @@  discard block
 block discarded – undo
2436 2574
 								WHERE spotter_output.airline_icao <> '' 
2437 2575
 								ORDER BY spotter_output.airline_name ASC";
2438 2576
 			*/
2439
-			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource;
2440
-			elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim';
2441
-			elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao';
2577
+			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
2578
+				$forsource = $globalAirlinesSource;
2579
+			} elseif (isset($globalVATSIM) && $globalVATSIM) {
2580
+				$forsource = 'vatsim';
2581
+			} elseif (isset($globalIVAO) && $globalIVAO) {
2582
+				$forsource = 'ivao';
2583
+			}
2442 2584
 			if ($forsource === NULL) {
2443 2585
 				$query = "SELECT DISTINCT icao AS airline_icao, name AS airline_name, type AS airline_type FROM airlines WHERE forsource IS NULL ORDER BY name ASC";
2444 2586
 				$query_data = array();
@@ -2730,7 +2872,9 @@  discard block
 block discarded – undo
2730 2872
 			date_default_timezone_set($globalTimezone);
2731 2873
 			$datetime = new DateTime();
2732 2874
 			$offset = $datetime->format('P');
2733
-		} else $offset = '+00:00';
2875
+		} else {
2876
+			$offset = '+00:00';
2877
+		}
2734 2878
 		if ($airport_icao == '') {
2735 2879
 			if ($globalDBdriver == 'mysql') {
2736 2880
 				$query = "SELECT COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output`".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' GROUP BY departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC";
@@ -2762,7 +2906,9 @@  discard block
 block discarded – undo
2762 2906
 			date_default_timezone_set($globalTimezone);
2763 2907
 			$datetime = new DateTime();
2764 2908
 			$offset = $datetime->format('P');
2765
-		} else $offset = '+00:00';
2909
+		} else {
2910
+			$offset = '+00:00';
2911
+		}
2766 2912
 		if ($airport_icao == '') {
2767 2913
 			if ($globalDBdriver == 'mysql') {
2768 2914
 				$query = "SELECT spotter_output.airline_icao, COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC";
@@ -2795,7 +2941,9 @@  discard block
 block discarded – undo
2795 2941
 			date_default_timezone_set($globalTimezone);
2796 2942
 			$datetime = new DateTime();
2797 2943
 			$offset = $datetime->format('P');
2798
-		} else $offset = '+00:00';
2944
+		} else {
2945
+			$offset = '+00:00';
2946
+		}
2799 2947
 		if ($airport_icao == '') {
2800 2948
 			if ($globalDBdriver == 'mysql') {
2801 2949
 				$query = "SELECT COUNT(real_departure_airport_icao) AS departure_airport_count, real_departure_airport_icao AS departure_airport_icao, airport.name AS departure_airport_name, airport.city AS departure_airport_city, airport.country AS departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date 
@@ -2834,7 +2982,9 @@  discard block
 block discarded – undo
2834 2982
 			date_default_timezone_set($globalTimezone);
2835 2983
 			$datetime = new DateTime();
2836 2984
 			$offset = $datetime->format('P');
2837
-		} else $offset = '+00:00';
2985
+		} else {
2986
+			$offset = '+00:00';
2987
+		}
2838 2988
 		if ($airport_icao == '') {
2839 2989
 			if ($globalDBdriver == 'mysql') {
2840 2990
 				$query = "SELECT spotter_output.airline_icao, COUNT(real_departure_airport_icao) AS departure_airport_count, real_departure_airport_icao AS departure_airport_icao, airport.name AS departure_airport_name, airport.city AS departure_airport_city, airport.country AS departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date 
@@ -2879,7 +3029,9 @@  discard block
 block discarded – undo
2879 3029
 			date_default_timezone_set($globalTimezone);
2880 3030
 			$datetime = new DateTime();
2881 3031
 			$offset = $datetime->format('P');
2882
-		} else $offset = '+00:00';
3032
+		} else {
3033
+			$offset = '+00:00';
3034
+		}
2883 3035
 		if ($airport_icao == '') {
2884 3036
 			if ($globalDBdriver == 'mysql') {
2885 3037
 				$query = "SELECT COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output`".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' GROUP BY arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC";
@@ -2914,7 +3066,9 @@  discard block
 block discarded – undo
2914 3066
 			date_default_timezone_set($globalTimezone);
2915 3067
 			$datetime = new DateTime();
2916 3068
 			$offset = $datetime->format('P');
2917
-		} else $offset = '+00:00';
3069
+		} else {
3070
+			$offset = '+00:00';
3071
+		}
2918 3072
 		if ($airport_icao == '') {
2919 3073
 			if ($globalDBdriver == 'mysql') {
2920 3074
 				$query = "SELECT COUNT(real_arrival_airport_icao) AS arrival_airport_count, real_arrival_airport_icao AS arrival_airport_icao, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date 
@@ -2956,7 +3110,9 @@  discard block
 block discarded – undo
2956 3110
 			date_default_timezone_set($globalTimezone);
2957 3111
 			$datetime = new DateTime();
2958 3112
 			$offset = $datetime->format('P');
2959
-		} else $offset = '+00:00';
3113
+		} else {
3114
+			$offset = '+00:00';
3115
+		}
2960 3116
 		if ($airport_icao == '') {
2961 3117
 			if ($globalDBdriver == 'mysql') {
2962 3118
 				$query = "SELECT spotter_output.airline_icao, COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC";
@@ -2990,7 +3146,9 @@  discard block
 block discarded – undo
2990 3146
 			date_default_timezone_set($globalTimezone);
2991 3147
 			$datetime = new DateTime();
2992 3148
 			$offset = $datetime->format('P');
2993
-		} else $offset = '+00:00';
3149
+		} else {
3150
+			$offset = '+00:00';
3151
+		}
2994 3152
 		if ($airport_icao == '') {
2995 3153
 			if ($globalDBdriver == 'mysql') {
2996 3154
 				$query = "SELECT spotter_output.airline_icao, COUNT(real_arrival_airport_icao) AS arrival_airport_count, real_arrival_airport_icao AS arrival_airport_icao, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date 
@@ -3038,7 +3196,9 @@  discard block
 block discarded – undo
3038 3196
 			date_default_timezone_set($globalTimezone);
3039 3197
 			$datetime = new DateTime();
3040 3198
 			$offset = $datetime->format('P');
3041
-		} else $offset = '+00:00';
3199
+		} else {
3200
+			$offset = '+00:00';
3201
+		}
3042 3202
 
3043 3203
 		if ($globalDBdriver == 'mysql') {
3044 3204
 			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
@@ -3158,7 +3318,9 @@  discard block
 block discarded – undo
3158 3318
 	*/	
3159 3319
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3160 3320
 	{
3161
-		if ($groundspeed == '') $groundspeed = NULL;
3321
+		if ($groundspeed == '') {
3322
+			$groundspeed = NULL;
3323
+		}
3162 3324
 		$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';
3163 3325
                 $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 3326
 
@@ -3208,10 +3370,18 @@  discard block
 block discarded – undo
3208 3370
 		$Image = new Image($this->db);
3209 3371
 		$Common = new Common();
3210 3372
 		
3211
-		if (!isset($globalIVAO)) $globalIVAO = FALSE;
3212
-		if (!isset($globalVATSIM)) $globalVATSIM = FALSE;
3213
-		if (!isset($globalphpVMS)) $globalphpVMS = FALSE;
3214
-		if (!isset($globalVAM)) $globalVAM = FALSE;
3373
+		if (!isset($globalIVAO)) {
3374
+			$globalIVAO = FALSE;
3375
+		}
3376
+		if (!isset($globalVATSIM)) {
3377
+			$globalVATSIM = FALSE;
3378
+		}
3379
+		if (!isset($globalphpVMS)) {
3380
+			$globalphpVMS = FALSE;
3381
+		}
3382
+		if (!isset($globalVAM)) {
3383
+			$globalVAM = FALSE;
3384
+		}
3215 3385
 		date_default_timezone_set('UTC');
3216 3386
 		
3217 3387
 		//getting the registration
@@ -3224,23 +3394,33 @@  discard block
 block discarded – undo
3224 3394
 				if ($ModeS != '') {
3225 3395
 					$timeelapsed = microtime(true);
3226 3396
 					$registration = $this->getAircraftRegistrationBymodeS($ModeS);
3227
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3397
+					if ($globalDebugTimeElapsed) {
3398
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3399
+					}
3228 3400
 				} else {
3229 3401
 					$myhex = explode('-',$flightaware_id);
3230 3402
 					if (count($myhex) > 0) {
3231 3403
 						$timeelapsed = microtime(true);
3232 3404
 						$registration = $this->getAircraftRegistrationBymodeS($myhex[0]);
3233
-						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3405
+						if ($globalDebugTimeElapsed) {
3406
+							echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3407
+						}
3234 3408
 					}
3235 3409
 				}
3236 3410
 			}
3237 3411
 		}
3238 3412
 		$fromsource = NULL;
3239
-		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
3240
-		elseif ($format_source == 'vatsimtxt') $fromsource = 'vatsim';
3241
-		elseif ($format_source == 'whazzup') $fromsource = 'ivao';
3242
-		elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
3243
-		elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
3413
+		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
3414
+			$fromsource = $globalAirlinesSource;
3415
+		} elseif ($format_source == 'vatsimtxt') {
3416
+			$fromsource = 'vatsim';
3417
+		} elseif ($format_source == 'whazzup') {
3418
+			$fromsource = 'ivao';
3419
+		} elseif (isset($globalVATSIM) && $globalVATSIM) {
3420
+			$fromsource = 'vatsim';
3421
+		} elseif (isset($globalIVAO) && $globalIVAO) {
3422
+			$fromsource = 'ivao';
3423
+		}
3244 3424
 		//getting the airline information
3245 3425
 		if ($ident != "")
3246 3426
 		{
@@ -3264,15 +3444,21 @@  discard block
 block discarded – undo
3264 3444
 					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3265 3445
 						$airline_array = $this->getAllAirlineInfo("NA");
3266 3446
 					}
3267
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3447
+					if ($globalDebugTimeElapsed) {
3448
+						echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3449
+					}
3268 3450
 
3269 3451
 				} else {
3270 3452
 					$timeelapsed = microtime(true);
3271 3453
 					$airline_array = $this->getAllAirlineInfo("NA");
3272
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3454
+					if ($globalDebugTimeElapsed) {
3455
+						echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3456
+					}
3273 3457
 				}
3274 3458
 			}
3275
-		} else $airline_array = array();
3459
+		} else {
3460
+			$airline_array = array();
3461
+		}
3276 3462
 		
3277 3463
 		//getting the aircraft information
3278 3464
 		$aircraft_array = array();
@@ -3286,27 +3472,37 @@  discard block
 block discarded – undo
3286 3472
 				{
3287 3473
 					$timeelapsed = microtime(true);
3288 3474
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3289
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3475
+					if ($globalDebugTimeElapsed) {
3476
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3477
+					}
3290 3478
 				} else {
3291 3479
 					$timeelapsed = microtime(true);
3292 3480
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3293
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3481
+					if ($globalDebugTimeElapsed) {
3482
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3483
+					}
3294 3484
 				}
3295 3485
 			}
3296 3486
 		} else {
3297 3487
 			if ($ModeS != '') {
3298 3488
 				$timeelapsed = microtime(true);
3299 3489
 				$aircraft_icao = $this->getAllAircraftType($ModeS);
3300
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3490
+				if ($globalDebugTimeElapsed) {
3491
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3492
+				}
3301 3493
 				if ($aircraft_icao == "" || $aircraft_icao == "XXXX")
3302 3494
 				{
3303 3495
 					$timeelapsed = microtime(true);
3304 3496
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3305
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3497
+					if ($globalDebugTimeElapsed) {
3498
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3499
+					}
3306 3500
 				} else {
3307 3501
 					$timeelapsed = microtime(true);
3308 3502
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3309
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3503
+					if ($globalDebugTimeElapsed) {
3504
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3505
+					}
3310 3506
 				}
3311 3507
 			}
3312 3508
 		}
@@ -3321,7 +3517,9 @@  discard block
 block discarded – undo
3321 3517
 			} else {
3322 3518
 				$timeelapsed = microtime(true);
3323 3519
 				$departure_airport_array = $this->getAllAirportInfo($departure_airport_icao);
3324
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3520
+				if ($globalDebugTimeElapsed) {
3521
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3522
+				}
3325 3523
 			}
3326 3524
 		}
3327 3525
 		
@@ -3335,7 +3533,9 @@  discard block
 block discarded – undo
3335 3533
 			} else {
3336 3534
 				$timeelapsed = microtime(true);
3337 3535
 				$arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao);
3338
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3536
+				if ($globalDebugTimeElapsed) {
3537
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3538
+				}
3339 3539
 			}
3340 3540
 		}
3341 3541
 
@@ -3370,7 +3570,9 @@  discard block
 block discarded – undo
3370 3570
 			{
3371 3571
 				return false;
3372 3572
 			}
3373
-		} else $altitude = 0;
3573
+		} else {
3574
+			$altitude = 0;
3575
+		}
3374 3576
 		
3375 3577
 		if ($heading != "")
3376 3578
 		{
@@ -3399,7 +3601,9 @@  discard block
 block discarded – undo
3399 3601
 		{
3400 3602
 			$timeelapsed = microtime(true);
3401 3603
 			$image_array = $Image->getSpotterImage($registration);
3402
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3604
+			if ($globalDebugTimeElapsed) {
3605
+				echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3606
+			}
3403 3607
 			if (!isset($image_array[0]['registration']))
3404 3608
 			{
3405 3609
 				//echo "Add image !!!! \n";
@@ -3407,14 +3611,21 @@  discard block
 block discarded – undo
3407 3611
 			}
3408 3612
 			$timeelapsed = microtime(true);
3409 3613
 			$owner_info = $this->getAircraftOwnerByRegistration($registration);
3410
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3411
-			if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner']));
3614
+			if ($globalDebugTimeElapsed) {
3615
+				echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3616
+			}
3617
+			if ($owner_info['owner'] != '') {
3618
+				$aircraft_owner = ucwords(strtolower($owner_info['owner']));
3619
+			}
3412 3620
 		}
3413 3621
     
3414 3622
 		if ($globalIVAO && $aircraft_icao != '')
3415 3623
 		{
3416
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3417
-            		else $airline_icao = '';
3624
+            		if (isset($airline_array[0]['icao'])) {
3625
+            			$airline_icao = $airline_array[0]['icao'];
3626
+            		} else {
3627
+            			$airline_icao = '';
3628
+            		}
3418 3629
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3419 3630
 			if (!isset($image_array[0]['registration']))
3420 3631
 			{
@@ -3459,12 +3670,24 @@  discard block
 block discarded – undo
3459 3670
                 {
3460 3671
                         $arrival_airport_array = $this->getAllAirportInfo('NA');
3461 3672
                 }
3462
-                if ($registration == '') $registration = 'NA';
3463
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3464
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3465
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3466
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3467
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3673
+                if ($registration == '') {
3674
+                	$registration = 'NA';
3675
+                }
3676
+                if ($squawk == '' || $Common->isInteger($squawk) === false) {
3677
+                	$squawk = NULL;
3678
+                }
3679
+                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) {
3680
+                	$verticalrate = NULL;
3681
+                }
3682
+                if ($heading == '' || $Common->isInteger($heading) === false) {
3683
+                	$heading = 0;
3684
+                }
3685
+                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) {
3686
+                	$groundspeed = 0;
3687
+                }
3688
+                if (!isset($aircraft_owner)) {
3689
+                	$aircraft_owner = NULL;
3690
+                }
3468 3691
                 $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) 
3469 3692
                 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)";
3470 3693
 
@@ -3475,9 +3698,13 @@  discard block
 block discarded – undo
3475 3698
 		if ($airline_type == '') {
3476 3699
 			$timeelapsed = microtime(true);
3477 3700
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3478
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3701
+			if ($globalDebugTimeElapsed) {
3702
+				echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3703
+			}
3704
+		}
3705
+		if ($airline_type == null) {
3706
+			$airline_type = '';
3479 3707
 		}
3480
-		if ($airline_type == null) $airline_type = '';
3481 3708
                 $aircraft_type = $aircraft_array[0]['type'];
3482 3709
                 $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3483 3710
                 $departure_airport_name = $departure_airport_array[0]['name'];
@@ -3612,7 +3839,9 @@  discard block
 block discarded – undo
3612 3839
 			}
3613 3840
 		}
3614 3841
 		$query .= "GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC";
3615
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
3842
+		if ($limit) {
3843
+			$query .= " LIMIT 10 OFFSET 0";
3844
+		}
3616 3845
 		
3617 3846
 		$sth = $this->db->prepare($query);
3618 3847
 		$sth->execute();
@@ -3657,7 +3886,9 @@  discard block
 block discarded – undo
3657 3886
 			}
3658 3887
 		}
3659 3888
 		$query .= "GROUP BY spotter_output.pilot_id,spotter_output.pilot_name ORDER BY pilot_count DESC";
3660
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
3889
+		if ($limit) {
3890
+			$query .= " LIMIT 10 OFFSET 0";
3891
+		}
3661 3892
       
3662 3893
 		
3663 3894
 		$sth = $this->db->prepare($query);
@@ -3702,7 +3933,9 @@  discard block
 block discarded – undo
3702 3933
 			}
3703 3934
 		}
3704 3935
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.pilot_id,spotter_output.pilot_name ORDER BY pilot_count DESC";
3705
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
3936
+		if ($limit) {
3937
+			$query .= " LIMIT 10 OFFSET 0";
3938
+		}
3706 3939
       
3707 3940
 		
3708 3941
 		$sth = $this->db->prepare($query);
@@ -3749,7 +3982,9 @@  discard block
 block discarded – undo
3749 3982
 			}
3750 3983
 		}
3751 3984
 		$query .= "GROUP BY spotter_output.owner_name ORDER BY owner_count DESC";
3752
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
3985
+		if ($limit) {
3986
+			$query .= " LIMIT 10 OFFSET 0";
3987
+		}
3753 3988
       
3754 3989
 		
3755 3990
 		$sth = $this->db->prepare($query);
@@ -3794,7 +4029,9 @@  discard block
 block discarded – undo
3794 4029
 			}
3795 4030
 		}
3796 4031
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.owner_name ORDER BY owner_count DESC";
3797
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4032
+		if ($limit) {
4033
+			$query .= " LIMIT 10 OFFSET 0";
4034
+		}
3798 4035
       
3799 4036
 		
3800 4037
 		$sth = $this->db->prepare($query);
@@ -4037,7 +4274,9 @@  discard block
 block discarded – undo
4037 4274
 			date_default_timezone_set($globalTimezone);
4038 4275
 			$datetime = new DateTime($date);
4039 4276
 			$offset = $datetime->format('P');
4040
-		} else $offset = '+00:00';
4277
+		} else {
4278
+			$offset = '+00:00';
4279
+		}
4041 4280
 
4042 4281
 		if ($globalDBdriver == 'mysql') {
4043 4282
 			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
@@ -4085,7 +4324,9 @@  discard block
 block discarded – undo
4085 4324
 			date_default_timezone_set($globalTimezone);
4086 4325
 			$datetime = new DateTime($date);
4087 4326
 			$offset = $datetime->format('P');
4088
-		} else $offset = '+00:00';
4327
+		} else {
4328
+			$offset = '+00:00';
4329
+		}
4089 4330
 		
4090 4331
 		if ($globalDBdriver == 'mysql') {
4091 4332
 			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
@@ -4303,7 +4544,9 @@  discard block
 block discarded – undo
4303 4544
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA' 
4304 4545
 					GROUP BY spotter_output.airline_country
4305 4546
 					ORDER BY airline_country_count DESC";
4306
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4547
+		if ($limit) {
4548
+			$query .= " LIMIT 10 OFFSET 0";
4549
+		}
4307 4550
       
4308 4551
 		$sth = $this->db->prepare($query);
4309 4552
 		$sth->execute();
@@ -4331,7 +4574,9 @@  discard block
 block discarded – undo
4331 4574
 		global $globalDBdriver;
4332 4575
 		//$filter_query = $this->getFilter($filters,true,true);
4333 4576
 		$Connection= new Connection($this->db);
4334
-		if (!$Connection->tableExists('countries')) return array();
4577
+		if (!$Connection->tableExists('countries')) {
4578
+			return array();
4579
+		}
4335 4580
 		/*
4336 4581
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
4337 4582
 					FROM countries c, spotter_output s
@@ -4356,7 +4601,9 @@  discard block
 block discarded – undo
4356 4601
 		}
4357 4602
 
4358 4603
 		$query .= "GROUP BY c.name ORDER BY nb DESC";
4359
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4604
+		if ($limit) {
4605
+			$query .= " LIMIT 10 OFFSET 0";
4606
+		}
4360 4607
       
4361 4608
 		
4362 4609
 		$sth = $this->db->prepare($query);
@@ -4406,7 +4653,9 @@  discard block
 block discarded – undo
4406 4653
 		}
4407 4654
 
4408 4655
 		$query .= " GROUP BY spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC";
4409
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4656
+		if ($limit) {
4657
+			$query .= " LIMIT 10 OFFSET 0";
4658
+		}
4410 4659
  
4411 4660
 		$sth = $this->db->prepare($query);
4412 4661
 		$sth->execute();
@@ -4452,7 +4701,9 @@  discard block
 block discarded – undo
4452 4701
 		}
4453 4702
 
4454 4703
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC";
4455
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4704
+		if ($limit) {
4705
+			$query .= " LIMIT 10 OFFSET 0";
4706
+		}
4456 4707
  
4457 4708
 		$sth = $this->db->prepare($query);
4458 4709
 		$sth->execute();
@@ -4505,7 +4756,9 @@  discard block
 block discarded – undo
4505 4756
 			if($row['registration'] != "")
4506 4757
 			{
4507 4758
 				$image_array = $Image->getSpotterImage($row['registration']);
4508
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4759
+				if (isset($image_array[0]['image_thumbnail'])) {
4760
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4761
+				}
4509 4762
 			}
4510 4763
 			$temp_array['registration_count'] = $row['registration_count'];
4511 4764
 
@@ -4580,7 +4833,9 @@  discard block
 block discarded – undo
4580 4833
 			if($row['registration'] != "")
4581 4834
 			{
4582 4835
 				$image_array = $Image->getSpotterImage($row['registration']);
4583
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4836
+				if (isset($image_array[0]['image_thumbnail'])) {
4837
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4838
+				}
4584 4839
 			}
4585 4840
 			$temp_array['registration_count'] = $row['registration_count'];
4586 4841
 
@@ -4687,7 +4942,9 @@  discard block
 block discarded – undo
4687 4942
 			if($row['registration'] != "")
4688 4943
 			{
4689 4944
 				$image_array = $Image->getSpotterImage($row['registration']);
4690
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4945
+				if (isset($image_array[0]['image_thumbnail'])) {
4946
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4947
+				}
4691 4948
 			}
4692 4949
 			$temp_array['registration_count'] = $row['registration_count'];
4693 4950
 			$aircraft_array[] = $temp_array;
@@ -4812,7 +5069,9 @@  discard block
 block discarded – undo
4812 5069
 			date_default_timezone_set($globalTimezone);
4813 5070
 			$datetime = new DateTime($date);
4814 5071
 			$offset = $datetime->format('P');
4815
-		} else $offset = '+00:00';
5072
+		} else {
5073
+			$offset = '+00:00';
5074
+		}
4816 5075
 
4817 5076
 		if ($globalDBdriver == 'mysql') {
4818 5077
 			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
@@ -4859,7 +5118,9 @@  discard block
 block discarded – undo
4859 5118
 			date_default_timezone_set($globalTimezone);
4860 5119
 			$datetime = new DateTime($date);
4861 5120
 			$offset = $datetime->format('P');
4862
-		} else $offset = '+00:00';
5121
+		} else {
5122
+			$offset = '+00:00';
5123
+		}
4863 5124
 
4864 5125
 		if ($globalDBdriver == 'mysql') {
4865 5126
 			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name 
@@ -4888,7 +5149,9 @@  discard block
 block discarded – undo
4888 5149
 			if($row['registration'] != "")
4889 5150
 			{
4890 5151
 				$image_array = $Image->getSpotterImage($row['registration']);
4891
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5152
+				if (isset($image_array[0]['image_thumbnail'])) {
5153
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5154
+				}
4892 5155
 			}
4893 5156
 			$temp_array['registration_count'] = $row['registration_count'];
4894 5157
  
@@ -4913,7 +5176,9 @@  discard block
 block discarded – undo
4913 5176
 			date_default_timezone_set($globalTimezone);
4914 5177
 			$datetime = new DateTime($date);
4915 5178
 			$offset = $datetime->format('P');
4916
-		} else $offset = '+00:00';
5179
+		} else {
5180
+			$offset = '+00:00';
5181
+		}
4917 5182
 
4918 5183
 		if ($globalDBdriver == 'mysql') {
4919 5184
 			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
@@ -5011,8 +5276,11 @@  discard block
 block discarded – undo
5011 5276
 			if($row['registration'] != "")
5012 5277
 			{
5013 5278
 				$image_array = $Image->getSpotterImage($row['registration']);
5014
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5015
-				else $temp_array['image_thumbnail'] = '';
5279
+				if (isset($image_array[0]['image_thumbnail'])) {
5280
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5281
+				} else {
5282
+					$temp_array['image_thumbnail'] = '';
5283
+				}
5016 5284
 			}
5017 5285
 			$temp_array['registration_count'] = $row['registration_count'];
5018 5286
 			$aircraft_array[] = $temp_array;
@@ -5119,7 +5387,9 @@  discard block
 block discarded – undo
5119 5387
 			if($row['registration'] != "")
5120 5388
 			{
5121 5389
 				$image_array = $Image->getSpotterImage($row['registration']);
5122
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5390
+				if (isset($image_array[0]['image_thumbnail'])) {
5391
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5392
+				}
5123 5393
 			}
5124 5394
 			$temp_array['registration_count'] = $row['registration_count'];
5125 5395
           
@@ -5236,7 +5506,9 @@  discard block
 block discarded – undo
5236 5506
 			if($row['registration'] != "")
5237 5507
 			{
5238 5508
 				$image_array = $Image->getSpotterImage($row['registration']);
5239
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5509
+				if (isset($image_array[0]['image_thumbnail'])) {
5510
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5511
+				}
5240 5512
 			}
5241 5513
 			$temp_array['registration_count'] = $row['registration_count'];
5242 5514
           
@@ -5348,7 +5620,9 @@  discard block
 block discarded – undo
5348 5620
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5349 5621
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5350 5622
                 $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5351
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5623
+		if ($limit) {
5624
+			$query .= " LIMIT 10 OFFSET 0";
5625
+		}
5352 5626
 		
5353 5627
 		$sth = $this->db->prepare($query);
5354 5628
 		$sth->execute();
@@ -5367,7 +5641,9 @@  discard block
 block discarded – undo
5367 5641
 			if($row['registration'] != "")
5368 5642
 			{
5369 5643
 				$image_array = $Image->getSpotterImage($row['registration']);
5370
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5644
+				if (isset($image_array[0]['image_thumbnail'])) {
5645
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5646
+				}
5371 5647
 			}
5372 5648
           
5373 5649
 			$aircraft_array[] = $temp_array;
@@ -5408,7 +5684,9 @@  discard block
 block discarded – undo
5408 5684
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5409 5685
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5410 5686
                 $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";
5411
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5687
+		if ($limit) {
5688
+			$query .= " LIMIT 10 OFFSET 0";
5689
+		}
5412 5690
 		
5413 5691
 		$sth = $this->db->prepare($query);
5414 5692
 		$sth->execute();
@@ -5428,7 +5706,9 @@  discard block
 block discarded – undo
5428 5706
 			if($row['registration'] != "")
5429 5707
 			{
5430 5708
 				$image_array = $Image->getSpotterImage($row['registration']);
5431
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5709
+				if (isset($image_array[0]['image_thumbnail'])) {
5710
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5711
+				}
5432 5712
 			}
5433 5713
           
5434 5714
 			$aircraft_array[] = $temp_array;
@@ -5469,7 +5749,9 @@  discard block
 block discarded – undo
5469 5749
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5470 5750
                 $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5471 5751
 				ORDER BY airport_departure_icao_count DESC";
5472
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5752
+		if ($limit) {
5753
+			$query .= " LIMIT 10 OFFSET 0";
5754
+		}
5473 5755
       
5474 5756
 		$sth = $this->db->prepare($query);
5475 5757
 		$sth->execute();
@@ -5521,7 +5803,9 @@  discard block
 block discarded – undo
5521 5803
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5522 5804
                 $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
5523 5805
 				ORDER BY airport_departure_icao_count DESC";
5524
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5806
+		if ($limit) {
5807
+			$query .= " LIMIT 10 OFFSET 0";
5808
+		}
5525 5809
       
5526 5810
 		$sth = $this->db->prepare($query);
5527 5811
 		$sth->execute();
@@ -5573,7 +5857,9 @@  discard block
 block discarded – undo
5573 5857
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5574 5858
                 $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5575 5859
 				ORDER BY airport_departure_icao_count DESC";
5576
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5860
+		if ($limit) {
5861
+			$query .= " LIMIT 10 OFFSET 0";
5862
+		}
5577 5863
     		//echo $query;
5578 5864
 		$sth = $this->db->prepare($query);
5579 5865
 		$sth->execute();
@@ -5625,7 +5911,9 @@  discard block
 block discarded – undo
5625 5911
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5626 5912
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5627 5913
 				ORDER BY airport_departure_icao_count DESC";
5628
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5914
+		if ($limit) {
5915
+			$query .= " LIMIT 10 OFFSET 0";
5916
+		}
5629 5917
       
5630 5918
 		$sth = $this->db->prepare($query);
5631 5919
 		$sth->execute();
@@ -6020,7 +6308,9 @@  discard block
 block discarded – undo
6020 6308
 			date_default_timezone_set($globalTimezone);
6021 6309
 			$datetime = new DateTime($date);
6022 6310
 			$offset = $datetime->format('P');
6023
-		} else $offset = '+00:00';
6311
+		} else {
6312
+			$offset = '+00:00';
6313
+		}
6024 6314
 
6025 6315
 		if ($globalDBdriver == 'mysql') {
6026 6316
 			$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 
@@ -6070,7 +6360,9 @@  discard block
 block discarded – undo
6070 6360
 			date_default_timezone_set($globalTimezone);
6071 6361
 			$datetime = new DateTime($date);
6072 6362
 			$offset = $datetime->format('P');
6073
-		} else $offset = '+00:00';
6363
+		} else {
6364
+			$offset = '+00:00';
6365
+		}
6074 6366
 
6075 6367
 		if ($globalDBdriver == 'mysql') {
6076 6368
 			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
@@ -6283,7 +6575,9 @@  discard block
 block discarded – undo
6283 6575
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6284 6576
                 $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6285 6577
 					ORDER BY airport_arrival_icao_count DESC";
6286
-		if ($limit) $query .= " LIMIT 10";
6578
+		if ($limit) {
6579
+			$query .= " LIMIT 10";
6580
+		}
6287 6581
       
6288 6582
 		
6289 6583
 		$sth = $this->db->prepare($query);
@@ -6303,7 +6597,9 @@  discard block
 block discarded – undo
6303 6597
 			if ($icaoaskey) {
6304 6598
 				$icao = $row['arrival_airport_icao'];
6305 6599
 				$airport_array[$icao] = $temp_array;
6306
-			} else $airport_array[] = $temp_array;
6600
+			} else {
6601
+				$airport_array[] = $temp_array;
6602
+			}
6307 6603
 		}
6308 6604
 
6309 6605
 		return $airport_array;
@@ -6345,7 +6641,9 @@  discard block
 block discarded – undo
6345 6641
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6346 6642
                 $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
6347 6643
 					ORDER BY airport_arrival_icao_count DESC";
6348
-		if ($limit) $query .= " LIMIT 10";
6644
+		if ($limit) {
6645
+			$query .= " LIMIT 10";
6646
+		}
6349 6647
       
6350 6648
 		
6351 6649
 		$sth = $this->db->prepare($query);
@@ -6366,7 +6664,9 @@  discard block
 block discarded – undo
6366 6664
 			if ($icaoaskey) {
6367 6665
 				$icao = $row['arrival_airport_icao'];
6368 6666
 				$airport_array[$icao] = $temp_array;
6369
-			} else $airport_array[] = $temp_array;
6667
+			} else {
6668
+				$airport_array[] = $temp_array;
6669
+			}
6370 6670
 		}
6371 6671
 
6372 6672
 		return $airport_array;
@@ -6408,7 +6708,9 @@  discard block
 block discarded – undo
6408 6708
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6409 6709
                 $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6410 6710
 					ORDER BY airport_arrival_icao_count DESC";
6411
-		if ($limit) $query .= " LIMIT 10";
6711
+		if ($limit) {
6712
+			$query .= " LIMIT 10";
6713
+		}
6412 6714
       
6413 6715
 		
6414 6716
 		$sth = $this->db->prepare($query);
@@ -6428,7 +6730,9 @@  discard block
 block discarded – undo
6428 6730
 			if ($icaoaskey) {
6429 6731
 				$icao = $row['arrival_airport_icao'];
6430 6732
 				$airport_array[$icao] = $temp_array;
6431
-			} else $airport_array[] = $temp_array;
6733
+			} else {
6734
+				$airport_array[] = $temp_array;
6735
+			}
6432 6736
 		}
6433 6737
 
6434 6738
 		return $airport_array;
@@ -6470,7 +6774,9 @@  discard block
 block discarded – undo
6470 6774
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6471 6775
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6472 6776
 					ORDER BY airport_arrival_icao_count DESC";
6473
-		if ($limit) $query .= " LIMIT 10";
6777
+		if ($limit) {
6778
+			$query .= " LIMIT 10";
6779
+		}
6474 6780
       
6475 6781
 		
6476 6782
 		$sth = $this->db->prepare($query);
@@ -6491,7 +6797,9 @@  discard block
 block discarded – undo
6491 6797
 			if ($icaoaskey) {
6492 6798
 				$icao = $row['arrival_airport_icao'];
6493 6799
 				$airport_array[$icao] = $temp_array;
6494
-			} else $airport_array[] = $temp_array;
6800
+			} else {
6801
+				$airport_array[] = $temp_array;
6802
+			}
6495 6803
 		}
6496 6804
 
6497 6805
 		return $airport_array;
@@ -6872,7 +7180,9 @@  discard block
 block discarded – undo
6872 7180
 			date_default_timezone_set($globalTimezone);
6873 7181
 			$datetime = new DateTime($date);
6874 7182
 			$offset = $datetime->format('P');
6875
-		} else $offset = '+00:00';
7183
+		} else {
7184
+			$offset = '+00:00';
7185
+		}
6876 7186
 
6877 7187
 		if ($globalDBdriver == 'mysql') {
6878 7188
 			$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 
@@ -6922,7 +7232,9 @@  discard block
 block discarded – undo
6922 7232
 			date_default_timezone_set($globalTimezone);
6923 7233
 			$datetime = new DateTime($date);
6924 7234
 			$offset = $datetime->format('P');
6925
-		} else $offset = '+00:00';
7235
+		} else {
7236
+			$offset = '+00:00';
7237
+		}
6926 7238
 
6927 7239
 		if ($globalDBdriver == 'mysql') {
6928 7240
 			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
@@ -7145,7 +7457,9 @@  discard block
 block discarded – undo
7145 7457
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA'";
7146 7458
 		$query .= " GROUP BY spotter_output.arrival_airport_country
7147 7459
 					ORDER BY airport_arrival_country_count DESC";
7148
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
7460
+		if ($limit) {
7461
+			$query .= " LIMIT 10 OFFSET 0";
7462
+		}
7149 7463
       
7150 7464
 		
7151 7465
 		$sth = $this->db->prepare($query);
@@ -7432,7 +7746,9 @@  discard block
 block discarded – undo
7432 7746
 			date_default_timezone_set($globalTimezone);
7433 7747
 			$datetime = new DateTime($date);
7434 7748
 			$offset = $datetime->format('P');
7435
-		} else $offset = '+00:00';
7749
+		} else {
7750
+			$offset = '+00:00';
7751
+		}
7436 7752
 		
7437 7753
 		if ($globalDBdriver == 'mysql') {
7438 7754
 			$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
@@ -7608,15 +7924,23 @@  discard block
 block discarded – undo
7608 7924
 		$query  = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
7609 7925
                     FROM spotter_output".$filter_query." spotter_output.ident <> '' ";
7610 7926
 		 if ($olderthanmonths > 0) {
7611
-			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
7612
-			else $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
7927
+			if ($globalDBdriver == 'mysql') {
7928
+				$query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
7929
+			} else {
7930
+				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
7931
+			}
7613 7932
 		}
7614 7933
 		if ($sincedate != '') {
7615
-			if ($globalDBdriver == 'mysql') $query .= " AND spotter_output.date > '".$sincedate."'";
7616
-			else $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
7934
+			if ($globalDBdriver == 'mysql') {
7935
+				$query .= " AND spotter_output.date > '".$sincedate."'";
7936
+			} else {
7937
+				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
7938
+			}
7617 7939
 		}
7618 7940
 		$query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
7619
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
7941
+		if ($limit) {
7942
+			$query .= " LIMIT 10 OFFSET 0";
7943
+		}
7620 7944
       		
7621 7945
 		$sth = $this->db->prepare($query);
7622 7946
 		$sth->execute();
@@ -7650,15 +7974,23 @@  discard block
 block discarded – undo
7650 7974
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
7651 7975
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''  AND spotter_output.airline_icao <> '' ";
7652 7976
 		 if ($olderthanmonths > 0) {
7653
-			if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7654
-			else $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
7977
+			if ($globalDBdriver == 'mysql') {
7978
+				$query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7979
+			} else {
7980
+				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
7981
+			}
7655 7982
 		}
7656 7983
 		if ($sincedate != '') {
7657
-			if ($globalDBdriver == 'mysql') $query .= "AND spotter_output.date > '".$sincedate."' ";
7658
-			else $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
7984
+			if ($globalDBdriver == 'mysql') {
7985
+				$query .= "AND spotter_output.date > '".$sincedate."' ";
7986
+			} else {
7987
+				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
7988
+			}
7659 7989
 		}
7660 7990
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
7661
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
7991
+		if ($limit) {
7992
+			$query .= " LIMIT 10 OFFSET 0";
7993
+		}
7662 7994
       		
7663 7995
 		$sth = $this->db->prepare($query);
7664 7996
 		$sth->execute();
@@ -7695,7 +8027,9 @@  discard block
 block discarded – undo
7695 8027
 			date_default_timezone_set($globalTimezone);
7696 8028
 			$datetime = new DateTime();
7697 8029
 			$offset = $datetime->format('P');
7698
-		} else $offset = '+00:00';
8030
+		} else {
8031
+			$offset = '+00:00';
8032
+		}
7699 8033
 
7700 8034
 		if ($globalDBdriver == 'mysql') {
7701 8035
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7744,7 +8078,9 @@  discard block
 block discarded – undo
7744 8078
 			date_default_timezone_set($globalTimezone);
7745 8079
 			$datetime = new DateTime();
7746 8080
 			$offset = $datetime->format('P');
7747
-		} else $offset = '+00:00';
8081
+		} else {
8082
+			$offset = '+00:00';
8083
+		}
7748 8084
 		$filter_query = $this->getFilter($filters,true,true);
7749 8085
 		if ($globalDBdriver == 'mysql') {
7750 8086
 			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7793,7 +8129,9 @@  discard block
 block discarded – undo
7793 8129
 			date_default_timezone_set($globalTimezone);
7794 8130
 			$datetime = new DateTime();
7795 8131
 			$offset = $datetime->format('P');
7796
-		} else $offset = '+00:00';
8132
+		} else {
8133
+			$offset = '+00:00';
8134
+		}
7797 8135
 		$filter_query = $this->getFilter($filters,true,true);
7798 8136
 		if ($globalDBdriver == 'mysql') {
7799 8137
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7839,7 +8177,9 @@  discard block
 block discarded – undo
7839 8177
 			date_default_timezone_set($globalTimezone);
7840 8178
 			$datetime = new DateTime();
7841 8179
 			$offset = $datetime->format('P');
7842
-		} else $offset = '+00:00';
8180
+		} else {
8181
+			$offset = '+00:00';
8182
+		}
7843 8183
 		$filter_query = $this->getFilter($filters,true,true);
7844 8184
 		if ($globalDBdriver == 'mysql') {
7845 8185
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7887,7 +8227,9 @@  discard block
 block discarded – undo
7887 8227
 			date_default_timezone_set($globalTimezone);
7888 8228
 			$datetime = new DateTime();
7889 8229
 			$offset = $datetime->format('P');
7890
-		} else $offset = '+00:00';
8230
+		} else {
8231
+			$offset = '+00:00';
8232
+		}
7891 8233
 		
7892 8234
 		if ($globalDBdriver == 'mysql') {
7893 8235
 			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7935,7 +8277,9 @@  discard block
 block discarded – undo
7935 8277
 			date_default_timezone_set($globalTimezone);
7936 8278
 			$datetime = new DateTime();
7937 8279
 			$offset = $datetime->format('P');
7938
-		} else $offset = '+00:00';
8280
+		} else {
8281
+			$offset = '+00:00';
8282
+		}
7939 8283
 
7940 8284
 		if ($globalDBdriver == 'mysql') {
7941 8285
 			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
@@ -7982,7 +8326,9 @@  discard block
 block discarded – undo
7982 8326
 			date_default_timezone_set($globalTimezone);
7983 8327
 			$datetime = new DateTime();
7984 8328
 			$offset = $datetime->format('P');
7985
-		} else $offset = '+00:00';
8329
+		} else {
8330
+			$offset = '+00:00';
8331
+		}
7986 8332
 
7987 8333
 		if ($globalDBdriver == 'mysql') {
7988 8334
 			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
@@ -8030,7 +8376,9 @@  discard block
 block discarded – undo
8030 8376
 			date_default_timezone_set($globalTimezone);
8031 8377
 			$datetime = new DateTime();
8032 8378
 			$offset = $datetime->format('P');
8033
-		} else $offset = '+00:00';
8379
+		} else {
8380
+			$offset = '+00:00';
8381
+		}
8034 8382
 		$filter_query = $this->getFilter($filters,true,true);
8035 8383
 		if ($globalDBdriver == 'mysql') {
8036 8384
 			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
@@ -8075,7 +8423,9 @@  discard block
 block discarded – undo
8075 8423
 			date_default_timezone_set($globalTimezone);
8076 8424
 			$datetime = new DateTime();
8077 8425
 			$offset = $datetime->format('P');
8078
-		} else $offset = '+00:00';
8426
+		} else {
8427
+			$offset = '+00:00';
8428
+		}
8079 8429
 		$filter_query = $this->getFilter($filters,true,true);
8080 8430
 
8081 8431
 		if ($globalDBdriver == 'mysql') {
@@ -8122,7 +8472,9 @@  discard block
 block discarded – undo
8122 8472
 			date_default_timezone_set($globalTimezone);
8123 8473
 			$datetime = new DateTime();
8124 8474
 			$offset = $datetime->format('P');
8125
-		} else $offset = '+00:00';
8475
+		} else {
8476
+			$offset = '+00:00';
8477
+		}
8126 8478
 
8127 8479
 		if ($globalDBdriver == 'mysql') {
8128 8480
 			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count
@@ -8168,7 +8520,9 @@  discard block
 block discarded – undo
8168 8520
 			date_default_timezone_set($globalTimezone);
8169 8521
 			$datetime = new DateTime();
8170 8522
 			$offset = $datetime->format('P');
8171
-		} else $offset = '+00:00';
8523
+		} else {
8524
+			$offset = '+00:00';
8525
+		}
8172 8526
 		$filter_query = $this->getFilter($filters,true,true);
8173 8527
 
8174 8528
 		if ($globalDBdriver == 'mysql') {
@@ -8215,7 +8569,9 @@  discard block
 block discarded – undo
8215 8569
 			date_default_timezone_set($globalTimezone);
8216 8570
 			$datetime = new DateTime();
8217 8571
 			$offset = $datetime->format('P');
8218
-		} else $offset = '+00:00';
8572
+		} else {
8573
+			$offset = '+00:00';
8574
+		}
8219 8575
 
8220 8576
 		if ($globalDBdriver == 'mysql') {
8221 8577
 			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count
@@ -8262,7 +8618,9 @@  discard block
 block discarded – undo
8262 8618
 			date_default_timezone_set($globalTimezone);
8263 8619
 			$datetime = new DateTime();
8264 8620
 			$offset = $datetime->format('P');
8265
-		} else $offset = '+00:00';
8621
+		} else {
8622
+			$offset = '+00:00';
8623
+		}
8266 8624
 
8267 8625
 		if ($globalDBdriver == 'mysql') {
8268 8626
 			$query  = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct airline_icao) as date_count
@@ -8307,7 +8665,9 @@  discard block
 block discarded – undo
8307 8665
 			date_default_timezone_set($globalTimezone);
8308 8666
 			$datetime = new DateTime();
8309 8667
 			$offset = $datetime->format('P');
8310
-		} else $offset = '+00:00';
8668
+		} else {
8669
+			$offset = '+00:00';
8670
+		}
8311 8671
 		$filter_query = $this->getFilter($filters,true,true);
8312 8672
 
8313 8673
 		if ($globalDBdriver == 'mysql') {
@@ -8355,7 +8715,9 @@  discard block
 block discarded – undo
8355 8715
 			date_default_timezone_set($globalTimezone);
8356 8716
 			$datetime = new DateTime();
8357 8717
 			$offset = $datetime->format('P');
8358
-		} else $offset = '+00:00';
8718
+		} else {
8719
+			$offset = '+00:00';
8720
+		}
8359 8721
 
8360 8722
 		if ($globalDBdriver == 'mysql') {
8361 8723
 			$query  = "SELECT spotter_output.airline_icao,YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count
@@ -8401,7 +8763,9 @@  discard block
 block discarded – undo
8401 8763
 			date_default_timezone_set($globalTimezone);
8402 8764
 			$datetime = new DateTime();
8403 8765
 			$offset = $datetime->format('P');
8404
-		} else $offset = '+00:00';
8766
+		} else {
8767
+			$offset = '+00:00';
8768
+		}
8405 8769
 		$filter_query = $this->getFilter($filters,true,true);
8406 8770
 
8407 8771
 		if ($globalDBdriver == 'mysql') {
@@ -8449,7 +8813,9 @@  discard block
 block discarded – undo
8449 8813
 			date_default_timezone_set($globalTimezone);
8450 8814
 			$datetime = new DateTime();
8451 8815
 			$offset = $datetime->format('P');
8452
-		} else $offset = '+00:00';
8816
+		} else {
8817
+			$offset = '+00:00';
8818
+		}
8453 8819
 
8454 8820
 		if ($globalDBdriver == 'mysql') {
8455 8821
 			$query  = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count
@@ -8496,7 +8862,9 @@  discard block
 block discarded – undo
8496 8862
 			date_default_timezone_set($globalTimezone);
8497 8863
 			$datetime = new DateTime();
8498 8864
 			$offset = $datetime->format('P');
8499
-		} else $offset = '+00:00';
8865
+		} else {
8866
+			$offset = '+00:00';
8867
+		}
8500 8868
 		$filter_query = $this->getFilter($filters,true,true);
8501 8869
 		if ($globalDBdriver == 'mysql') {
8502 8870
 			$query  = "SELECT MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count
@@ -8545,7 +8913,9 @@  discard block
 block discarded – undo
8545 8913
 			date_default_timezone_set($globalTimezone);
8546 8914
 			$datetime = new DateTime();
8547 8915
 			$offset = $datetime->format('P');
8548
-		} else $offset = '+00:00';
8916
+		} else {
8917
+			$offset = '+00:00';
8918
+		}
8549 8919
 
8550 8920
 		$orderby_sql = '';
8551 8921
 		if ($orderby == "hour")
@@ -8611,7 +8981,9 @@  discard block
 block discarded – undo
8611 8981
 			date_default_timezone_set($globalTimezone);
8612 8982
 			$datetime = new DateTime();
8613 8983
 			$offset = $datetime->format('P');
8614
-		} else $offset = '+00:00';
8984
+		} else {
8985
+			$offset = '+00:00';
8986
+		}
8615 8987
 
8616 8988
 		$orderby_sql = '';
8617 8989
 		if ($orderby == "hour")
@@ -8678,7 +9050,9 @@  discard block
 block discarded – undo
8678 9050
 			date_default_timezone_set($globalTimezone);
8679 9051
 			$datetime = new DateTime();
8680 9052
 			$offset = $datetime->format('P');
8681
-		} else $offset = '+00:00';
9053
+		} else {
9054
+			$offset = '+00:00';
9055
+		}
8682 9056
 
8683 9057
 		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
8684 9058
 
@@ -8729,7 +9103,9 @@  discard block
 block discarded – undo
8729 9103
 			date_default_timezone_set($globalTimezone);
8730 9104
 			$datetime = new DateTime();
8731 9105
 			$offset = $datetime->format('P');
8732
-		} else $offset = '+00:00';
9106
+		} else {
9107
+			$offset = '+00:00';
9108
+		}
8733 9109
 
8734 9110
 		if ($globalDBdriver == 'mysql') {
8735 9111
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -8776,7 +9152,9 @@  discard block
 block discarded – undo
8776 9152
 			date_default_timezone_set($globalTimezone);
8777 9153
 			$datetime = new DateTime();
8778 9154
 			$offset = $datetime->format('P');
8779
-		} else $offset = '+00:00';
9155
+		} else {
9156
+			$offset = '+00:00';
9157
+		}
8780 9158
 
8781 9159
 		if ($globalDBdriver == 'mysql') {
8782 9160
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -8823,7 +9201,9 @@  discard block
 block discarded – undo
8823 9201
 			date_default_timezone_set($globalTimezone);
8824 9202
 			$datetime = new DateTime();
8825 9203
 			$offset = $datetime->format('P');
8826
-		} else $offset = '+00:00';
9204
+		} else {
9205
+			$offset = '+00:00';
9206
+		}
8827 9207
 
8828 9208
 		if ($globalDBdriver == 'mysql') {
8829 9209
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -8871,7 +9251,9 @@  discard block
 block discarded – undo
8871 9251
 			date_default_timezone_set($globalTimezone);
8872 9252
 			$datetime = new DateTime();
8873 9253
 			$offset = $datetime->format('P');
8874
-		} else $offset = '+00:00';
9254
+		} else {
9255
+			$offset = '+00:00';
9256
+		}
8875 9257
 
8876 9258
 		if ($globalDBdriver == 'mysql') {
8877 9259
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -8919,7 +9301,9 @@  discard block
 block discarded – undo
8919 9301
 			date_default_timezone_set($globalTimezone);
8920 9302
 			$datetime = new DateTime($date);
8921 9303
 			$offset = $datetime->format('P');
8922
-		} else $offset = '+00:00';
9304
+		} else {
9305
+			$offset = '+00:00';
9306
+		}
8923 9307
 
8924 9308
 		if ($globalDBdriver == 'mysql') {
8925 9309
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -8967,7 +9351,9 @@  discard block
 block discarded – undo
8967 9351
 			date_default_timezone_set($globalTimezone);
8968 9352
 			$datetime = new DateTime();
8969 9353
 			$offset = $datetime->format('P');
8970
-		} else $offset = '+00:00';
9354
+		} else {
9355
+			$offset = '+00:00';
9356
+		}
8971 9357
 
8972 9358
 		if ($globalDBdriver == 'mysql') {
8973 9359
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9017,7 +9403,9 @@  discard block
 block discarded – undo
9017 9403
 			date_default_timezone_set($globalTimezone);
9018 9404
 			$datetime = new DateTime();
9019 9405
 			$offset = $datetime->format('P');
9020
-		} else $offset = '+00:00';
9406
+		} else {
9407
+			$offset = '+00:00';
9408
+		}
9021 9409
 
9022 9410
 		if ($globalDBdriver == 'mysql') {
9023 9411
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9064,7 +9452,9 @@  discard block
 block discarded – undo
9064 9452
 			date_default_timezone_set($globalTimezone);
9065 9453
 			$datetime = new DateTime();
9066 9454
 			$offset = $datetime->format('P');
9067
-		} else $offset = '+00:00';
9455
+		} else {
9456
+			$offset = '+00:00';
9457
+		}
9068 9458
 
9069 9459
 		if ($globalDBdriver == 'mysql') {
9070 9460
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9232,7 +9622,9 @@  discard block
 block discarded – undo
9232 9622
 			date_default_timezone_set($globalTimezone);
9233 9623
 			$datetime = new DateTime();
9234 9624
 			$offset = $datetime->format('P');
9235
-		} else $offset = '+00:00';
9625
+		} else {
9626
+			$offset = '+00:00';
9627
+		}
9236 9628
 
9237 9629
 		if ($globalDBdriver == 'mysql') {
9238 9630
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9418,7 +9810,9 @@  discard block
 block discarded – undo
9418 9810
 	*/
9419 9811
 	public function parseDirection($direction = 0)
9420 9812
 	{
9421
-		if ($direction == '') $direction = 0;
9813
+		if ($direction == '') {
9814
+			$direction = 0;
9815
+		}
9422 9816
 		$direction_array = array();
9423 9817
 		$temp_array = array();
9424 9818
 
@@ -9519,7 +9913,9 @@  discard block
 block discarded – undo
9519 9913
 		if (isset($result->AirlineFlightInfoResult))
9520 9914
 		{
9521 9915
 			$registration = $result->AirlineFlightInfoResult->tailnumber;
9522
-		} else return '';
9916
+		} else {
9917
+			return '';
9918
+		}
9523 9919
 		
9524 9920
 		$registration = $this->convertAircraftRegistration($registration);
9525 9921
 		
@@ -9548,7 +9944,9 @@  discard block
 block discarded – undo
9548 9944
 		if (count($row) > 0) {
9549 9945
 		    //return $row['Registration'];
9550 9946
 		    return $row['registration'];
9551
-		} else return '';
9947
+		} else {
9948
+			return '';
9949
+		}
9552 9950
 	
9553 9951
 	}
9554 9952
 
@@ -9571,9 +9969,14 @@  discard block
 block discarded – undo
9571 9969
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
9572 9970
 		$sth->closeCursor();
9573 9971
 		if (count($row) > 0) {
9574
-		    if ($row['type_flight'] == null) return '';
9575
-		    else return $row['type_flight'];
9576
-		} else return '';
9972
+		    if ($row['type_flight'] == null) {
9973
+		    	return '';
9974
+		    } else {
9975
+		    	return $row['type_flight'];
9976
+		    }
9977
+		} else {
9978
+			return '';
9979
+		}
9577 9980
 	
9578 9981
 	}
9579 9982
 
@@ -9591,7 +9994,9 @@  discard block
 block discarded – undo
9591 9994
 		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
9592 9995
 	
9593 9996
 		$Connection = new Connection($this->db);
9594
-		if (!$Connection->tableExists('countries')) return '';
9997
+		if (!$Connection->tableExists('countries')) {
9998
+			return '';
9999
+		}
9595 10000
 	
9596 10001
 		try {
9597 10002
 			/*
@@ -9611,9 +10016,13 @@  discard block
 block discarded – undo
9611 10016
 			$sth->closeCursor();
9612 10017
 			if (count($row) > 0) {
9613 10018
 				return $row;
9614
-			} else return '';
10019
+			} else {
10020
+				return '';
10021
+			}
9615 10022
 		} catch (PDOException $e) {
9616
-			if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n";
10023
+			if (isset($globalDebug) && $globalDebug) {
10024
+				echo 'Error : '.$e->getMessage()."\n";
10025
+			}
9617 10026
 			return '';
9618 10027
 		}
9619 10028
 	
@@ -9761,7 +10170,9 @@  discard block
 block discarded – undo
9761 10170
 	{
9762 10171
 		global $globalBitlyAccessToken;
9763 10172
 		
9764
-		if ($globalBitlyAccessToken == '') return $url;
10173
+		if ($globalBitlyAccessToken == '') {
10174
+			return $url;
10175
+		}
9765 10176
         
9766 10177
 		$google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url;
9767 10178
 		
@@ -9910,7 +10321,9 @@  discard block
 block discarded – undo
9910 10321
 		
9911 10322
 
9912 10323
 		// routes
9913
-		if ($globalDebug) print "Routes...\n";
10324
+		if ($globalDebug) {
10325
+			print "Routes...\n";
10326
+		}
9914 10327
 		if ($globalDBdriver == 'mysql') {
9915 10328
 			$query = "SELECT spotter_output.spotter_id, routes.FromAirport_ICAO, routes.ToAirport_ICAO FROM spotter_output, routes WHERE spotter_output.ident = routes.CallSign AND ( spotter_output.departure_airport_icao != routes.FromAirport_ICAO OR spotter_output.arrival_airport_icao != routes.ToAirport_ICAO) AND routes.FromAirport_ICAO != '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 DAY)";
9916 10329
 		} else {
@@ -9929,7 +10342,9 @@  discard block
 block discarded – undo
9929 10342
 			}
9930 10343
 		}
9931 10344
 		
9932
-		if ($globalDebug) print "Airlines...\n";
10345
+		if ($globalDebug) {
10346
+			print "Airlines...\n";
10347
+		}
9933 10348
 		//airlines
9934 10349
 		if ($globalDBdriver == 'mysql') {
9935 10350
 			$query  = "SELECT spotter_output.spotter_id, spotter_output.ident FROM spotter_output WHERE (spotter_output.airline_name = '' OR spotter_output.airline_name = 'Not Available') AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 DAY)";
@@ -9943,10 +10358,15 @@  discard block
 block discarded – undo
9943 10358
 			if (is_numeric(substr($row['ident'], -1, 1)))
9944 10359
 			{
9945 10360
 				$fromsource = NULL;
9946
-				if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
9947
-				elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
9948
-				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
9949
-				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
10361
+				if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') {
10362
+					$fromsource = 'vatsim';
10363
+				} elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') {
10364
+					$fromsource = 'ivao';
10365
+				} elseif (isset($globalVATSIM) && $globalVATSIM) {
10366
+					$fromsource = 'vatsim';
10367
+				} elseif (isset($globalIVAO) && $globalIVAO) {
10368
+					$fromsource = 'ivao';
10369
+				}
9950 10370
 				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
9951 10371
 				if (isset($airline_array[0]['name'])) {
9952 10372
 					$update_query  = "UPDATE spotter_output SET spotter_output.airline_name = :airline_name, spotter_output.airline_icao = :airline_icao, spotter_output.airline_country = :airline_country, spotter_output.airline_type = :airline_type WHERE spotter_output.spotter_id = :spotter_id";
@@ -9956,13 +10376,17 @@  discard block
 block discarded – undo
9956 10376
 			}
9957 10377
 		}
9958 10378
 
9959
-		if ($globalDebug) print "Remove Duplicate in aircraft_modes...\n";
10379
+		if ($globalDebug) {
10380
+			print "Remove Duplicate in aircraft_modes...\n";
10381
+		}
9960 10382
 		//duplicate modes
9961 10383
 		$query = "DELETE aircraft_modes FROM aircraft_modes LEFT OUTER JOIN (SELECT max(`AircraftID`) as `AircraftID`,`ModeS` FROM `aircraft_modes` group by ModeS) as KeepRows ON aircraft_modes.AircraftID = KeepRows.AircraftID WHERE KeepRows.AircraftID IS NULL";
9962 10384
 		$sth = $this->db->prepare($query);
9963 10385
 		$sth->execute();
9964 10386
 		
9965
-		if ($globalDebug) print "Aircraft...\n";
10387
+		if ($globalDebug) {
10388
+			print "Aircraft...\n";
10389
+		}
9966 10390
 		//aircraft
9967 10391
 		if ($globalDBdriver == 'mysql') {
9968 10392
 			$query  = "SELECT spotter_output.spotter_id, spotter_output.aircraft_icao, spotter_output.registration FROM spotter_output WHERE (spotter_output.aircraft_name = '' OR spotter_output.aircraft_name = 'Not Available') AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)";
@@ -10005,26 +10429,38 @@  discard block
 block discarded – undo
10005 10429
 				 if (isset($closestAirports[0])) {
10006 10430
 					if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) {
10007 10431
 						$airport_icao = $closestAirports[0]['icao'];
10008
-						if ($globalDebug) echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10432
+						if ($globalDebug) {
10433
+							echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10434
+						}
10009 10435
 					} elseif (count($closestAirports > 1) && $row['arrival_airport_icao'] != '' && $row['arrival_airport_icao'] != 'NA') {
10010 10436
 						foreach ($closestAirports as $airport) {
10011 10437
 							if ($row['arrival_airport_icao'] == $airport['icao']) {
10012 10438
 								$airport_icao = $airport['icao'];
10013
-								if ($globalDebug) echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10439
+								if ($globalDebug) {
10440
+									echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10441
+								}
10014 10442
 								break;
10015 10443
 							}
10016 10444
 						}
10017 10445
 					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) {
10018 10446
 						$airport_icao = $closestAirports[0]['icao'];
10019
-						if ($globalDebug) echo "\o/ NP --++ Find arrival airport. Airport ICAO : ".$airport_icao." !  Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n";
10447
+						if ($globalDebug) {
10448
+							echo "\o/ NP --++ Find arrival airport. Airport ICAO : ".$airport_icao." !  Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n";
10449
+						}
10020 10450
 					} else {
10021
-						if ($globalDebug) echo "----- Can't find arrival airport. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n";
10451
+						if ($globalDebug) {
10452
+							echo "----- Can't find arrival airport. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n";
10453
+						}
10022 10454
 					}
10023 10455
 				} else {
10024
-					if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n";
10456
+					if ($globalDebug) {
10457
+						echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n";
10458
+					}
10025 10459
 				}
10026 10460
 				if ($row['real_arrival_airport_icao'] != $airport_icao) {
10027
-					if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n";
10461
+					if ($globalDebug) {
10462
+						echo "Updating airport to ".$airport_icao."...\n";
10463
+					}
10028 10464
 					$update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
10029 10465
 					$sthu = $this->db->prepare($update_query);
10030 10466
 					$sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id']));
Please login to merge, or discard this patch.
statistics-sub-menu.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 					} else {
14 14
 						print '<option value="">All</option>';
15 15
 					}
16
-					foreach($airlines as $airline) {
16
+					foreach ($airlines as $airline) {
17 17
 						if (isset($airline_icao) && $airline_icao == $airline['airline_icao']) {
18 18
 							print '<option value="'.$airline['airline_icao'].'" selected>'.$airline['airline_name'].'</option>';
19 19
 						} else {
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 <div class="sub-menu sub-menu-container">
29 29
 	<ul class="nav">
30 30
 		<li class="dropdown">
31
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-aircraft" || strtolower($current_page) == "statistics-registration" || strtolower($current_page) == "statistics-manufacturer"){ print 'active'; } ?>" data-toggle="dropdown" href="#" >
31
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-aircraft" || strtolower($current_page) == "statistics-registration" || strtolower($current_page) == "statistics-manufacturer") { print 'active'; } ?>" data-toggle="dropdown" href="#" >
32 32
 		      <?php echo _("Aircraft"); ?> <span class="caret"></span>
33 33
 		    </a>
34 34
 		    <ul class="dropdown-menu">
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 		    </ul>
40 40
 		</li>
41 41
 		<li class="dropdown">
42
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-airline" || strtolower($current_page) == "statistics-airline-country" || strtolower($current_page) == "statistics-callsign"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
42
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-airline" || strtolower($current_page) == "statistics-airline-country" || strtolower($current_page) == "statistics-callsign") { print 'active'; } ?>" data-toggle="dropdown" href="#">
43 43
 		      <?php echo _("Airline"); ?> <span class="caret"></span>
44 44
 		    </a>
45 45
 		    <ul class="dropdown-menu" role="menu">
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 		    </ul>
50 50
 		</li>
51 51
 		<li class="dropdown">
52
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-airport-departure" || strtolower($current_page) == "statistics-airport-departure-country" || strtolower($current_page) == "statistics-airport-arrival" || strtolower($current_page) == "statistics-airport-arrival-country"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
52
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-airport-departure" || strtolower($current_page) == "statistics-airport-departure-country" || strtolower($current_page) == "statistics-airport-arrival" || strtolower($current_page) == "statistics-airport-arrival-country") { print 'active'; } ?>" data-toggle="dropdown" href="#">
53 53
 		      <?php echo _("Airport"); ?> <span class="caret"></span>
54 54
 		    </a>
55 55
 		    <ul class="dropdown-menu" role="menu">
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 		    </ul>
61 61
 		</li>
62 62
 		<li class="dropdown">
63
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
63
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint") { print 'active'; } ?>" data-toggle="dropdown" href="#">
64 64
 		      <?php echo _("Route"); ?> <span class="caret"></span>
65 65
 		    </a>
66 66
 		    <ul class="dropdown-menu" role="menu">
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 		    </ul>
70 70
 		</li>
71 71
 		<li class="dropdown">
72
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
72
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time") { print 'active'; } ?>" data-toggle="dropdown" href="#">
73 73
 		      <?php echo _("Date &amp; Time"); ?> <span class="caret"></span>
74 74
 		    </a>
75 75
 		    <ul class="dropdown-menu" role="menu">
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,9 @@
 block discarded – undo
7 7
 				<?php
8 8
 					require_once('require/class.Stats.php');
9 9
 					$Stats = new Stats();
10
-					if (!isset($filter_name)) $filter_name = '';
10
+					if (!isset($filter_name)) {
11
+						$filter_name = '';
12
+					}
11 13
 					$airlines = $Stats->getAllAirlineNames($filter_name);
12 14
 					if (isset($airline_icao) && ($airline_icao == '' || $airline_icao == 'all')) {
13 15
 						print '<option value="all" selected>All</option>';
Please login to merge, or discard this patch.
notam-data.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
 <button type="button" class="close">&times;</button>
8 8
 <?php
9 9
 
10
-$notamref = filter_input(INPUT_GET,'notam',FILTER_SANITIZE_STRING);
10
+$notamref = filter_input(INPUT_GET, 'notam', FILTER_SANITIZE_STRING);
11 11
 $notamref = urldecode($notamref);
12 12
 $NOTAM = new NOTAM();
13 13
 $notam = $NOTAM->getNOTAMbyRef($notamref);
Please login to merge, or discard this patch.