Completed
Push — master ( 64cd98...c5e9bd )
by Yannick
04:45
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.
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.
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 // When button "Remove all filters" is clicked
29 29
 if (isset($_POST['removefilters'])) {
30 30
 	$allfilters = array_filter(array_keys($_COOKIE),function($key) {
31
-	    return strpos($key,'filter_') === 0;
31
+		return strpos($key,'filter_') === 0;
32 32
 	});
33 33
 	foreach ($allfilters as $filt) {
34 34
 		unset($_COOKIE[$filt]);
@@ -167,16 +167,16 @@  discard block
 block discarded – undo
167 167
 	}
168 168
 ?>
169 169
 <?php 
170
-    if (isset($_POST['archive'])) {
170
+	if (isset($_POST['archive'])) {
171 171
 ?>
172 172
 <?php 
173
-	    if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
173
+		if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
174 174
 ?>
175 175
 
176 176
 <script src="<?php print $globalURL; ?>/js/map.js.php?<?php print time(); ?>&archive&begindate=<?php print strtotime($_POST['start_date']); ?>&enddate=<?php print strtotime($_POST['end_date']); ?>&archivespeed=<?php print $_POST['archivespeed']; ?>"></script>
177 177
 <?php    
178
-	    }
179
-    } else {
178
+		}
179
+	} else {
180 180
 ?>
181 181
 <?php
182 182
 /*	if (isset($globalBeta) && $globalBeta) {
@@ -188,18 +188,18 @@  discard block
 block discarded – undo
188 188
 */
189 189
 ?>
190 190
 <?php 
191
-	    if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
191
+		if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
192 192
 ?>
193 193
 <script src="<?php print $globalURL; ?>/js/leaflet-playback.js"></script>
194 194
 <script src="<?php print $globalURL; ?>/js/map.js.php?<?php print time(); ?>"></script>
195 195
 <?php
196
-	    }
196
+		}
197 197
 ?>
198 198
 <?php
199 199
 //	}
200 200
 ?>
201 201
 <?php
202
-    }
202
+	}
203 203
 }
204 204
 ?>
205 205
 <?php
@@ -359,23 +359,23 @@  discard block
 block discarded – undo
359 359
             <li><a href="<?php print $globalURL; ?>/date/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Activity"); ?></a></li>
360 360
             <li><a href="<?php print $globalURL; ?>/newest"><?php echo _("Newest by Category"); ?></a></li>
361 361
             <?php
362
-        	if ($globalACARS) {
363
-        	    if (isset($globalDemo) && $globalDemo) {
364
-    	    ?>
362
+			if ($globalACARS) {
363
+				if (isset($globalDemo) && $globalDemo) {
364
+			?>
365 365
             <li><hr /></li>
366 366
             <li><i><?php echo _('ACARS data not available publicly'); ?></i></li>
367 367
             <li><a href=""><?php echo _('Latest ACARS messages'); ?></a></li>
368 368
             <li><a href=""><?php echo _('Archive ACARS messages'); ?></a></li>
369 369
             <?php
370
-        	    } else {
371
-    	    ?>
370
+				} else {
371
+			?>
372 372
             <li><hr /></li>
373 373
             <li><a href="<?php print $globalURL; ?>/acars-latest"><?php echo _("Latest ACARS messages"); ?></a></li>
374 374
             <li><a href="<?php print $globalURL; ?>/acars-archive"><?php echo _("Archive ACARS messages"); ?></a></li>
375 375
             <?php
376
-        	    }
377
-        	}
378
-    	    ?>
376
+				}
377
+			}
378
+			?>
379 379
             <li><hr /></li>
380 380
             <li><a href="<?php print $globalURL; ?>/highlights/table"><?php echo _("Special Highlights"); ?></a></li>
381 381
             <li><a href="<?php print $globalURL; ?>/upcoming"><?php echo _("Upcoming Flights"); ?></a></li>
@@ -417,14 +417,14 @@  discard block
 block discarded – undo
417 417
   	    <form>
418 418
   		<select class="selectpicker" data-width="120px" onchange="language(this);">
419 419
   		    <?php
420
-  		        $Language = new Language();
421
-  		        $alllang = $Language->getLanguages();
422
-  		        foreach ($alllang as $key => $lang) {
423
-  		            print '<option value="'.$key.'"';
424
-  		            if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected ';
425
-  		            print '>'.$lang[0].'</option>';
426
-  		        }
427
-  		    ?>
420
+  				$Language = new Language();
421
+  				$alllang = $Language->getLanguages();
422
+  				foreach ($alllang as $key => $lang) {
423
+  					print '<option value="'.$key.'"';
424
+  					if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected ';
425
+  					print '>'.$lang[0].'</option>';
426
+  				}
427
+  			?>
428 428
   		</select>
429 429
   	    </form>
430 430
   	</div>
@@ -455,18 +455,18 @@  discard block
 block discarded – undo
455 455
 ?>
456 456
     <div class="top-header clear" role="main">
457 457
 <?php
458
-    if (isset($longitude) && isset($latitude) && $longitude != 0 && $latitude != 0) {
458
+	if (isset($longitude) && isset($latitude) && $longitude != 0 && $latitude != 0) {
459 459
 ?>
460 460
     <div id="archive-map"></div>
461 461
 <?php
462
-    }
462
+	}
463 463
 ?>
464 464
     </div>
465 465
 <?php
466 466
 }
467 467
 if ((strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) || (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false))
468 468
 {
469
-    ?>
469
+	?>
470 470
     <div class="top-header clear" role="main">
471 471
         <div id="map"></div>
472 472
 	<link rel="stylesheet" href="<?php print $globalURL; ?>/css/leaflet.css" />
@@ -477,15 +477,15 @@  discard block
 block discarded – undo
477 477
         var zoom = 13;
478 478
 //create the map
479 479
 <?php
480
-    if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) {
480
+	if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) {
481 481
 ?>
482 482
   map = L.map('map', { zoomControl:true }).setView([<?php print $airport_array[0]['latitude']; ?>,<?php print $airport_array[0]['longitude']; ?>], zoom);
483 483
 <?php
484
-    } elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) {
484
+	} elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) {
485 485
 ?>
486 486
   map = L.map('map', { zoomControl:true });
487 487
 <?php
488
-    } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) {
488
+	} elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) {
489 489
 ?>
490 490
   map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['departure_airport_latitude']; ?>,<?php print $spotter_array[0]['arrival_airport_longitude']; ?>]);
491 491
     var line = L.polyline([[<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>],[<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>]]).addTo(map);
@@ -493,22 +493,22 @@  discard block
 block discarded – undo
493 493
     var departure_airport = L.marker([<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/departure_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map);
494 494
     var arrival_airport = L.marker([<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/arrival_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map);
495 495
 <?php
496
-    } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude'])) {
496
+	} elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude'])) {
497 497
 ?>
498 498
   map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['latitude']; ?>,<?php print $spotter_array[0]['longitude']; ?>]);
499 499
 <?php
500
-    } elseif (!isset($spotter_array[0]['latitude']) && !isset($spotter_array[0]['longitude'])) {
500
+	} elseif (!isset($spotter_array[0]['latitude']) && !isset($spotter_array[0]['longitude'])) {
501 501
 ?>
502 502
   map = L.map('map', { zoomControl:true });
503 503
 <?php
504
-    }
504
+	}
505 505
 ?>
506 506
   //initialize the layer group for the aircrft markers
507 507
   var layer_data = L.layerGroup();
508 508
 
509 509
   //a few title layers
510 510
 <?php
511
-    if ($globalMapProvider == 'Mapbox') {
511
+	if ($globalMapProvider == 'Mapbox') {
512 512
 ?>
513 513
   L.tileLayer('https://{s}.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={token}', {
514 514
     maxZoom: 18,
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
     token : '<?php print $globalMapboxToken; ?>'
520 520
   }).addTo(map);
521 521
 <?php
522
-    } elseif ($globalMapProvider == 'OpenStreetMap') {
522
+	} elseif ($globalMapProvider == 'OpenStreetMap') {
523 523
 ?>
524 524
   L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
525 525
     maxZoom: 18,
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
       '<a href="http://www.openstreetmap.org/copyright">Open Database Licence</a>'
528 528
   }).addTo(map);
529 529
 <?php
530
-    } elseif ($globalMapProvider == 'MapQuest-OSM') {
530
+	} elseif ($globalMapProvider == 'MapQuest-OSM') {
531 531
 ?>
532 532
   L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.png', {
533 533
     maxZoom: 18,
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
       'Tiles Courtesy of <a href="http://www.mapquest.com">MapQuest</a>'
537 537
   }).addTo(map);
538 538
 <?php
539
-    } elseif ($globalMapProvider == 'MapQuest-Aerial') {
539
+	} elseif ($globalMapProvider == 'MapQuest-Aerial') {
540 540
 ?>
541 541
   L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.png', {
542 542
     maxZoom: 18,
@@ -545,27 +545,27 @@  discard block
 block discarded – undo
545 545
       'Tiles Courtesy of <a href="http://www.mapquest.com">MapQuest</a>, Portions Courtesy NASA/JPL-Caltech and U.S. Depart. of Agriculture, Farm Service Agency"'
546 546
   }).addTo(map);
547 547
 <?php
548
-    } elseif ($globalMapProvider == 'Google-Roadmap') {
548
+	} elseif ($globalMapProvider == 'Google-Roadmap') {
549 549
 ?>
550 550
     var googleLayer = new L.Google('ROADMAP');
551 551
     map.addLayer(googleLayer);
552 552
 <?php
553
-    } elseif ($globalMapProvider == 'Google-Satellite') {
553
+	} elseif ($globalMapProvider == 'Google-Satellite') {
554 554
 ?>
555 555
     var googleLayer = new L.Google('SATELLITE');
556 556
     map.addLayer(googleLayer);
557 557
 <?php
558
-    } elseif ($globalMapProvider == 'Google-Hybrid') {
558
+	} elseif ($globalMapProvider == 'Google-Hybrid') {
559 559
 ?>
560 560
     var googleLayer = new L.Google('HYBRID');
561 561
     map.addLayer(googleLayer);
562 562
 <?php
563
-    } elseif ($globalMapProvider == 'Google-Terrain') {
563
+	} elseif ($globalMapProvider == 'Google-Terrain') {
564 564
 ?>
565 565
     var googleLayer = new L.Google('Terrain');
566 566
     map.addLayer(googleLayer);
567 567
 <?php
568
-    }
568
+	}
569 569
 ?>
570 570
         </script>
571 571
     </div>
Please login to merge, or discard this patch.
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   +104 added lines, -104 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];
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 		global $globalDBdriver, $globalLiveInterval;
108 108
 		date_default_timezone_set('UTC');
109 109
 
110
-		$filter_query = $this->getFilter($filter,true,true);
110
+		$filter_query = $this->getFilter($filter, true, true);
111 111
 
112 112
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
113 113
 		if ($globalDBdriver == 'mysql') {
@@ -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." spotter_live.latitude <> '0' AND spotter_live.longitude <> '0'";
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." spotter_live.latitude <> '0' AND spotter_live.longitude <> '0'";
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 AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' 
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 AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' 
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   +74 added lines, -25 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,true,true);
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).")");
@@ -832,7 +857,9 @@  discard block
 block discarded – undo
832 857
 			{
833 858
 				return false;
834 859
 			}
835
-		} else return '';
860
+		} else {
861
+			return '';
862
+		}
836 863
 
837 864
 		if ($longitude != '')
838 865
 		{
@@ -840,7 +867,9 @@  discard block
 block discarded – undo
840 867
 			{
841 868
 				return false;
842 869
 			}
843
-		} else return '';
870
+		} else {
871
+			return '';
872
+		}
844 873
 
845 874
 		if ($waypoints != '')
846 875
 		{
@@ -856,7 +885,9 @@  discard block
 block discarded – undo
856 885
 			{
857 886
 				return false;
858 887
 			}
859
-		} else $altitude = 0;
888
+		} else {
889
+			$altitude = 0;
890
+		}
860 891
 
861 892
 		if ($heading != '')
862 893
 		{
@@ -864,7 +895,9 @@  discard block
 block discarded – undo
864 895
 			{
865 896
 				return false;
866 897
 			}
867
-		} else $heading = 0;
898
+		} else {
899
+			$heading = 0;
900
+		}
868 901
 
869 902
 		if ($groundspeed != '')
870 903
 		{
@@ -872,9 +905,13 @@  discard block
 block discarded – undo
872 905
 			{
873 906
 				return false;
874 907
 			}
875
-		} else $groundspeed = 0;
908
+		} else {
909
+			$groundspeed = 0;
910
+		}
876 911
 		date_default_timezone_set('UTC');
877
-		if ($date == '') $date = date("Y-m-d H:i:s", time());
912
+		if ($date == '') {
913
+			$date = date("Y-m-d H:i:s", time());
914
+		}
878 915
 
879 916
         
880 917
 		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
@@ -918,10 +955,18 @@  discard block
 block discarded – undo
918 955
 		$arrival_airport_country = '';
919 956
 		
920 957
             	
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;
958
+            	if ($squawk == '' || $Common->isInteger($squawk) === false ) {
959
+            		$squawk = NULL;
960
+            	}
961
+            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) {
962
+            		$verticalrate = NULL;
963
+            	}
964
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) {
965
+            		$groundspeed = 0;
966
+            	}
967
+            	if ($heading == '' || $Common->isInteger($heading) === false ) {
968
+            		$heading = 0;
969
+            	}
925 970
             	
926 971
 		$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 972
 		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 +981,13 @@  discard block
 block discarded – undo
936 981
                 	return "error : ".$e->getMessage();
937 982
                 }
938 983
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
939
-		    if ($globalDebug) echo '(Add to SBS archive : ';
984
+		    if ($globalDebug) {
985
+		    	echo '(Add to SBS archive : ';
986
+		    }
940 987
 		    $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.')';
988
+		    if ($globalDebug) {
989
+		    	echo $result.')';
990
+		    }
942 991
 		}
943 992
 		return "success";
944 993
 
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   +1270 added lines, -1270 removed lines patch added patch discarded remove patch
@@ -13,10 +13,10 @@  discard block
 block discarded – undo
13 13
 	}
14 14
 
15 15
 	/**
16
-	* Get SQL query part for filter used
17
-	* @param Array $filter the filter
18
-	* @return Array the SQL part
19
-	*/
16
+	 * Get SQL query part for filter used
17
+	 * @param Array $filter the filter
18
+	 * @return Array the SQL part
19
+	 */
20 20
 	public function getFilter($filter = array(),$where = false,$and = false) {
21 21
 		global $globalFilter, $globalStatsFilters, $globalFilterName;
22 22
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) $filter = array_merge($globalStatsFilters[$globalFilterName],$filter);
@@ -55,14 +55,14 @@  discard block
 block discarded – undo
55 55
 	}
56 56
 
57 57
 	/**
58
-	* Executes the SQL statements to get the spotter information
59
-	*
60
-	* @param String $query the SQL query
61
-	* @param Array $params parameter of the query
62
-	* @param String $limitQuery the limit query
63
-	* @return Array the spotter information
64
-	*
65
-	*/
58
+	 * Executes the SQL statements to get the spotter information
59
+	 *
60
+	 * @param String $query the SQL query
61
+	 * @param Array $params parameter of the query
62
+	 * @param String $limitQuery the limit query
63
+	 * @return Array the spotter information
64
+	 *
65
+	 */
66 66
 	public function getDataFromDB($query, $params = array(), $limitQuery = '')
67 67
 	{
68 68
 		global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalAirlinesSource, $globalVAM;
@@ -226,11 +226,11 @@  discard block
 block discarded – undo
226 226
 					if ($aircraft_array[0]['aircraft_shadow'] != NULL) {
227 227
 						$temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow'];
228 228
 					} else $temp_array['aircraft_shadow'] = 'default.png';
229
-                                } else {
230
-                            		$temp_array['aircraft_shadow'] = 'default.png';
229
+								} else {
230
+									$temp_array['aircraft_shadow'] = 'default.png';
231 231
 					$temp_array['aircraft_name'] = 'N/A';
232 232
 					$temp_array['aircraft_manufacturer'] = 'N/A';
233
-                            	}
233
+								}
234 234
 			}
235 235
 			$fromsource = NULL;
236 236
 			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
@@ -413,11 +413,11 @@  discard block
 block discarded – undo
413 413
 	
414 414
 	
415 415
 	/**
416
-	* Gets all the spotter information
417
-	*
418
-	* @return Array the spotter information
419
-	*
420
-	*/
416
+	 * Gets all the spotter information
417
+	 *
418
+	 * @return Array the spotter information
419
+	 *
420
+	 */
421 421
 	public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array())
422 422
 	{
423 423
 		global $globalTimezone, $globalDBdriver;
@@ -764,11 +764,11 @@  discard block
 block discarded – undo
764 764
 	
765 765
 	
766 766
 	/**
767
-	* Gets all the spotter information based on the latest data entry
768
-	*
769
-	* @return Array the spotter information
770
-	*
771
-	*/
767
+	 * Gets all the spotter information based on the latest data entry
768
+	 *
769
+	 * @return Array the spotter information
770
+	 *
771
+	 */
772 772
 	public function getLatestSpotterData($limit = '', $sort = '', $filter = array())
773 773
 	{
774 774
 		global $global_query;
@@ -807,12 +807,12 @@  discard block
 block discarded – undo
807 807
 	}
808 808
     
809 809
     
810
-    /**
811
-	* Gets all the spotter information based on a user's latitude and longitude
812
-	*
813
-	* @return Array the spotter information
814
-	*
815
-	*/
810
+	/**
811
+	 * Gets all the spotter information based on a user's latitude and longitude
812
+	 *
813
+	 * @return Array the spotter information
814
+	 *
815
+	 */
816 816
 	public function getLatestSpotterForLayar($lat, $lng, $radius, $interval)
817 817
 	{
818 818
 		date_default_timezone_set('UTC');
@@ -840,7 +840,7 @@  discard block
 block discarded – undo
840 840
 				return false;
841 841
 			}
842 842
 		}
843
-    		$additional_query = '';
843
+			$additional_query = '';
844 844
 		if ($interval != "")
845 845
 		{
846 846
 			if (!is_string($interval))
@@ -880,12 +880,12 @@  discard block
 block discarded – undo
880 880
 	}
881 881
     
882 882
     
883
-    /**
884
-	* Gets all the spotter information sorted by the newest aircraft type
885
-	*
886
-	* @return Array the spotter information
887
-	*
888
-	*/
883
+	/**
884
+	 * Gets all the spotter information sorted by the newest aircraft type
885
+	 *
886
+	 * @return Array the spotter information
887
+	 *
888
+	 */
889 889
 	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array())
890 890
 	{
891 891
 		global $global_query;
@@ -926,11 +926,11 @@  discard block
 block discarded – undo
926 926
     
927 927
     
928 928
 	/**
929
-	* Gets all the spotter information sorted by the newest aircraft registration
930
-	*
931
-	* @return Array the spotter information
932
-	*
933
-	*/
929
+	 * Gets all the spotter information sorted by the newest aircraft registration
930
+	 *
931
+	 * @return Array the spotter information
932
+	 *
933
+	 */
934 934
 	public function getNewestSpotterDataSortedByAircraftRegistration($limit = '', $sort = '', $filter = array())
935 935
 	{
936 936
 		global $global_query;
@@ -970,11 +970,11 @@  discard block
 block discarded – undo
970 970
 
971 971
 
972 972
 	/**
973
-	* Gets all the spotter information sorted by the newest airline
974
-	*
975
-	* @return Array the spotter information
976
-	*
977
-	*/
973
+	 * Gets all the spotter information sorted by the newest airline
974
+	 *
975
+	 * @return Array the spotter information
976
+	 *
977
+	 */
978 978
 	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array())
979 979
 	{
980 980
 		global $global_query;
@@ -1013,12 +1013,12 @@  discard block
 block discarded – undo
1013 1013
 	}
1014 1014
     
1015 1015
     
1016
-    /**
1017
-	* Gets all the spotter information sorted by the newest departure airport
1018
-	*
1019
-	* @return Array the spotter information
1020
-	*
1021
-	*/
1016
+	/**
1017
+	 * Gets all the spotter information sorted by the newest departure airport
1018
+	 *
1019
+	 * @return Array the spotter information
1020
+	 *
1021
+	 */
1022 1022
 	public function getNewestSpotterDataSortedByDepartureAirport($limit = '', $sort = '', $filter = array())
1023 1023
 	{
1024 1024
 		global $global_query;
@@ -1060,11 +1060,11 @@  discard block
 block discarded – undo
1060 1060
 
1061 1061
 
1062 1062
 	/**
1063
-	* Gets all the spotter information sorted by the newest arrival airport
1064
-	*
1065
-	* @return Array the spotter information
1066
-	*
1067
-	*/
1063
+	 * Gets all the spotter information sorted by the newest arrival airport
1064
+	 *
1065
+	 * @return Array the spotter information
1066
+	 *
1067
+	 */
1068 1068
 	public function getNewestSpotterDataSortedByArrivalAirport($limit = '', $sort = '', $filter = array())
1069 1069
 	{
1070 1070
 		global $global_query;
@@ -1103,11 +1103,11 @@  discard block
 block discarded – undo
1103 1103
 	
1104 1104
 
1105 1105
 	/**
1106
-	* Gets all the spotter information based on the spotter id
1107
-	*
1108
-	* @return Array the spotter information
1109
-	*
1110
-	*/
1106
+	 * Gets all the spotter information based on the spotter id
1107
+	 *
1108
+	 * @return Array the spotter information
1109
+	 *
1110
+	 */
1111 1111
 	public function getSpotterDataByID($id = '')
1112 1112
 	{
1113 1113
 		global $global_query;
@@ -1129,11 +1129,11 @@  discard block
 block discarded – undo
1129 1129
 	
1130 1130
 	
1131 1131
 	/**
1132
-	* Gets all the spotter information based on the callsign
1133
-	*
1134
-	* @return Array the spotter information
1135
-	*
1136
-	*/
1132
+	 * Gets all the spotter information based on the callsign
1133
+	 *
1134
+	 * @return Array the spotter information
1135
+	 *
1136
+	 */
1137 1137
 	public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '')
1138 1138
 	{
1139 1139
 		global $global_query;
@@ -1186,11 +1186,11 @@  discard block
 block discarded – undo
1186 1186
 	
1187 1187
 	
1188 1188
 	/**
1189
-	* Gets all the spotter information based on the aircraft type
1190
-	*
1191
-	* @return Array the spotter information
1192
-	*
1193
-	*/
1189
+	 * Gets all the spotter information based on the aircraft type
1190
+	 *
1191
+	 * @return Array the spotter information
1192
+	 *
1193
+	 */
1194 1194
 	public function getSpotterDataByAircraft($aircraft_type = '', $limit = '', $sort = '', $filter = array())
1195 1195
 	{
1196 1196
 		global $global_query;
@@ -1244,11 +1244,11 @@  discard block
 block discarded – undo
1244 1244
 	
1245 1245
 	
1246 1246
 	/**
1247
-	* Gets all the spotter information based on the aircraft registration
1248
-	*
1249
-	* @return Array the spotter information
1250
-	*
1251
-	*/
1247
+	 * Gets all the spotter information based on the aircraft registration
1248
+	 *
1249
+	 * @return Array the spotter information
1250
+	 *
1251
+	 */
1252 1252
 	public function getSpotterDataByRegistration($registration = '', $limit = '', $sort = '', $filter = array())
1253 1253
 	{
1254 1254
 		global $global_query;
@@ -1305,11 +1305,11 @@  discard block
 block discarded – undo
1305 1305
 	
1306 1306
 	
1307 1307
 	/**
1308
-	* Gets all the spotter information based on the airline
1309
-	*
1310
-	* @return Array the spotter information
1311
-	*
1312
-	*/
1308
+	 * Gets all the spotter information based on the airline
1309
+	 *
1310
+	 * @return Array the spotter information
1311
+	 *
1312
+	 */
1313 1313
 	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array())
1314 1314
 	{
1315 1315
 		global $global_query;
@@ -1362,11 +1362,11 @@  discard block
 block discarded – undo
1362 1362
 	
1363 1363
 	
1364 1364
 	/**
1365
-	* Gets all the spotter information based on the airport
1366
-	*
1367
-	* @return Array the spotter information
1368
-	*
1369
-	*/
1365
+	 * Gets all the spotter information based on the airport
1366
+	 *
1367
+	 * @return Array the spotter information
1368
+	 *
1369
+	 */
1370 1370
 	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1371 1371
 	{
1372 1372
 		global $global_query;
@@ -1420,11 +1420,11 @@  discard block
 block discarded – undo
1420 1420
 
1421 1421
 
1422 1422
 	/**
1423
-	* Gets all the spotter information based on the date
1424
-	*
1425
-	* @return Array the spotter information
1426
-	*
1427
-	*/
1423
+	 * Gets all the spotter information based on the date
1424
+	 *
1425
+	 * @return Array the spotter information
1426
+	 *
1427
+	 */
1428 1428
 	public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array())
1429 1429
 	{
1430 1430
 		global $global_query, $globalTimezone, $globalDBdriver;
@@ -1485,11 +1485,11 @@  discard block
 block discarded – undo
1485 1485
 
1486 1486
 
1487 1487
 	/**
1488
-	* Gets all the spotter information based on the country name
1489
-	*
1490
-	* @return Array the spotter information
1491
-	*
1492
-	*/
1488
+	 * Gets all the spotter information based on the country name
1489
+	 *
1490
+	 * @return Array the spotter information
1491
+	 *
1492
+	 */
1493 1493
 	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array())
1494 1494
 	{
1495 1495
 		global $global_query;
@@ -1543,11 +1543,11 @@  discard block
 block discarded – undo
1543 1543
 	
1544 1544
 	
1545 1545
 	/**
1546
-	* Gets all the spotter information based on the manufacturer name
1547
-	*
1548
-	* @return Array the spotter information
1549
-	*
1550
-	*/
1546
+	 * Gets all the spotter information based on the manufacturer name
1547
+	 *
1548
+	 * @return Array the spotter information
1549
+	 *
1550
+	 */
1551 1551
 	public function getSpotterDataByManufacturer($aircraft_manufacturer = '', $limit = '', $sort = '', $filters = array())
1552 1552
 	{
1553 1553
 		global $global_query;
@@ -1603,13 +1603,13 @@  discard block
 block discarded – undo
1603 1603
   
1604 1604
   
1605 1605
 	/**
1606
-	* Gets a list of all aircraft that take a route
1607
-	*
1608
-	* @param String $departure_airport_icao ICAO code of departure airport
1609
-	* @param String $arrival_airport_icao ICAO code of arrival airport
1610
-	* @return Array the spotter information
1611
-	*
1612
-	*/
1606
+	 * Gets a list of all aircraft that take a route
1607
+	 *
1608
+	 * @param String $departure_airport_icao ICAO code of departure airport
1609
+	 * @param String $arrival_airport_icao ICAO code of arrival airport
1610
+	 * @return Array the spotter information
1611
+	 *
1612
+	 */
1613 1613
 	public function getSpotterDataByRoute($departure_airport_icao = '', $arrival_airport_icao = '', $limit = '', $sort = '', $filters = array())
1614 1614
 	{
1615 1615
 		global $global_query;
@@ -1676,11 +1676,11 @@  discard block
 block discarded – undo
1676 1676
 	
1677 1677
 	
1678 1678
 	/**
1679
-	* Gets all the spotter information based on the special column in the table
1680
-	*
1681
-	* @return Array the spotter information
1682
-	*
1683
-	*/
1679
+	 * Gets all the spotter information based on the special column in the table
1680
+	 *
1681
+	 * @return Array the spotter information
1682
+	 *
1683
+	 */
1684 1684
 	public function getSpotterDataByHighlight($limit = '', $sort = '', $filter = array())
1685 1685
 	{
1686 1686
 		global $global_query;
@@ -1719,11 +1719,11 @@  discard block
 block discarded – undo
1719 1719
 	}
1720 1720
 
1721 1721
 	/**
1722
-	* Gets all the highlight based on a aircraft registration
1723
-	*
1724
-	* @return String the highlight text
1725
-	*
1726
-	*/
1722
+	 * Gets all the highlight based on a aircraft registration
1723
+	 *
1724
+	 * @return String the highlight text
1725
+	 *
1726
+	 */
1727 1727
 	public function getHighlightByRegistration($registration,$filter = array())
1728 1728
 	{
1729 1729
 		global $global_query;
@@ -1745,13 +1745,13 @@  discard block
 block discarded – undo
1745 1745
 
1746 1746
 	
1747 1747
 	/**
1748
-	* Gets the squawk usage from squawk code
1749
-	*
1750
-	* @param String $squawk squawk code
1751
-	* @param String $country country
1752
-	* @return String usage
1753
-	*
1754
-	*/
1748
+	 * Gets the squawk usage from squawk code
1749
+	 *
1750
+	 * @param String $squawk squawk code
1751
+	 * @param String $country country
1752
+	 * @return String usage
1753
+	 *
1754
+	 */
1755 1755
 	public function getSquawkUsage($squawk = '',$country = 'FR')
1756 1756
 	{
1757 1757
 		
@@ -1772,12 +1772,12 @@  discard block
 block discarded – undo
1772 1772
 	}
1773 1773
 
1774 1774
 	/**
1775
-	* Gets the airport icao from the iata
1776
-	*
1777
-	* @param String $airport_iata the iata code of the airport
1778
-	* @return String airport iata
1779
-	*
1780
-	*/
1775
+	 * Gets the airport icao from the iata
1776
+	 *
1777
+	 * @param String $airport_iata the iata code of the airport
1778
+	 * @return String airport iata
1779
+	 *
1780
+	 */
1781 1781
 	public function getAirportIcao($airport_iata = '')
1782 1782
 	{
1783 1783
 		
@@ -1797,14 +1797,14 @@  discard block
 block discarded – undo
1797 1797
 	}
1798 1798
 
1799 1799
 	/**
1800
-	* Gets the airport distance
1801
-	*
1802
-	* @param String $airport_icao the icao code of the airport
1803
-	* @param Float $latitude the latitude
1804
-	* @param Float $longitude the longitude
1805
-	* @return Float distance to the airport
1806
-	*
1807
-	*/
1800
+	 * Gets the airport distance
1801
+	 *
1802
+	 * @param String $airport_icao the icao code of the airport
1803
+	 * @param Float $latitude the latitude
1804
+	 * @param Float $longitude the longitude
1805
+	 * @return Float distance to the airport
1806
+	 *
1807
+	 */
1808 1808
 	public function getAirportDistance($airport_icao,$latitude,$longitude)
1809 1809
 	{
1810 1810
 		
@@ -1825,12 +1825,12 @@  discard block
 block discarded – undo
1825 1825
 	}
1826 1826
 	
1827 1827
 	/**
1828
-	* Gets the airport info based on the icao
1829
-	*
1830
-	* @param String $airport the icao code of the airport
1831
-	* @return Array airport information
1832
-	*
1833
-	*/
1828
+	 * Gets the airport info based on the icao
1829
+	 *
1830
+	 * @param String $airport the icao code of the airport
1831
+	 * @return Array airport information
1832
+	 *
1833
+	 */
1834 1834
 	public function getAllAirportInfo($airport = '')
1835 1835
 	{
1836 1836
 		
@@ -1876,12 +1876,12 @@  discard block
 block discarded – undo
1876 1876
 	}
1877 1877
 	
1878 1878
 	/**
1879
-	* Gets the airport info based on the country
1880
-	*
1881
-	* @param Array $countries Airports countries
1882
-	* @return Array airport information
1883
-	*
1884
-	*/
1879
+	 * Gets the airport info based on the country
1880
+	 *
1881
+	 * @param Array $countries Airports countries
1882
+	 * @return Array airport information
1883
+	 *
1884
+	 */
1885 1885
 	public function getAllAirportInfobyCountry($countries)
1886 1886
 	{
1887 1887
 		$lst_countries = '';
@@ -1919,12 +1919,12 @@  discard block
 block discarded – undo
1919 1919
 	}
1920 1920
 	
1921 1921
 	/**
1922
-	* Gets airports info based on the coord
1923
-	*
1924
-	* @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
1925
-	* @return Array airport information
1926
-	*
1927
-	*/
1922
+	 * Gets airports info based on the coord
1923
+	 *
1924
+	 * @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
1925
+	 * @return Array airport information
1926
+	 *
1927
+	 */
1928 1928
 	public function getAllAirportInfobyCoord($coord)
1929 1929
 	{
1930 1930
 		global $globalDBdriver;
@@ -1955,12 +1955,12 @@  discard block
 block discarded – undo
1955 1955
 	}
1956 1956
 
1957 1957
 	/**
1958
-	* Gets waypoints info based on the coord
1959
-	*
1960
-	* @param Array $coord waypoints coord
1961
-	* @return Array airport information
1962
-	*
1963
-	*/
1958
+	 * Gets waypoints info based on the coord
1959
+	 *
1960
+	 * @param Array $coord waypoints coord
1961
+	 * @return Array airport information
1962
+	 *
1963
+	 */
1964 1964
 	public function getAllWaypointsInfobyCoord($coord)
1965 1965
 	{
1966 1966
 		if (is_array($coord)) {
@@ -1994,12 +1994,12 @@  discard block
 block discarded – undo
1994 1994
 	
1995 1995
 	
1996 1996
 	/**
1997
-	* Gets the airline info based on the icao code or iata code
1998
-	*
1999
-	* @param String $airline_icao the iata code of the airport
2000
-	* @return Array airport information
2001
-	*
2002
-	*/
1997
+	 * Gets the airline info based on the icao code or iata code
1998
+	 *
1999
+	 * @param String $airline_icao the iata code of the airport
2000
+	 * @return Array airport information
2001
+	 *
2002
+	 */
2003 2003
 	public function getAllAirlineInfo($airline_icao, $fromsource = NULL)
2004 2004
 	{
2005 2005
 		global $globalUseRealAirlines;
@@ -2030,7 +2030,7 @@  discard block
 block discarded – undo
2030 2030
 			} else {
2031 2031
 				$sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource));
2032 2032
 			}
2033
-                        /*
2033
+						/*
2034 2034
 			$airline_array = array();
2035 2035
 			$temp_array = array();
2036 2036
 		
@@ -2062,12 +2062,12 @@  discard block
 block discarded – undo
2062 2062
 	
2063 2063
 	
2064 2064
 	/**
2065
-	* Gets the aircraft info based on the aircraft type
2066
-	*
2067
-	* @param String $aircraft_type the aircraft type
2068
-	* @return Array aircraft information
2069
-	*
2070
-	*/
2065
+	 * Gets the aircraft info based on the aircraft type
2066
+	 *
2067
+	 * @param String $aircraft_type the aircraft type
2068
+	 * @return Array aircraft information
2069
+	 *
2070
+	 */
2071 2071
 	public function getAllAircraftInfo($aircraft_type)
2072 2072
 	{
2073 2073
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2099,12 +2099,12 @@  discard block
 block discarded – undo
2099 2099
 	}
2100 2100
 
2101 2101
 	/**
2102
-	* Gets the aircraft icao based on the aircraft name/type
2103
-	*
2104
-	* @param String $aircraft_type the aircraft type
2105
-	* @return String aircraft information
2106
-	*
2107
-	*/
2102
+	 * Gets the aircraft icao based on the aircraft name/type
2103
+	 *
2104
+	 * @param String $aircraft_type the aircraft type
2105
+	 * @return String aircraft information
2106
+	 *
2107
+	 */
2108 2108
 	public function getAircraftIcao($aircraft_type)
2109 2109
 	{
2110 2110
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2129,12 +2129,12 @@  discard block
 block discarded – undo
2129 2129
 	}
2130 2130
 	
2131 2131
 	/**
2132
-	* Gets the aircraft info based on the aircraft ident
2133
-	*
2134
-	* @param String $aircraft_modes the aircraft ident (hex)
2135
-	* @return String aircraft type
2136
-	*
2137
-	*/
2132
+	 * Gets the aircraft info based on the aircraft ident
2133
+	 *
2134
+	 * @param String $aircraft_modes the aircraft ident (hex)
2135
+	 * @return String aircraft type
2136
+	 *
2137
+	 */
2138 2138
 	public function getAllAircraftType($aircraft_modes)
2139 2139
 	{
2140 2140
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -2152,12 +2152,12 @@  discard block
 block discarded – undo
2152 2152
 	}
2153 2153
 
2154 2154
 	/**
2155
-	* Gets correct aircraft operator corde
2156
-	*
2157
-	* @param String $operator the aircraft operator code (callsign)
2158
-	* @return String aircraft operator code
2159
-	*
2160
-	*/
2155
+	 * Gets correct aircraft operator corde
2156
+	 *
2157
+	 * @param String $operator the aircraft operator code (callsign)
2158
+	 * @return String aircraft operator code
2159
+	 *
2160
+	 */
2161 2161
 	public function getOperator($operator)
2162 2162
 	{
2163 2163
 		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
@@ -2174,16 +2174,16 @@  discard block
 block discarded – undo
2174 2174
 	}
2175 2175
 
2176 2176
 	/**
2177
-	* Gets the aircraft route based on the aircraft callsign
2178
-	*
2179
-	* @param String $callsign the aircraft callsign
2180
-	* @return Array aircraft type
2181
-	*
2182
-	*/
2177
+	 * Gets the aircraft route based on the aircraft callsign
2178
+	 *
2179
+	 * @param String $callsign the aircraft callsign
2180
+	 * @return Array aircraft type
2181
+	 *
2182
+	 */
2183 2183
 	public function getRouteInfo($callsign)
2184 2184
 	{
2185 2185
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2186
-                if ($callsign == '') return array();
2186
+				if ($callsign == '') return array();
2187 2187
 		$query  = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1";
2188 2188
 		
2189 2189
 		$sth = $this->db->prepare($query);
@@ -2197,12 +2197,12 @@  discard block
 block discarded – undo
2197 2197
 	}
2198 2198
 	
2199 2199
 	/**
2200
-	* Gets the aircraft info based on the aircraft registration
2201
-	*
2202
-	* @param String $registration the aircraft registration
2203
-	* @return Array aircraft information
2204
-	*
2205
-	*/
2200
+	 * Gets the aircraft info based on the aircraft registration
2201
+	 *
2202
+	 * @param String $registration the aircraft registration
2203
+	 * @return Array aircraft information
2204
+	 *
2205
+	 */
2206 2206
 	public function getAircraftInfoByRegistration($registration)
2207 2207
 	{
2208 2208
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2229,12 +2229,12 @@  discard block
 block discarded – undo
2229 2229
 	}
2230 2230
 	
2231 2231
 	/**
2232
-	* Gets the aircraft owner & base based on the aircraft registration
2233
-	*
2234
-	* @param String $registration the aircraft registration
2235
-	* @return Array aircraft information
2236
-	*
2237
-	*/
2232
+	 * Gets the aircraft owner & base based on the aircraft registration
2233
+	 *
2234
+	 * @param String $registration the aircraft registration
2235
+	 * @return Array aircraft information
2236
+	 *
2237
+	 */
2238 2238
 	public function getAircraftOwnerByRegistration($registration)
2239 2239
 	{
2240 2240
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2251,11 +2251,11 @@  discard block
 block discarded – undo
2251 2251
 	
2252 2252
   
2253 2253
   /**
2254
-	* Gets all flights (but with only little info)
2255
-	*
2256
-	* @return Array basic flight information
2257
-	*
2258
-	*/
2254
+   * Gets all flights (but with only little info)
2255
+   *
2256
+   * @return Array basic flight information
2257
+   *
2258
+   */
2259 2259
 	public function getAllFlightsforSitemap()
2260 2260
 	{
2261 2261
 		//$query  = "SELECT spotter_output.spotter_id, spotter_output.ident, spotter_output.airline_name, spotter_output.aircraft_name, spotter_output.aircraft_icao FROM spotter_output ORDER BY LIMIT ";
@@ -2263,7 +2263,7 @@  discard block
 block discarded – undo
2263 2263
 		
2264 2264
 		$sth = $this->db->prepare($query);
2265 2265
 		$sth->execute();
2266
-                  /*
2266
+				  /*
2267 2267
 		$flight_array = array();
2268 2268
 		$temp_array = array();
2269 2269
 		
@@ -2285,11 +2285,11 @@  discard block
 block discarded – undo
2285 2285
 	}
2286 2286
   
2287 2287
 	/**
2288
-	* Gets a list of all aircraft manufacturers
2289
-	*
2290
-	* @return Array list of aircraft types
2291
-	*
2292
-	*/
2288
+	 * Gets a list of all aircraft manufacturers
2289
+	 *
2290
+	 * @return Array list of aircraft types
2291
+	 *
2292
+	 */
2293 2293
 	public function getAllManufacturers()
2294 2294
 	{
2295 2295
 		/*
@@ -2318,11 +2318,11 @@  discard block
 block discarded – undo
2318 2318
   
2319 2319
   
2320 2320
   /**
2321
-	* Gets a list of all aircraft types
2322
-	*
2323
-	* @return Array list of aircraft types
2324
-	*
2325
-	*/
2321
+   * Gets a list of all aircraft types
2322
+   *
2323
+   * @return Array list of aircraft types
2324
+   *
2325
+   */
2326 2326
 	public function getAllAircraftTypes($filters = array())
2327 2327
 	{
2328 2328
 		/*
@@ -2355,11 +2355,11 @@  discard block
 block discarded – undo
2355 2355
 	
2356 2356
 	
2357 2357
 	/**
2358
-	* Gets a list of all aircraft registrations
2359
-	*
2360
-	* @return Array list of aircraft registrations
2361
-	*
2362
-	*/
2358
+	 * Gets a list of all aircraft registrations
2359
+	 *
2360
+	 * @return Array list of aircraft registrations
2361
+	 *
2362
+	 */
2363 2363
 	public function getAllAircraftRegistrations($filters = array())
2364 2364
 	{
2365 2365
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2384,12 +2384,12 @@  discard block
 block discarded – undo
2384 2384
 	}
2385 2385
 
2386 2386
 	/**
2387
-	* Gets all source name
2388
-	*
2389
-	* @param String type format of source
2390
-	* @return Array list of source name
2391
-	*
2392
-	*/
2387
+	 * Gets all source name
2388
+	 *
2389
+	 * @param String type format of source
2390
+	 * @return Array list of source name
2391
+	 *
2392
+	 */
2393 2393
 	public function getAllSourceName($type = '',$filters = array())
2394 2394
 	{
2395 2395
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2420,11 +2420,11 @@  discard block
 block discarded – undo
2420 2420
 
2421 2421
 
2422 2422
 	/**
2423
-	* Gets a list of all airline names
2424
-	*
2425
-	* @return Array list of airline names
2426
-	*
2427
-	*/
2423
+	 * Gets a list of all airline names
2424
+	 *
2425
+	 * @return Array list of airline names
2426
+	 *
2427
+	 */
2428 2428
 	public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array())
2429 2429
 	{
2430 2430
 		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
@@ -2474,11 +2474,11 @@  discard block
 block discarded – undo
2474 2474
 	
2475 2475
 	
2476 2476
 	/**
2477
-	* Gets a list of all airline countries
2478
-	*
2479
-	* @return Array list of airline countries
2480
-	*
2481
-	*/
2477
+	 * Gets a list of all airline countries
2478
+	 *
2479
+	 * @return Array list of airline countries
2480
+	 *
2481
+	 */
2482 2482
 	public function getAllAirlineCountries($filters = array())
2483 2483
 	{
2484 2484
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2506,11 +2506,11 @@  discard block
 block discarded – undo
2506 2506
 	
2507 2507
 	
2508 2508
 	/**
2509
-	* Gets a list of all departure & arrival names
2510
-	*
2511
-	* @return Array list of airport names
2512
-	*
2513
-	*/
2509
+	 * Gets a list of all departure & arrival names
2510
+	 *
2511
+	 * @return Array list of airport names
2512
+	 *
2513
+	 */
2514 2514
 	public function getAllAirportNames($filters = array())
2515 2515
 	{
2516 2516
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2559,11 +2559,11 @@  discard block
 block discarded – undo
2559 2559
 	
2560 2560
 	
2561 2561
 	/**
2562
-	* Gets a list of all departure & arrival airport countries
2563
-	*
2564
-	* @return Array list of airport countries
2565
-	*
2566
-	*/
2562
+	 * Gets a list of all departure & arrival airport countries
2563
+	 *
2564
+	 * @return Array list of airport countries
2565
+	 *
2566
+	 */
2567 2567
 	public function getAllAirportCountries($filters = array())
2568 2568
 	{
2569 2569
 		$airport_array = array();
@@ -2611,11 +2611,11 @@  discard block
 block discarded – undo
2611 2611
 	
2612 2612
 	
2613 2613
 	/**
2614
-	* Gets a list of all countries (airline, departure airport & arrival airport)
2615
-	*
2616
-	* @return Array list of countries
2617
-	*
2618
-	*/
2614
+	 * Gets a list of all countries (airline, departure airport & arrival airport)
2615
+	 *
2616
+	 * @return Array list of countries
2617
+	 *
2618
+	 */
2619 2619
 	public function getAllCountries($filters = array())
2620 2620
 	{
2621 2621
 		$Connection= new Connection($this->db);
@@ -2692,11 +2692,11 @@  discard block
 block discarded – undo
2692 2692
 	
2693 2693
 	
2694 2694
 	/**
2695
-	* Gets a list of all idents/callsigns
2696
-	*
2697
-	* @return Array list of ident/callsign names
2698
-	*
2699
-	*/
2695
+	 * Gets a list of all idents/callsigns
2696
+	 *
2697
+	 * @return Array list of ident/callsign names
2698
+	 *
2699
+	 */
2700 2700
 	public function getAllIdents($filters = array())
2701 2701
 	{
2702 2702
 		$filter_query = $this->getFilter($filters,true,true);
@@ -2720,9 +2720,9 @@  discard block
 block discarded – undo
2720 2720
 	}
2721 2721
 
2722 2722
 	/**
2723
-	* Get a list of flights from airport since 7 days
2724
-	* @return Array number, icao, name and city of airports
2725
-	*/
2723
+	 * Get a list of flights from airport since 7 days
2724
+	 * @return Array number, icao, name and city of airports
2725
+	 */
2726 2726
 
2727 2727
 	public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) {
2728 2728
 		global $globalTimezone, $globalDBdriver;
@@ -2753,9 +2753,9 @@  discard block
 block discarded – undo
2753 2753
 	}
2754 2754
 
2755 2755
 	/**
2756
-	* Get a list of flights from airport since 7 days
2757
-	* @return Array number, icao, name and city of airports
2758
-	*/
2756
+	 * Get a list of flights from airport since 7 days
2757
+	 * @return Array number, icao, name and city of airports
2758
+	 */
2759 2759
 
2760 2760
 	public function getLast7DaysAirportsDepartureByAirlines($airport_icao = '') {
2761 2761
 		global $globalTimezone, $globalDBdriver;
@@ -2785,9 +2785,9 @@  discard block
 block discarded – undo
2785 2785
 	}
2786 2786
 
2787 2787
 	/**
2788
-	* Get a list of flights from detected airport since 7 days
2789
-	* @return Array number, icao, name and city of airports
2790
-	*/
2788
+	 * Get a list of flights from detected airport since 7 days
2789
+	 * @return Array number, icao, name and city of airports
2790
+	 */
2791 2791
 
2792 2792
 	public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) {
2793 2793
 		global $globalTimezone, $globalDBdriver;
@@ -2825,9 +2825,9 @@  discard block
 block discarded – undo
2825 2825
 	}
2826 2826
 
2827 2827
 	/**
2828
-	* Get a list of flights from detected airport since 7 days
2829
-	* @return Array number, icao, name and city of airports
2830
-	*/
2828
+	 * Get a list of flights from detected airport since 7 days
2829
+	 * @return Array number, icao, name and city of airports
2830
+	 */
2831 2831
 
2832 2832
 	public function getLast7DaysDetectedAirportsDepartureByAirlines($airport_icao = '') {
2833 2833
 		global $globalTimezone, $globalDBdriver;
@@ -2869,9 +2869,9 @@  discard block
 block discarded – undo
2869 2869
 
2870 2870
 
2871 2871
 	/**
2872
-	* Get a list of flights to airport since 7 days
2873
-	* @return Array number, icao, name and city of airports
2874
-	*/
2872
+	 * Get a list of flights to airport since 7 days
2873
+	 * @return Array number, icao, name and city of airports
2874
+	 */
2875 2875
 
2876 2876
 	public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) {
2877 2877
 		global $globalTimezone, $globalDBdriver;
@@ -2904,9 +2904,9 @@  discard block
 block discarded – undo
2904 2904
 
2905 2905
 
2906 2906
 	/**
2907
-	* Get a list of flights detected to airport since 7 days
2908
-	* @return Array number, icao, name and city of airports
2909
-	*/
2907
+	 * Get a list of flights detected to airport since 7 days
2908
+	 * @return Array number, icao, name and city of airports
2909
+	 */
2910 2910
 
2911 2911
 	public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) {
2912 2912
 		global $globalTimezone, $globalDBdriver;
@@ -2947,9 +2947,9 @@  discard block
 block discarded – undo
2947 2947
 
2948 2948
 
2949 2949
 	/**
2950
-	* Get a list of flights to airport since 7 days
2951
-	* @return Array number, icao, name and city of airports
2952
-	*/
2950
+	 * Get a list of flights to airport since 7 days
2951
+	 * @return Array number, icao, name and city of airports
2952
+	 */
2953 2953
 
2954 2954
 	public function getLast7DaysAirportsArrivalByAirlines($airport_icao = '') {
2955 2955
 		global $globalTimezone, $globalDBdriver;
@@ -2981,9 +2981,9 @@  discard block
 block discarded – undo
2981 2981
 
2982 2982
 
2983 2983
 	/**
2984
-	* Get a list of flights detected to airport since 7 days
2985
-	* @return Array number, icao, name and city of airports
2986
-	*/
2984
+	 * Get a list of flights detected to airport since 7 days
2985
+	 * @return Array number, icao, name and city of airports
2986
+	 */
2987 2987
 
2988 2988
 	public function getLast7DaysDetectedAirportsArrivalByAirlines($airport_icao = '') {
2989 2989
 		global $globalTimezone, $globalDBdriver;
@@ -3027,11 +3027,11 @@  discard block
 block discarded – undo
3027 3027
 
3028 3028
 
3029 3029
 	/**
3030
-	* Gets a list of all dates
3031
-	*
3032
-	* @return Array list of date names
3033
-	*
3034
-	*/
3030
+	 * Gets a list of all dates
3031
+	 *
3032
+	 * @return Array list of date names
3033
+	 *
3034
+	 */
3035 3035
 	public function getAllDates()
3036 3036
 	{
3037 3037
 		global $globalTimezone, $globalDBdriver;
@@ -3072,11 +3072,11 @@  discard block
 block discarded – undo
3072 3072
 	
3073 3073
 	
3074 3074
 	/**
3075
-	* Gets all route combinations
3076
-	*
3077
-	* @return Array the route list
3078
-	*
3079
-	*/
3075
+	 * Gets all route combinations
3076
+	 *
3077
+	 * @return Array the route list
3078
+	 *
3079
+	 */
3080 3080
 	public function getAllRoutes()
3081 3081
 	{
3082 3082
 		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route,  spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao 
@@ -3102,13 +3102,13 @@  discard block
 block discarded – undo
3102 3102
 	}
3103 3103
 
3104 3104
 	/**
3105
-	* Update ident spotter data
3106
-	*
3107
-	* @param String $flightaware_id the ID from flightaware
3108
-	* @param String $ident the flight ident
3109
-	* @return String success or false
3110
-	*
3111
-	*/	
3105
+	 * Update ident spotter data
3106
+	 *
3107
+	 * @param String $flightaware_id the ID from flightaware
3108
+	 * @param String $ident the flight ident
3109
+	 * @return String success or false
3110
+	 *
3111
+	 */	
3112 3112
 	public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL)
3113 3113
 	{
3114 3114
 		if (!is_numeric(substr($ident, 0, 3)))
@@ -3129,14 +3129,14 @@  discard block
 block discarded – undo
3129 3129
 		} else {
3130 3130
 			$airline_array = $this->getAllAirlineInfo("NA");
3131 3131
 		}
3132
-                $airline_name = $airline_array[0]['name'];
3133
-                $airline_icao = $airline_array[0]['icao'];
3134
-                $airline_country = $airline_array[0]['country'];
3135
-                $airline_type = $airline_array[0]['type'];
3132
+				$airline_name = $airline_array[0]['name'];
3133
+				$airline_icao = $airline_array[0]['icao'];
3134
+				$airline_country = $airline_array[0]['country'];
3135
+				$airline_type = $airline_array[0]['type'];
3136 3136
 
3137 3137
 
3138 3138
 		$query = 'UPDATE spotter_output SET ident = :ident, airline_name = :airline_name, airline_icao = :airline_icao, airline_country = :airline_country, airline_type = :airline_type WHERE flightaware_id = :flightaware_id';
3139
-                $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type);
3139
+				$query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type);
3140 3140
 
3141 3141
 		try {
3142 3142
 			$sth = $this->db->prepare($query);
@@ -3149,19 +3149,19 @@  discard block
 block discarded – undo
3149 3149
 
3150 3150
 	}
3151 3151
 	/**
3152
-	* Update latest spotter data
3153
-	*
3154
-	* @param String $flightaware_id the ID from flightaware
3155
-	* @param String $ident the flight ident
3156
-	* @param String $arrival_airport_icao the arrival airport
3157
-	* @return String success or false
3158
-	*
3159
-	*/	
3152
+	 * Update latest spotter data
3153
+	 *
3154
+	 * @param String $flightaware_id the ID from flightaware
3155
+	 * @param String $ident the flight ident
3156
+	 * @param String $arrival_airport_icao the arrival airport
3157
+	 * @return String success or false
3158
+	 *
3159
+	 */	
3160 3160
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3161 3161
 	{
3162 3162
 		if ($groundspeed == '') $groundspeed = NULL;
3163 3163
 		$query = 'UPDATE spotter_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_ground = :last_ground, last_seen = :last_seen, real_arrival_airport_icao = :real_arrival_airport_icao, real_arrival_airport_time = :real_arrival_airport_time, last_ground_speed = :last_ground_speed WHERE flightaware_id = :flightaware_id';
3164
-                $query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident);
3164
+				$query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident);
3165 3165
 
3166 3166
 		try {
3167 3167
 			$sth = $this->db->prepare($query);
@@ -3175,32 +3175,32 @@  discard block
 block discarded – undo
3175 3175
 	}
3176 3176
 
3177 3177
 	/**
3178
-	* Adds a new spotter data
3179
-	*
3180
-	* @param String $flightaware_id the ID from flightaware
3181
-	* @param String $ident the flight ident
3182
-	* @param String $aircraft_icao the aircraft type
3183
-	* @param String $departure_airport_icao the departure airport
3184
-	* @param String $arrival_airport_icao the arrival airport
3185
-	* @param String $latitude latitude of flight
3186
-	* @param String $longitude latitude of flight
3187
-	* @param String $waypoints waypoints of flight
3188
-	* @param String $altitude altitude of flight
3189
-	* @param String $heading heading of flight
3190
-	* @param String $groundspeed speed of flight
3191
-	* @param String $date date of flight
3192
-	* @param String $departure_airport_time departure time of flight
3193
-	* @param String $arrival_airport_time arrival time of flight
3194
-	* @param String $squawk squawk code of flight
3195
-	* @param String $route_stop route stop of flight
3196
-	* @param String $highlight highlight or not
3197
-	* @param String $ModeS ModesS code of flight
3198
-	* @param String $registration registration code of flight
3199
-	* @param String $pilot_id pilot id of flight (for virtual airlines)
3200
-	* @param String $pilot_name pilot name of flight (for virtual airlines)
3201
-	* @param String $verticalrate vertival rate of flight
3202
-	* @return String success or false
3203
-	*/
3178
+	 * Adds a new spotter data
3179
+	 *
3180
+	 * @param String $flightaware_id the ID from flightaware
3181
+	 * @param String $ident the flight ident
3182
+	 * @param String $aircraft_icao the aircraft type
3183
+	 * @param String $departure_airport_icao the departure airport
3184
+	 * @param String $arrival_airport_icao the arrival airport
3185
+	 * @param String $latitude latitude of flight
3186
+	 * @param String $longitude latitude of flight
3187
+	 * @param String $waypoints waypoints of flight
3188
+	 * @param String $altitude altitude of flight
3189
+	 * @param String $heading heading of flight
3190
+	 * @param String $groundspeed speed of flight
3191
+	 * @param String $date date of flight
3192
+	 * @param String $departure_airport_time departure time of flight
3193
+	 * @param String $arrival_airport_time arrival time of flight
3194
+	 * @param String $squawk squawk code of flight
3195
+	 * @param String $route_stop route stop of flight
3196
+	 * @param String $highlight highlight or not
3197
+	 * @param String $ModeS ModesS code of flight
3198
+	 * @param String $registration registration code of flight
3199
+	 * @param String $pilot_id pilot id of flight (for virtual airlines)
3200
+	 * @param String $pilot_name pilot name of flight (for virtual airlines)
3201
+	 * @param String $verticalrate vertival rate of flight
3202
+	 * @return String success or false
3203
+	 */
3204 3204
 	public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '',$squawk = '', $route_stop = '', $highlight = '', $ModeS = '', $registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $ground = false,$format_source = '', $source_name = '')
3205 3205
 	{
3206 3206
 		global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM;
@@ -3414,8 +3414,8 @@  discard block
 block discarded – undo
3414 3414
     
3415 3415
 		if ($globalIVAO && $aircraft_icao != '')
3416 3416
 		{
3417
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3418
-            		else $airline_icao = '';
3417
+					if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3418
+					else $airline_icao = '';
3419 3419
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3420 3420
 			if (!isset($image_array[0]['registration']))
3421 3421
 			{
@@ -3446,52 +3446,52 @@  discard block
 block discarded – undo
3446 3446
 	
3447 3447
 		if (count($airline_array) == 0) 
3448 3448
 		{
3449
-                        $airline_array = $this->getAllAirlineInfo('NA');
3450
-                }
3451
-                if (count($aircraft_array) == 0) 
3452
-                {
3453
-                        $aircraft_array = $this->getAllAircraftInfo('NA');
3454
-                }
3455
-                if (count($departure_airport_array) == 0) 
3456
-                {
3457
-                        $departure_airport_array = $this->getAllAirportInfo('NA');
3458
-                }
3459
-                if (count($arrival_airport_array) == 0) 
3460
-                {
3461
-                        $arrival_airport_array = $this->getAllAirportInfo('NA');
3462
-                }
3463
-                if ($registration == '') $registration = 'NA';
3464
-                if ($latitude == '' && $longitude == '') {
3465
-            		$latitude = 0;
3466
-            		$longitude = 0;
3467
-            	}
3468
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3469
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3470
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3471
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3472
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3473
-                $query  = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) 
3449
+						$airline_array = $this->getAllAirlineInfo('NA');
3450
+				}
3451
+				if (count($aircraft_array) == 0) 
3452
+				{
3453
+						$aircraft_array = $this->getAllAircraftInfo('NA');
3454
+				}
3455
+				if (count($departure_airport_array) == 0) 
3456
+				{
3457
+						$departure_airport_array = $this->getAllAirportInfo('NA');
3458
+				}
3459
+				if (count($arrival_airport_array) == 0) 
3460
+				{
3461
+						$arrival_airport_array = $this->getAllAirportInfo('NA');
3462
+				}
3463
+				if ($registration == '') $registration = 'NA';
3464
+				if ($latitude == '' && $longitude == '') {
3465
+					$latitude = 0;
3466
+					$longitude = 0;
3467
+				}
3468
+				if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3469
+				if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3470
+				if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3471
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3472
+				if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3473
+				$query  = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) 
3474 3474
                 VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name,:departure_airport_city,:departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date, :departure_airport_time, :arrival_airport_time, :squawk, :route_stop, :highlight, :ModeS, :pilot_id, :pilot_name, :verticalrate, :owner_name,:ground, :format_source, :source_name)";
3475 3475
 
3476
-                $airline_name = $airline_array[0]['name'];
3477
-                $airline_icao = $airline_array[0]['icao'];
3478
-                $airline_country = $airline_array[0]['country'];
3479
-                $airline_type = $airline_array[0]['type'];
3476
+				$airline_name = $airline_array[0]['name'];
3477
+				$airline_icao = $airline_array[0]['icao'];
3478
+				$airline_country = $airline_array[0]['country'];
3479
+				$airline_type = $airline_array[0]['type'];
3480 3480
 		if ($airline_type == '') {
3481 3481
 			$timeelapsed = microtime(true);
3482 3482
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3483 3483
 			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3484 3484
 		}
3485 3485
 		if ($airline_type == null) $airline_type = '';
3486
-                $aircraft_type = $aircraft_array[0]['type'];
3487
-                $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3488
-                $departure_airport_name = $departure_airport_array[0]['name'];
3489
-                $departure_airport_city = $departure_airport_array[0]['city'];
3490
-                $departure_airport_country = $departure_airport_array[0]['country'];
3491
-                $arrival_airport_name = $arrival_airport_array[0]['name'];
3492
-                $arrival_airport_city = $arrival_airport_array[0]['city'];
3493
-                $arrival_airport_country = $arrival_airport_array[0]['country'];
3494
-                $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date,':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name);
3486
+				$aircraft_type = $aircraft_array[0]['type'];
3487
+				$aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3488
+				$departure_airport_name = $departure_airport_array[0]['name'];
3489
+				$departure_airport_city = $departure_airport_array[0]['city'];
3490
+				$departure_airport_country = $departure_airport_array[0]['country'];
3491
+				$arrival_airport_name = $arrival_airport_array[0]['name'];
3492
+				$arrival_airport_city = $arrival_airport_array[0]['city'];
3493
+				$arrival_airport_country = $arrival_airport_array[0]['country'];
3494
+				$query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date,':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name);
3495 3495
 
3496 3496
 		try {
3497 3497
 		        
@@ -3499,7 +3499,7 @@  discard block
 block discarded – undo
3499 3499
 			$sth->execute($query_values);
3500 3500
 			$this->db = null;
3501 3501
 		} catch (PDOException $e) {
3502
-		    return "error : ".$e->getMessage();
3502
+			return "error : ".$e->getMessage();
3503 3503
 		}
3504 3504
 		
3505 3505
 		return "success";
@@ -3508,11 +3508,11 @@  discard block
 block discarded – undo
3508 3508
 	
3509 3509
   
3510 3510
 	/**
3511
-	* Gets the aircraft ident within the last hour
3512
-	*
3513
-	* @return String the ident
3514
-	*
3515
-	*/
3511
+	 * Gets the aircraft ident within the last hour
3512
+	 *
3513
+	 * @return String the ident
3514
+	 *
3515
+	 */
3516 3516
 	public function getIdentFromLastHour($ident)
3517 3517
 	{
3518 3518
 		global $globalDBdriver, $globalTimezone;
@@ -3528,11 +3528,11 @@  discard block
 block discarded – undo
3528 3528
 								AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
3529 3529
 								AND spotter_output.date < now() AT TIME ZONE 'UTC'";
3530 3530
 			$query_data = array(':ident' => $ident);
3531
-    		}
3531
+			}
3532 3532
 		
3533 3533
 		$sth = $this->db->prepare($query);
3534 3534
 		$sth->execute($query_data);
3535
-    		$ident_result='';
3535
+			$ident_result='';
3536 3536
 		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3537 3537
 		{
3538 3538
 			$ident_result = $row['ident'];
@@ -3543,11 +3543,11 @@  discard block
 block discarded – undo
3543 3543
 	
3544 3544
 	
3545 3545
 	/**
3546
-	* Gets the aircraft data from the last 20 seconds
3547
-	*
3548
-	* @return Array the spotter data
3549
-	*
3550
-	*/
3546
+	 * Gets the aircraft data from the last 20 seconds
3547
+	 *
3548
+	 * @return Array the spotter data
3549
+	 *
3550
+	 */
3551 3551
 	public function getRealTimeData($q = '')
3552 3552
 	{
3553 3553
 		global $globalDBdriver;
@@ -3591,11 +3591,11 @@  discard block
 block discarded – undo
3591 3591
 	
3592 3592
 	
3593 3593
 	 /**
3594
-	* Gets all airlines that have flown over
3595
-	*
3596
-	* @return Array the airline list
3597
-	*
3598
-	*/
3594
+	  * Gets all airlines that have flown over
3595
+	  *
3596
+	  * @return Array the airline list
3597
+	  *
3598
+	  */
3599 3599
 	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3600 3600
 	{
3601 3601
 		global $globalDBdriver;
@@ -3609,7 +3609,7 @@  discard block
 block discarded – undo
3609 3609
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3610 3610
 			}
3611 3611
 		}
3612
-                if ($sincedate != '') {
3612
+				if ($sincedate != '') {
3613 3613
 			if ($globalDBdriver == 'mysql') {
3614 3614
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3615 3615
 			} else {
@@ -3636,26 +3636,26 @@  discard block
 block discarded – undo
3636 3636
 	}
3637 3637
 
3638 3638
 	 /**
3639
-	* Gets all pilots that have flown over
3640
-	*
3641
-	* @return Array the pilots list
3642
-	*
3643
-	*/
3639
+	  * Gets all pilots that have flown over
3640
+	  *
3641
+	  * @return Array the pilots list
3642
+	  *
3643
+	  */
3644 3644
 	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3645 3645
 	{
3646 3646
 		global $globalDBdriver;
3647 3647
 		$filter_query = $this->getFilter($filters,true,true);
3648 3648
 		$query  = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count
3649 3649
 		 			FROM spotter_output".$filter_query." spotter_output.pilot_id <> '' ";
3650
-                if ($olderthanmonths > 0) {
3651
-            		if ($globalDBdriver == 'mysql') {
3650
+				if ($olderthanmonths > 0) {
3651
+					if ($globalDBdriver == 'mysql') {
3652 3652
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3653 3653
 			} else {
3654 3654
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3655 3655
 			}
3656 3656
 		}
3657
-                if ($sincedate != '') {
3658
-            		if ($globalDBdriver == 'mysql') {
3657
+				if ($sincedate != '') {
3658
+					if ($globalDBdriver == 'mysql') {
3659 3659
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3660 3660
 			} else {
3661 3661
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3682,25 +3682,25 @@  discard block
 block discarded – undo
3682 3682
 	}
3683 3683
 	
3684 3684
 		 /**
3685
-	* Gets all pilots that have flown over
3686
-	*
3687
-	* @return Array the pilots list
3688
-	*
3689
-	*/
3685
+		  * Gets all pilots that have flown over
3686
+		  *
3687
+		  * @return Array the pilots list
3688
+		  *
3689
+		  */
3690 3690
 	public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
3691 3691
 	{
3692 3692
 		global $globalDBdriver;
3693 3693
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count
3694 3694
 		 			FROM spotter_output WHERE spotter_output.pilot_id <> '' ";
3695
-                if ($olderthanmonths > 0) {
3696
-            		if ($globalDBdriver == 'mysql') {
3695
+				if ($olderthanmonths > 0) {
3696
+					if ($globalDBdriver == 'mysql') {
3697 3697
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3698 3698
 			} else {
3699 3699
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3700 3700
 			}
3701 3701
 		}
3702
-                if ($sincedate != '') {
3703
-            		if ($globalDBdriver == 'mysql') {
3702
+				if ($sincedate != '') {
3703
+					if ($globalDBdriver == 'mysql') {
3704 3704
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3705 3705
 			} else {
3706 3706
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3728,26 +3728,26 @@  discard block
 block discarded – undo
3728 3728
 	}
3729 3729
 	
3730 3730
 	 /**
3731
-	* Gets all owner that have flown over
3732
-	*
3733
-	* @return Array the pilots list
3734
-	*
3735
-	*/
3731
+	  * Gets all owner that have flown over
3732
+	  *
3733
+	  * @return Array the pilots list
3734
+	  *
3735
+	  */
3736 3736
 	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3737 3737
 	{
3738 3738
 		global $globalDBdriver;
3739 3739
 		$filter_query = $this->getFilter($filters,true,true);
3740 3740
 		$query  = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3741 3741
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3742
-                if ($olderthanmonths > 0) {
3743
-            		if ($globalDBdriver == 'mysql') {
3742
+				if ($olderthanmonths > 0) {
3743
+					if ($globalDBdriver == 'mysql') {
3744 3744
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3745 3745
 			} else {
3746 3746
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3747 3747
 			}
3748 3748
 		}
3749
-                if ($sincedate != '') {
3750
-            		if ($globalDBdriver == 'mysql') {
3749
+				if ($sincedate != '') {
3750
+					if ($globalDBdriver == 'mysql') {
3751 3751
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3752 3752
 			} else {
3753 3753
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3773,26 +3773,26 @@  discard block
 block discarded – undo
3773 3773
 	}
3774 3774
 	
3775 3775
 	 /**
3776
-	* Gets all owner that have flown over
3777
-	*
3778
-	* @return Array the pilots list
3779
-	*
3780
-	*/
3776
+	  * Gets all owner that have flown over
3777
+	  *
3778
+	  * @return Array the pilots list
3779
+	  *
3780
+	  */
3781 3781
 	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3782 3782
 	{
3783 3783
 		global $globalDBdriver;
3784 3784
 		$filter_query = $this->getFilter($filters,true,true);
3785 3785
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3786 3786
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3787
-                if ($olderthanmonths > 0) {
3788
-            		if ($globalDBdriver == 'mysql') {
3787
+				if ($olderthanmonths > 0) {
3788
+					if ($globalDBdriver == 'mysql') {
3789 3789
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3790 3790
 			} else {
3791 3791
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3792 3792
 			}
3793 3793
 		}
3794
-                if ($sincedate != '') {
3795
-            		if ($globalDBdriver == 'mysql') {
3794
+				if ($sincedate != '') {
3795
+					if ($globalDBdriver == 'mysql') {
3796 3796
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
3797 3797
 			} else {
3798 3798
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3819,11 +3819,11 @@  discard block
 block discarded – undo
3819 3819
 	}
3820 3820
 
3821 3821
 	/**
3822
-	* Gets all airlines that have flown over by aircraft
3823
-	*
3824
-	* @return Array the airline list
3825
-	*
3826
-	*/
3822
+	 * Gets all airlines that have flown over by aircraft
3823
+	 *
3824
+	 * @return Array the airline list
3825
+	 *
3826
+	 */
3827 3827
 	public function countAllAirlinesByAircraft($aircraft_icao,$filters = array())
3828 3828
 	{
3829 3829
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -3855,11 +3855,11 @@  discard block
 block discarded – undo
3855 3855
 
3856 3856
 
3857 3857
 	/**
3858
-	* Gets all airline countries that have flown over by aircraft
3859
-	*
3860
-	* @return Array the airline country list
3861
-	*
3862
-	*/
3858
+	 * Gets all airline countries that have flown over by aircraft
3859
+	 *
3860
+	 * @return Array the airline country list
3861
+	 *
3862
+	 */
3863 3863
 	public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array())
3864 3864
 	{
3865 3865
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -3891,11 +3891,11 @@  discard block
 block discarded – undo
3891 3891
 	
3892 3892
 	
3893 3893
 	/**
3894
-	* Gets all airlines that have flown over by airport
3895
-	*
3896
-	* @return Array the airline list
3897
-	*
3898
-	*/
3894
+	 * Gets all airlines that have flown over by airport
3895
+	 *
3896
+	 * @return Array the airline list
3897
+	 *
3898
+	 */
3899 3899
 	public function countAllAirlinesByAirport($airport_icao,$filters = array())
3900 3900
 	{
3901 3901
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -3926,11 +3926,11 @@  discard block
 block discarded – undo
3926 3926
 
3927 3927
 
3928 3928
 	/**
3929
-	* Gets all airline countries that have flown over by airport icao
3930
-	*
3931
-	* @return Array the airline country list
3932
-	*
3933
-	*/
3929
+	 * Gets all airline countries that have flown over by airport icao
3930
+	 *
3931
+	 * @return Array the airline country list
3932
+	 *
3933
+	 */
3934 3934
 	public function countAllAirlineCountriesByAirport($airport_icao,$filters = array())
3935 3935
 	{
3936 3936
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -3960,11 +3960,11 @@  discard block
 block discarded – undo
3960 3960
 
3961 3961
 
3962 3962
 	/**
3963
-	* Gets all airlines that have flown over by aircraft manufacturer
3964
-	*
3965
-	* @return Array the airline list
3966
-	*
3967
-	*/
3963
+	 * Gets all airlines that have flown over by aircraft manufacturer
3964
+	 *
3965
+	 * @return Array the airline list
3966
+	 *
3967
+	 */
3968 3968
 	public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array())
3969 3969
 	{
3970 3970
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -3995,11 +3995,11 @@  discard block
 block discarded – undo
3995 3995
 
3996 3996
 
3997 3997
 	/**
3998
-	* Gets all airline countries that have flown over by aircraft manufacturer
3999
-	*
4000
-	* @return Array the airline country list
4001
-	*
4002
-	*/
3998
+	 * Gets all airline countries that have flown over by aircraft manufacturer
3999
+	 *
4000
+	 * @return Array the airline country list
4001
+	 *
4002
+	 */
4003 4003
 	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array())
4004 4004
 	{
4005 4005
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4028,11 +4028,11 @@  discard block
 block discarded – undo
4028 4028
 
4029 4029
 
4030 4030
 	/**
4031
-	* Gets all airlines that have flown over by date
4032
-	*
4033
-	* @return Array the airline list
4034
-	*
4035
-	*/
4031
+	 * Gets all airlines that have flown over by date
4032
+	 *
4033
+	 * @return Array the airline list
4034
+	 *
4035
+	 */
4036 4036
 	public function countAllAirlinesByDate($date,$filters = array())
4037 4037
 	{
4038 4038
 		global $globalTimezone, $globalDBdriver;
@@ -4076,11 +4076,11 @@  discard block
 block discarded – undo
4076 4076
 	
4077 4077
 	
4078 4078
 	/**
4079
-	* Gets all airline countries that have flown over by date
4080
-	*
4081
-	* @return Array the airline country list
4082
-	*
4083
-	*/
4079
+	 * Gets all airline countries that have flown over by date
4080
+	 *
4081
+	 * @return Array the airline country list
4082
+	 *
4083
+	 */
4084 4084
 	public function countAllAirlineCountriesByDate($date,$filters = array())
4085 4085
 	{
4086 4086
 		global $globalTimezone, $globalDBdriver;
@@ -4123,11 +4123,11 @@  discard block
 block discarded – undo
4123 4123
 
4124 4124
 
4125 4125
 	/**
4126
-	* Gets all airlines that have flown over by ident/callsign
4127
-	*
4128
-	* @return Array the airline list
4129
-	*
4130
-	*/
4126
+	 * Gets all airlines that have flown over by ident/callsign
4127
+	 *
4128
+	 * @return Array the airline list
4129
+	 *
4130
+	 */
4131 4131
 	public function countAllAirlinesByIdent($ident,$filters = array())
4132 4132
 	{
4133 4133
 		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
@@ -4157,11 +4157,11 @@  discard block
 block discarded – undo
4157 4157
 	}
4158 4158
 
4159 4159
 	/**
4160
-	* Gets all airlines that have flown over by route
4161
-	*
4162
-	* @return Array the airline list
4163
-	*
4164
-	*/
4160
+	 * Gets all airlines that have flown over by route
4161
+	 *
4162
+	 * @return Array the airline list
4163
+	 *
4164
+	 */
4165 4165
 	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
4166 4166
 	{
4167 4167
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4193,11 +4193,11 @@  discard block
 block discarded – undo
4193 4193
 	}
4194 4194
 
4195 4195
 	/**
4196
-	* Gets all airline countries that have flown over by route
4197
-	*
4198
-	* @return Array the airline country list
4199
-	*
4200
-	*/
4196
+	 * Gets all airline countries that have flown over by route
4197
+	 *
4198
+	 * @return Array the airline country list
4199
+	 *
4200
+	 */
4201 4201
 	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array())
4202 4202
 	{
4203 4203
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4229,11 +4229,11 @@  discard block
 block discarded – undo
4229 4229
 
4230 4230
 
4231 4231
 	/**
4232
-	* Gets all airlines that have flown over by country
4233
-	*
4234
-	* @return Array the airline list
4235
-	*
4236
-	*/
4232
+	 * Gets all airlines that have flown over by country
4233
+	 *
4234
+	 * @return Array the airline list
4235
+	 *
4236
+	 */
4237 4237
 	public function countAllAirlinesByCountry($country,$filters = array())
4238 4238
 	{
4239 4239
 		$country = filter_var($country,FILTER_SANITIZE_STRING);
@@ -4263,11 +4263,11 @@  discard block
 block discarded – undo
4263 4263
 
4264 4264
 
4265 4265
 	/**
4266
-	* Gets all airline countries that have flown over by country
4267
-	*
4268
-	* @return Array the airline country list
4269
-	*
4270
-	*/
4266
+	 * Gets all airline countries that have flown over by country
4267
+	 *
4268
+	 * @return Array the airline country list
4269
+	 *
4270
+	 */
4271 4271
 	public function countAllAirlineCountriesByCountry($country,$filters = array())
4272 4272
 	{
4273 4273
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4296,11 +4296,11 @@  discard block
 block discarded – undo
4296 4296
 
4297 4297
 
4298 4298
 	/**
4299
-	* Gets all airlines countries
4300
-	*
4301
-	* @return Array the airline country list
4302
-	*
4303
-	*/
4299
+	 * Gets all airlines countries
4300
+	 *
4301
+	 * @return Array the airline country list
4302
+	 *
4303
+	 */
4304 4304
 	public function countAllAirlineCountries($limit = true, $filters = array())
4305 4305
 	{
4306 4306
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4326,11 +4326,11 @@  discard block
 block discarded – undo
4326 4326
 	}
4327 4327
 
4328 4328
 	/**
4329
-	* Gets all number of flight over countries
4330
-	*
4331
-	* @return Array the airline country list
4332
-	*
4333
-	*/
4329
+	 * Gets all number of flight over countries
4330
+	 *
4331
+	 * @return Array the airline country list
4332
+	 *
4333
+	 */
4334 4334
 	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
4335 4335
 	{
4336 4336
 		global $globalDBdriver;
@@ -4345,15 +4345,15 @@  discard block
 block discarded – undo
4345 4345
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
4346 4346
 					FROM countries c, spotter_live s
4347 4347
 					WHERE c.iso2 = s.over_country ";
4348
-                if ($olderthanmonths > 0) {
4348
+				if ($olderthanmonths > 0) {
4349 4349
 			if ($globalDBdriver == 'mysql') {
4350 4350
 				$query .= 'AND spotter_live.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
4351 4351
 			} else {
4352 4352
 				$query .= "AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
4353 4353
 			}
4354 4354
 		}
4355
-                if ($sincedate != '') {
4356
-            		if ($globalDBdriver == 'mysql') {
4355
+				if ($sincedate != '') {
4356
+					if ($globalDBdriver == 'mysql') {
4357 4357
 				$query .= "AND spotter_live.date > '".$sincedate."' ";
4358 4358
 			} else {
4359 4359
 				$query .= "AND spotter_live.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4383,11 +4383,11 @@  discard block
 block discarded – undo
4383 4383
 	
4384 4384
 	
4385 4385
 	/**
4386
-	* Gets all aircraft types that have flown over
4387
-	*
4388
-	* @return Array the aircraft list
4389
-	*
4390
-	*/
4386
+	 * Gets all aircraft types that have flown over
4387
+	 *
4388
+	 * @return Array the aircraft list
4389
+	 *
4390
+	 */
4391 4391
 	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4392 4392
 	{
4393 4393
 		global $globalDBdriver;
@@ -4430,11 +4430,11 @@  discard block
 block discarded – undo
4430 4430
 	}
4431 4431
 
4432 4432
 	/**
4433
-	* Gets all aircraft types that have flown over by airline
4434
-	*
4435
-	* @return Array the aircraft list
4436
-	*
4437
-	*/
4433
+	 * Gets all aircraft types that have flown over by airline
4434
+	 *
4435
+	 * @return Array the aircraft list
4436
+	 *
4437
+	 */
4438 4438
 	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4439 4439
 	{
4440 4440
 		global $globalDBdriver;
@@ -4478,11 +4478,11 @@  discard block
 block discarded – undo
4478 4478
 
4479 4479
 
4480 4480
 	/**
4481
-	* Gets all aircraft registration that have flown over by aircaft icao
4482
-	*
4483
-	* @return Array the aircraft list
4484
-	*
4485
-	*/
4481
+	 * Gets all aircraft registration that have flown over by aircaft icao
4482
+	 *
4483
+	 * @return Array the aircraft list
4484
+	 *
4485
+	 */
4486 4486
 	public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array())
4487 4487
 	{
4488 4488
 		$Image = new Image($this->db);
@@ -4521,11 +4521,11 @@  discard block
 block discarded – undo
4521 4521
 
4522 4522
 
4523 4523
 	/**
4524
-	* Gets all aircraft types that have flown over by airline icao
4525
-	*
4526
-	* @return Array the aircraft list
4527
-	*
4528
-	*/
4524
+	 * Gets all aircraft types that have flown over by airline icao
4525
+	 *
4526
+	 * @return Array the aircraft list
4527
+	 *
4528
+	 */
4529 4529
 	public function countAllAircraftTypesByAirline($airline_icao,$filters = array())
4530 4530
 	{
4531 4531
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4554,11 +4554,11 @@  discard block
 block discarded – undo
4554 4554
 
4555 4555
 
4556 4556
 	/**
4557
-	* Gets all aircraft registration that have flown over by airline icao
4558
-	*
4559
-	* @return Array the aircraft list
4560
-	*
4561
-	*/
4557
+	 * Gets all aircraft registration that have flown over by airline icao
4558
+	 *
4559
+	 * @return Array the aircraft list
4560
+	 *
4561
+	 */
4562 4562
 	public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array())
4563 4563
 	{
4564 4564
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4596,11 +4596,11 @@  discard block
 block discarded – undo
4596 4596
 
4597 4597
 
4598 4598
 	/**
4599
-	* Gets all aircraft manufacturer that have flown over by airline icao
4600
-	*
4601
-	* @return Array the aircraft list
4602
-	*
4603
-	*/
4599
+	 * Gets all aircraft manufacturer that have flown over by airline icao
4600
+	 *
4601
+	 * @return Array the aircraft list
4602
+	 *
4603
+	 */
4604 4604
 	public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array())
4605 4605
 	{
4606 4606
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4628,11 +4628,11 @@  discard block
 block discarded – undo
4628 4628
 
4629 4629
 
4630 4630
 	/**
4631
-	* Gets all aircraft types that have flown over by airline icao
4632
-	*
4633
-	* @return Array the aircraft list
4634
-	*
4635
-	*/
4631
+	 * Gets all aircraft types that have flown over by airline icao
4632
+	 *
4633
+	 * @return Array the aircraft list
4634
+	 *
4635
+	 */
4636 4636
 	public function countAllAircraftTypesByAirport($airport_icao,$filters = array())
4637 4637
 	{
4638 4638
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4661,11 +4661,11 @@  discard block
 block discarded – undo
4661 4661
 
4662 4662
 
4663 4663
 	/**
4664
-	* Gets all aircraft registration that have flown over by airport icao
4665
-	*
4666
-	* @return Array the aircraft list
4667
-	*
4668
-	*/
4664
+	 * Gets all aircraft registration that have flown over by airport icao
4665
+	 *
4666
+	 * @return Array the aircraft list
4667
+	 *
4668
+	 */
4669 4669
 	public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array())
4670 4670
 	{
4671 4671
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4702,11 +4702,11 @@  discard block
 block discarded – undo
4702 4702
 	
4703 4703
 	
4704 4704
 	/**
4705
-	* Gets all aircraft manufacturer that have flown over by airport icao
4706
-	*
4707
-	* @return Array the aircraft list
4708
-	*
4709
-	*/
4705
+	 * Gets all aircraft manufacturer that have flown over by airport icao
4706
+	 *
4707
+	 * @return Array the aircraft list
4708
+	 *
4709
+	 */
4710 4710
 	public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array())
4711 4711
 	{
4712 4712
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4732,11 +4732,11 @@  discard block
 block discarded – undo
4732 4732
 	}
4733 4733
 
4734 4734
 	/**
4735
-	* Gets all aircraft types that have flown over by aircraft manufacturer
4736
-	*
4737
-	* @return Array the aircraft list
4738
-	*
4739
-	*/
4735
+	 * Gets all aircraft types that have flown over by aircraft manufacturer
4736
+	 *
4737
+	 * @return Array the aircraft list
4738
+	 *
4739
+	 */
4740 4740
 	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array())
4741 4741
 	{
4742 4742
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4763,11 +4763,11 @@  discard block
 block discarded – undo
4763 4763
 
4764 4764
 
4765 4765
 	/**
4766
-	* Gets all aircraft registration that have flown over by aircaft manufacturer
4767
-	*
4768
-	* @return Array the aircraft list
4769
-	*
4770
-	*/
4766
+	 * Gets all aircraft registration that have flown over by aircaft manufacturer
4767
+	 *
4768
+	 * @return Array the aircraft list
4769
+	 *
4770
+	 */
4771 4771
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array())
4772 4772
 	{
4773 4773
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4803,11 +4803,11 @@  discard block
 block discarded – undo
4803 4803
 	}
4804 4804
 
4805 4805
 	/**
4806
-	* Gets all aircraft types that have flown over by date
4807
-	*
4808
-	* @return Array the aircraft list
4809
-	*
4810
-	*/
4806
+	 * Gets all aircraft types that have flown over by date
4807
+	 *
4808
+	 * @return Array the aircraft list
4809
+	 *
4810
+	 */
4811 4811
 	public function countAllAircraftTypesByDate($date,$filters = array())
4812 4812
 	{
4813 4813
 		global $globalTimezone, $globalDBdriver;
@@ -4849,11 +4849,11 @@  discard block
 block discarded – undo
4849 4849
 
4850 4850
 
4851 4851
 	/**
4852
-	* Gets all aircraft registration that have flown over by date
4853
-	*
4854
-	* @return Array the aircraft list
4855
-	*
4856
-	*/
4852
+	 * Gets all aircraft registration that have flown over by date
4853
+	 *
4854
+	 * @return Array the aircraft list
4855
+	 *
4856
+	 */
4857 4857
 	public function countAllAircraftRegistrationByDate($date,$filters = array())
4858 4858
 	{
4859 4859
 		global $globalTimezone, $globalDBdriver;
@@ -4904,11 +4904,11 @@  discard block
 block discarded – undo
4904 4904
 
4905 4905
 
4906 4906
 	/**
4907
-	* Gets all aircraft manufacturer that have flown over by date
4908
-	*
4909
-	* @return Array the aircraft manufacturer list
4910
-	*
4911
-	*/
4907
+	 * Gets all aircraft manufacturer that have flown over by date
4908
+	 *
4909
+	 * @return Array the aircraft manufacturer list
4910
+	 *
4911
+	 */
4912 4912
 	public function countAllAircraftManufacturerByDate($date,$filters = array())
4913 4913
 	{
4914 4914
 		global $globalTimezone, $globalDBdriver;
@@ -4950,11 +4950,11 @@  discard block
 block discarded – undo
4950 4950
 
4951 4951
 
4952 4952
 	/**
4953
-	* Gets all aircraft types that have flown over by ident/callsign
4954
-	*
4955
-	* @return Array the aircraft list
4956
-	*
4957
-	*/
4953
+	 * Gets all aircraft types that have flown over by ident/callsign
4954
+	 *
4955
+	 * @return Array the aircraft list
4956
+	 *
4957
+	 */
4958 4958
 	public function countAllAircraftTypesByIdent($ident,$filters = array())
4959 4959
 	{
4960 4960
 		$filter_query = $this->getFilter($filters,true,true);
@@ -4983,11 +4983,11 @@  discard block
 block discarded – undo
4983 4983
 
4984 4984
 
4985 4985
 	/**
4986
-	* Gets all aircraft registration that have flown over by ident/callsign
4987
-	*
4988
-	* @return Array the aircraft list
4989
-	*
4990
-	*/
4986
+	 * Gets all aircraft registration that have flown over by ident/callsign
4987
+	 *
4988
+	 * @return Array the aircraft list
4989
+	 *
4990
+	 */
4991 4991
 	public function countAllAircraftRegistrationByIdent($ident,$filters = array())
4992 4992
 	{
4993 4993
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5027,11 +5027,11 @@  discard block
 block discarded – undo
5027 5027
 
5028 5028
 
5029 5029
 	/**
5030
-	* Gets all aircraft manufacturer that have flown over by ident/callsign
5031
-	*
5032
-	* @return Array the aircraft manufacturer list
5033
-	*
5034
-	*/
5030
+	 * Gets all aircraft manufacturer that have flown over by ident/callsign
5031
+	 *
5032
+	 * @return Array the aircraft manufacturer list
5033
+	 *
5034
+	 */
5035 5035
 	public function countAllAircraftManufacturerByIdent($ident,$filters = array())
5036 5036
 	{
5037 5037
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5057,11 +5057,11 @@  discard block
 block discarded – undo
5057 5057
 
5058 5058
 
5059 5059
 	/**
5060
-	* Gets all aircraft types that have flown over by route
5061
-	*
5062
-	* @return Array the aircraft list
5063
-	*
5064
-	*/
5060
+	 * Gets all aircraft types that have flown over by route
5061
+	 *
5062
+	 * @return Array the aircraft list
5063
+	 *
5064
+	 */
5065 5065
 	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5066 5066
 	{
5067 5067
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5090,11 +5090,11 @@  discard block
 block discarded – undo
5090 5090
 	}
5091 5091
 
5092 5092
 	/**
5093
-	* Gets all aircraft registration that have flown over by route
5094
-	*
5095
-	* @return Array the aircraft list
5096
-	*
5097
-	*/
5093
+	 * Gets all aircraft registration that have flown over by route
5094
+	 *
5095
+	 * @return Array the aircraft list
5096
+	 *
5097
+	 */
5098 5098
 	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5099 5099
 	{
5100 5100
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5136,11 +5136,11 @@  discard block
 block discarded – undo
5136 5136
 	
5137 5137
 	
5138 5138
 	/**
5139
-	* Gets all aircraft manufacturer that have flown over by route
5140
-	*
5141
-	* @return Array the aircraft manufacturer list
5142
-	*
5143
-	*/
5139
+	 * Gets all aircraft manufacturer that have flown over by route
5140
+	 *
5141
+	 * @return Array the aircraft manufacturer list
5142
+	 *
5143
+	 */
5144 5144
 	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5145 5145
 	{
5146 5146
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5174,11 +5174,11 @@  discard block
 block discarded – undo
5174 5174
 	
5175 5175
 	
5176 5176
 	/**
5177
-	* Gets all aircraft types that have flown over by country
5178
-	*
5179
-	* @return Array the aircraft list
5180
-	*
5181
-	*/
5177
+	 * Gets all aircraft types that have flown over by country
5178
+	 *
5179
+	 * @return Array the aircraft list
5180
+	 *
5181
+	 */
5182 5182
 	public function countAllAircraftTypesByCountry($country,$filters = array())
5183 5183
 	{
5184 5184
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5209,11 +5209,11 @@  discard block
 block discarded – undo
5209 5209
 
5210 5210
 
5211 5211
 	/**
5212
-	* Gets all aircraft registration that have flown over by country
5213
-	*
5214
-	* @return Array the aircraft list
5215
-	*
5216
-	*/
5212
+	 * Gets all aircraft registration that have flown over by country
5213
+	 *
5214
+	 * @return Array the aircraft list
5215
+	 *
5216
+	 */
5217 5217
 	public function countAllAircraftRegistrationByCountry($country,$filters = array())
5218 5218
 	{
5219 5219
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5253,11 +5253,11 @@  discard block
 block discarded – undo
5253 5253
 	
5254 5254
 	
5255 5255
 	/**
5256
-	* Gets all aircraft manufacturer that have flown over by country
5257
-	*
5258
-	* @return Array the aircraft manufacturer list
5259
-	*
5260
-	*/
5256
+	 * Gets all aircraft manufacturer that have flown over by country
5257
+	 *
5258
+	 * @return Array the aircraft manufacturer list
5259
+	 *
5260
+	 */
5261 5261
 	public function countAllAircraftManufacturerByCountry($country,$filters = array())
5262 5262
 	{
5263 5263
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5288,17 +5288,17 @@  discard block
 block discarded – undo
5288 5288
 	
5289 5289
 	
5290 5290
 	/**
5291
-	* Gets all aircraft manufacturers that have flown over
5292
-	*
5293
-	* @return Array the aircraft list
5294
-	*
5295
-	*/
5291
+	 * Gets all aircraft manufacturers that have flown over
5292
+	 *
5293
+	 * @return Array the aircraft list
5294
+	 *
5295
+	 */
5296 5296
 	public function countAllAircraftManufacturers($filters = array())
5297 5297
 	{
5298 5298
 		$filter_query = $this->getFilter($filters,true,true);
5299 5299
 		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5300 5300
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
5301
-                $query .= " GROUP BY spotter_output.aircraft_manufacturer
5301
+				$query .= " GROUP BY spotter_output.aircraft_manufacturer
5302 5302
 					ORDER BY aircraft_manufacturer_count DESC
5303 5303
 					LIMIT 10";
5304 5304
       
@@ -5323,11 +5323,11 @@  discard block
 block discarded – undo
5323 5323
 	
5324 5324
 	
5325 5325
 	/**
5326
-	* Gets all aircraft registrations that have flown over
5327
-	*
5328
-	* @return Array the aircraft list
5329
-	*
5330
-	*/
5326
+	 * Gets all aircraft registrations that have flown over
5327
+	 *
5328
+	 * @return Array the aircraft list
5329
+	 *
5330
+	 */
5331 5331
 	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5332 5332
 	{
5333 5333
 		global $globalDBdriver;
@@ -5335,15 +5335,15 @@  discard block
 block discarded – undo
5335 5335
 		$filter_query = $this->getFilter($filters,true,true);
5336 5336
 		$query  = "SELECT DISTINCT spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao,  spotter_output.aircraft_name, spotter_output.airline_name    
5337 5337
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
5338
-                if ($olderthanmonths > 0) {
5339
-            		if ($globalDBdriver == 'mysql') {
5338
+				if ($olderthanmonths > 0) {
5339
+					if ($globalDBdriver == 'mysql') {
5340 5340
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
5341 5341
 			} else {
5342 5342
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5343 5343
 			}
5344 5344
 		}
5345
-                if ($sincedate != '') {
5346
-            		if ($globalDBdriver == 'mysql') {
5345
+				if ($sincedate != '') {
5346
+					if ($globalDBdriver == 'mysql') {
5347 5347
 				$query .= " AND spotter_output.date > '".$sincedate."'";
5348 5348
 			} else {
5349 5349
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -5352,7 +5352,7 @@  discard block
 block discarded – undo
5352 5352
 
5353 5353
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5354 5354
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5355
-                $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5355
+				$query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5356 5356
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5357 5357
 		
5358 5358
 		$sth = $this->db->prepare($query);
@@ -5383,11 +5383,11 @@  discard block
 block discarded – undo
5383 5383
 
5384 5384
 
5385 5385
 	/**
5386
-	* Gets all aircraft registrations that have flown over
5387
-	*
5388
-	* @return Array the aircraft list
5389
-	*
5390
-	*/
5386
+	 * Gets all aircraft registrations that have flown over
5387
+	 *
5388
+	 * @return Array the aircraft list
5389
+	 *
5390
+	 */
5391 5391
 	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5392 5392
 	{
5393 5393
 		global $globalDBdriver;
@@ -5395,15 +5395,15 @@  discard block
 block discarded – undo
5395 5395
 		$Image = new Image($this->db);
5396 5396
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao,  spotter_output.aircraft_name, spotter_output.airline_name    
5397 5397
                     FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
5398
-                if ($olderthanmonths > 0) {
5399
-            		if ($globalDBdriver == 'mysql') {
5398
+				if ($olderthanmonths > 0) {
5399
+					if ($globalDBdriver == 'mysql') {
5400 5400
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5401 5401
 			} else {
5402 5402
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5403 5403
 			}
5404 5404
 		}
5405
-                if ($sincedate != '') {
5406
-            		if ($globalDBdriver == 'mysql') {
5405
+				if ($sincedate != '') {
5406
+					if ($globalDBdriver == 'mysql') {
5407 5407
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
5408 5408
 			} else {
5409 5409
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -5412,7 +5412,7 @@  discard block
 block discarded – undo
5412 5412
 
5413 5413
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5414 5414
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5415
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5415
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5416 5416
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5417 5417
 		
5418 5418
 		$sth = $this->db->prepare($query);
@@ -5444,35 +5444,35 @@  discard block
 block discarded – undo
5444 5444
 	
5445 5445
 	
5446 5446
 	/**
5447
-	* Gets all departure airports of the airplanes that have flown over
5448
-	*
5449
-	* @return Array the airport list
5450
-	*
5451
-	*/
5447
+	 * Gets all departure airports of the airplanes that have flown over
5448
+	 *
5449
+	 * @return Array the airport list
5450
+	 *
5451
+	 */
5452 5452
 	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5453 5453
 	{
5454 5454
 		global $globalDBdriver;
5455 5455
 		$filter_query = $this->getFilter($filters,true,true);
5456 5456
 		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5457 5457
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA'";
5458
-                if ($olderthanmonths > 0) {
5459
-            		if ($globalDBdriver == 'mysql') {
5458
+				if ($olderthanmonths > 0) {
5459
+					if ($globalDBdriver == 'mysql') {
5460 5460
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
5461 5461
 			} else {
5462 5462
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5463 5463
 			}
5464
-                }
5465
-                if ($sincedate != '') {
5466
-            		if ($globalDBdriver == 'mysql') {
5464
+				}
5465
+				if ($sincedate != '') {
5466
+					if ($globalDBdriver == 'mysql') {
5467 5467
 				$query .= " AND spotter_output.date > '".$sincedate."'";
5468 5468
 			} else {
5469 5469
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
5470 5470
 			}
5471 5471
 		}
5472 5472
 
5473
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5474
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5475
-                $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5473
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5474
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5475
+				$query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5476 5476
 				ORDER BY airport_departure_icao_count DESC";
5477 5477
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5478 5478
       
@@ -5496,35 +5496,35 @@  discard block
 block discarded – undo
5496 5496
 	}
5497 5497
 
5498 5498
 	/**
5499
-	* Gets all departure airports of the airplanes that have flown over
5500
-	*
5501
-	* @return Array the airport list
5502
-	*
5503
-	*/
5499
+	 * Gets all departure airports of the airplanes that have flown over
5500
+	 *
5501
+	 * @return Array the airport list
5502
+	 *
5503
+	 */
5504 5504
 	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5505 5505
 	{
5506 5506
 		global $globalDBdriver;
5507 5507
 		$filter_query = $this->getFilter($filters,true,true);
5508 5508
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5509 5509
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' ";
5510
-                if ($olderthanmonths > 0) {
5511
-            		if ($globalDBdriver == 'mysql') {
5510
+				if ($olderthanmonths > 0) {
5511
+					if ($globalDBdriver == 'mysql') {
5512 5512
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5513 5513
 			} else {
5514 5514
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5515 5515
 			}
5516
-                }
5517
-                if ($sincedate != '') {
5518
-            		if ($globalDBdriver == 'mysql') {
5516
+				}
5517
+				if ($sincedate != '') {
5518
+					if ($globalDBdriver == 'mysql') {
5519 5519
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
5520 5520
 			} else {
5521 5521
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
5522 5522
 			}
5523 5523
 		}
5524 5524
 
5525
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5526
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5527
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5525
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5526
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5527
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5528 5528
 				ORDER BY airport_departure_icao_count DESC";
5529 5529
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5530 5530
       
@@ -5549,37 +5549,37 @@  discard block
 block discarded – undo
5549 5549
 	}
5550 5550
 
5551 5551
 	/**
5552
-	* Gets all detected departure airports of the airplanes that have flown over
5553
-	*
5554
-	* @return Array the airport list
5555
-	*
5556
-	*/
5552
+	 * Gets all detected departure airports of the airplanes that have flown over
5553
+	 *
5554
+	 * @return Array the airport list
5555
+	 *
5556
+	 */
5557 5557
 	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5558 5558
 	{
5559 5559
 		global $globalDBdriver;
5560 5560
 		$filter_query = $this->getFilter($filters,true,true);
5561 5561
 		$query  = "SELECT DISTINCT spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country
5562 5562
 				FROM airport, spotter_output".$filter_query." spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao";
5563
-                if ($olderthanmonths > 0) {
5564
-            		if ($globalDBdriver == 'mysql') {
5563
+				if ($olderthanmonths > 0) {
5564
+					if ($globalDBdriver == 'mysql') {
5565 5565
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
5566 5566
 			} else {
5567 5567
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
5568 5568
 			}
5569
-                }
5570
-                if ($sincedate != '') {
5571
-            		if ($globalDBdriver == 'mysql') {
5569
+				}
5570
+				if ($sincedate != '') {
5571
+					if ($globalDBdriver == 'mysql') {
5572 5572
 				$query .= " AND spotter_output.date > '".$sincedate."'";
5573 5573
 			} else {
5574 5574
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
5575 5575
 			}
5576 5576
 		}
5577
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5578
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5579
-                $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5577
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5578
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5579
+				$query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5580 5580
 				ORDER BY airport_departure_icao_count DESC";
5581 5581
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5582
-    		//echo $query;
5582
+			//echo $query;
5583 5583
 		$sth = $this->db->prepare($query);
5584 5584
 		$sth->execute();
5585 5585
       
@@ -5600,35 +5600,35 @@  discard block
 block discarded – undo
5600 5600
 	}
5601 5601
 	
5602 5602
 	/**
5603
-	* Gets all detected departure airports of the airplanes that have flown over
5604
-	*
5605
-	* @return Array the airport list
5606
-	*
5607
-	*/
5603
+	 * Gets all detected departure airports of the airplanes that have flown over
5604
+	 *
5605
+	 * @return Array the airport list
5606
+	 *
5607
+	 */
5608 5608
 	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5609 5609
 	{
5610 5610
 		global $globalDBdriver;
5611 5611
 		$filter_query = $this->getFilter($filters,true,true);
5612 5612
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country
5613 5613
 				FROM airport, spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao ";
5614
-                if ($olderthanmonths > 0) {
5615
-            		if ($globalDBdriver == 'mysql') {
5614
+				if ($olderthanmonths > 0) {
5615
+					if ($globalDBdriver == 'mysql') {
5616 5616
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5617 5617
 			} else {
5618 5618
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5619 5619
 			}
5620
-                }
5621
-                if ($sincedate != '') {
5622
-            		if ($globalDBdriver == 'mysql') {
5620
+				}
5621
+				if ($sincedate != '') {
5622
+					if ($globalDBdriver == 'mysql') {
5623 5623
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
5624 5624
 			} else {
5625 5625
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
5626 5626
 			}
5627 5627
 		}
5628 5628
 
5629
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5630
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5631
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5629
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5630
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5631
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5632 5632
 				ORDER BY airport_departure_icao_count DESC";
5633 5633
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5634 5634
       
@@ -5653,11 +5653,11 @@  discard block
 block discarded – undo
5653 5653
 	}	
5654 5654
 	
5655 5655
 	/**
5656
-	* Gets all departure airports of the airplanes that have flown over based on an airline icao
5657
-	*
5658
-	* @return Array the airport list
5659
-	*
5660
-	*/
5656
+	 * Gets all departure airports of the airplanes that have flown over based on an airline icao
5657
+	 *
5658
+	 * @return Array the airport list
5659
+	 *
5660
+	 */
5661 5661
 	public function countAllDepartureAirportsByAirline($airline_icao,$filters = array())
5662 5662
 	{
5663 5663
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5691,11 +5691,11 @@  discard block
 block discarded – undo
5691 5691
 	
5692 5692
 	
5693 5693
 	/**
5694
-	* Gets all departure airports by country of the airplanes that have flown over based on an airline icao
5695
-	*
5696
-	* @return Array the airport list
5697
-	*
5698
-	*/
5694
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airline icao
5695
+	 *
5696
+	 * @return Array the airport list
5697
+	 *
5698
+	 */
5699 5699
 	public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array())
5700 5700
 	{
5701 5701
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5726,11 +5726,11 @@  discard block
 block discarded – undo
5726 5726
 	
5727 5727
 	
5728 5728
 	/**
5729
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft icao
5730
-	*
5731
-	* @return Array the airport list
5732
-	*
5733
-	*/
5729
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft icao
5730
+	 *
5731
+	 * @return Array the airport list
5732
+	 *
5733
+	 */
5734 5734
 	public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array())
5735 5735
 	{
5736 5736
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5763,11 +5763,11 @@  discard block
 block discarded – undo
5763 5763
 	
5764 5764
 	
5765 5765
 	/**
5766
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
5767
-	*
5768
-	* @return Array the airport list
5769
-	*
5770
-	*/
5766
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
5767
+	 *
5768
+	 * @return Array the airport list
5769
+	 *
5770
+	 */
5771 5771
 	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array())
5772 5772
 	{
5773 5773
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5797,11 +5797,11 @@  discard block
 block discarded – undo
5797 5797
 	
5798 5798
 	
5799 5799
 	/**
5800
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft registration
5801
-	*
5802
-	* @return Array the airport list
5803
-	*
5804
-	*/
5800
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft registration
5801
+	 *
5802
+	 * @return Array the airport list
5803
+	 *
5804
+	 */
5805 5805
 	public function countAllDepartureAirportsByRegistration($registration,$filters = array())
5806 5806
 	{
5807 5807
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5834,11 +5834,11 @@  discard block
 block discarded – undo
5834 5834
 	
5835 5835
 	
5836 5836
 	/**
5837
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
5838
-	*
5839
-	* @return Array the airport list
5840
-	*
5841
-	*/
5837
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
5838
+	 *
5839
+	 * @return Array the airport list
5840
+	 *
5841
+	 */
5842 5842
 	public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array())
5843 5843
 	{
5844 5844
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5868,11 +5868,11 @@  discard block
 block discarded – undo
5868 5868
 	
5869 5869
 	
5870 5870
 	/**
5871
-	* Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
5872
-	*
5873
-	* @return Array the airport list
5874
-	*
5875
-	*/
5871
+	 * Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
5872
+	 *
5873
+	 * @return Array the airport list
5874
+	 *
5875
+	 */
5876 5876
 	public function countAllDepartureAirportsByAirport($airport_icao,$filters = array())
5877 5877
 	{
5878 5878
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5905,11 +5905,11 @@  discard block
 block discarded – undo
5905 5905
 	
5906 5906
 	
5907 5907
 	/**
5908
-	* Gets all departure airports by country of the airplanes that have flown over based on an airport icao
5909
-	*
5910
-	* @return Array the airport list
5911
-	*
5912
-	*/
5908
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airport icao
5909
+	 *
5910
+	 * @return Array the airport list
5911
+	 *
5912
+	 */
5913 5913
 	public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array())
5914 5914
 	{
5915 5915
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5940,11 +5940,11 @@  discard block
 block discarded – undo
5940 5940
 	
5941 5941
 	
5942 5942
 	/**
5943
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
5944
-	*
5945
-	* @return Array the airport list
5946
-	*
5947
-	*/
5943
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
5944
+	 *
5945
+	 * @return Array the airport list
5946
+	 *
5947
+	 */
5948 5948
 	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array())
5949 5949
 	{
5950 5950
 		$filter_query = $this->getFilter($filters,true,true);
@@ -5977,11 +5977,11 @@  discard block
 block discarded – undo
5977 5977
 	
5978 5978
 	
5979 5979
 	/**
5980
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
5981
-	*
5982
-	* @return Array the airport list
5983
-	*
5984
-	*/
5980
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
5981
+	 *
5982
+	 * @return Array the airport list
5983
+	 *
5984
+	 */
5985 5985
 	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
5986 5986
 	{
5987 5987
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6011,11 +6011,11 @@  discard block
 block discarded – undo
6011 6011
 	
6012 6012
 	
6013 6013
 	/**
6014
-	* Gets all departure airports of the airplanes that have flown over based on a date
6015
-	*
6016
-	* @return Array the airport list
6017
-	*
6018
-	*/
6014
+	 * Gets all departure airports of the airplanes that have flown over based on a date
6015
+	 *
6016
+	 * @return Array the airport list
6017
+	 *
6018
+	 */
6019 6019
 	public function countAllDepartureAirportsByDate($date,$filters = array())
6020 6020
 	{
6021 6021
 		global $globalTimezone, $globalDBdriver;
@@ -6061,11 +6061,11 @@  discard block
 block discarded – undo
6061 6061
 	
6062 6062
 	
6063 6063
 	/**
6064
-	* Gets all departure airports by country of the airplanes that have flown over based on a date
6065
-	*
6066
-	* @return Array the airport list
6067
-	*
6068
-	*/
6064
+	 * Gets all departure airports by country of the airplanes that have flown over based on a date
6065
+	 *
6066
+	 * @return Array the airport list
6067
+	 *
6068
+	 */
6069 6069
 	public function countAllDepartureAirportCountriesByDate($date,$filters = array())
6070 6070
 	{
6071 6071
 		global $globalTimezone, $globalDBdriver;
@@ -6108,11 +6108,11 @@  discard block
 block discarded – undo
6108 6108
 	
6109 6109
 	
6110 6110
 	/**
6111
-	* Gets all departure airports of the airplanes that have flown over based on a ident/callsign
6112
-	*
6113
-	* @return Array the airport list
6114
-	*
6115
-	*/
6111
+	 * Gets all departure airports of the airplanes that have flown over based on a ident/callsign
6112
+	 *
6113
+	 * @return Array the airport list
6114
+	 *
6115
+	 */
6116 6116
 	public function countAllDepartureAirportsByIdent($ident,$filters = array())
6117 6117
 	{
6118 6118
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6146,11 +6146,11 @@  discard block
 block discarded – undo
6146 6146
 	
6147 6147
 	
6148 6148
 	/**
6149
-	* Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
6150
-	*
6151
-	* @return Array the airport list
6152
-	*
6153
-	*/
6149
+	 * Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
6150
+	 *
6151
+	 * @return Array the airport list
6152
+	 *
6153
+	 */
6154 6154
 	public function countAllDepartureAirportCountriesByIdent($ident,$filters = array())
6155 6155
 	{
6156 6156
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6181,11 +6181,11 @@  discard block
 block discarded – undo
6181 6181
 	
6182 6182
 	
6183 6183
 	/**
6184
-	* Gets all departure airports of the airplanes that have flown over based on a country
6185
-	*
6186
-	* @return Array the airport list
6187
-	*
6188
-	*/
6184
+	 * Gets all departure airports of the airplanes that have flown over based on a country
6185
+	 *
6186
+	 * @return Array the airport list
6187
+	 *
6188
+	 */
6189 6189
 	public function countAllDepartureAirportsByCountry($country,$filters = array())
6190 6190
 	{
6191 6191
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6219,11 +6219,11 @@  discard block
 block discarded – undo
6219 6219
 
6220 6220
 
6221 6221
 	/**
6222
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
6223
-	*
6224
-	* @return Array the airport list
6225
-	*
6226
-	*/
6222
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
6223
+	 *
6224
+	 * @return Array the airport list
6225
+	 *
6226
+	 */
6227 6227
 	public function countAllDepartureAirportCountriesByCountry($country,$filters = array())
6228 6228
 	{
6229 6229
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6253,40 +6253,40 @@  discard block
 block discarded – undo
6253 6253
 	
6254 6254
 
6255 6255
 	/**
6256
-	* Gets all arrival airports of the airplanes that have flown over
6257
-	*
6258
-	* @return Array the airport list
6259
-	*
6260
-	*/
6256
+	 * Gets all arrival airports of the airplanes that have flown over
6257
+	 *
6258
+	 * @return Array the airport list
6259
+	 *
6260
+	 */
6261 6261
 	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6262 6262
 	{
6263 6263
 		global $globalDBdriver;
6264 6264
 		$filter_query = $this->getFilter($filters,true,true);
6265 6265
 		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6266 6266
 				FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA'";
6267
-                if ($olderthanmonths > 0) {
6268
-            		if ($globalDBdriver == 'mysql') {
6267
+				if ($olderthanmonths > 0) {
6268
+					if ($globalDBdriver == 'mysql') {
6269 6269
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6270 6270
 			} else {
6271 6271
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6272 6272
 			}
6273
-                if ($sincedate != '') {
6274
-            		if ($globalDBdriver == 'mysql') {
6273
+				if ($sincedate != '') {
6274
+					if ($globalDBdriver == 'mysql') {
6275 6275
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6276 6276
 			} else {
6277 6277
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6278 6278
 			}
6279 6279
 		}
6280
-            		if ($globalDBdriver == 'mysql') {
6280
+					if ($globalDBdriver == 'mysql') {
6281 6281
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6282 6282
 			} else {
6283 6283
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6284 6284
 			}
6285 6285
 		}
6286 6286
 
6287
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6288
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6289
-                $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6287
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6288
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6289
+				$query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6290 6290
 					ORDER BY airport_arrival_icao_count DESC";
6291 6291
 		if ($limit) $query .= " LIMIT 10";
6292 6292
       
@@ -6315,40 +6315,40 @@  discard block
 block discarded – undo
6315 6315
 	}
6316 6316
 
6317 6317
 	/**
6318
-	* Gets all arrival airports of the airplanes that have flown over
6319
-	*
6320
-	* @return Array the airport list
6321
-	*
6322
-	*/
6318
+	 * Gets all arrival airports of the airplanes that have flown over
6319
+	 *
6320
+	 * @return Array the airport list
6321
+	 *
6322
+	 */
6323 6323
 	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6324 6324
 	{
6325 6325
 		global $globalDBdriver;
6326 6326
 		$filter_query = $this->getFilter($filters,true,true);
6327 6327
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6328 6328
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' ";
6329
-                if ($olderthanmonths > 0) {
6330
-            		if ($globalDBdriver == 'mysql') {
6329
+				if ($olderthanmonths > 0) {
6330
+					if ($globalDBdriver == 'mysql') {
6331 6331
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6332 6332
 			} else {
6333 6333
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6334 6334
 			}
6335
-                if ($sincedate != '') {
6336
-            		if ($globalDBdriver == 'mysql') {
6335
+				if ($sincedate != '') {
6336
+					if ($globalDBdriver == 'mysql') {
6337 6337
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6338 6338
 			} else {
6339 6339
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6340 6340
 			}
6341 6341
 		}
6342
-            		if ($globalDBdriver == 'mysql') {
6342
+					if ($globalDBdriver == 'mysql') {
6343 6343
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6344 6344
 			} else {
6345 6345
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6346 6346
 			}
6347 6347
 		}
6348 6348
 
6349
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6350
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6351
-                $query .= "GROUP BY spotter_output.airline_icao,spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6349
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6350
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6351
+				$query .= "GROUP BY spotter_output.airline_icao,spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6352 6352
 					ORDER BY airport_arrival_icao_count DESC";
6353 6353
 		if ($limit) $query .= " LIMIT 10";
6354 6354
       
@@ -6379,39 +6379,39 @@  discard block
 block discarded – undo
6379 6379
 
6380 6380
 
6381 6381
 	/**
6382
-	* Gets all detected arrival airports of the airplanes that have flown over
6383
-	*
6384
-	* @return Array the airport list
6385
-	*
6386
-	*/
6382
+	 * Gets all detected arrival airports of the airplanes that have flown over
6383
+	 *
6384
+	 * @return Array the airport list
6385
+	 *
6386
+	 */
6387 6387
 	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6388 6388
 	{
6389 6389
 		global $globalDBdriver;
6390 6390
 		$filter_query = $this->getFilter($filters,true,true);
6391 6391
 		$query  = "SELECT DISTINCT spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country 
6392 6392
 			FROM airport,spotter_output".$filter_query." spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao";
6393
-                if ($olderthanmonths > 0) {
6394
-            		if ($globalDBdriver == 'mysql') {
6393
+				if ($olderthanmonths > 0) {
6394
+					if ($globalDBdriver == 'mysql') {
6395 6395
 				$query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)';
6396 6396
 			} else {
6397 6397
 				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
6398 6398
 			}
6399
-                if ($sincedate != '') {
6400
-            		if ($globalDBdriver == 'mysql') {
6399
+				if ($sincedate != '') {
6400
+					if ($globalDBdriver == 'mysql') {
6401 6401
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6402 6402
 			} else {
6403 6403
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6404 6404
 			}
6405 6405
 		}
6406
-            		if ($globalDBdriver == 'mysql') {
6406
+					if ($globalDBdriver == 'mysql') {
6407 6407
 				$query .= " AND spotter_output.date > '".$sincedate."'";
6408 6408
 			} else {
6409 6409
 				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6410 6410
 			}
6411 6411
 		}
6412
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6413
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6414
-                $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6412
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6413
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6414
+				$query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6415 6415
 					ORDER BY airport_arrival_icao_count DESC";
6416 6416
 		if ($limit) $query .= " LIMIT 10";
6417 6417
       
@@ -6440,40 +6440,40 @@  discard block
 block discarded – undo
6440 6440
 	}
6441 6441
 	
6442 6442
 	/**
6443
-	* Gets all detected arrival airports of the airplanes that have flown over
6444
-	*
6445
-	* @return Array the airport list
6446
-	*
6447
-	*/
6443
+	 * Gets all detected arrival airports of the airplanes that have flown over
6444
+	 *
6445
+	 * @return Array the airport list
6446
+	 *
6447
+	 */
6448 6448
 	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6449 6449
 	{
6450 6450
 		global $globalDBdriver;
6451 6451
 		$filter_query = $this->getFilter($filters,true,true);
6452 6452
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country 
6453 6453
 			FROM airport,spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao ";
6454
-                if ($olderthanmonths > 0) {
6455
-            		if ($globalDBdriver == 'mysql') {
6454
+				if ($olderthanmonths > 0) {
6455
+					if ($globalDBdriver == 'mysql') {
6456 6456
 				$query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
6457 6457
 			} else {
6458 6458
 				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
6459 6459
 			}
6460
-                if ($sincedate != '') {
6461
-            		if ($globalDBdriver == 'mysql') {
6460
+				if ($sincedate != '') {
6461
+					if ($globalDBdriver == 'mysql') {
6462 6462
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6463 6463
 			} else {
6464 6464
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6465 6465
 			}
6466 6466
 		}
6467
-            		if ($globalDBdriver == 'mysql') {
6467
+					if ($globalDBdriver == 'mysql') {
6468 6468
 				$query .= "AND spotter_output.date > '".$sincedate."' ";
6469 6469
 			} else {
6470 6470
 				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
6471 6471
 			}
6472 6472
 		}
6473 6473
 
6474
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6475
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6476
-                $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6474
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
6475
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6476
+				$query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6477 6477
 					ORDER BY airport_arrival_icao_count DESC";
6478 6478
 		if ($limit) $query .= " LIMIT 10";
6479 6479
       
@@ -6503,11 +6503,11 @@  discard block
 block discarded – undo
6503 6503
 	}	
6504 6504
 	
6505 6505
 	/**
6506
-	* Gets all arrival airports of the airplanes that have flown over based on an airline icao
6507
-	*
6508
-	* @return Array the airport list
6509
-	*
6510
-	*/
6506
+	 * Gets all arrival airports of the airplanes that have flown over based on an airline icao
6507
+	 *
6508
+	 * @return Array the airport list
6509
+	 *
6510
+	 */
6511 6511
 	public function countAllArrivalAirportsByAirline($airline_icao, $filters = array())
6512 6512
 	{
6513 6513
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6539,11 +6539,11 @@  discard block
 block discarded – undo
6539 6539
 	
6540 6540
 	
6541 6541
 	/**
6542
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
6543
-	*
6544
-	* @return Array the airport list
6545
-	*
6546
-	*/
6542
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
6543
+	 *
6544
+	 * @return Array the airport list
6545
+	 *
6546
+	 */
6547 6547
 	public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array())
6548 6548
 	{
6549 6549
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6574,11 +6574,11 @@  discard block
 block discarded – undo
6574 6574
 	
6575 6575
 	
6576 6576
 	/**
6577
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
6578
-	*
6579
-	* @return Array the airport list
6580
-	*
6581
-	*/
6577
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
6578
+	 *
6579
+	 * @return Array the airport list
6580
+	 *
6581
+	 */
6582 6582
 	public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array())
6583 6583
 	{
6584 6584
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6612,11 +6612,11 @@  discard block
 block discarded – undo
6612 6612
 	
6613 6613
 	
6614 6614
 	/**
6615
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
6616
-	*
6617
-	* @return Array the airport list
6618
-	*
6619
-	*/
6615
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
6616
+	 *
6617
+	 * @return Array the airport list
6618
+	 *
6619
+	 */
6620 6620
 	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array())
6621 6621
 	{
6622 6622
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6646,11 +6646,11 @@  discard block
 block discarded – undo
6646 6646
 	
6647 6647
 	
6648 6648
 	/**
6649
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
6650
-	*
6651
-	* @return Array the airport list
6652
-	*
6653
-	*/
6649
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
6650
+	 *
6651
+	 * @return Array the airport list
6652
+	 *
6653
+	 */
6654 6654
 	public function countAllArrivalAirportsByRegistration($registration,$filters = array())
6655 6655
 	{
6656 6656
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6684,11 +6684,11 @@  discard block
 block discarded – undo
6684 6684
 	
6685 6685
 	
6686 6686
 	/**
6687
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
6688
-	*
6689
-	* @return Array the airport list
6690
-	*
6691
-	*/
6687
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
6688
+	 *
6689
+	 * @return Array the airport list
6690
+	 *
6691
+	 */
6692 6692
 	public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array())
6693 6693
 	{
6694 6694
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6719,11 +6719,11 @@  discard block
 block discarded – undo
6719 6719
 	
6720 6720
 	
6721 6721
 	/**
6722
-	* Gets all arrival airports of the airplanes that have flown over based on an departure airport
6723
-	*
6724
-	* @return Array the airport list
6725
-	*
6726
-	*/
6722
+	 * Gets all arrival airports of the airplanes that have flown over based on an departure airport
6723
+	 *
6724
+	 * @return Array the airport list
6725
+	 *
6726
+	 */
6727 6727
 	public function countAllArrivalAirportsByAirport($airport_icao,$filters = array())
6728 6728
 	{
6729 6729
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6756,11 +6756,11 @@  discard block
 block discarded – undo
6756 6756
 	
6757 6757
 	
6758 6758
 	/**
6759
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
6760
-	*
6761
-	* @return Array the airport list
6762
-	*
6763
-	*/
6759
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
6760
+	 *
6761
+	 * @return Array the airport list
6762
+	 *
6763
+	 */
6764 6764
 	public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array())
6765 6765
 	{
6766 6766
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6790,11 +6790,11 @@  discard block
 block discarded – undo
6790 6790
 	
6791 6791
 	
6792 6792
 	/**
6793
-	* Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
6794
-	*
6795
-	* @return Array the airport list
6796
-	*
6797
-	*/
6793
+	 * Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
6794
+	 *
6795
+	 * @return Array the airport list
6796
+	 *
6797
+	 */
6798 6798
 	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array())
6799 6799
 	{
6800 6800
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6828,11 +6828,11 @@  discard block
 block discarded – undo
6828 6828
 	
6829 6829
 	
6830 6830
 	/**
6831
-	* Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
6832
-	*
6833
-	* @return Array the airport list
6834
-	*
6835
-	*/
6831
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
6832
+	 *
6833
+	 * @return Array the airport list
6834
+	 *
6835
+	 */
6836 6836
 	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
6837 6837
 	{
6838 6838
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6863,11 +6863,11 @@  discard block
 block discarded – undo
6863 6863
 	
6864 6864
 	
6865 6865
 	/**
6866
-	* Gets all arrival airports of the airplanes that have flown over based on a date
6867
-	*
6868
-	* @return Array the airport list
6869
-	*
6870
-	*/
6866
+	 * Gets all arrival airports of the airplanes that have flown over based on a date
6867
+	 *
6868
+	 * @return Array the airport list
6869
+	 *
6870
+	 */
6871 6871
 	public function countAllArrivalAirportsByDate($date,$filters = array())
6872 6872
 	{
6873 6873
 		global $globalTimezone, $globalDBdriver;
@@ -6913,11 +6913,11 @@  discard block
 block discarded – undo
6913 6913
 	
6914 6914
 	
6915 6915
 	/**
6916
-	* Gets all arrival airports by country of the airplanes that have flown over based on a date
6917
-	*
6918
-	* @return Array the airport list
6919
-	*
6920
-	*/
6916
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a date
6917
+	 *
6918
+	 * @return Array the airport list
6919
+	 *
6920
+	 */
6921 6921
 	public function countAllArrivalAirportCountriesByDate($date, $filters = array())
6922 6922
 	{
6923 6923
 		global $globalTimezone, $globalDBdriver;
@@ -6960,11 +6960,11 @@  discard block
 block discarded – undo
6960 6960
 	
6961 6961
 	
6962 6962
 	/**
6963
-	* Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
6964
-	*
6965
-	* @return Array the airport list
6966
-	*
6967
-	*/
6963
+	 * Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
6964
+	 *
6965
+	 * @return Array the airport list
6966
+	 *
6967
+	 */
6968 6968
 	public function countAllArrivalAirportsByIdent($ident,$filters = array())
6969 6969
 	{
6970 6970
 		$filter_query = $this->getFilter($filters,true,true);
@@ -6997,11 +6997,11 @@  discard block
 block discarded – undo
6997 6997
 	
6998 6998
 	
6999 6999
 	/**
7000
-	* Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
7001
-	*
7002
-	* @return Array the airport list
7003
-	*
7004
-	*/
7000
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
7001
+	 *
7002
+	 * @return Array the airport list
7003
+	 *
7004
+	 */
7005 7005
 	public function countAllArrivalAirportCountriesByIdent($ident, $filters = array())
7006 7006
 	{
7007 7007
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7032,11 +7032,11 @@  discard block
 block discarded – undo
7032 7032
 	
7033 7033
 	
7034 7034
 	/**
7035
-	* Gets all arrival airports of the airplanes that have flown over based on a country
7036
-	*
7037
-	* @return Array the airport list
7038
-	*
7039
-	*/
7035
+	 * Gets all arrival airports of the airplanes that have flown over based on a country
7036
+	 *
7037
+	 * @return Array the airport list
7038
+	 *
7039
+	 */
7040 7040
 	public function countAllArrivalAirportsByCountry($country,$filters = array())
7041 7041
 	{
7042 7042
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7069,11 +7069,11 @@  discard block
 block discarded – undo
7069 7069
 	
7070 7070
 	
7071 7071
 	/**
7072
-	* Gets all arrival airports by country of the airplanes that have flown over based on a country
7073
-	*
7074
-	* @return Array the airport list
7075
-	*
7076
-	*/
7072
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a country
7073
+	 *
7074
+	 * @return Array the airport list
7075
+	 *
7076
+	 */
7077 7077
 	public function countAllArrivalAirportCountriesByCountry($country,$filters = array())
7078 7078
 	{
7079 7079
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7104,11 +7104,11 @@  discard block
 block discarded – undo
7104 7104
 
7105 7105
 
7106 7106
 	/**
7107
-	* Counts all airport departure countries
7108
-	*
7109
-	* @return Array the airport departure list
7110
-	*
7111
-	*/
7107
+	 * Counts all airport departure countries
7108
+	 *
7109
+	 * @return Array the airport departure list
7110
+	 *
7111
+	 */
7112 7112
 	public function countAllDepartureCountries($filters = array())
7113 7113
 	{
7114 7114
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7138,11 +7138,11 @@  discard block
 block discarded – undo
7138 7138
 	
7139 7139
 	
7140 7140
 	/**
7141
-	* Counts all airport arrival countries
7142
-	*
7143
-	* @return Array the airport arrival list
7144
-	*
7145
-	*/
7141
+	 * Counts all airport arrival countries
7142
+	 *
7143
+	 * @return Array the airport arrival list
7144
+	 *
7145
+	 */
7146 7146
 	public function countAllArrivalCountries($limit = true,$filters = array())
7147 7147
 	{
7148 7148
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7175,11 +7175,11 @@  discard block
 block discarded – undo
7175 7175
 
7176 7176
 
7177 7177
 	/**
7178
-	* Gets all route combinations
7179
-	*
7180
-	* @return Array the route list
7181
-	*
7182
-	*/
7178
+	 * Gets all route combinations
7179
+	 *
7180
+	 * @return Array the route list
7181
+	 *
7182
+	 */
7183 7183
 	public function countAllRoutes($filters = array())
7184 7184
 	{
7185 7185
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7218,11 +7218,11 @@  discard block
 block discarded – undo
7218 7218
 	
7219 7219
 	
7220 7220
 	/**
7221
-	* Gets all route combinations based on an aircraft
7222
-	*
7223
-	* @return Array the route list
7224
-	*
7225
-	*/
7221
+	 * Gets all route combinations based on an aircraft
7222
+	 *
7223
+	 * @return Array the route list
7224
+	 *
7225
+	 */
7226 7226
 	public function countAllRoutesByAircraft($aircraft_icao,$filters = array())
7227 7227
 	{
7228 7228
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7258,11 +7258,11 @@  discard block
 block discarded – undo
7258 7258
 	
7259 7259
 	
7260 7260
 	/**
7261
-	* Gets all route combinations based on an aircraft registration
7262
-	*
7263
-	* @return Array the route list
7264
-	*
7265
-	*/
7261
+	 * Gets all route combinations based on an aircraft registration
7262
+	 *
7263
+	 * @return Array the route list
7264
+	 *
7265
+	 */
7266 7266
 	public function countAllRoutesByRegistration($registration, $filters = array())
7267 7267
 	{
7268 7268
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7300,11 +7300,11 @@  discard block
 block discarded – undo
7300 7300
 	
7301 7301
 	
7302 7302
 	/**
7303
-	* Gets all route combinations based on an airline
7304
-	*
7305
-	* @return Array the route list
7306
-	*
7307
-	*/
7303
+	 * Gets all route combinations based on an airline
7304
+	 *
7305
+	 * @return Array the route list
7306
+	 *
7307
+	 */
7308 7308
 	public function countAllRoutesByAirline($airline_icao, $filters = array())
7309 7309
 	{
7310 7310
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7342,11 +7342,11 @@  discard block
 block discarded – undo
7342 7342
 	
7343 7343
 	
7344 7344
 	/**
7345
-	* Gets all route combinations based on an airport
7346
-	*
7347
-	* @return Array the route list
7348
-	*
7349
-	*/
7345
+	 * Gets all route combinations based on an airport
7346
+	 *
7347
+	 * @return Array the route list
7348
+	 *
7349
+	 */
7350 7350
 	public function countAllRoutesByAirport($airport_icao, $filters = array())
7351 7351
 	{
7352 7352
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7383,11 +7383,11 @@  discard block
 block discarded – undo
7383 7383
 	
7384 7384
 	
7385 7385
 	/**
7386
-	* Gets all route combinations based on an country
7387
-	*
7388
-	* @return Array the route list
7389
-	*
7390
-	*/
7386
+	 * Gets all route combinations based on an country
7387
+	 *
7388
+	 * @return Array the route list
7389
+	 *
7390
+	 */
7391 7391
 	public function countAllRoutesByCountry($country, $filters = array())
7392 7392
 	{
7393 7393
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7423,11 +7423,11 @@  discard block
 block discarded – undo
7423 7423
 
7424 7424
 
7425 7425
 	/**
7426
-	* Gets all route combinations based on an date
7427
-	*
7428
-	* @return Array the route list
7429
-	*
7430
-	*/
7426
+	 * Gets all route combinations based on an date
7427
+	 *
7428
+	 * @return Array the route list
7429
+	 *
7430
+	 */
7431 7431
 	public function countAllRoutesByDate($date, $filters = array())
7432 7432
 	{
7433 7433
 		global $globalTimezone, $globalDBdriver;
@@ -7477,11 +7477,11 @@  discard block
 block discarded – undo
7477 7477
 	
7478 7478
 	
7479 7479
 	/**
7480
-	* Gets all route combinations based on an ident/callsign
7481
-	*
7482
-	* @return Array the route list
7483
-	*
7484
-	*/
7480
+	 * Gets all route combinations based on an ident/callsign
7481
+	 *
7482
+	 * @return Array the route list
7483
+	 *
7484
+	 */
7485 7485
 	public function countAllRoutesByIdent($ident, $filters = array())
7486 7486
 	{
7487 7487
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7518,11 +7518,11 @@  discard block
 block discarded – undo
7518 7518
 	
7519 7519
 	
7520 7520
 	/**
7521
-	* Gets all route combinations based on an manufacturer
7522
-	*
7523
-	* @return Array the route list
7524
-	*
7525
-	*/
7521
+	 * Gets all route combinations based on an manufacturer
7522
+	 *
7523
+	 * @return Array the route list
7524
+	 *
7525
+	 */
7526 7526
 	public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array())
7527 7527
 	{
7528 7528
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7560,11 +7560,11 @@  discard block
 block discarded – undo
7560 7560
 	
7561 7561
 	
7562 7562
 	/**
7563
-	* Gets all route combinations with waypoints
7564
-	*
7565
-	* @return Array the route list
7566
-	*
7567
-	*/
7563
+	 * Gets all route combinations with waypoints
7564
+	 *
7565
+	 * @return Array the route list
7566
+	 *
7567
+	 */
7568 7568
 	public function countAllRoutesWithWaypoints($filters = array())
7569 7569
 	{
7570 7570
 		$filter_query = $this->getFilter($filters,true,true);
@@ -7601,11 +7601,11 @@  discard block
 block discarded – undo
7601 7601
 	}
7602 7602
 	
7603 7603
 	/**
7604
-	* Gets all callsigns that have flown over
7605
-	*
7606
-	* @return Array the callsign list
7607
-	*
7608
-	*/
7604
+	 * Gets all callsigns that have flown over
7605
+	 *
7606
+	 * @return Array the callsign list
7607
+	 *
7608
+	 */
7609 7609
 	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
7610 7610
 	{
7611 7611
 		global $globalDBdriver;
@@ -7643,11 +7643,11 @@  discard block
 block discarded – undo
7643 7643
 	}
7644 7644
 
7645 7645
 	/**
7646
-	* Gets all callsigns that have flown over
7647
-	*
7648
-	* @return Array the callsign list
7649
-	*
7650
-	*/
7646
+	 * Gets all callsigns that have flown over
7647
+	 *
7648
+	 * @return Array the callsign list
7649
+	 *
7650
+	 */
7651 7651
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
7652 7652
 	{
7653 7653
 		global $globalDBdriver;
@@ -7688,11 +7688,11 @@  discard block
 block discarded – undo
7688 7688
 
7689 7689
 
7690 7690
 	/**
7691
-	* Counts all dates
7692
-	*
7693
-	* @return Array the date list
7694
-	*
7695
-	*/
7691
+	 * Counts all dates
7692
+	 *
7693
+	 * @return Array the date list
7694
+	 *
7695
+	 */
7696 7696
 	public function countAllDates($filters = array())
7697 7697
 	{
7698 7698
 		global $globalTimezone, $globalDBdriver;
@@ -7737,11 +7737,11 @@  discard block
 block discarded – undo
7737 7737
 	}
7738 7738
 	
7739 7739
 	/**
7740
-	* Counts all dates
7741
-	*
7742
-	* @return Array the date list
7743
-	*
7744
-	*/
7740
+	 * Counts all dates
7741
+	 *
7742
+	 * @return Array the date list
7743
+	 *
7744
+	 */
7745 7745
 	public function countAllDatesByAirlines($filters = array())
7746 7746
 	{
7747 7747
 		global $globalTimezone, $globalDBdriver;
@@ -7786,11 +7786,11 @@  discard block
 block discarded – undo
7786 7786
 	}	
7787 7787
 	
7788 7788
 	/**
7789
-	* Counts all dates during the last 7 days
7790
-	*
7791
-	* @return Array the date list
7792
-	*
7793
-	*/
7789
+	 * Counts all dates during the last 7 days
7790
+	 *
7791
+	 * @return Array the date list
7792
+	 *
7793
+	 */
7794 7794
 	public function countAllDatesLast7Days($filters = array())
7795 7795
 	{
7796 7796
 		global $globalTimezone, $globalDBdriver;
@@ -7812,7 +7812,7 @@  discard block
 block discarded – undo
7812 7812
 			$query .= " GROUP BY date_name 
7813 7813
 								ORDER BY date_name ASC";
7814 7814
 			$query_data = array(':offset' => $offset);
7815
-    		}
7815
+			}
7816 7816
 		
7817 7817
 		$sth = $this->db->prepare($query);
7818 7818
 		$sth->execute($query_data);
@@ -7832,11 +7832,11 @@  discard block
 block discarded – undo
7832 7832
 	}
7833 7833
 
7834 7834
 	/**
7835
-	* Counts all dates during the last month
7836
-	*
7837
-	* @return Array the date list
7838
-	*
7839
-	*/
7835
+	 * Counts all dates during the last month
7836
+	 *
7837
+	 * @return Array the date list
7838
+	 *
7839
+	 */
7840 7840
 	public function countAllDatesLastMonth($filters = array())
7841 7841
 	{
7842 7842
 		global $globalTimezone, $globalDBdriver;
@@ -7858,7 +7858,7 @@  discard block
 block discarded – undo
7858 7858
 			$query .= " GROUP BY date_name 
7859 7859
 								ORDER BY date_name ASC";
7860 7860
 			$query_data = array(':offset' => $offset);
7861
-    		}
7861
+			}
7862 7862
 		
7863 7863
 		$sth = $this->db->prepare($query);
7864 7864
 		$sth->execute($query_data);
@@ -7879,11 +7879,11 @@  discard block
 block discarded – undo
7879 7879
 
7880 7880
 
7881 7881
 	/**
7882
-	* Counts all dates during the last month
7883
-	*
7884
-	* @return Array the date list
7885
-	*
7886
-	*/
7882
+	 * Counts all dates during the last month
7883
+	 *
7884
+	 * @return Array the date list
7885
+	 *
7886
+	 */
7887 7887
 	public function countAllDatesLastMonthByAirlines($filters = array())
7888 7888
 	{
7889 7889
 		global $globalTimezone, $globalDBdriver;
@@ -7906,7 +7906,7 @@  discard block
 block discarded – undo
7906 7906
 								GROUP BY spotter_output.airline_icao, date_name 
7907 7907
 								ORDER BY date_name ASC";
7908 7908
 			$query_data = array(':offset' => $offset);
7909
-    		}
7909
+			}
7910 7910
 		
7911 7911
 		$sth = $this->db->prepare($query);
7912 7912
 		$sth->execute($query_data);
@@ -7928,11 +7928,11 @@  discard block
 block discarded – undo
7928 7928
 	
7929 7929
 
7930 7930
 	/**
7931
-	* Counts all month
7932
-	*
7933
-	* @return Array the month list
7934
-	*
7935
-	*/
7931
+	 * Counts all month
7932
+	 *
7933
+	 * @return Array the month list
7934
+	 *
7935
+	 */
7936 7936
 	public function countAllMonths($filters = array())
7937 7937
 	{
7938 7938
 		global $globalTimezone, $globalDBdriver;
@@ -7974,11 +7974,11 @@  discard block
 block discarded – undo
7974 7974
 	}
7975 7975
 
7976 7976
 	/**
7977
-	* Counts all month
7978
-	*
7979
-	* @return Array the month list
7980
-	*
7981
-	*/
7977
+	 * Counts all month
7978
+	 *
7979
+	 * @return Array the month list
7980
+	 *
7981
+	 */
7982 7982
 	public function countAllMonthsByAirlines($filters = array())
7983 7983
 	{
7984 7984
 		global $globalTimezone, $globalDBdriver;
@@ -8023,11 +8023,11 @@  discard block
 block discarded – undo
8023 8023
 	}
8024 8024
 
8025 8025
 	/**
8026
-	* Counts all military month
8027
-	*
8028
-	* @return Array the month list
8029
-	*
8030
-	*/
8026
+	 * Counts all military month
8027
+	 *
8028
+	 * @return Array the month list
8029
+	 *
8030
+	 */
8031 8031
 	public function countAllMilitaryMonths($filters = array())
8032 8032
 	{
8033 8033
 		global $globalTimezone, $globalDBdriver;
@@ -8068,11 +8068,11 @@  discard block
 block discarded – undo
8068 8068
 	}
8069 8069
 	
8070 8070
 	/**
8071
-	* Counts all month owners
8072
-	*
8073
-	* @return Array the month list
8074
-	*
8075
-	*/
8071
+	 * Counts all month owners
8072
+	 *
8073
+	 * @return Array the month list
8074
+	 *
8075
+	 */
8076 8076
 	public function countAllMonthsOwners($filters = array())
8077 8077
 	{
8078 8078
 		global $globalTimezone, $globalDBdriver;
@@ -8114,11 +8114,11 @@  discard block
 block discarded – undo
8114 8114
 	}
8115 8115
 	
8116 8116
 	/**
8117
-	* Counts all month owners
8118
-	*
8119
-	* @return Array the month list
8120
-	*
8121
-	*/
8117
+	 * Counts all month owners
8118
+	 *
8119
+	 * @return Array the month list
8120
+	 *
8121
+	 */
8122 8122
 	public function countAllMonthsOwnersByAirlines($filters = array())
8123 8123
 	{
8124 8124
 		global $globalTimezone, $globalDBdriver;
@@ -8161,11 +8161,11 @@  discard block
 block discarded – undo
8161 8161
 	}
8162 8162
 
8163 8163
 	/**
8164
-	* Counts all month pilot
8165
-	*
8166
-	* @return Array the month list
8167
-	*
8168
-	*/
8164
+	 * Counts all month pilot
8165
+	 *
8166
+	 * @return Array the month list
8167
+	 *
8168
+	 */
8169 8169
 	public function countAllMonthsPilots($filters = array())
8170 8170
 	{
8171 8171
 		global $globalTimezone, $globalDBdriver;
@@ -8207,11 +8207,11 @@  discard block
 block discarded – undo
8207 8207
 	}
8208 8208
 	
8209 8209
 	/**
8210
-	* Counts all month pilot
8211
-	*
8212
-	* @return Array the month list
8213
-	*
8214
-	*/
8210
+	 * Counts all month pilot
8211
+	 *
8212
+	 * @return Array the month list
8213
+	 *
8214
+	 */
8215 8215
 	public function countAllMonthsPilotsByAirlines($filters = array())
8216 8216
 	{
8217 8217
 		global $globalTimezone, $globalDBdriver;
@@ -8254,11 +8254,11 @@  discard block
 block discarded – undo
8254 8254
 	}
8255 8255
 
8256 8256
 	/**
8257
-	* Counts all month airline
8258
-	*
8259
-	* @return Array the month list
8260
-	*
8261
-	*/
8257
+	 * Counts all month airline
8258
+	 *
8259
+	 * @return Array the month list
8260
+	 *
8261
+	 */
8262 8262
 	public function countAllMonthsAirlines($filters = array())
8263 8263
 	{
8264 8264
 		global $globalTimezone, $globalDBdriver;
@@ -8300,11 +8300,11 @@  discard block
 block discarded – undo
8300 8300
 	}
8301 8301
 	
8302 8302
 	/**
8303
-	* Counts all month aircraft
8304
-	*
8305
-	* @return Array the month list
8306
-	*
8307
-	*/
8303
+	 * Counts all month aircraft
8304
+	 *
8305
+	 * @return Array the month list
8306
+	 *
8307
+	 */
8308 8308
 	public function countAllMonthsAircrafts($filters = array())
8309 8309
 	{
8310 8310
 		global $globalTimezone, $globalDBdriver;
@@ -8347,11 +8347,11 @@  discard block
 block discarded – undo
8347 8347
 	
8348 8348
 
8349 8349
 	/**
8350
-	* Counts all month aircraft
8351
-	*
8352
-	* @return Array the month list
8353
-	*
8354
-	*/
8350
+	 * Counts all month aircraft
8351
+	 *
8352
+	 * @return Array the month list
8353
+	 *
8354
+	 */
8355 8355
 	public function countAllMonthsAircraftsByAirlines($filters = array())
8356 8356
 	{
8357 8357
 		global $globalTimezone, $globalDBdriver;
@@ -8394,11 +8394,11 @@  discard block
 block discarded – undo
8394 8394
 	}
8395 8395
 
8396 8396
 	/**
8397
-	* Counts all month real arrival
8398
-	*
8399
-	* @return Array the month list
8400
-	*
8401
-	*/
8397
+	 * Counts all month real arrival
8398
+	 *
8399
+	 * @return Array the month list
8400
+	 *
8401
+	 */
8402 8402
 	public function countAllMonthsRealArrivals($filters = array())
8403 8403
 	{
8404 8404
 		global $globalTimezone, $globalDBdriver;
@@ -8441,11 +8441,11 @@  discard block
 block discarded – undo
8441 8441
 	
8442 8442
 
8443 8443
 	/**
8444
-	* Counts all month real arrival
8445
-	*
8446
-	* @return Array the month list
8447
-	*
8448
-	*/
8444
+	 * Counts all month real arrival
8445
+	 *
8446
+	 * @return Array the month list
8447
+	 *
8448
+	 */
8449 8449
 	public function countAllMonthsRealArrivalsByAirlines($filters = array())
8450 8450
 	{
8451 8451
 		global $globalTimezone, $globalDBdriver;
@@ -8489,11 +8489,11 @@  discard block
 block discarded – undo
8489 8489
 	
8490 8490
 
8491 8491
 	/**
8492
-	* Counts all dates during the last year
8493
-	*
8494
-	* @return Array the date list
8495
-	*
8496
-	*/
8492
+	 * Counts all dates during the last year
8493
+	 *
8494
+	 * @return Array the date list
8495
+	 *
8496
+	 */
8497 8497
 	public function countAllMonthsLastYear($filters)
8498 8498
 	{
8499 8499
 		global $globalTimezone, $globalDBdriver;
@@ -8515,7 +8515,7 @@  discard block
 block discarded – undo
8515 8515
 			$query .= " GROUP BY year_name, month_name
8516 8516
 								ORDER BY year_name, month_name ASC";
8517 8517
 			$query_data = array(':offset' => $offset);
8518
-    		}
8518
+			}
8519 8519
 		
8520 8520
 		$sth = $this->db->prepare($query);
8521 8521
 		$sth->execute($query_data);
@@ -8538,11 +8538,11 @@  discard block
 block discarded – undo
8538 8538
 	
8539 8539
 	
8540 8540
 	/**
8541
-	* Counts all hours
8542
-	*
8543
-	* @return Array the hour list
8544
-	*
8545
-	*/
8541
+	 * Counts all hours
8542
+	 *
8543
+	 * @return Array the hour list
8544
+	 *
8545
+	 */
8546 8546
 	public function countAllHours($orderby,$filters = array())
8547 8547
 	{
8548 8548
 		global $globalTimezone, $globalDBdriver;
@@ -8603,11 +8603,11 @@  discard block
 block discarded – undo
8603 8603
 	}
8604 8604
 	
8605 8605
 	/**
8606
-	* Counts all hours
8607
-	*
8608
-	* @return Array the hour list
8609
-	*
8610
-	*/
8606
+	 * Counts all hours
8607
+	 *
8608
+	 * @return Array the hour list
8609
+	 *
8610
+	 */
8611 8611
 	public function countAllHoursByAirlines($orderby, $filters = array())
8612 8612
 	{
8613 8613
 		global $globalTimezone, $globalDBdriver;
@@ -8670,11 +8670,11 @@  discard block
 block discarded – undo
8670 8670
 
8671 8671
 
8672 8672
 	/**
8673
-	* Counts all hours by airline
8674
-	*
8675
-	* @return Array the hour list
8676
-	*
8677
-	*/
8673
+	 * Counts all hours by airline
8674
+	 *
8675
+	 * @return Array the hour list
8676
+	 *
8677
+	 */
8678 8678
 	public function countAllHoursByAirline($airline_icao, $filters = array())
8679 8679
 	{
8680 8680
 		global $globalTimezone, $globalDBdriver;
@@ -8720,11 +8720,11 @@  discard block
 block discarded – undo
8720 8720
 	
8721 8721
 	
8722 8722
 	/**
8723
-	* Counts all hours by aircraft
8724
-	*
8725
-	* @return Array the hour list
8726
-	*
8727
-	*/
8723
+	 * Counts all hours by aircraft
8724
+	 *
8725
+	 * @return Array the hour list
8726
+	 *
8727
+	 */
8728 8728
 	public function countAllHoursByAircraft($aircraft_icao, $filters = array())
8729 8729
 	{
8730 8730
 		global $globalTimezone, $globalDBdriver;
@@ -8767,11 +8767,11 @@  discard block
 block discarded – undo
8767 8767
 	
8768 8768
 	
8769 8769
 	/**
8770
-	* Counts all hours by aircraft registration
8771
-	*
8772
-	* @return Array the hour list
8773
-	*
8774
-	*/
8770
+	 * Counts all hours by aircraft registration
8771
+	 *
8772
+	 * @return Array the hour list
8773
+	 *
8774
+	 */
8775 8775
 	public function countAllHoursByRegistration($registration, $filters = array())
8776 8776
 	{
8777 8777
 		global $globalTimezone, $globalDBdriver;
@@ -8814,11 +8814,11 @@  discard block
 block discarded – undo
8814 8814
 	
8815 8815
 	
8816 8816
 	/**
8817
-	* Counts all hours by airport
8818
-	*
8819
-	* @return Array the hour list
8820
-	*
8821
-	*/
8817
+	 * Counts all hours by airport
8818
+	 *
8819
+	 * @return Array the hour list
8820
+	 *
8821
+	 */
8822 8822
 	public function countAllHoursByAirport($airport_icao, $filters = array())
8823 8823
 	{
8824 8824
 		global $globalTimezone, $globalDBdriver;
@@ -8862,11 +8862,11 @@  discard block
 block discarded – undo
8862 8862
 	
8863 8863
 	
8864 8864
 	/**
8865
-	* Counts all hours by manufacturer
8866
-	*
8867
-	* @return Array the hour list
8868
-	*
8869
-	*/
8865
+	 * Counts all hours by manufacturer
8866
+	 *
8867
+	 * @return Array the hour list
8868
+	 *
8869
+	 */
8870 8870
 	public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array())
8871 8871
 	{
8872 8872
 		global $globalTimezone, $globalDBdriver;
@@ -8910,11 +8910,11 @@  discard block
 block discarded – undo
8910 8910
 	
8911 8911
 	
8912 8912
 	/**
8913
-	* Counts all hours by date
8914
-	*
8915
-	* @return Array the hour list
8916
-	*
8917
-	*/
8913
+	 * Counts all hours by date
8914
+	 *
8915
+	 * @return Array the hour list
8916
+	 *
8917
+	 */
8918 8918
 	public function countAllHoursByDate($date, $filters = array())
8919 8919
 	{
8920 8920
 		global $globalTimezone, $globalDBdriver;
@@ -8958,11 +8958,11 @@  discard block
 block discarded – undo
8958 8958
 	
8959 8959
 	
8960 8960
 	/**
8961
-	* Counts all hours by a ident/callsign
8962
-	*
8963
-	* @return Array the hour list
8964
-	*
8965
-	*/
8961
+	 * Counts all hours by a ident/callsign
8962
+	 *
8963
+	 * @return Array the hour list
8964
+	 *
8965
+	 */
8966 8966
 	public function countAllHoursByIdent($ident, $filters = array())
8967 8967
 	{
8968 8968
 		global $globalTimezone, $globalDBdriver;
@@ -9007,11 +9007,11 @@  discard block
 block discarded – undo
9007 9007
 	
9008 9008
 	
9009 9009
 	/**
9010
-	* Counts all hours by route
9011
-	*
9012
-	* @return Array the hour list
9013
-	*
9014
-	*/
9010
+	 * Counts all hours by route
9011
+	 *
9012
+	 * @return Array the hour list
9013
+	 *
9014
+	 */
9015 9015
 	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array())
9016 9016
 	{
9017 9017
 		global $globalTimezone, $globalDBdriver;
@@ -9055,11 +9055,11 @@  discard block
 block discarded – undo
9055 9055
 	
9056 9056
 	
9057 9057
 	/**
9058
-	* Counts all hours by country
9059
-	*
9060
-	* @return Array the hour list
9061
-	*
9062
-	*/
9058
+	 * Counts all hours by country
9059
+	 *
9060
+	 * @return Array the hour list
9061
+	 *
9062
+	 */
9063 9063
 	public function countAllHoursByCountry($country, $filters = array())
9064 9064
 	{
9065 9065
 		global $globalTimezone, $globalDBdriver;
@@ -9104,11 +9104,11 @@  discard block
 block discarded – undo
9104 9104
 
9105 9105
 
9106 9106
 	/**
9107
-	* Counts all aircraft that have flown over
9108
-	*
9109
-	* @return Integer the number of aircrafts
9110
-	*
9111
-	*/
9107
+	 * Counts all aircraft that have flown over
9108
+	 *
9109
+	 * @return Integer the number of aircrafts
9110
+	 *
9111
+	 */
9112 9112
 	public function countOverallAircrafts($filters = array())
9113 9113
 	{
9114 9114
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9120,11 +9120,11 @@  discard block
 block discarded – undo
9120 9120
 	}
9121 9121
 
9122 9122
 	/**
9123
-	* Counts all flight that really arrival
9124
-	*
9125
-	* @return Integer the number of aircrafts
9126
-	*
9127
-	*/
9123
+	 * Counts all flight that really arrival
9124
+	 *
9125
+	 * @return Integer the number of aircrafts
9126
+	 *
9127
+	 */
9128 9128
 	public function countOverallArrival($filters = array())
9129 9129
 	{
9130 9130
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9137,11 +9137,11 @@  discard block
 block discarded – undo
9137 9137
 	}
9138 9138
 
9139 9139
 	/**
9140
-	* Counts all pilots that have flown over
9141
-	*
9142
-	* @return Integer the number of pilots
9143
-	*
9144
-	*/
9140
+	 * Counts all pilots that have flown over
9141
+	 *
9142
+	 * @return Integer the number of pilots
9143
+	 *
9144
+	 */
9145 9145
 	public function countOverallPilots($filters = array())
9146 9146
 	{
9147 9147
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9153,11 +9153,11 @@  discard block
 block discarded – undo
9153 9153
 	}
9154 9154
 
9155 9155
 	/**
9156
-	* Counts all owners that have flown over
9157
-	*
9158
-	* @return Integer the number of owners
9159
-	*
9160
-	*/
9156
+	 * Counts all owners that have flown over
9157
+	 *
9158
+	 * @return Integer the number of owners
9159
+	 *
9160
+	 */
9161 9161
 	public function countOverallOwners($filters = array())
9162 9162
 	{
9163 9163
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9170,11 +9170,11 @@  discard block
 block discarded – undo
9170 9170
 	
9171 9171
 	
9172 9172
 	/**
9173
-	* Counts all flights that have flown over
9174
-	*
9175
-	* @return Integer the number of flights
9176
-	*
9177
-	*/
9173
+	 * Counts all flights that have flown over
9174
+	 *
9175
+	 * @return Integer the number of flights
9176
+	 *
9177
+	 */
9178 9178
 	public function countOverallFlights($filters = array())
9179 9179
 	{
9180 9180
 		$query  = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
@@ -9187,11 +9187,11 @@  discard block
 block discarded – undo
9187 9187
 	}
9188 9188
 	
9189 9189
 	/**
9190
-	* Counts all military flights that have flown over
9191
-	*
9192
-	* @return Integer the number of flights
9193
-	*
9194
-	*/
9190
+	 * Counts all military flights that have flown over
9191
+	 *
9192
+	 * @return Integer the number of flights
9193
+	 *
9194
+	 */
9195 9195
 	public function countOverallMilitaryFlights($filters = array())
9196 9196
 	{
9197 9197
 		$filter_query = $this->getFilter($filters,true,true);
@@ -9206,11 +9206,11 @@  discard block
 block discarded – undo
9206 9206
 	
9207 9207
 	
9208 9208
 	/**
9209
-	* Counts all airlines that have flown over
9210
-	*
9211
-	* @return Integer the number of airlines
9212
-	*
9213
-	*/
9209
+	 * Counts all airlines that have flown over
9210
+	 *
9211
+	 * @return Integer the number of airlines
9212
+	 *
9213
+	 */
9214 9214
 	public function countOverallAirlines($filters = array())
9215 9215
 	{
9216 9216
 		$query  = "SELECT COUNT(DISTINCT spotter_output.airline_name) AS airline_count 
@@ -9224,11 +9224,11 @@  discard block
 block discarded – undo
9224 9224
 
9225 9225
   
9226 9226
 	/**
9227
-	* Counts all hours of today
9228
-	*
9229
-	* @return Array the hour list
9230
-	*
9231
-	*/
9227
+	 * Counts all hours of today
9228
+	 *
9229
+	 * @return Array the hour list
9230
+	 *
9231
+	 */
9232 9232
 	public function countAllHoursFromToday($filters = array())
9233 9233
 	{
9234 9234
 		global $globalTimezone, $globalDBdriver;
@@ -9268,11 +9268,11 @@  discard block
 block discarded – undo
9268 9268
 	}
9269 9269
     
9270 9270
 	/**
9271
-	* Gets all the spotter information based on calculated upcoming flights
9272
-	*
9273
-	* @return Array the spotter information
9274
-	*
9275
-	*/
9271
+	 * Gets all the spotter information based on calculated upcoming flights
9272
+	 *
9273
+	 * @return Array the spotter information
9274
+	 *
9275
+	 */
9276 9276
 	public function getUpcomingFlights($limit = '', $sort = '', $filters = array())
9277 9277
 	{
9278 9278
 		global $global_query, $globalDBdriver, $globalTimezone;
@@ -9347,12 +9347,12 @@  discard block
 block discarded – undo
9347 9347
 	}
9348 9348
     
9349 9349
     
9350
-     /**
9351
-	* Gets the Barrie Spotter ID based on the FlightAware ID
9352
-	*
9353
-	* @return Integer the Barrie Spotter ID
9350
+	 /**
9351
+	  * Gets the Barrie Spotter ID based on the FlightAware ID
9352
+	  *
9353
+	  * @return Integer the Barrie Spotter ID
9354 9354
 q	*
9355
-	*/
9355
+	  */
9356 9356
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
9357 9357
 	{
9358 9358
 		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
@@ -9373,13 +9373,13 @@  discard block
 block discarded – undo
9373 9373
   
9374 9374
  
9375 9375
 	/**
9376
-	* Parses a date string
9377
-	*
9378
-	* @param String $dateString the date string
9379
-	* @param String $timezone the timezone of a user
9380
-	* @return Array the time information
9381
-	*
9382
-	*/
9376
+	 * Parses a date string
9377
+	 *
9378
+	 * @param String $dateString the date string
9379
+	 * @param String $timezone the timezone of a user
9380
+	 * @return Array the time information
9381
+	 *
9382
+	 */
9383 9383
 	public function parseDateString($dateString, $timezone = '')
9384 9384
 	{
9385 9385
 		$time_array = array();
@@ -9415,12 +9415,12 @@  discard block
 block discarded – undo
9415 9415
 	
9416 9416
 	
9417 9417
 	/**
9418
-	* Parses the direction degrees to working
9419
-	*
9420
-	* @param Float $direction the direction in degrees
9421
-	* @return Array the direction information
9422
-	*
9423
-	*/
9418
+	 * Parses the direction degrees to working
9419
+	 *
9420
+	 * @param Float $direction the direction in degrees
9421
+	 * @return Array the direction information
9422
+	 *
9423
+	 */
9424 9424
 	public function parseDirection($direction = 0)
9425 9425
 	{
9426 9426
 		if ($direction == '') $direction = 0;
@@ -9499,12 +9499,12 @@  discard block
 block discarded – undo
9499 9499
 	
9500 9500
 	
9501 9501
 	/**
9502
-	* Gets the aircraft registration
9503
-	*
9504
-	* @param String $flightaware_id the flight aware id
9505
-	* @return String the aircraft registration
9506
-	*
9507
-	*/
9502
+	 * Gets the aircraft registration
9503
+	 *
9504
+	 * @param String $flightaware_id the flight aware id
9505
+	 * @return String the aircraft registration
9506
+	 *
9507
+	 */
9508 9508
 	
9509 9509
 	public function getAircraftRegistration($flightaware_id)
9510 9510
 	{
@@ -9533,12 +9533,12 @@  discard block
 block discarded – undo
9533 9533
 
9534 9534
 
9535 9535
 	/**
9536
-	* Gets the aircraft registration from ModeS
9537
-	*
9538
-	* @param String $aircraft_modes the flight ModeS in hex
9539
-	* @return String the aircraft registration
9540
-	*
9541
-	*/
9536
+	 * Gets the aircraft registration from ModeS
9537
+	 *
9538
+	 * @param String $aircraft_modes the flight ModeS in hex
9539
+	 * @return String the aircraft registration
9540
+	 *
9541
+	 */
9542 9542
 	public function getAircraftRegistrationBymodeS($aircraft_modes)
9543 9543
 	{
9544 9544
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -9551,19 +9551,19 @@  discard block
 block discarded – undo
9551 9551
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
9552 9552
 		$sth->closeCursor();
9553 9553
 		if (count($row) > 0) {
9554
-		    //return $row['Registration'];
9555
-		    return $row['registration'];
9554
+			//return $row['Registration'];
9555
+			return $row['registration'];
9556 9556
 		} else return '';
9557 9557
 	
9558 9558
 	}
9559 9559
 
9560 9560
 	/**
9561
-	* Gets the aircraft type from ModeS
9562
-	*
9563
-	* @param String $aircraft_modes the flight ModeS in hex
9564
-	* @return String the aircraft type
9565
-	*
9566
-	*/
9561
+	 * Gets the aircraft type from ModeS
9562
+	 *
9563
+	 * @param String $aircraft_modes the flight ModeS in hex
9564
+	 * @return String the aircraft type
9565
+	 *
9566
+	 */
9567 9567
 	public function getAircraftTypeBymodeS($aircraft_modes)
9568 9568
 	{
9569 9569
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -9576,19 +9576,19 @@  discard block
 block discarded – undo
9576 9576
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
9577 9577
 		$sth->closeCursor();
9578 9578
 		if (count($row) > 0) {
9579
-		    if ($row['type_flight'] == null) return '';
9580
-		    else return $row['type_flight'];
9579
+			if ($row['type_flight'] == null) return '';
9580
+			else return $row['type_flight'];
9581 9581
 		} else return '';
9582 9582
 	
9583 9583
 	}
9584 9584
 
9585 9585
 	/**
9586
-	* Gets Countrie from latitude/longitude
9587
-	*
9588
-	* @param Float $latitude latitute of the flight
9589
-	* @param Float $longitude longitute of the flight
9590
-	* @return String the countrie
9591
-	*/
9586
+	 * Gets Countrie from latitude/longitude
9587
+	 *
9588
+	 * @param Float $latitude latitute of the flight
9589
+	 * @param Float $longitude longitute of the flight
9590
+	 * @return String the countrie
9591
+	 */
9592 9592
 	public function getCountryFromLatitudeLongitude($latitude,$longitude)
9593 9593
 	{
9594 9594
 		global $globalDBdriver, $globalDebug;
@@ -9625,12 +9625,12 @@  discard block
 block discarded – undo
9625 9625
 	}
9626 9626
 
9627 9627
 	/**
9628
-	* converts the registration code using the country prefix
9629
-	*
9630
-	* @param String $registration the aircraft registration
9631
-	* @return String the aircraft registration
9632
-	*
9633
-	*/
9628
+	 * converts the registration code using the country prefix
9629
+	 *
9630
+	 * @param String $registration the aircraft registration
9631
+	 * @return String the aircraft registration
9632
+	 *
9633
+	 */
9634 9634
 	public function convertAircraftRegistration($registration)
9635 9635
 	{
9636 9636
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -9682,12 +9682,12 @@  discard block
 block discarded – undo
9682 9682
 	}
9683 9683
 
9684 9684
 	/**
9685
-	* Country from the registration code
9686
-	*
9687
-	* @param String $registration the aircraft registration
9688
-	* @return String the country
9689
-	*
9690
-	*/
9685
+	 * Country from the registration code
9686
+	 *
9687
+	 * @param String $registration the aircraft registration
9688
+	 * @return String the country
9689
+	 *
9690
+	 */
9691 9691
 	public function countryFromAircraftRegistration($registration)
9692 9692
 	{
9693 9693
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -9706,8 +9706,8 @@  discard block
 block discarded – undo
9706 9706
 				$country = $row['country'];
9707 9707
 			}
9708 9708
 		} else {
9709
-    			$registration_1 = substr($registration, 0, 1);
9710
-		        $registration_2 = substr($registration, 0, 2);
9709
+				$registration_1 = substr($registration, 0, 1);
9710
+				$registration_2 = substr($registration, 0, 2);
9711 9711
 
9712 9712
 			$country = '';
9713 9713
 			//first get the prefix based on two characters
@@ -9743,11 +9743,11 @@  discard block
 block discarded – undo
9743 9743
 	}
9744 9744
 	
9745 9745
 	/**
9746
-	* Set a new highlight value for a flight
9747
-	*
9748
-	* @param String $flightaware_id flightaware_id from spotter_output table
9749
-	* @param String $highlight New highlight value
9750
-	*/
9746
+	 * Set a new highlight value for a flight
9747
+	 *
9748
+	 * @param String $flightaware_id flightaware_id from spotter_output table
9749
+	 * @param String $highlight New highlight value
9750
+	 */
9751 9751
 	public function setHighlightFlight($flightaware_id,$highlight) {
9752 9752
 		
9753 9753
 		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
@@ -9756,12 +9756,12 @@  discard block
 block discarded – undo
9756 9756
 	}
9757 9757
 	
9758 9758
 	/**
9759
-	* Gets the short url from bit.ly
9760
-	*
9761
-	* @param String $url the full url
9762
-	* @return String the bit.ly url
9763
-	*
9764
-	*/
9759
+	 * Gets the short url from bit.ly
9760
+	 *
9761
+	 * @param String $url the full url
9762
+	 * @return String the bit.ly url
9763
+	 *
9764
+	 */
9765 9765
 	public function getBitlyURL($url)
9766 9766
 	{
9767 9767
 		global $globalBitlyAccessToken;
@@ -10050,11 +10050,11 @@  discard block
 block discarded – undo
10050 10050
 			$query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance 
10051 10051
 	                      FROM airport WHERE longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
10052 10052
 	                      AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;";
10053
-                } else {
10053
+				} else {
10054 10054
 			$query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2))) as distance 
10055 10055
 	                      FROM airport WHERE CAST(longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
10056 10056
 	                      AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;";
10057
-    		}
10057
+			}
10058 10058
 		$sth = $this->db->prepare($query);
10059 10059
 		$sth->execute();
10060 10060
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
Please login to merge, or discard this patch.
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
 			{
@@ -1274,8 +1274,8 @@  discard block
 block discarded – undo
1274 1274
 		{
1275 1275
 			$limit_array = explode(",", $limit);
1276 1276
 			
1277
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1278
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1277
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1278
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1279 1279
 			
1280 1280
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1281 1281
 			{
@@ -1291,7 +1291,7 @@  discard block
 block discarded – undo
1291 1291
 		} else {
1292 1292
 			$orderby_query = " ORDER BY spotter_output.date DESC";
1293 1293
 		}
1294
-		$filter_query = $this->getFilter($filter,true,true);
1294
+		$filter_query = $this->getFilter($filter, true, true);
1295 1295
 
1296 1296
 		//$query = $global_query.$filter_query." spotter_output.ident <> '' ".$additional_query." ".$orderby_query;
1297 1297
 		$query = $global_query.$filter_query." ".$additional_query." ".$orderby_query;
@@ -1310,7 +1310,7 @@  discard block
 block discarded – undo
1310 1310
 	* @return Array the spotter information
1311 1311
 	*
1312 1312
 	*/
1313
-	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array())
1313
+	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '', $filters = array())
1314 1314
 	{
1315 1315
 		global $global_query;
1316 1316
 		
@@ -1319,7 +1319,7 @@  discard block
 block discarded – undo
1319 1319
 		$query_values = array();
1320 1320
 		$limit_query = '';
1321 1321
 		$additional_query = '';
1322
-		$filter_query = $this->getFilter($filters,true,true);
1322
+		$filter_query = $this->getFilter($filters, true, true);
1323 1323
 		
1324 1324
 		if ($airline != "")
1325 1325
 		{
@@ -1336,8 +1336,8 @@  discard block
 block discarded – undo
1336 1336
 		{
1337 1337
 			$limit_array = explode(",", $limit);
1338 1338
 			
1339
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1340
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1339
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1340
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1341 1341
 			
1342 1342
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1343 1343
 			{
@@ -1367,7 +1367,7 @@  discard block
 block discarded – undo
1367 1367
 	* @return Array the spotter information
1368 1368
 	*
1369 1369
 	*/
1370
-	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1370
+	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '', $filters = array())
1371 1371
 	{
1372 1372
 		global $global_query;
1373 1373
 		
@@ -1375,7 +1375,7 @@  discard block
 block discarded – undo
1375 1375
 		$query_values = array();
1376 1376
 		$limit_query = '';
1377 1377
 		$additional_query = '';
1378
-		$filter_query = $this->getFilter($filters,true,true);
1378
+		$filter_query = $this->getFilter($filters, true, true);
1379 1379
 		
1380 1380
 		if ($airport != "")
1381 1381
 		{
@@ -1392,8 +1392,8 @@  discard block
 block discarded – undo
1392 1392
 		{
1393 1393
 			$limit_array = explode(",", $limit);
1394 1394
 			
1395
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1396
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1395
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1396
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1397 1397
 			
1398 1398
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1399 1399
 			{
@@ -1425,7 +1425,7 @@  discard block
 block discarded – undo
1425 1425
 	* @return Array the spotter information
1426 1426
 	*
1427 1427
 	*/
1428
-	public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array())
1428
+	public function getSpotterDataByDate($date = '', $limit = '', $sort = '', $filter = array())
1429 1429
 	{
1430 1430
 		global $global_query, $globalTimezone, $globalDBdriver;
1431 1431
 		
@@ -1433,7 +1433,7 @@  discard block
 block discarded – undo
1433 1433
 		$limit_query = '';
1434 1434
 		$additional_query = '';
1435 1435
 
1436
-		$filter_query = $this->getFilter($filter,true,true);
1436
+		$filter_query = $this->getFilter($filter, true, true);
1437 1437
 		
1438 1438
 		if ($date != "")
1439 1439
 		{
@@ -1459,8 +1459,8 @@  discard block
 block discarded – undo
1459 1459
 		{
1460 1460
 			$limit_array = explode(",", $limit);
1461 1461
 			
1462
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1463
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1462
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1463
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1464 1464
 			
1465 1465
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1466 1466
 			{
@@ -1490,7 +1490,7 @@  discard block
 block discarded – undo
1490 1490
 	* @return Array the spotter information
1491 1491
 	*
1492 1492
 	*/
1493
-	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array())
1493
+	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '', $filters = array())
1494 1494
 	{
1495 1495
 		global $global_query;
1496 1496
 		
@@ -1499,7 +1499,7 @@  discard block
 block discarded – undo
1499 1499
 		$query_values = array();
1500 1500
 		$limit_query = '';
1501 1501
 		$additional_query = '';
1502
-		$filter_query = $this->getFilter($filters,true,true);
1502
+		$filter_query = $this->getFilter($filters, true, true);
1503 1503
 		if ($country != "")
1504 1504
 		{
1505 1505
 			if (!is_string($country))
@@ -1516,8 +1516,8 @@  discard block
 block discarded – undo
1516 1516
 		{
1517 1517
 			$limit_array = explode(",", $limit);
1518 1518
 			
1519
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1520
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1519
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1520
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1521 1521
 			
1522 1522
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1523 1523
 			{
@@ -1557,7 +1557,7 @@  discard block
 block discarded – undo
1557 1557
 		$query_values = array();
1558 1558
 		$additional_query = '';
1559 1559
 		$limit_query = '';
1560
-		$filter_query = $this->getFilter($filters,true,true);
1560
+		$filter_query = $this->getFilter($filters, true, true);
1561 1561
 		
1562 1562
 		if ($aircraft_manufacturer != "")
1563 1563
 		{
@@ -1574,8 +1574,8 @@  discard block
 block discarded – undo
1574 1574
 		{
1575 1575
 			$limit_array = explode(",", $limit);
1576 1576
 			
1577
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1578
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1577
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1578
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1579 1579
 			
1580 1580
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1581 1581
 			{
@@ -1617,14 +1617,14 @@  discard block
 block discarded – undo
1617 1617
 		$query_values = array();
1618 1618
 		$additional_query = '';
1619 1619
 		$limit_query = '';
1620
-		$filter_query = $this->getFilter($filters,true,true);
1620
+		$filter_query = $this->getFilter($filters, true, true);
1621 1621
 		if ($departure_airport_icao != "")
1622 1622
 		{
1623 1623
 			if (!is_string($departure_airport_icao))
1624 1624
 			{
1625 1625
 				return false;
1626 1626
 			} else {
1627
-				$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
1627
+				$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
1628 1628
 				$additional_query .= " AND (spotter_output.departure_airport_icao = :departure_airport_icao)";
1629 1629
 				$query_values = array(':departure_airport_icao' => $departure_airport_icao);
1630 1630
 			}
@@ -1636,9 +1636,9 @@  discard block
 block discarded – undo
1636 1636
 			{
1637 1637
 				return false;
1638 1638
 			} else {
1639
-				$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
1639
+				$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
1640 1640
 				$additional_query .= " AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)";
1641
-				$query_values = array_merge($query_values,array(':arrival_airport_icao' => $arrival_airport_icao));
1641
+				$query_values = array_merge($query_values, array(':arrival_airport_icao' => $arrival_airport_icao));
1642 1642
 			}
1643 1643
 		}
1644 1644
 		
@@ -1646,8 +1646,8 @@  discard block
 block discarded – undo
1646 1646
 		{
1647 1647
 			$limit_array = explode(",", $limit);
1648 1648
 			
1649
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1650
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1649
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1650
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1651 1651
 			
1652 1652
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1653 1653
 			{
@@ -1686,15 +1686,15 @@  discard block
 block discarded – undo
1686 1686
 		global $global_query;
1687 1687
 		
1688 1688
 		date_default_timezone_set('UTC');
1689
-		$filter_query = $this->getFilter($filter,true,true);
1689
+		$filter_query = $this->getFilter($filter, true, true);
1690 1690
 		$limit_query = '';
1691 1691
 		
1692 1692
 		if ($limit != "")
1693 1693
 		{
1694 1694
 			$limit_array = explode(",", $limit);
1695 1695
 			
1696
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1697
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1696
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1697
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1698 1698
 			
1699 1699
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1700 1700
 			{
@@ -1711,7 +1711,7 @@  discard block
 block discarded – undo
1711 1711
 			$orderby_query = " ORDER BY spotter_output.date DESC";
1712 1712
 		}
1713 1713
 
1714
-		$query  = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query;
1714
+		$query = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query;
1715 1715
 
1716 1716
 		$spotter_array = $this->getDataFromDB($query, array(), $limit_query);
1717 1717
 
@@ -1724,19 +1724,19 @@  discard block
 block discarded – undo
1724 1724
 	* @return String the highlight text
1725 1725
 	*
1726 1726
 	*/
1727
-	public function getHighlightByRegistration($registration,$filter = array())
1727
+	public function getHighlightByRegistration($registration, $filter = array())
1728 1728
 	{
1729 1729
 		global $global_query;
1730 1730
 		
1731 1731
 		date_default_timezone_set('UTC');
1732
-		$filter_query = $this->getFilter($filter,true,true);
1733
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
1732
+		$filter_query = $this->getFilter($filter, true, true);
1733
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
1734 1734
 		
1735
-		$query  = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration";
1735
+		$query = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration";
1736 1736
 		$sth = $this->db->prepare($query);
1737 1737
 		$sth->execute(array(':registration' => $registration));
1738 1738
 
1739
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1739
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1740 1740
 		{
1741 1741
 			$highlight = $row['highlight'];
1742 1742
 		}
@@ -1752,14 +1752,14 @@  discard block
 block discarded – undo
1752 1752
 	* @return String usage
1753 1753
 	*
1754 1754
 	*/
1755
-	public function getSquawkUsage($squawk = '',$country = 'FR')
1755
+	public function getSquawkUsage($squawk = '', $country = 'FR')
1756 1756
 	{
1757 1757
 		
1758
-		$squawk = filter_var($squawk,FILTER_SANITIZE_STRING);
1759
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
1758
+		$squawk = filter_var($squawk, FILTER_SANITIZE_STRING);
1759
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
1760 1760
 
1761 1761
 		$query  = "SELECT squawk.* FROM squawk WHERE squawk.code = :squawk AND squawk.country = :country LIMIT 1";
1762
-		$query_values = array(':squawk' => ltrim($squawk,'0'), ':country' => $country);
1762
+		$query_values = array(':squawk' => ltrim($squawk, '0'), ':country' => $country);
1763 1763
 		
1764 1764
 		$sth = $this->db->prepare($query);
1765 1765
 		$sth->execute($query_values);
@@ -1781,9 +1781,9 @@  discard block
 block discarded – undo
1781 1781
 	public function getAirportIcao($airport_iata = '')
1782 1782
 	{
1783 1783
 		
1784
-		$airport_iata = filter_var($airport_iata,FILTER_SANITIZE_STRING);
1784
+		$airport_iata = filter_var($airport_iata, FILTER_SANITIZE_STRING);
1785 1785
 
1786
-		$query  = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1";
1786
+		$query = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1";
1787 1787
 		$query_values = array(':airport' => $airport_iata);
1788 1788
 		
1789 1789
 		$sth = $this->db->prepare($query);
@@ -1805,12 +1805,12 @@  discard block
 block discarded – undo
1805 1805
 	* @return Float distance to the airport
1806 1806
 	*
1807 1807
 	*/
1808
-	public function getAirportDistance($airport_icao,$latitude,$longitude)
1808
+	public function getAirportDistance($airport_icao, $latitude, $longitude)
1809 1809
 	{
1810 1810
 		
1811
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
1811
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
1812 1812
 
1813
-		$query  = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1";
1813
+		$query = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1";
1814 1814
 		$query_values = array(':airport' => $airport_icao);
1815 1815
 		$sth = $this->db->prepare($query);
1816 1816
 		$sth->execute($query_values);
@@ -1820,7 +1820,7 @@  discard block
 block discarded – undo
1820 1820
 			$airport_latitude = $row['latitude'];
1821 1821
 			$airport_longitude = $row['longitude'];
1822 1822
 			$Common = new Common();
1823
-			return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude);
1823
+			return $Common->distance($latitude, $longitude, $airport_latitude, $airport_longitude);
1824 1824
 		} else return '';
1825 1825
 	}
1826 1826
 	
@@ -1834,11 +1834,11 @@  discard block
 block discarded – undo
1834 1834
 	public function getAllAirportInfo($airport = '')
1835 1835
 	{
1836 1836
 		
1837
-		$airport = filter_var($airport,FILTER_SANITIZE_STRING);
1837
+		$airport = filter_var($airport, FILTER_SANITIZE_STRING);
1838 1838
 
1839 1839
 		$query_values = array();
1840 1840
 		if ($airport == 'NA') {
1841
-			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
+			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' => ''));
1842 1842
 		} elseif ($airport == '') {
1843 1843
 			$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";
1844 1844
 		} else {
@@ -1886,14 +1886,14 @@  discard block
 block discarded – undo
1886 1886
 	{
1887 1887
 		$lst_countries = '';
1888 1888
 		foreach ($countries as $country) {
1889
-			$country = filter_var($country,FILTER_SANITIZE_STRING);
1889
+			$country = filter_var($country, FILTER_SANITIZE_STRING);
1890 1890
 			if ($lst_countries == '') {
1891 1891
 				$lst_countries = "'".$country."'";
1892 1892
 			} else {
1893 1893
 				$lst_countries .= ",'".$country."'";
1894 1894
 			}
1895 1895
 		}
1896
-		$query  = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")";
1896
+		$query = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")";
1897 1897
 		
1898 1898
 		$sth = $this->db->prepare($query);
1899 1899
 		$sth->execute();
@@ -1901,7 +1901,7 @@  discard block
 block discarded – undo
1901 1901
 		$airport_array = array();
1902 1902
 		$temp_array = array();
1903 1903
 		
1904
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1904
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1905 1905
 		{
1906 1906
 			$temp_array['name'] = $row['name'];
1907 1907
 			$temp_array['city'] = $row['city'];
@@ -1929,10 +1929,10 @@  discard block
 block discarded – undo
1929 1929
 	{
1930 1930
 		global $globalDBdriver;
1931 1931
 		if (is_array($coord)) {
1932
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1933
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1934
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1935
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1932
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1933
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1934
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1935
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1936 1936
 		} else return array();
1937 1937
 		if ($globalDBdriver == 'mysql') {
1938 1938
 			$query  = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'";
@@ -1944,7 +1944,7 @@  discard block
 block discarded – undo
1944 1944
     
1945 1945
 		$airport_array = array();
1946 1946
 		
1947
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1947
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1948 1948
 		{
1949 1949
 			$temp_array = $row;
1950 1950
 
@@ -1964,13 +1964,13 @@  discard block
 block discarded – undo
1964 1964
 	public function getAllWaypointsInfobyCoord($coord)
1965 1965
 	{
1966 1966
 		if (is_array($coord)) {
1967
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1968
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1969
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1970
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1967
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1968
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1969
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1970
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1971 1971
 		} else return array();
1972 1972
 		//$query  = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
1973
-		$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
+		$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.")";
1974 1974
 		//$query  = "SELECT waypoints.* FROM waypoints";
1975 1975
 		//$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";
1976 1976
 		//$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;
@@ -1982,7 +1982,7 @@  discard block
 block discarded – undo
1982 1982
     
1983 1983
 		$waypoints_array = array();
1984 1984
 		
1985
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1985
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1986 1986
 		{
1987 1987
 			$temp_array = $row;
1988 1988
 
@@ -2004,10 +2004,10 @@  discard block
 block discarded – undo
2004 2004
 	{
2005 2005
 		global $globalUseRealAirlines;
2006 2006
 		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2007
-		$airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING));
2007
+		$airline_icao = strtoupper(filter_var($airline_icao, FILTER_SANITIZE_STRING));
2008 2008
 		if ($airline_icao == 'NA') {
2009 2009
 			$airline_array = array();
2010
-			$airline_array[] = array('name' => 'Not Available','iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>'');
2010
+			$airline_array[] = array('name' => 'Not Available', 'iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>'');
2011 2011
 			return $airline_array;
2012 2012
 		} else {
2013 2013
 			if (strlen($airline_icao) == 2) {
@@ -2028,7 +2028,7 @@  discard block
 block discarded – undo
2028 2028
 			if ($fromsource === NULL) {
2029 2029
 				$sth->execute(array(':airline_icao' => $airline_icao));
2030 2030
 			} else {
2031
-				$sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource));
2031
+				$sth->execute(array(':airline_icao' => $airline_icao, ':fromsource' => $fromsource));
2032 2032
 			}
2033 2033
                         /*
2034 2034
 			$airline_array = array();
@@ -2070,12 +2070,12 @@  discard block
 block discarded – undo
2070 2070
 	*/
2071 2071
 	public function getAllAircraftInfo($aircraft_type)
2072 2072
 	{
2073
-		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
2073
+		$aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING);
2074 2074
 
2075 2075
 		if ($aircraft_type == 'NA') {
2076
-			return array(array('icao' => 'NA','type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL));
2076
+			return array(array('icao' => 'NA', 'type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL));
2077 2077
 		}
2078
-		$query  = "SELECT aircraft.icao, aircraft.type,aircraft.manufacturer,aircraft.aircraft_shadow FROM aircraft WHERE aircraft.icao = :aircraft_type";
2078
+		$query = "SELECT aircraft.icao, aircraft.type,aircraft.manufacturer,aircraft.aircraft_shadow FROM aircraft WHERE aircraft.icao = :aircraft_type";
2079 2079
 		
2080 2080
 		$sth = $this->db->prepare($query);
2081 2081
 		$sth->execute(array(':aircraft_type' => $aircraft_type));
@@ -2107,7 +2107,7 @@  discard block
 block discarded – undo
2107 2107
 	*/
2108 2108
 	public function getAircraftIcao($aircraft_type)
2109 2109
 	{
2110
-		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
2110
+		$aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING);
2111 2111
 		$all_aircraft = array('737-300' => 'B733',
2112 2112
 				'777-200' => 'B772',
2113 2113
 				'777-200ER' => 'B772',
@@ -2119,10 +2119,10 @@  discard block
 block discarded – undo
2119 2119
 				'A380' => 'A388');
2120 2120
 		if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type];
2121 2121
 
2122
-		$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
+		$query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2123 2123
 		$aircraft_type = strtoupper($aircraft_type);
2124 2124
 		$sth = $this->db->prepare($query);
2125
-		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,));
2125
+		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%', ':aircraft_type' => $aircraft_type,));
2126 2126
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2127 2127
 		if (isset($result[0]['icao'])) return $result[0]['icao'];
2128 2128
 		else return '';
@@ -2137,9 +2137,9 @@  discard block
 block discarded – undo
2137 2137
 	*/
2138 2138
 	public function getAllAircraftType($aircraft_modes)
2139 2139
 	{
2140
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
2140
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
2141 2141
 
2142
-		$query  = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1";
2142
+		$query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1";
2143 2143
 		
2144 2144
 		$sth = $this->db->prepare($query);
2145 2145
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -2160,8 +2160,8 @@  discard block
 block discarded – undo
2160 2160
 	*/
2161 2161
 	public function getOperator($operator)
2162 2162
 	{
2163
-		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
2164
-		$query  = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1";
2163
+		$operator = filter_var($operator, FILTER_SANITIZE_STRING);
2164
+		$query = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1";
2165 2165
 		
2166 2166
 		$sth = $this->db->prepare($query);
2167 2167
 		$sth->execute(array(':operator' => $operator));
@@ -2182,9 +2182,9 @@  discard block
 block discarded – undo
2182 2182
 	*/
2183 2183
 	public function getRouteInfo($callsign)
2184 2184
 	{
2185
-		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2185
+		$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
2186 2186
                 if ($callsign == '') return array();
2187
-		$query  = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1";
2187
+		$query = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1";
2188 2188
 		
2189 2189
 		$sth = $this->db->prepare($query);
2190 2190
 		$sth->execute(array(':callsign' => $callsign));
@@ -2205,9 +2205,9 @@  discard block
 block discarded – undo
2205 2205
 	*/
2206 2206
 	public function getAircraftInfoByRegistration($registration)
2207 2207
 	{
2208
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2208
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2209 2209
 
2210
-		$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
+		$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";
2211 2211
 		
2212 2212
 		$sth = $this->db->prepare($query);
2213 2213
 		$sth->execute(array(':registration' => $registration));
@@ -2215,7 +2215,7 @@  discard block
 block discarded – undo
2215 2215
 		$aircraft_array = array();
2216 2216
 		$temp_array = array();
2217 2217
 		
2218
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2218
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2219 2219
 		{
2220 2220
 			$temp_array['airline_icao'] = $row['airline_icao'];
2221 2221
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -2237,7 +2237,7 @@  discard block
 block discarded – undo
2237 2237
 	*/
2238 2238
 	public function getAircraftOwnerByRegistration($registration)
2239 2239
 	{
2240
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
2240
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
2241 2241
 		$Connection = new Connection($this->db);
2242 2242
 		if ($Connection->tableExists('aircraft_owner')) {
2243 2243
 			$query  = "SELECT aircraft_owner.base, aircraft_owner.owner, aircraft_owner.date_first_reg FROM aircraft_owner WHERE registration = :registration LIMIT 1";
@@ -2259,7 +2259,7 @@  discard block
 block discarded – undo
2259 2259
 	public function getAllFlightsforSitemap()
2260 2260
 	{
2261 2261
 		//$query  = "SELECT spotter_output.spotter_id, spotter_output.ident, spotter_output.airline_name, spotter_output.aircraft_name, spotter_output.aircraft_icao FROM spotter_output ORDER BY LIMIT ";
2262
-		$query  = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0";
2262
+		$query = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0";
2263 2263
 		
2264 2264
 		$sth = $this->db->prepare($query);
2265 2265
 		$sth->execute();
@@ -2306,7 +2306,7 @@  discard block
 block discarded – undo
2306 2306
 		$manufacturer_array = array();
2307 2307
 		$temp_array = array();
2308 2308
 		
2309
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2309
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2310 2310
 		{
2311 2311
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
2312 2312
 
@@ -2332,7 +2332,7 @@  discard block
 block discarded – undo
2332 2332
 								ORDER BY spotter_output.aircraft_name ASC";
2333 2333
 								
2334 2334
 		*/
2335
-		$filter_query = $this->getFilter($filters,true,true);
2335
+		$filter_query = $this->getFilter($filters, true, true);
2336 2336
 		$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";
2337 2337
 		
2338 2338
 		$sth = $this->db->prepare($query);
@@ -2341,7 +2341,7 @@  discard block
 block discarded – undo
2341 2341
 		$aircraft_array = array();
2342 2342
 		$temp_array = array();
2343 2343
 		
2344
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2344
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2345 2345
 		{
2346 2346
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
2347 2347
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
@@ -2362,8 +2362,8 @@  discard block
 block discarded – undo
2362 2362
 	*/
2363 2363
 	public function getAllAircraftRegistrations($filters = array())
2364 2364
 	{
2365
-		$filter_query = $this->getFilter($filters,true,true);
2366
-		$query  = "SELECT DISTINCT spotter_output.registration 
2365
+		$filter_query = $this->getFilter($filters, true, true);
2366
+		$query = "SELECT DISTINCT spotter_output.registration 
2367 2367
 				FROM spotter_output".$filter_query." spotter_output.registration <> '' 
2368 2368
 				ORDER BY spotter_output.registration ASC";
2369 2369
 
@@ -2373,7 +2373,7 @@  discard block
 block discarded – undo
2373 2373
 		$aircraft_array = array();
2374 2374
 		$temp_array = array();
2375 2375
 		
2376
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2376
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2377 2377
 		{
2378 2378
 			$temp_array['registration'] = $row['registration'];
2379 2379
 
@@ -2390,11 +2390,11 @@  discard block
 block discarded – undo
2390 2390
 	* @return Array list of source name
2391 2391
 	*
2392 2392
 	*/
2393
-	public function getAllSourceName($type = '',$filters = array())
2393
+	public function getAllSourceName($type = '', $filters = array())
2394 2394
 	{
2395
-		$filter_query = $this->getFilter($filters,true,true);
2395
+		$filter_query = $this->getFilter($filters, true, true);
2396 2396
 		$query_values = array();
2397
-		$query  = "SELECT DISTINCT spotter_output.source_name 
2397
+		$query = "SELECT DISTINCT spotter_output.source_name 
2398 2398
 				FROM spotter_output".$filter_query." spotter_output.source_name <> ''";
2399 2399
 		if ($type != '') {
2400 2400
 			$query_values = array(':type' => $type);
@@ -2409,7 +2409,7 @@  discard block
 block discarded – undo
2409 2409
 		$source_array = array();
2410 2410
 		$temp_array = array();
2411 2411
 		
2412
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2412
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2413 2413
 		{
2414 2414
 			$temp_array['source_name'] = $row['source_name'];
2415 2415
 			$source_array[] = $temp_array;
@@ -2425,11 +2425,11 @@  discard block
 block discarded – undo
2425 2425
 	* @return Array list of airline names
2426 2426
 	*
2427 2427
 	*/
2428
-	public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array())
2428
+	public function getAllAirlineNames($airline_type = '', $forsource = NULL, $filters = array())
2429 2429
 	{
2430
-		global $globalAirlinesSource,$globalVATSIM, $globalIVAO;
2431
-		$filter_query = $this->getFilter($filters,true,true);
2432
-		$airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
2430
+		global $globalAirlinesSource, $globalVATSIM, $globalIVAO;
2431
+		$filter_query = $this->getFilter($filters, true, true);
2432
+		$airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING);
2433 2433
 		if ($airline_type == '' || $airline_type == 'all') {
2434 2434
 			/*
2435 2435
 			$query  = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
@@ -2448,7 +2448,7 @@  discard block
 block discarded – undo
2448 2448
 				$query_data = array(':forsource' => $forsource);
2449 2449
 			}
2450 2450
 		} else {
2451
-			$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
+			$query = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type
2452 2452
 					FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
2453 2453
 					AND spotter_output.airline_type = :airline_type 
2454 2454
 					ORDER BY spotter_output.airline_icao ASC";
@@ -2461,7 +2461,7 @@  discard block
 block discarded – undo
2461 2461
 		$airline_array = array();
2462 2462
 		$temp_array = array();
2463 2463
 		
2464
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2464
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2465 2465
 		{
2466 2466
 			$temp_array['airline_icao'] = $row['airline_icao'];
2467 2467
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -2481,8 +2481,8 @@  discard block
 block discarded – undo
2481 2481
 	*/
2482 2482
 	public function getAllAirlineCountries($filters = array())
2483 2483
 	{
2484
-		$filter_query = $this->getFilter($filters,true,true);
2485
-		$query  = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2484
+		$filter_query = $this->getFilter($filters, true, true);
2485
+		$query = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2486 2486
 				FROM spotter_output".$filter_query." spotter_output.airline_country <> '' 
2487 2487
 				ORDER BY spotter_output.airline_country ASC";
2488 2488
 		
@@ -2493,7 +2493,7 @@  discard block
 block discarded – undo
2493 2493
 		$airline_array = array();
2494 2494
 		$temp_array = array();
2495 2495
 		
2496
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2496
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2497 2497
 		{
2498 2498
 			$temp_array['airline_country'] = $row['airline_country'];
2499 2499
 
@@ -2513,9 +2513,9 @@  discard block
 block discarded – undo
2513 2513
 	*/
2514 2514
 	public function getAllAirportNames($filters = array())
2515 2515
 	{
2516
-		$filter_query = $this->getFilter($filters,true,true);
2516
+		$filter_query = $this->getFilter($filters, true, true);
2517 2517
 		$airport_array = array();
2518
-		$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
+		$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
2519 2519
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_icao <> '' AND spotter_output.departure_airport_icao <> 'NA' 
2520 2520
 				ORDER BY spotter_output.departure_airport_city ASC";
2521 2521
 		
@@ -2524,7 +2524,7 @@  discard block
 block discarded – undo
2524 2524
 		$sth->execute();
2525 2525
 
2526 2526
 		$temp_array = array();
2527
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2527
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2528 2528
 		{
2529 2529
 			$temp_array['airport_icao'] = $row['airport_icao'];
2530 2530
 			$temp_array['airport_name'] = $row['airport_name'];
@@ -2534,14 +2534,14 @@  discard block
 block discarded – undo
2534 2534
 			$airport_array[$row['airport_city'].",".$row['airport_name']] = $temp_array;
2535 2535
 		}
2536 2536
 
2537
-		$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
+		$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
2538 2538
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> '' AND spotter_output.arrival_airport_icao <> 'NA' 
2539 2539
 								ORDER BY spotter_output.arrival_airport_city ASC";
2540 2540
 					
2541 2541
 		$sth = $this->db->prepare($query);
2542 2542
 		$sth->execute();
2543 2543
 
2544
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2544
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2545 2545
 			{
2546 2546
 		//	if ($airport_array[$row['airport_city'].",".$row['airport_name']]['airport_icao'] != $row['airport_icao'])
2547 2547
 		//	{
@@ -2581,21 +2581,21 @@  discard block
 block discarded – undo
2581 2581
    
2582 2582
 		$temp_array = array();
2583 2583
 		
2584
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2584
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2585 2585
 		{
2586 2586
 			$temp_array['airport_country'] = $row['airport_country'];
2587 2587
 
2588 2588
 			$airport_array[$row['airport_country']] = $temp_array;
2589 2589
 		}
2590
-		$filter_query = $this->getFilter($filters,true,true);
2591
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2590
+		$filter_query = $this->getFilter($filters, true, true);
2591
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2592 2592
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' 
2593 2593
 								ORDER BY spotter_output.arrival_airport_country ASC";
2594 2594
 					
2595 2595
 		$sth = $this->db->prepare($query);
2596 2596
 		$sth->execute();
2597 2597
 		
2598
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2598
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2599 2599
 		{
2600 2600
 			if (isset($airport_array[$row['airport_country']]['airport_country']) && $airport_array[$row['airport_country']]['airport_country'] != $row['airport_country'])
2601 2601
 			{
@@ -2618,9 +2618,9 @@  discard block
 block discarded – undo
2618 2618
 	*/
2619 2619
 	public function getAllCountries($filters = array())
2620 2620
 	{
2621
-		$Connection= new Connection($this->db);
2621
+		$Connection = new Connection($this->db);
2622 2622
 		if ($Connection->tableExists('countries')) {
2623
-			$query  = "SELECT countries.name AS airport_country
2623
+			$query = "SELECT countries.name AS airport_country
2624 2624
 				FROM countries
2625 2625
 				ORDER BY countries.name ASC";
2626 2626
 			$sth = $this->db->prepare($query);
@@ -2629,14 +2629,14 @@  discard block
 block discarded – undo
2629 2629
 			$temp_array = array();
2630 2630
 			$country_array = array();
2631 2631
 		
2632
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
2632
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2633 2633
 			{
2634 2634
 				$temp_array['country'] = $row['airport_country'];
2635 2635
 				$country_array[$row['airport_country']] = $temp_array;
2636 2636
 			}
2637 2637
 		} else {
2638
-			$filter_query = $this->getFilter($filters,true,true);
2639
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country
2638
+			$filter_query = $this->getFilter($filters, true, true);
2639
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country
2640 2640
 								FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' 
2641 2641
 								ORDER BY spotter_output.departure_airport_country ASC";
2642 2642
 
@@ -2645,20 +2645,20 @@  discard block
 block discarded – undo
2645 2645
    
2646 2646
 			$temp_array = array();
2647 2647
 			$country_array = array();
2648
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
2648
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2649 2649
 			{
2650 2650
 				$temp_array['country'] = $row['airport_country'];
2651 2651
 				$country_array[$row['airport_country']] = $temp_array;
2652 2652
 			}
2653 2653
 
2654
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2654
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country
2655 2655
 								FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' 
2656 2656
 								ORDER BY spotter_output.arrival_airport_country ASC";
2657 2657
 					
2658 2658
 		$sth = $this->db->prepare($query);
2659 2659
 		$sth->execute();
2660 2660
 		
2661
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2661
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2662 2662
 		{
2663 2663
 			if ($country_array[$row['airport_country']]['country'] != $row['airport_country'])
2664 2664
 			{
@@ -2668,14 +2668,14 @@  discard block
 block discarded – undo
2668 2668
 			}
2669 2669
 		}
2670 2670
 		
2671
-		$query  = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2671
+		$query = "SELECT DISTINCT spotter_output.airline_country AS airline_country
2672 2672
 								FROM spotter_output".$filter_query." spotter_output.airline_country <> '' 
2673 2673
 								ORDER BY spotter_output.airline_country ASC";
2674 2674
 					
2675 2675
 		$sth = $this->db->prepare($query);
2676 2676
 		$sth->execute();
2677 2677
 		
2678
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2678
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2679 2679
 		{
2680 2680
 			if (isset($country_array[$row['airline_country']]['country']) && $country_array[$row['airline_country']]['country'] != $row['airline_country'])
2681 2681
 			{
@@ -2699,8 +2699,8 @@  discard block
 block discarded – undo
2699 2699
 	*/
2700 2700
 	public function getAllIdents($filters = array())
2701 2701
 	{
2702
-		$filter_query = $this->getFilter($filters,true,true);
2703
-		$query  = "SELECT DISTINCT spotter_output.ident
2702
+		$filter_query = $this->getFilter($filters, true, true);
2703
+		$query = "SELECT DISTINCT spotter_output.ident
2704 2704
 								FROM spotter_output".$filter_query." spotter_output.ident <> '' 
2705 2705
 								ORDER BY spotter_output.date ASC LIMIT 700 OFFSET 0";
2706 2706
 
@@ -2710,7 +2710,7 @@  discard block
 block discarded – undo
2710 2710
 		$ident_array = array();
2711 2711
 		$temp_array = array();
2712 2712
 		
2713
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
2713
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
2714 2714
 		{
2715 2715
 			$temp_array['ident'] = $row['ident'];
2716 2716
 			$ident_array[] = $temp_array;
@@ -2724,9 +2724,9 @@  discard block
 block discarded – undo
2724 2724
 	* @return Array number, icao, name and city of airports
2725 2725
 	*/
2726 2726
 
2727
-	public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) {
2727
+	public function getLast7DaysAirportsDeparture($airport_icao = '', $filters = array()) {
2728 2728
 		global $globalTimezone, $globalDBdriver;
2729
-		$filter_query = $this->getFilter($filters,true,true);
2729
+		$filter_query = $this->getFilter($filters, true, true);
2730 2730
 		if ($globalTimezone != '') {
2731 2731
 			date_default_timezone_set($globalTimezone);
2732 2732
 			$datetime = new DateTime();
@@ -2791,7 +2791,7 @@  discard block
 block discarded – undo
2791 2791
 
2792 2792
 	public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) {
2793 2793
 		global $globalTimezone, $globalDBdriver;
2794
-		$filter_query = $this->getFilter($filters,true,true);
2794
+		$filter_query = $this->getFilter($filters, true, true);
2795 2795
 		if ($globalTimezone != '') {
2796 2796
 			date_default_timezone_set($globalTimezone);
2797 2797
 			$datetime = new DateTime();
@@ -2875,7 +2875,7 @@  discard block
 block discarded – undo
2875 2875
 
2876 2876
 	public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) {
2877 2877
 		global $globalTimezone, $globalDBdriver;
2878
-		$filter_query = $this->getFilter($filters,true,true);
2878
+		$filter_query = $this->getFilter($filters, true, true);
2879 2879
 		if ($globalTimezone != '') {
2880 2880
 			date_default_timezone_set($globalTimezone);
2881 2881
 			$datetime = new DateTime();
@@ -2908,9 +2908,9 @@  discard block
 block discarded – undo
2908 2908
 	* @return Array number, icao, name and city of airports
2909 2909
 	*/
2910 2910
 
2911
-	public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) {
2911
+	public function getLast7DaysDetectedAirportsArrival($airport_icao = '', $filters = array()) {
2912 2912
 		global $globalTimezone, $globalDBdriver;
2913
-		$filter_query = $this->getFilter($filters,true,true);
2913
+		$filter_query = $this->getFilter($filters, true, true);
2914 2914
 		if ($globalTimezone != '') {
2915 2915
 			date_default_timezone_set($globalTimezone);
2916 2916
 			$datetime = new DateTime();
@@ -3042,12 +3042,12 @@  discard block
 block discarded – undo
3042 3042
 		} else $offset = '+00:00';
3043 3043
 
3044 3044
 		if ($globalDBdriver == 'mysql') {
3045
-			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
3045
+			$query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
3046 3046
 								FROM spotter_output
3047 3047
 								WHERE spotter_output.date <> '' 
3048 3048
 								ORDER BY spotter_output.date ASC LIMIT 0,200";
3049 3049
 		} else {
3050
-			$query  = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
3050
+			$query = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
3051 3051
 								FROM spotter_output
3052 3052
 								WHERE spotter_output.date <> '' 
3053 3053
 								ORDER BY spotter_output.date ASC LIMIT 0,200";
@@ -3059,7 +3059,7 @@  discard block
 block discarded – undo
3059 3059
 		$date_array = array();
3060 3060
 		$temp_array = array();
3061 3061
 		
3062
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3062
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3063 3063
 		{
3064 3064
 			$temp_array['date'] = $row['date'];
3065 3065
 
@@ -3079,7 +3079,7 @@  discard block
 block discarded – undo
3079 3079
 	*/
3080 3080
 	public function getAllRoutes()
3081 3081
 	{
3082
-		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route,  spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao 
3082
+		$query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route,  spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao 
3083 3083
 				FROM spotter_output
3084 3084
 				WHERE spotter_output.ident <> '' 
3085 3085
 				GROUP BY route
@@ -3090,7 +3090,7 @@  discard block
 block discarded – undo
3090 3090
 
3091 3091
 		$routes_array = array();
3092 3092
 		$temp_array = array();
3093
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3093
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3094 3094
 		{
3095 3095
 			$temp_array['route'] = $row['route'];
3096 3096
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -3109,21 +3109,21 @@  discard block
 block discarded – undo
3109 3109
 	* @return String success or false
3110 3110
 	*
3111 3111
 	*/	
3112
-	public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL)
3112
+	public function updateIdentSpotterData($flightaware_id = '', $ident = '', $fromsource = NULL)
3113 3113
 	{
3114 3114
 		if (!is_numeric(substr($ident, 0, 3)))
3115 3115
 		{
3116 3116
 			if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) {
3117
-				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource);
3117
+				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource);
3118 3118
 			} elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) {
3119
-				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource);
3119
+				$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource);
3120 3120
 			} else {
3121 3121
 				$airline_array = $this->getAllAirlineInfo("NA");
3122 3122
 			}
3123 3123
 			if (count($airline_array) == 0) {
3124 3124
 				$airline_array = $this->getAllAirlineInfo("NA");
3125 3125
 			}
3126
-			if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3126
+			if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") {
3127 3127
 				$airline_array = $this->getAllAirlineInfo("NA");
3128 3128
 			}
3129 3129
 		} else {
@@ -3136,7 +3136,7 @@  discard block
 block discarded – undo
3136 3136
 
3137 3137
 
3138 3138
 		$query = 'UPDATE spotter_output SET ident = :ident, airline_name = :airline_name, airline_icao = :airline_icao, airline_country = :airline_country, airline_type = :airline_type WHERE flightaware_id = :flightaware_id';
3139
-                $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type);
3139
+                $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type);
3140 3140
 
3141 3141
 		try {
3142 3142
 			$sth = $this->db->prepare($query);
@@ -3157,11 +3157,11 @@  discard block
 block discarded – undo
3157 3157
 	* @return String success or false
3158 3158
 	*
3159 3159
 	*/	
3160
-	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3160
+	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '', $arrival_airport_time = '')
3161 3161
 	{
3162 3162
 		if ($groundspeed == '') $groundspeed = NULL;
3163 3163
 		$query = 'UPDATE spotter_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_ground = :last_ground, last_seen = :last_seen, real_arrival_airport_icao = :real_arrival_airport_icao, real_arrival_airport_time = :real_arrival_airport_time, last_ground_speed = :last_ground_speed WHERE flightaware_id = :flightaware_id';
3164
-                $query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident);
3164
+                $query_values = array(':flightaware_id' => $flightaware_id, ':real_arrival_airport_icao' => $arrival_airport_icao, ':last_latitude' => $latitude, ':last_longitude' => $longitude, ':last_altitude' => $altitude, ':last_ground_speed' => $groundspeed, ':last_seen' => $date, ':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident);
3165 3165
 
3166 3166
 		try {
3167 3167
 			$sth = $this->db->prepare($query);
@@ -3201,7 +3201,7 @@  discard block
 block discarded – undo
3201 3201
 	* @param String $verticalrate vertival rate of flight
3202 3202
 	* @return String success or false
3203 3203
 	*/
3204
-	public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '',$squawk = '', $route_stop = '', $highlight = '', $ModeS = '', $registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $ground = false,$format_source = '', $source_name = '')
3204
+	public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $highlight = '', $ModeS = '', $registration = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $ground = false, $format_source = '', $source_name = '')
3205 3205
 	{
3206 3206
 		global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM;
3207 3207
 		
@@ -3225,13 +3225,13 @@  discard block
 block discarded – undo
3225 3225
 				if ($ModeS != '') {
3226 3226
 					$timeelapsed = microtime(true);
3227 3227
 					$registration = $this->getAircraftRegistrationBymodeS($ModeS);
3228
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3228
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3229 3229
 				} else {
3230
-					$myhex = explode('-',$flightaware_id);
3230
+					$myhex = explode('-', $flightaware_id);
3231 3231
 					if (count($myhex) > 0) {
3232 3232
 						$timeelapsed = microtime(true);
3233 3233
 						$registration = $this->getAircraftRegistrationBymodeS($myhex[0]);
3234
-						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3234
+						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3235 3235
 					}
3236 3236
 				}
3237 3237
 			}
@@ -3253,24 +3253,24 @@  discard block
 block discarded – undo
3253 3253
 				{
3254 3254
 					$timeelapsed = microtime(true);
3255 3255
 					if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) {
3256
-						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource);
3256
+						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource);
3257 3257
 					} elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) {
3258
-						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource);
3258
+						$airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource);
3259 3259
 					} else {
3260 3260
 						$airline_array = $this->getAllAirlineInfo("NA");
3261 3261
 					}
3262 3262
 					if (count($airline_array) == 0) {
3263 3263
 						$airline_array = $this->getAllAirlineInfo("NA");
3264 3264
 					}
3265
-					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3265
+					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") {
3266 3266
 						$airline_array = $this->getAllAirlineInfo("NA");
3267 3267
 					}
3268
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3268
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3269 3269
 
3270 3270
 				} else {
3271 3271
 					$timeelapsed = microtime(true);
3272 3272
 					$airline_array = $this->getAllAirlineInfo("NA");
3273
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3273
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3274 3274
 				}
3275 3275
 			}
3276 3276
 		} else $airline_array = array();
@@ -3287,27 +3287,27 @@  discard block
 block discarded – undo
3287 3287
 				{
3288 3288
 					$timeelapsed = microtime(true);
3289 3289
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3290
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3290
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3291 3291
 				} else {
3292 3292
 					$timeelapsed = microtime(true);
3293 3293
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3294
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3294
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3295 3295
 				}
3296 3296
 			}
3297 3297
 		} else {
3298 3298
 			if ($ModeS != '') {
3299 3299
 				$timeelapsed = microtime(true);
3300 3300
 				$aircraft_icao = $this->getAllAircraftType($ModeS);
3301
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3301
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3302 3302
 				if ($aircraft_icao == "" || $aircraft_icao == "XXXX")
3303 3303
 				{
3304 3304
 					$timeelapsed = microtime(true);
3305 3305
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3306
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3306
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3307 3307
 				} else {
3308 3308
 					$timeelapsed = microtime(true);
3309 3309
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3310
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3310
+					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3311 3311
 				}
3312 3312
 			}
3313 3313
 		}
@@ -3322,7 +3322,7 @@  discard block
 block discarded – undo
3322 3322
 			} else {
3323 3323
 				$timeelapsed = microtime(true);
3324 3324
 				$departure_airport_array = $this->getAllAirportInfo($departure_airport_icao);
3325
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3325
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3326 3326
 			}
3327 3327
 		}
3328 3328
 		
@@ -3336,7 +3336,7 @@  discard block
 block discarded – undo
3336 3336
 			} else {
3337 3337
 				$timeelapsed = microtime(true);
3338 3338
 				$arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao);
3339
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3339
+				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3340 3340
 			}
3341 3341
 		}
3342 3342
 
@@ -3400,7 +3400,7 @@  discard block
 block discarded – undo
3400 3400
 		{
3401 3401
 			$timeelapsed = microtime(true);
3402 3402
 			$image_array = $Image->getSpotterImage($registration);
3403
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3403
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3404 3404
 			if (!isset($image_array[0]['registration']))
3405 3405
 			{
3406 3406
 				//echo "Add image !!!! \n";
@@ -3408,7 +3408,7 @@  discard block
 block discarded – undo
3408 3408
 			}
3409 3409
 			$timeelapsed = microtime(true);
3410 3410
 			$owner_info = $this->getAircraftOwnerByRegistration($registration);
3411
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3411
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3412 3412
 			if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner']));
3413 3413
 		}
3414 3414
     
@@ -3416,33 +3416,33 @@  discard block
 block discarded – undo
3416 3416
 		{
3417 3417
             		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3418 3418
             		else $airline_icao = '';
3419
-			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3419
+			$image_array = $Image->getSpotterImage('', $aircraft_icao, $airline_icao);
3420 3420
 			if (!isset($image_array[0]['registration']))
3421 3421
 			{
3422 3422
 				//echo "Add image !!!! \n";
3423
-				$Image->addSpotterImage('',$aircraft_icao,$airline_icao);
3423
+				$Image->addSpotterImage('', $aircraft_icao, $airline_icao);
3424 3424
 			}
3425 3425
 		}
3426 3426
     
3427
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
3428
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
3429
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
3430
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
3431
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
3432
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
3433
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3434
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3435
-		$waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING);
3436
-		$altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3437
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
3438
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
3439
-		$squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT);
3440
-		$route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING);
3441
-		$ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING);
3442
-		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING);
3443
-		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
3444
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
3445
-		$verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT);
3427
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
3428
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
3429
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
3430
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
3431
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
3432
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
3433
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3434
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3435
+		$waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING);
3436
+		$altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3437
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
3438
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
3439
+		$squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT);
3440
+		$route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING);
3441
+		$ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING);
3442
+		$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING);
3443
+		$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
3444
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
3445
+		$verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT);
3446 3446
 	
3447 3447
 		if (count($airline_array) == 0) 
3448 3448
 		{
@@ -3470,7 +3470,7 @@  discard block
 block discarded – undo
3470 3470
                 if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3471 3471
                 if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3472 3472
                 if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3473
-                $query  = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) 
3473
+                $query = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) 
3474 3474
                 VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name,:departure_airport_city,:departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date, :departure_airport_time, :arrival_airport_time, :squawk, :route_stop, :highlight, :ModeS, :pilot_id, :pilot_name, :verticalrate, :owner_name,:ground, :format_source, :source_name)";
3475 3475
 
3476 3476
                 $airline_name = $airline_array[0]['name'];
@@ -3480,7 +3480,7 @@  discard block
 block discarded – undo
3480 3480
 		if ($airline_type == '') {
3481 3481
 			$timeelapsed = microtime(true);
3482 3482
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3483
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3483
+			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
3484 3484
 		}
3485 3485
 		if ($airline_type == null) $airline_type = '';
3486 3486
                 $aircraft_type = $aircraft_array[0]['type'];
@@ -3491,7 +3491,7 @@  discard block
 block discarded – undo
3491 3491
                 $arrival_airport_name = $arrival_airport_array[0]['name'];
3492 3492
                 $arrival_airport_city = $arrival_airport_array[0]['city'];
3493 3493
                 $arrival_airport_country = $arrival_airport_array[0]['country'];
3494
-                $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date,':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name);
3494
+                $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_type' => $aircraft_type, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name);
3495 3495
 
3496 3496
 		try {
3497 3497
 		        
@@ -3517,13 +3517,13 @@  discard block
 block discarded – undo
3517 3517
 	{
3518 3518
 		global $globalDBdriver, $globalTimezone;
3519 3519
 		if ($globalDBdriver == 'mysql') {
3520
-			$query  = "SELECT spotter_output.ident FROM spotter_output 
3520
+			$query = "SELECT spotter_output.ident FROM spotter_output 
3521 3521
 								WHERE spotter_output.ident = :ident 
3522 3522
 								AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
3523 3523
 								AND spotter_output.date < UTC_TIMESTAMP()";
3524 3524
 			$query_data = array(':ident' => $ident);
3525 3525
 		} else {
3526
-			$query  = "SELECT spotter_output.ident FROM spotter_output 
3526
+			$query = "SELECT spotter_output.ident FROM spotter_output 
3527 3527
 								WHERE spotter_output.ident = :ident 
3528 3528
 								AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
3529 3529
 								AND spotter_output.date < now() AT TIME ZONE 'UTC'";
@@ -3532,8 +3532,8 @@  discard block
 block discarded – undo
3532 3532
 		
3533 3533
 		$sth = $this->db->prepare($query);
3534 3534
 		$sth->execute($query_data);
3535
-    		$ident_result='';
3536
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3535
+    		$ident_result = '';
3536
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3537 3537
 		{
3538 3538
 			$ident_result = $row['ident'];
3539 3539
 		}
@@ -3559,8 +3559,8 @@  discard block
 block discarded – undo
3559 3559
 				return false;
3560 3560
 			} else {
3561 3561
 				$q_array = explode(" ", $q);
3562
-				foreach ($q_array as $q_item){
3563
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
3562
+				foreach ($q_array as $q_item) {
3563
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
3564 3564
 					$additional_query .= " AND (";
3565 3565
 					$additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR ";
3566 3566
 					$additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR ";
@@ -3575,11 +3575,11 @@  discard block
 block discarded – undo
3575 3575
 			}
3576 3576
 		}
3577 3577
 		if ($globalDBdriver == 'mysql') {
3578
-			$query  = "SELECT spotter_output.* FROM spotter_output 
3578
+			$query = "SELECT spotter_output.* FROM spotter_output 
3579 3579
 				WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." 
3580 3580
 				AND spotter_output.date < UTC_TIMESTAMP()";
3581 3581
 		} else {
3582
-			$query  = "SELECT spotter_output.* FROM spotter_output 
3582
+			$query = "SELECT spotter_output.* FROM spotter_output 
3583 3583
 				WHERE spotter_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." 
3584 3584
 				AND spotter_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
3585 3585
 		}
@@ -3596,11 +3596,11 @@  discard block
 block discarded – undo
3596 3596
 	* @return Array the airline list
3597 3597
 	*
3598 3598
 	*/
3599
-	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3599
+	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
3600 3600
 	{
3601 3601
 		global $globalDBdriver;
3602
-		$filter_query = $this->getFilter($filters,true,true);
3603
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3602
+		$filter_query = $this->getFilter($filters, true, true);
3603
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3604 3604
 		 			FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.airline_icao <> 'NA' ";
3605 3605
 		if ($olderthanmonths > 0) {
3606 3606
 			if ($globalDBdriver == 'mysql') {
@@ -3624,7 +3624,7 @@  discard block
 block discarded – undo
3624 3624
  
3625 3625
 		$airline_array = array();
3626 3626
 		$temp_array = array();
3627
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3627
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3628 3628
 		{
3629 3629
 			$temp_array['airline_name'] = $row['airline_name'];
3630 3630
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -3641,11 +3641,11 @@  discard block
 block discarded – undo
3641 3641
 	* @return Array the pilots list
3642 3642
 	*
3643 3643
 	*/
3644
-	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3644
+	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
3645 3645
 	{
3646 3646
 		global $globalDBdriver;
3647
-		$filter_query = $this->getFilter($filters,true,true);
3648
-		$query  = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count
3647
+		$filter_query = $this->getFilter($filters, true, true);
3648
+		$query = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count
3649 3649
 		 			FROM spotter_output".$filter_query." spotter_output.pilot_id <> '' ";
3650 3650
                 if ($olderthanmonths > 0) {
3651 3651
             		if ($globalDBdriver == 'mysql') {
@@ -3671,7 +3671,7 @@  discard block
 block discarded – undo
3671 3671
 		$airline_array = array();
3672 3672
 		$temp_array = array();
3673 3673
         
3674
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3674
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3675 3675
 		{
3676 3676
 			$temp_array['pilot_name'] = $row['pilot_name'];
3677 3677
 			$temp_array['pilot_id'] = $row['pilot_id'];
@@ -3690,7 +3690,7 @@  discard block
 block discarded – undo
3690 3690
 	public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
3691 3691
 	{
3692 3692
 		global $globalDBdriver;
3693
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count
3693
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count
3694 3694
 		 			FROM spotter_output WHERE spotter_output.pilot_id <> '' ";
3695 3695
                 if ($olderthanmonths > 0) {
3696 3696
             		if ($globalDBdriver == 'mysql') {
@@ -3716,7 +3716,7 @@  discard block
 block discarded – undo
3716 3716
 		$airline_array = array();
3717 3717
 		$temp_array = array();
3718 3718
         
3719
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3719
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3720 3720
 		{
3721 3721
 			$temp_array['pilot_name'] = $row['pilot_name'];
3722 3722
 			$temp_array['pilot_id'] = $row['pilot_id'];
@@ -3733,11 +3733,11 @@  discard block
 block discarded – undo
3733 3733
 	* @return Array the pilots list
3734 3734
 	*
3735 3735
 	*/
3736
-	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3736
+	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
3737 3737
 	{
3738 3738
 		global $globalDBdriver;
3739
-		$filter_query = $this->getFilter($filters,true,true);
3740
-		$query  = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3739
+		$filter_query = $this->getFilter($filters, true, true);
3740
+		$query = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3741 3741
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3742 3742
                 if ($olderthanmonths > 0) {
3743 3743
             		if ($globalDBdriver == 'mysql') {
@@ -3763,7 +3763,7 @@  discard block
 block discarded – undo
3763 3763
 		$airline_array = array();
3764 3764
 		$temp_array = array();
3765 3765
         
3766
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3766
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3767 3767
 		{
3768 3768
 			$temp_array['owner_name'] = $row['owner_name'];
3769 3769
 			$temp_array['owner_count'] = $row['owner_count'];
@@ -3778,11 +3778,11 @@  discard block
 block discarded – undo
3778 3778
 	* @return Array the pilots list
3779 3779
 	*
3780 3780
 	*/
3781
-	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
3781
+	public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
3782 3782
 	{
3783 3783
 		global $globalDBdriver;
3784
-		$filter_query = $this->getFilter($filters,true,true);
3785
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3784
+		$filter_query = $this->getFilter($filters, true, true);
3785
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count
3786 3786
 		 			FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL ";
3787 3787
                 if ($olderthanmonths > 0) {
3788 3788
             		if ($globalDBdriver == 'mysql') {
@@ -3808,7 +3808,7 @@  discard block
 block discarded – undo
3808 3808
 		$airline_array = array();
3809 3809
 		$temp_array = array();
3810 3810
         
3811
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3811
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3812 3812
 		{
3813 3813
 			$temp_array['owner_name'] = $row['owner_name'];
3814 3814
 			$temp_array['owner_count'] = $row['owner_count'];
@@ -3824,11 +3824,11 @@  discard block
 block discarded – undo
3824 3824
 	* @return Array the airline list
3825 3825
 	*
3826 3826
 	*/
3827
-	public function countAllAirlinesByAircraft($aircraft_icao,$filters = array())
3827
+	public function countAllAirlinesByAircraft($aircraft_icao, $filters = array())
3828 3828
 	{
3829
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
3830
-		$filter_query = $this->getFilter($filters,true,true);
3831
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3829
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
3830
+		$filter_query = $this->getFilter($filters, true, true);
3831
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3832 3832
 		 	    FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
3833 3833
 			    GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country 
3834 3834
 			    ORDER BY airline_count DESC";
@@ -3840,7 +3840,7 @@  discard block
 block discarded – undo
3840 3840
 		$airline_array = array();
3841 3841
 		$temp_array = array();
3842 3842
         
3843
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3843
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3844 3844
 		{
3845 3845
 			$temp_array['airline_name'] = $row['airline_name'];
3846 3846
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -3860,11 +3860,11 @@  discard block
 block discarded – undo
3860 3860
 	* @return Array the airline country list
3861 3861
 	*
3862 3862
 	*/
3863
-	public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array())
3863
+	public function countAllAirlineCountriesByAircraft($aircraft_icao, $filters = array())
3864 3864
 	{
3865
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
3866
-		$filter_query = $this->getFilter($filters,true,true);
3867
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
3865
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
3866
+		$filter_query = $this->getFilter($filters, true, true);
3867
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
3868 3868
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
3869 3869
                     GROUP BY spotter_output.airline_country
3870 3870
 					ORDER BY airline_country_count DESC
@@ -3877,7 +3877,7 @@  discard block
 block discarded – undo
3877 3877
 		$airline_country_array = array();
3878 3878
 		$temp_array = array();
3879 3879
         
3880
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3880
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3881 3881
 		{
3882 3882
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
3883 3883
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -3896,11 +3896,11 @@  discard block
 block discarded – undo
3896 3896
 	* @return Array the airline list
3897 3897
 	*
3898 3898
 	*/
3899
-	public function countAllAirlinesByAirport($airport_icao,$filters = array())
3899
+	public function countAllAirlinesByAirport($airport_icao, $filters = array())
3900 3900
 	{
3901
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
3902
-		$filter_query = $this->getFilter($filters,true,true);
3903
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3901
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
3902
+		$filter_query = $this->getFilter($filters, true, true);
3903
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3904 3904
 		    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 ) 
3905 3905
                     GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country
3906 3906
 		    ORDER BY airline_count DESC";
@@ -3912,7 +3912,7 @@  discard block
 block discarded – undo
3912 3912
 		$airline_array = array();
3913 3913
 		$temp_array = array();
3914 3914
         
3915
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3915
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3916 3916
 		{
3917 3917
 			$temp_array['airline_name'] = $row['airline_name'];
3918 3918
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -3931,11 +3931,11 @@  discard block
 block discarded – undo
3931 3931
 	* @return Array the airline country list
3932 3932
 	*
3933 3933
 	*/
3934
-	public function countAllAirlineCountriesByAirport($airport_icao,$filters = array())
3934
+	public function countAllAirlineCountriesByAirport($airport_icao, $filters = array())
3935 3935
 	{
3936
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
3937
-		$filter_query = $this->getFilter($filters,true,true);
3938
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
3936
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
3937
+		$filter_query = $this->getFilter($filters, true, true);
3938
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
3939 3939
 		 			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 )
3940 3940
 					GROUP BY spotter_output.airline_country
3941 3941
 					ORDER BY airline_country_count DESC
@@ -3948,7 +3948,7 @@  discard block
 block discarded – undo
3948 3948
 		$airline_country_array = array();
3949 3949
 		$temp_array = array();
3950 3950
         
3951
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3951
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3952 3952
 		{
3953 3953
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
3954 3954
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -3965,11 +3965,11 @@  discard block
 block discarded – undo
3965 3965
 	* @return Array the airline list
3966 3966
 	*
3967 3967
 	*/
3968
-	public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array())
3968
+	public function countAllAirlinesByManufacturer($aircraft_manufacturer, $filters = array())
3969 3969
 	{
3970
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
3971
-		$filter_query = $this->getFilter($filters,true,true);
3972
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3970
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
3971
+		$filter_query = $this->getFilter($filters, true, true);
3972
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3973 3973
 		 			FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
3974 3974
 					GROUP BY spotter_output.airline_name
3975 3975
 					ORDER BY airline_count DESC";
@@ -3980,7 +3980,7 @@  discard block
 block discarded – undo
3980 3980
 		$airline_array = array();
3981 3981
 		$temp_array = array();
3982 3982
         
3983
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3983
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
3984 3984
 		{
3985 3985
 			$temp_array['airline_name'] = $row['airline_name'];
3986 3986
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4000,11 +4000,11 @@  discard block
 block discarded – undo
4000 4000
 	* @return Array the airline country list
4001 4001
 	*
4002 4002
 	*/
4003
-	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array())
4003
+	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer, $filters = array())
4004 4004
 	{
4005
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4006
-		$filter_query = $this->getFilter($filters,true,true);
4007
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4005
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4006
+		$filter_query = $this->getFilter($filters, true, true);
4007
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4008 4008
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
4009 4009
 					GROUP BY spotter_output.airline_country
4010 4010
 					ORDER BY airline_country_count DESC
@@ -4017,7 +4017,7 @@  discard block
 block discarded – undo
4017 4017
 		$airline_country_array = array();
4018 4018
 		$temp_array = array();
4019 4019
         
4020
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4020
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4021 4021
 		{
4022 4022
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4023 4023
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4033,11 +4033,11 @@  discard block
 block discarded – undo
4033 4033
 	* @return Array the airline list
4034 4034
 	*
4035 4035
 	*/
4036
-	public function countAllAirlinesByDate($date,$filters = array())
4036
+	public function countAllAirlinesByDate($date, $filters = array())
4037 4037
 	{
4038 4038
 		global $globalTimezone, $globalDBdriver;
4039
-		$filter_query = $this->getFilter($filters,true,true);
4040
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4039
+		$filter_query = $this->getFilter($filters, true, true);
4040
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4041 4041
 		if ($globalTimezone != '') {
4042 4042
 			date_default_timezone_set($globalTimezone);
4043 4043
 			$datetime = new DateTime($date);
@@ -4045,12 +4045,12 @@  discard block
 block discarded – undo
4045 4045
 		} else $offset = '+00:00';
4046 4046
 
4047 4047
 		if ($globalDBdriver == 'mysql') {
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." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4050 4050
 					GROUP BY spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country 
4051 4051
 					ORDER BY airline_count DESC";
4052 4052
 		} else {
4053
-			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4053
+			$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4054 4054
 		 			FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4055 4055
 					GROUP BY spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country
4056 4056
 					ORDER BY airline_count DESC";
@@ -4061,7 +4061,7 @@  discard block
 block discarded – undo
4061 4061
 
4062 4062
 		$airline_array = array();
4063 4063
 		$temp_array = array();
4064
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4064
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4065 4065
 		{
4066 4066
 			$temp_array['airline_name'] = $row['airline_name'];
4067 4067
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4081,11 +4081,11 @@  discard block
 block discarded – undo
4081 4081
 	* @return Array the airline country list
4082 4082
 	*
4083 4083
 	*/
4084
-	public function countAllAirlineCountriesByDate($date,$filters = array())
4084
+	public function countAllAirlineCountriesByDate($date, $filters = array())
4085 4085
 	{
4086 4086
 		global $globalTimezone, $globalDBdriver;
4087
-		$filter_query = $this->getFilter($filters,true,true);
4088
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4087
+		$filter_query = $this->getFilter($filters, true, true);
4088
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4089 4089
 		if ($globalTimezone != '') {
4090 4090
 			date_default_timezone_set($globalTimezone);
4091 4091
 			$datetime = new DateTime($date);
@@ -4093,13 +4093,13 @@  discard block
 block discarded – undo
4093 4093
 		} else $offset = '+00:00';
4094 4094
 		
4095 4095
 		if ($globalDBdriver == 'mysql') {
4096
-			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4096
+			$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4097 4097
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4098 4098
 					GROUP BY spotter_output.airline_country
4099 4099
 					ORDER BY airline_country_count DESC
4100 4100
 					LIMIT 10 OFFSET 0";
4101 4101
 		} else {
4102
-			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4102
+			$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4103 4103
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4104 4104
 					GROUP BY spotter_output.airline_country
4105 4105
 					ORDER BY airline_country_count DESC
@@ -4111,7 +4111,7 @@  discard block
 block discarded – undo
4111 4111
  
4112 4112
 		$airline_country_array = array();
4113 4113
 		$temp_array = array();
4114
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4114
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4115 4115
 		{
4116 4116
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4117 4117
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4128,11 +4128,11 @@  discard block
 block discarded – undo
4128 4128
 	* @return Array the airline list
4129 4129
 	*
4130 4130
 	*/
4131
-	public function countAllAirlinesByIdent($ident,$filters = array())
4131
+	public function countAllAirlinesByIdent($ident, $filters = array())
4132 4132
 	{
4133
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
4134
-		$filter_query = $this->getFilter($filters,true,true);
4135
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4133
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
4134
+		$filter_query = $this->getFilter($filters, true, true);
4135
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4136 4136
 		 		FROM spotter_output".$filter_query." spotter_output.ident = :ident  
4137 4137
 				GROUP BY spotter_output.airline_name
4138 4138
 				ORDER BY airline_count DESC";
@@ -4144,7 +4144,7 @@  discard block
 block discarded – undo
4144 4144
 		$airline_array = array();
4145 4145
 		$temp_array = array();
4146 4146
         
4147
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4147
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4148 4148
 		{
4149 4149
 			$temp_array['airline_name'] = $row['airline_name'];
4150 4150
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4162,25 +4162,25 @@  discard block
 block discarded – undo
4162 4162
 	* @return Array the airline list
4163 4163
 	*
4164 4164
 	*/
4165
-	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
4165
+	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
4166 4166
 	{
4167
-		$filter_query = $this->getFilter($filters,true,true);
4168
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
4169
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
4167
+		$filter_query = $this->getFilter($filters, true, true);
4168
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
4169
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
4170 4170
 
4171
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4171
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4172 4172
 		 			FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) 
4173 4173
 					GROUP BY spotter_output.airline_name
4174 4174
 					ORDER BY airline_count DESC";
4175 4175
       
4176 4176
 		
4177 4177
 		$sth = $this->db->prepare($query);
4178
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
4178
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
4179 4179
       
4180 4180
 		$airline_array = array();
4181 4181
 		$temp_array = array();
4182 4182
         
4183
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4183
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4184 4184
 		{
4185 4185
 			$temp_array['airline_name'] = $row['airline_name'];
4186 4186
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4198,13 +4198,13 @@  discard block
 block discarded – undo
4198 4198
 	* @return Array the airline country list
4199 4199
 	*
4200 4200
 	*/
4201
-	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array())
4201
+	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
4202 4202
 	{
4203
-		$filter_query = $this->getFilter($filters,true,true);
4204
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
4205
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
4203
+		$filter_query = $this->getFilter($filters, true, true);
4204
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
4205
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
4206 4206
       
4207
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4207
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4208 4208
 		 		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) 
4209 4209
 				GROUP BY spotter_output.airline_country
4210 4210
 				ORDER BY airline_country_count DESC
@@ -4212,11 +4212,11 @@  discard block
 block discarded – undo
4212 4212
       
4213 4213
 		
4214 4214
 		$sth = $this->db->prepare($query);
4215
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
4215
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
4216 4216
       
4217 4217
 		$airline_country_array = array();
4218 4218
 		$temp_array = array();
4219
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4219
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4220 4220
 		{
4221 4221
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4222 4222
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4234,11 +4234,11 @@  discard block
 block discarded – undo
4234 4234
 	* @return Array the airline list
4235 4235
 	*
4236 4236
 	*/
4237
-	public function countAllAirlinesByCountry($country,$filters = array())
4237
+	public function countAllAirlinesByCountry($country, $filters = array())
4238 4238
 	{
4239
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
4240
-		$filter_query = $this->getFilter($filters,true,true);
4241
-		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4239
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
4240
+		$filter_query = $this->getFilter($filters, true, true);
4241
+		$query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
4242 4242
 		 	    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country  
4243 4243
 			    GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country 
4244 4244
 			    ORDER BY airline_count DESC";
@@ -4249,7 +4249,7 @@  discard block
 block discarded – undo
4249 4249
 
4250 4250
 		$airline_array = array();
4251 4251
 		$temp_array = array();
4252
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4252
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4253 4253
 		{
4254 4254
 			$temp_array['airline_name'] = $row['airline_name'];
4255 4255
 			$temp_array['airline_icao'] = $row['airline_icao'];
@@ -4268,11 +4268,11 @@  discard block
 block discarded – undo
4268 4268
 	* @return Array the airline country list
4269 4269
 	*
4270 4270
 	*/
4271
-	public function countAllAirlineCountriesByCountry($country,$filters = array())
4271
+	public function countAllAirlineCountriesByCountry($country, $filters = array())
4272 4272
 	{
4273
-		$filter_query = $this->getFilter($filters,true,true);
4274
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
4275
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4273
+		$filter_query = $this->getFilter($filters, true, true);
4274
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
4275
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4276 4276
 		 		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 
4277 4277
 				GROUP BY spotter_output.airline_country
4278 4278
 				ORDER BY airline_country_count DESC
@@ -4284,7 +4284,7 @@  discard block
 block discarded – undo
4284 4284
 
4285 4285
 		$airline_country_array = array();
4286 4286
 		$temp_array = array();
4287
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4287
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4288 4288
 		{
4289 4289
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4290 4290
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4303,8 +4303,8 @@  discard block
 block discarded – undo
4303 4303
 	*/
4304 4304
 	public function countAllAirlineCountries($limit = true, $filters = array())
4305 4305
 	{
4306
-		$filter_query = $this->getFilter($filters,true,true);
4307
-		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4306
+		$filter_query = $this->getFilter($filters, true, true);
4307
+		$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
4308 4308
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA' 
4309 4309
 					GROUP BY spotter_output.airline_country
4310 4310
 					ORDER BY airline_country_count DESC";
@@ -4315,7 +4315,7 @@  discard block
 block discarded – undo
4315 4315
 
4316 4316
 		$airline_array = array();
4317 4317
 		$temp_array = array();
4318
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4318
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4319 4319
 		{
4320 4320
 			$temp_array['airline_country_count'] = $row['airline_country_count'];
4321 4321
 			$temp_array['airline_country'] = $row['airline_country'];
@@ -4331,11 +4331,11 @@  discard block
 block discarded – undo
4331 4331
 	* @return Array the airline country list
4332 4332
 	*
4333 4333
 	*/
4334
-	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
4334
+	public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '')
4335 4335
 	{
4336 4336
 		global $globalDBdriver;
4337 4337
 		//$filter_query = $this->getFilter($filters,true,true);
4338
-		$Connection= new Connection($this->db);
4338
+		$Connection = new Connection($this->db);
4339 4339
 		if (!$Connection->tableExists('countries')) return array();
4340 4340
 		/*
4341 4341
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
@@ -4370,7 +4370,7 @@  discard block
 block discarded – undo
4370 4370
 		$flight_array = array();
4371 4371
 		$temp_array = array();
4372 4372
         
4373
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4373
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4374 4374
 		{
4375 4375
 			$temp_array['flight_count'] = $row['nb'];
4376 4376
 			$temp_array['flight_country'] = $row['name'];
@@ -4388,12 +4388,12 @@  discard block
 block discarded – undo
4388 4388
 	* @return Array the aircraft list
4389 4389
 	*
4390 4390
 	*/
4391
-	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4391
+	public function countAllAircraftTypes($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
4392 4392
 	{
4393 4393
 		global $globalDBdriver;
4394
-		$filter_query = $this->getFilter($filters,true,true);
4394
+		$filter_query = $this->getFilter($filters, true, true);
4395 4395
 
4396
-		$query  = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4396
+		$query = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer 
4397 4397
 		    FROM spotter_output ".$filter_query." spotter_output.aircraft_name  <> '' AND spotter_output.aircraft_icao  <> ''";
4398 4398
 		if ($olderthanmonths > 0) {
4399 4399
 			if ($globalDBdriver == 'mysql') {
@@ -4418,7 +4418,7 @@  discard block
 block discarded – undo
4418 4418
 
4419 4419
 		$aircraft_array = array();
4420 4420
 		$temp_array = array();
4421
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4421
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4422 4422
 		{
4423 4423
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4424 4424
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4435,11 +4435,11 @@  discard block
 block discarded – undo
4435 4435
 	* @return Array the aircraft list
4436 4436
 	*
4437 4437
 	*/
4438
-	public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
4438
+	public function countAllAircraftTypesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
4439 4439
 	{
4440 4440
 		global $globalDBdriver;
4441
-		$filter_query = $this->getFilter($filters,true,true);
4442
-		$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 
4441
+		$filter_query = $this->getFilter($filters, true, true);
4442
+		$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 
4443 4443
 		    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' ";
4444 4444
 		if ($olderthanmonths > 0) {
4445 4445
 			if ($globalDBdriver == 'mysql') {
@@ -4464,7 +4464,7 @@  discard block
 block discarded – undo
4464 4464
 
4465 4465
 		$aircraft_array = array();
4466 4466
 		$temp_array = array();
4467
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4467
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4468 4468
 		{
4469 4469
 			$temp_array['airline_icao'] = $row['airline_icao'];
4470 4470
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
@@ -4483,13 +4483,13 @@  discard block
 block discarded – undo
4483 4483
 	* @return Array the aircraft list
4484 4484
 	*
4485 4485
 	*/
4486
-	public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array())
4486
+	public function countAllAircraftRegistrationByAircraft($aircraft_icao, $filters = array())
4487 4487
 	{
4488 4488
 		$Image = new Image($this->db);
4489
-		$filter_query = $this->getFilter($filters,true,true);
4490
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
4489
+		$filter_query = $this->getFilter($filters, true, true);
4490
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
4491 4491
 
4492
-		$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  
4492
+		$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  
4493 4493
 				FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_icao = :aircraft_icao  
4494 4494
 				GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name  
4495 4495
 				ORDER BY registration_count DESC";
@@ -4500,14 +4500,14 @@  discard block
 block discarded – undo
4500 4500
 		$aircraft_array = array();
4501 4501
 		$temp_array = array();
4502 4502
         
4503
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4503
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4504 4504
 		{
4505 4505
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4506 4506
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4507 4507
 			$temp_array['registration'] = $row['registration'];
4508 4508
 			$temp_array['airline_name'] = $row['airline_name'];
4509 4509
 			$temp_array['image_thumbnail'] = "";
4510
-			if($row['registration'] != "")
4510
+			if ($row['registration'] != "")
4511 4511
 			{
4512 4512
 				$image_array = $Image->getSpotterImage($row['registration']);
4513 4513
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4526,11 +4526,11 @@  discard block
 block discarded – undo
4526 4526
 	* @return Array the aircraft list
4527 4527
 	*
4528 4528
 	*/
4529
-	public function countAllAircraftTypesByAirline($airline_icao,$filters = array())
4529
+	public function countAllAircraftTypesByAirline($airline_icao, $filters = array())
4530 4530
 	{
4531
-		$filter_query = $this->getFilter($filters,true,true);
4532
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
4533
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4531
+		$filter_query = $this->getFilter($filters, true, true);
4532
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
4533
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4534 4534
 			    FROM spotter_output".$filter_query." spotter_output.aircraft_icao <> '' AND spotter_output.airline_icao = :airline_icao 
4535 4535
 			    GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
4536 4536
 			    ORDER BY aircraft_icao_count DESC";
@@ -4541,7 +4541,7 @@  discard block
 block discarded – undo
4541 4541
 		$aircraft_array = array();
4542 4542
 		$temp_array = array();
4543 4543
 
4544
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4544
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4545 4545
 		{
4546 4546
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4547 4547
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4559,13 +4559,13 @@  discard block
 block discarded – undo
4559 4559
 	* @return Array the aircraft list
4560 4560
 	*
4561 4561
 	*/
4562
-	public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array())
4562
+	public function countAllAircraftRegistrationByAirline($airline_icao, $filters = array())
4563 4563
 	{
4564
-		$filter_query = $this->getFilter($filters,true,true);
4564
+		$filter_query = $this->getFilter($filters, true, true);
4565 4565
 		$Image = new Image($this->db);
4566
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
4566
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
4567 4567
 
4568
-		$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 
4568
+		$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 
4569 4569
 			    FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.airline_icao = :airline_icao 
4570 4570
 			    GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name
4571 4571
 			    ORDER BY registration_count DESC";
@@ -4575,14 +4575,14 @@  discard block
 block discarded – undo
4575 4575
 
4576 4576
 		$aircraft_array = array();
4577 4577
 		$temp_array = array();
4578
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4578
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4579 4579
 		{
4580 4580
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4581 4581
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4582 4582
 			$temp_array['registration'] = $row['registration'];
4583 4583
 			$temp_array['airline_name'] = $row['airline_name'];
4584 4584
 			$temp_array['image_thumbnail'] = "";
4585
-			if($row['registration'] != "")
4585
+			if ($row['registration'] != "")
4586 4586
 			{
4587 4587
 				$image_array = $Image->getSpotterImage($row['registration']);
4588 4588
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4601,11 +4601,11 @@  discard block
 block discarded – undo
4601 4601
 	* @return Array the aircraft list
4602 4602
 	*
4603 4603
 	*/
4604
-	public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array())
4604
+	public function countAllAircraftManufacturerByAirline($airline_icao, $filters = array())
4605 4605
 	{
4606
-		$filter_query = $this->getFilter($filters,true,true);
4607
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
4608
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4606
+		$filter_query = $this->getFilter($filters, true, true);
4607
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
4608
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4609 4609
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.airline_icao = :airline_icao 
4610 4610
 				GROUP BY spotter_output.aircraft_manufacturer 
4611 4611
 				ORDER BY aircraft_manufacturer_count DESC";
@@ -4616,7 +4616,7 @@  discard block
 block discarded – undo
4616 4616
 		$aircraft_array = array();
4617 4617
 		$temp_array = array();
4618 4618
 
4619
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4619
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4620 4620
 		{
4621 4621
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
4622 4622
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -4633,12 +4633,12 @@  discard block
 block discarded – undo
4633 4633
 	* @return Array the aircraft list
4634 4634
 	*
4635 4635
 	*/
4636
-	public function countAllAircraftTypesByAirport($airport_icao,$filters = array())
4636
+	public function countAllAircraftTypesByAirport($airport_icao, $filters = array())
4637 4637
 	{
4638
-		$filter_query = $this->getFilter($filters,true,true);
4639
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4638
+		$filter_query = $this->getFilter($filters, true, true);
4639
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4640 4640
 
4641
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4641
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4642 4642
 				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) 
4643 4643
 				GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
4644 4644
 				ORDER BY aircraft_icao_count DESC";
@@ -4648,7 +4648,7 @@  discard block
 block discarded – undo
4648 4648
 
4649 4649
 		$aircraft_array = array();
4650 4650
 		$temp_array = array();
4651
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4651
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4652 4652
 		{
4653 4653
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4654 4654
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4666,13 +4666,13 @@  discard block
 block discarded – undo
4666 4666
 	* @return Array the aircraft list
4667 4667
 	*
4668 4668
 	*/
4669
-	public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array())
4669
+	public function countAllAircraftRegistrationByAirport($airport_icao, $filters = array())
4670 4670
 	{
4671
-		$filter_query = $this->getFilter($filters,true,true);
4671
+		$filter_query = $this->getFilter($filters, true, true);
4672 4672
 		$Image = new Image($this->db);
4673
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4673
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4674 4674
 
4675
-		$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  
4675
+		$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  
4676 4676
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)   
4677 4677
                     GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
4678 4678
 		    ORDER BY registration_count DESC";
@@ -4682,14 +4682,14 @@  discard block
 block discarded – undo
4682 4682
 
4683 4683
 		$aircraft_array = array();
4684 4684
 		$temp_array = array();
4685
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4685
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4686 4686
 		{
4687 4687
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4688 4688
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4689 4689
 			$temp_array['registration'] = $row['registration'];
4690 4690
 			$temp_array['airline_name'] = $row['airline_name'];
4691 4691
 			$temp_array['image_thumbnail'] = "";
4692
-			if($row['registration'] != "")
4692
+			if ($row['registration'] != "")
4693 4693
 			{
4694 4694
 				$image_array = $Image->getSpotterImage($row['registration']);
4695 4695
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4707,11 +4707,11 @@  discard block
 block discarded – undo
4707 4707
 	* @return Array the aircraft list
4708 4708
 	*
4709 4709
 	*/
4710
-	public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array())
4710
+	public function countAllAircraftManufacturerByAirport($airport_icao, $filters = array())
4711 4711
 	{
4712
-		$filter_query = $this->getFilter($filters,true,true);
4713
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
4714
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4712
+		$filter_query = $this->getFilter($filters, true, true);
4713
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
4714
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4715 4715
                     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)  
4716 4716
                     GROUP BY spotter_output.aircraft_manufacturer 
4717 4717
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -4722,7 +4722,7 @@  discard block
 block discarded – undo
4722 4722
 
4723 4723
 		$aircraft_array = array();
4724 4724
 		$temp_array = array();
4725
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4725
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4726 4726
 		{
4727 4727
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
4728 4728
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -4737,12 +4737,12 @@  discard block
 block discarded – undo
4737 4737
 	* @return Array the aircraft list
4738 4738
 	*
4739 4739
 	*/
4740
-	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array())
4740
+	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer, $filters = array())
4741 4741
 	{
4742
-		$filter_query = $this->getFilter($filters,true,true);
4743
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4742
+		$filter_query = $this->getFilter($filters, true, true);
4743
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4744 4744
 
4745
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4745
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4746 4746
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
4747 4747
                     GROUP BY spotter_output.aircraft_name 
4748 4748
 					ORDER BY aircraft_icao_count DESC";
@@ -4751,7 +4751,7 @@  discard block
 block discarded – undo
4751 4751
 		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer));
4752 4752
 		$aircraft_array = array();
4753 4753
 		$temp_array = array();
4754
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4754
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4755 4755
 		{
4756 4756
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4757 4757
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4770,11 +4770,11 @@  discard block
 block discarded – undo
4770 4770
 	*/
4771 4771
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array())
4772 4772
 	{
4773
-		$filter_query = $this->getFilter($filters,true,true);
4773
+		$filter_query = $this->getFilter($filters, true, true);
4774 4774
 		$Image = new Image($this->db);
4775
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
4775
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
4776 4776
 
4777
-		$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   
4777
+		$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   
4778 4778
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer   
4779 4779
                     GROUP BY spotter_output.registration 
4780 4780
 					ORDER BY registration_count DESC";
@@ -4784,14 +4784,14 @@  discard block
 block discarded – undo
4784 4784
 		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer));
4785 4785
 		$aircraft_array = array();
4786 4786
 		$temp_array = array();
4787
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4787
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4788 4788
 		{
4789 4789
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4790 4790
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4791 4791
 			$temp_array['registration'] = $row['registration'];
4792 4792
 			$temp_array['airline_name'] = $row['airline_name'];
4793 4793
 			$temp_array['image_thumbnail'] = "";
4794
-			if($row['registration'] != "")
4794
+			if ($row['registration'] != "")
4795 4795
 			{
4796 4796
 				$image_array = $Image->getSpotterImage($row['registration']);
4797 4797
 				$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4808,11 +4808,11 @@  discard block
 block discarded – undo
4808 4808
 	* @return Array the aircraft list
4809 4809
 	*
4810 4810
 	*/
4811
-	public function countAllAircraftTypesByDate($date,$filters = array())
4811
+	public function countAllAircraftTypesByDate($date, $filters = array())
4812 4812
 	{
4813 4813
 		global $globalTimezone, $globalDBdriver;
4814
-		$filter_query = $this->getFilter($filters,true,true);
4815
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4814
+		$filter_query = $this->getFilter($filters, true, true);
4815
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4816 4816
 		if ($globalTimezone != '') {
4817 4817
 			date_default_timezone_set($globalTimezone);
4818 4818
 			$datetime = new DateTime($date);
@@ -4820,12 +4820,12 @@  discard block
 block discarded – undo
4820 4820
 		} else $offset = '+00:00';
4821 4821
 
4822 4822
 		if ($globalDBdriver == 'mysql') {
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." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
4825 4825
 					GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
4826 4826
 					ORDER BY aircraft_icao_count DESC";
4827 4827
 		} else {
4828
-			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4828
+			$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4829 4829
 					FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date
4830 4830
 					GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
4831 4831
 					ORDER BY aircraft_icao_count DESC";
@@ -4836,7 +4836,7 @@  discard block
 block discarded – undo
4836 4836
 
4837 4837
 		$aircraft_array = array();
4838 4838
 		$temp_array = array();
4839
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4839
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4840 4840
 		{
4841 4841
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4842 4842
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4854,12 +4854,12 @@  discard block
 block discarded – undo
4854 4854
 	* @return Array the aircraft list
4855 4855
 	*
4856 4856
 	*/
4857
-	public function countAllAircraftRegistrationByDate($date,$filters = array())
4857
+	public function countAllAircraftRegistrationByDate($date, $filters = array())
4858 4858
 	{
4859 4859
 		global $globalTimezone, $globalDBdriver;
4860
-		$filter_query = $this->getFilter($filters,true,true);
4860
+		$filter_query = $this->getFilter($filters, true, true);
4861 4861
 		$Image = new Image($this->db);
4862
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4862
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4863 4863
 		if ($globalTimezone != '') {
4864 4864
 			date_default_timezone_set($globalTimezone);
4865 4865
 			$datetime = new DateTime($date);
@@ -4867,12 +4867,12 @@  discard block
 block discarded – undo
4867 4867
 		} else $offset = '+00:00';
4868 4868
 
4869 4869
 		if ($globalDBdriver == 'mysql') {
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 DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :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";
4874 4874
 		} else {
4875
-			$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    
4875
+			$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    
4876 4876
 					FROM spotter_output".$filter_query." spotter_output.registration <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4877 4877
 					GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
4878 4878
 					ORDER BY registration_count DESC";
@@ -4883,14 +4883,14 @@  discard block
 block discarded – undo
4883 4883
 
4884 4884
 		$aircraft_array = array();
4885 4885
 		$temp_array = array();
4886
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4886
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4887 4887
 		{
4888 4888
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4889 4889
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4890 4890
 			$temp_array['registration'] = $row['registration'];
4891 4891
 			$temp_array['airline_name'] = $row['airline_name'];
4892 4892
 			$temp_array['image_thumbnail'] = "";
4893
-			if($row['registration'] != "")
4893
+			if ($row['registration'] != "")
4894 4894
 			{
4895 4895
 				$image_array = $Image->getSpotterImage($row['registration']);
4896 4896
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -4909,11 +4909,11 @@  discard block
 block discarded – undo
4909 4909
 	* @return Array the aircraft manufacturer list
4910 4910
 	*
4911 4911
 	*/
4912
-	public function countAllAircraftManufacturerByDate($date,$filters = array())
4912
+	public function countAllAircraftManufacturerByDate($date, $filters = array())
4913 4913
 	{
4914 4914
 		global $globalTimezone, $globalDBdriver;
4915
-		$filter_query = $this->getFilter($filters,true,true);
4916
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
4915
+		$filter_query = $this->getFilter($filters, true, true);
4916
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
4917 4917
 		if ($globalTimezone != '') {
4918 4918
 			date_default_timezone_set($globalTimezone);
4919 4919
 			$datetime = new DateTime($date);
@@ -4921,12 +4921,12 @@  discard block
 block discarded – undo
4921 4921
 		} else $offset = '+00:00';
4922 4922
 
4923 4923
 		if ($globalDBdriver == 'mysql') {
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 DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
4926 4926
 				GROUP BY spotter_output.aircraft_manufacturer 
4927 4927
 				ORDER BY aircraft_manufacturer_count DESC";
4928 4928
 		} else {
4929
-			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4929
+			$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
4930 4930
 				FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date 
4931 4931
 				GROUP BY spotter_output.aircraft_manufacturer 
4932 4932
 				ORDER BY aircraft_manufacturer_count DESC";
@@ -4938,7 +4938,7 @@  discard block
 block discarded – undo
4938 4938
 		$aircraft_array = array();
4939 4939
 		$temp_array = array();
4940 4940
 
4941
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4941
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4942 4942
 		{
4943 4943
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
4944 4944
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -4955,11 +4955,11 @@  discard block
 block discarded – undo
4955 4955
 	* @return Array the aircraft list
4956 4956
 	*
4957 4957
 	*/
4958
-	public function countAllAircraftTypesByIdent($ident,$filters = array())
4958
+	public function countAllAircraftTypesByIdent($ident, $filters = array())
4959 4959
 	{
4960
-		$filter_query = $this->getFilter($filters,true,true);
4961
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
4962
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4960
+		$filter_query = $this->getFilter($filters, true, true);
4961
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
4962
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
4963 4963
 				FROM spotter_output".$filter_query." spotter_output.ident = :ident 
4964 4964
 				GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao
4965 4965
 				ORDER BY aircraft_icao_count DESC";
@@ -4970,7 +4970,7 @@  discard block
 block discarded – undo
4970 4970
 		$aircraft_array = array();
4971 4971
 		$temp_array = array();
4972 4972
 
4973
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4973
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
4974 4974
 		{
4975 4975
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4976 4976
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -4988,13 +4988,13 @@  discard block
 block discarded – undo
4988 4988
 	* @return Array the aircraft list
4989 4989
 	*
4990 4990
 	*/
4991
-	public function countAllAircraftRegistrationByIdent($ident,$filters = array())
4991
+	public function countAllAircraftRegistrationByIdent($ident, $filters = array())
4992 4992
 	{
4993
-		$filter_query = $this->getFilter($filters,true,true);
4993
+		$filter_query = $this->getFilter($filters, true, true);
4994 4994
 		$Image = new Image($this->db);
4995
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
4995
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
4996 4996
 
4997
-		$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  
4997
+		$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  
4998 4998
                     FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.ident = :ident   
4999 4999
                     GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name
5000 5000
 		    ORDER BY registration_count DESC";
@@ -5006,14 +5006,14 @@  discard block
 block discarded – undo
5006 5006
 		$aircraft_array = array();
5007 5007
 		$temp_array = array();
5008 5008
         
5009
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5009
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5010 5010
 		{
5011 5011
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5012 5012
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5013 5013
 			$temp_array['registration'] = $row['registration'];
5014 5014
 			$temp_array['airline_name'] = $row['airline_name'];
5015 5015
 			$temp_array['image_thumbnail'] = "";
5016
-			if($row['registration'] != "")
5016
+			if ($row['registration'] != "")
5017 5017
 			{
5018 5018
 				$image_array = $Image->getSpotterImage($row['registration']);
5019 5019
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5032,11 +5032,11 @@  discard block
 block discarded – undo
5032 5032
 	* @return Array the aircraft manufacturer list
5033 5033
 	*
5034 5034
 	*/
5035
-	public function countAllAircraftManufacturerByIdent($ident,$filters = array())
5035
+	public function countAllAircraftManufacturerByIdent($ident, $filters = array())
5036 5036
 	{
5037
-		$filter_query = $this->getFilter($filters,true,true);
5038
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
5039
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5037
+		$filter_query = $this->getFilter($filters, true, true);
5038
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
5039
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5040 5040
                     FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.ident = :ident  
5041 5041
                     GROUP BY spotter_output.aircraft_manufacturer 
5042 5042
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -5046,7 +5046,7 @@  discard block
 block discarded – undo
5046 5046
 		$sth->execute(array(':ident' => $ident));
5047 5047
 		$aircraft_array = array();
5048 5048
 		$temp_array = array();
5049
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5049
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5050 5050
 		{
5051 5051
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5052 5052
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5062,24 +5062,24 @@  discard block
 block discarded – undo
5062 5062
 	* @return Array the aircraft list
5063 5063
 	*
5064 5064
 	*/
5065
-	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5065
+	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
5066 5066
 	{
5067
-		$filter_query = $this->getFilter($filters,true,true);
5068
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5069
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5067
+		$filter_query = $this->getFilter($filters, true, true);
5068
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5069
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5070 5070
 		
5071 5071
 
5072
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5072
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5073 5073
                     FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
5074 5074
                     GROUP BY spotter_output.aircraft_name 
5075 5075
 					ORDER BY aircraft_icao_count DESC";
5076 5076
  
5077 5077
 		
5078 5078
 		$sth = $this->db->prepare($query);
5079
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5079
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5080 5080
 		$aircraft_array = array();
5081 5081
 		$temp_array = array();
5082
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5082
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5083 5083
 		{
5084 5084
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5085 5085
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5095,33 +5095,33 @@  discard block
 block discarded – undo
5095 5095
 	* @return Array the aircraft list
5096 5096
 	*
5097 5097
 	*/
5098
-	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5098
+	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
5099 5099
 	{
5100
-		$filter_query = $this->getFilter($filters,true,true);
5100
+		$filter_query = $this->getFilter($filters, true, true);
5101 5101
 		$Image = new Image($this->db);
5102
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5103
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5102
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5103
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5104 5104
 
5105
-		$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   
5105
+		$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   
5106 5106
                     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)   
5107 5107
                     GROUP BY spotter_output.registration 
5108 5108
 					ORDER BY registration_count DESC";
5109 5109
 
5110 5110
 		
5111 5111
 		$sth = $this->db->prepare($query);
5112
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5112
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5113 5113
       
5114 5114
 		$aircraft_array = array();
5115 5115
 		$temp_array = array();
5116 5116
         
5117
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5117
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5118 5118
 		{
5119 5119
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5120 5120
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5121 5121
 			$temp_array['registration'] = $row['registration'];
5122 5122
 			$temp_array['airline_name'] = $row['airline_name'];
5123 5123
 			$temp_array['image_thumbnail'] = "";
5124
-			if($row['registration'] != "")
5124
+			if ($row['registration'] != "")
5125 5125
 			{
5126 5126
 				$image_array = $Image->getSpotterImage($row['registration']);
5127 5127
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5141,25 +5141,25 @@  discard block
 block discarded – undo
5141 5141
 	* @return Array the aircraft manufacturer list
5142 5142
 	*
5143 5143
 	*/
5144
-	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array())
5144
+	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
5145 5145
 	{
5146
-		$filter_query = $this->getFilter($filters,true,true);
5147
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
5148
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
5146
+		$filter_query = $this->getFilter($filters, true, true);
5147
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
5148
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
5149 5149
 
5150
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5150
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5151 5151
                     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) 
5152 5152
                     GROUP BY spotter_output.aircraft_manufacturer 
5153 5153
 					ORDER BY aircraft_manufacturer_count DESC";
5154 5154
 
5155 5155
 		
5156 5156
 		$sth = $this->db->prepare($query);
5157
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
5157
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao));
5158 5158
       
5159 5159
 		$aircraft_array = array();
5160 5160
 		$temp_array = array();
5161 5161
         
5162
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5162
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5163 5163
 		{
5164 5164
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5165 5165
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5179,11 +5179,11 @@  discard block
 block discarded – undo
5179 5179
 	* @return Array the aircraft list
5180 5180
 	*
5181 5181
 	*/
5182
-	public function countAllAircraftTypesByCountry($country,$filters = array())
5182
+	public function countAllAircraftTypesByCountry($country, $filters = array())
5183 5183
 	{
5184
-		$filter_query = $this->getFilter($filters,true,true);
5185
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
5186
-		$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5184
+		$filter_query = $this->getFilter($filters, true, true);
5185
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
5186
+		$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
5187 5187
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country 
5188 5188
 			    GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao 
5189 5189
 			    ORDER BY aircraft_icao_count DESC";
@@ -5195,7 +5195,7 @@  discard block
 block discarded – undo
5195 5195
 		$aircraft_array = array();
5196 5196
 		$temp_array = array();
5197 5197
         
5198
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5198
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5199 5199
 		{
5200 5200
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5201 5201
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
@@ -5214,12 +5214,12 @@  discard block
 block discarded – undo
5214 5214
 	* @return Array the aircraft list
5215 5215
 	*
5216 5216
 	*/
5217
-	public function countAllAircraftRegistrationByCountry($country,$filters = array())
5217
+	public function countAllAircraftRegistrationByCountry($country, $filters = array())
5218 5218
 	{
5219
-		$filter_query = $this->getFilter($filters,true,true);
5219
+		$filter_query = $this->getFilter($filters, true, true);
5220 5220
 		$Image = new Image($this->db);
5221
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
5222
-		$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 
5221
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
5222
+		$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 
5223 5223
 			    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)    
5224 5224
 			    GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name 
5225 5225
 			    ORDER BY registration_count DESC";
@@ -5231,14 +5231,14 @@  discard block
 block discarded – undo
5231 5231
 		$aircraft_array = array();
5232 5232
 		$temp_array = array();
5233 5233
         
5234
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5234
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5235 5235
 		{
5236 5236
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
5237 5237
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5238 5238
 			$temp_array['registration'] = $row['registration'];
5239 5239
 			$temp_array['airline_name'] = $row['airline_name'];
5240 5240
 			$temp_array['image_thumbnail'] = "";
5241
-			if($row['registration'] != "")
5241
+			if ($row['registration'] != "")
5242 5242
 			{
5243 5243
 				$image_array = $Image->getSpotterImage($row['registration']);
5244 5244
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5258,11 +5258,11 @@  discard block
 block discarded – undo
5258 5258
 	* @return Array the aircraft manufacturer list
5259 5259
 	*
5260 5260
 	*/
5261
-	public function countAllAircraftManufacturerByCountry($country,$filters = array())
5261
+	public function countAllAircraftManufacturerByCountry($country, $filters = array())
5262 5262
 	{
5263
-		$filter_query = $this->getFilter($filters,true,true);
5264
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
5265
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5263
+		$filter_query = $this->getFilter($filters, true, true);
5264
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
5265
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5266 5266
                     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) 
5267 5267
                     GROUP BY spotter_output.aircraft_manufacturer 
5268 5268
 					ORDER BY aircraft_manufacturer_count DESC";
@@ -5274,7 +5274,7 @@  discard block
 block discarded – undo
5274 5274
 		$aircraft_array = array();
5275 5275
 		$temp_array = array();
5276 5276
         
5277
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5277
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5278 5278
 		{
5279 5279
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5280 5280
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5295,8 +5295,8 @@  discard block
 block discarded – undo
5295 5295
 	*/
5296 5296
 	public function countAllAircraftManufacturers($filters = array())
5297 5297
 	{
5298
-		$filter_query = $this->getFilter($filters,true,true);
5299
-		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5298
+		$filter_query = $this->getFilter($filters, true, true);
5299
+		$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
5300 5300
                     FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'";
5301 5301
                 $query .= " GROUP BY spotter_output.aircraft_manufacturer
5302 5302
 					ORDER BY aircraft_manufacturer_count DESC
@@ -5309,7 +5309,7 @@  discard block
 block discarded – undo
5309 5309
 		$manufacturer_array = array();
5310 5310
 		$temp_array = array();
5311 5311
         
5312
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5312
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5313 5313
 		{
5314 5314
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
5315 5315
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
@@ -5328,12 +5328,12 @@  discard block
 block discarded – undo
5328 5328
 	* @return Array the aircraft list
5329 5329
 	*
5330 5330
 	*/
5331
-	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5331
+	public function countAllAircraftRegistrations($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5332 5332
 	{
5333 5333
 		global $globalDBdriver;
5334 5334
 		$Image = new Image($this->db);
5335
-		$filter_query = $this->getFilter($filters,true,true);
5336
-		$query  = "SELECT DISTINCT spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao,  spotter_output.aircraft_name, spotter_output.airline_name    
5335
+		$filter_query = $this->getFilter($filters, true, true);
5336
+		$query = "SELECT DISTINCT spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao,  spotter_output.aircraft_name, spotter_output.airline_name    
5337 5337
                     FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'";
5338 5338
                 if ($olderthanmonths > 0) {
5339 5339
             		if ($globalDBdriver == 'mysql') {
@@ -5361,7 +5361,7 @@  discard block
 block discarded – undo
5361 5361
 		$aircraft_array = array();
5362 5362
 		$temp_array = array();
5363 5363
         
5364
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5364
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5365 5365
 		{
5366 5366
 			$temp_array['registration'] = $row['registration'];
5367 5367
 			$temp_array['aircraft_registration_count'] = $row['aircraft_registration_count'];
@@ -5369,7 +5369,7 @@  discard block
 block discarded – undo
5369 5369
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5370 5370
 			$temp_array['airline_name'] = $row['airline_name'];
5371 5371
 			$temp_array['image_thumbnail'] = "";
5372
-			if($row['registration'] != "")
5372
+			if ($row['registration'] != "")
5373 5373
 			{
5374 5374
 				$image_array = $Image->getSpotterImage($row['registration']);
5375 5375
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5388,12 +5388,12 @@  discard block
 block discarded – undo
5388 5388
 	* @return Array the aircraft list
5389 5389
 	*
5390 5390
 	*/
5391
-	public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
5391
+	public function countAllAircraftRegistrationsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5392 5392
 	{
5393 5393
 		global $globalDBdriver;
5394
-		$filter_query = $this->getFilter($filters,true,true);
5394
+		$filter_query = $this->getFilter($filters, true, true);
5395 5395
 		$Image = new Image($this->db);
5396
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao,  spotter_output.aircraft_name, spotter_output.airline_name    
5396
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao,  spotter_output.aircraft_name, spotter_output.airline_name    
5397 5397
                     FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
5398 5398
                 if ($olderthanmonths > 0) {
5399 5399
             		if ($globalDBdriver == 'mysql') {
@@ -5421,7 +5421,7 @@  discard block
 block discarded – undo
5421 5421
 		$aircraft_array = array();
5422 5422
 		$temp_array = array();
5423 5423
         
5424
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5424
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5425 5425
 		{
5426 5426
 			$temp_array['registration'] = $row['registration'];
5427 5427
 			$temp_array['aircraft_registration_count'] = $row['aircraft_registration_count'];
@@ -5430,7 +5430,7 @@  discard block
 block discarded – undo
5430 5430
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
5431 5431
 			$temp_array['airline_name'] = $row['airline_name'];
5432 5432
 			$temp_array['image_thumbnail'] = "";
5433
-			if($row['registration'] != "")
5433
+			if ($row['registration'] != "")
5434 5434
 			{
5435 5435
 				$image_array = $Image->getSpotterImage($row['registration']);
5436 5436
 				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
@@ -5449,11 +5449,11 @@  discard block
 block discarded – undo
5449 5449
 	* @return Array the airport list
5450 5450
 	*
5451 5451
 	*/
5452
-	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5452
+	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5453 5453
 	{
5454 5454
 		global $globalDBdriver;
5455
-		$filter_query = $this->getFilter($filters,true,true);
5456
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5455
+		$filter_query = $this->getFilter($filters, true, true);
5456
+		$query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5457 5457
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA'";
5458 5458
                 if ($olderthanmonths > 0) {
5459 5459
             		if ($globalDBdriver == 'mysql') {
@@ -5482,7 +5482,7 @@  discard block
 block discarded – undo
5482 5482
 		$airport_array = array();
5483 5483
 		$temp_array = array();
5484 5484
         
5485
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5485
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5486 5486
 		{
5487 5487
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5488 5488
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5501,11 +5501,11 @@  discard block
 block discarded – undo
5501 5501
 	* @return Array the airport list
5502 5502
 	*
5503 5503
 	*/
5504
-	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5504
+	public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5505 5505
 	{
5506 5506
 		global $globalDBdriver;
5507
-		$filter_query = $this->getFilter($filters,true,true);
5508
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5507
+		$filter_query = $this->getFilter($filters, true, true);
5508
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5509 5509
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' ";
5510 5510
                 if ($olderthanmonths > 0) {
5511 5511
             		if ($globalDBdriver == 'mysql') {
@@ -5534,7 +5534,7 @@  discard block
 block discarded – undo
5534 5534
 		$airport_array = array();
5535 5535
 		$temp_array = array();
5536 5536
         
5537
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5537
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5538 5538
 		{
5539 5539
 			$temp_array['airline_icao'] = $row['airline_icao'];
5540 5540
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -5554,11 +5554,11 @@  discard block
 block discarded – undo
5554 5554
 	* @return Array the airport list
5555 5555
 	*
5556 5556
 	*/
5557
-	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5557
+	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5558 5558
 	{
5559 5559
 		global $globalDBdriver;
5560
-		$filter_query = $this->getFilter($filters,true,true);
5561
-		$query  = "SELECT DISTINCT spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country
5560
+		$filter_query = $this->getFilter($filters, true, true);
5561
+		$query = "SELECT DISTINCT spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country
5562 5562
 				FROM airport, spotter_output".$filter_query." spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao";
5563 5563
                 if ($olderthanmonths > 0) {
5564 5564
             		if ($globalDBdriver == 'mysql') {
@@ -5586,7 +5586,7 @@  discard block
 block discarded – undo
5586 5586
 		$airport_array = array();
5587 5587
 		$temp_array = array();
5588 5588
         
5589
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5589
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5590 5590
 		{
5591 5591
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5592 5592
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5605,11 +5605,11 @@  discard block
 block discarded – undo
5605 5605
 	* @return Array the airport list
5606 5606
 	*
5607 5607
 	*/
5608
-	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
5608
+	public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
5609 5609
 	{
5610 5610
 		global $globalDBdriver;
5611
-		$filter_query = $this->getFilter($filters,true,true);
5612
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country
5611
+		$filter_query = $this->getFilter($filters, true, true);
5612
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country
5613 5613
 				FROM airport, spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao ";
5614 5614
                 if ($olderthanmonths > 0) {
5615 5615
             		if ($globalDBdriver == 'mysql') {
@@ -5638,7 +5638,7 @@  discard block
 block discarded – undo
5638 5638
 		$airport_array = array();
5639 5639
 		$temp_array = array();
5640 5640
         
5641
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5641
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5642 5642
 		{
5643 5643
 			$temp_array['airline_icao'] = $row['airline_icao'];
5644 5644
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -5658,11 +5658,11 @@  discard block
 block discarded – undo
5658 5658
 	* @return Array the airport list
5659 5659
 	*
5660 5660
 	*/
5661
-	public function countAllDepartureAirportsByAirline($airline_icao,$filters = array())
5661
+	public function countAllDepartureAirportsByAirline($airline_icao, $filters = array())
5662 5662
 	{
5663
-		$filter_query = $this->getFilter($filters,true,true);
5664
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5665
-		$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 
5663
+		$filter_query = $this->getFilter($filters, true, true);
5664
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5665
+		$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 
5666 5666
 			    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.airline_icao = :airline_icao 
5667 5667
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
5668 5668
 			    ORDER BY airport_departure_icao_count DESC";
@@ -5674,7 +5674,7 @@  discard block
 block discarded – undo
5674 5674
 		$airport_array = array();
5675 5675
 		$temp_array = array();
5676 5676
         
5677
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5677
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5678 5678
 		{
5679 5679
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5680 5680
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5696,11 +5696,11 @@  discard block
 block discarded – undo
5696 5696
 	* @return Array the airport list
5697 5697
 	*
5698 5698
 	*/
5699
-	public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array())
5699
+	public function countAllDepartureAirportCountriesByAirline($airline_icao, $filters = array())
5700 5700
 	{
5701
-		$filter_query = $this->getFilter($filters,true,true);
5702
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
5703
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5701
+		$filter_query = $this->getFilter($filters, true, true);
5702
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
5703
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5704 5704
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.airline_icao = :airline_icao 
5705 5705
                     GROUP BY spotter_output.departure_airport_country
5706 5706
 					ORDER BY airport_departure_country_count DESC";
@@ -5712,7 +5712,7 @@  discard block
 block discarded – undo
5712 5712
 		$airport_array = array();
5713 5713
 		$temp_array = array();
5714 5714
         
5715
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5715
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5716 5716
 		{
5717 5717
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
5718 5718
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -5731,11 +5731,11 @@  discard block
 block discarded – undo
5731 5731
 	* @return Array the airport list
5732 5732
 	*
5733 5733
 	*/
5734
-	public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array())
5734
+	public function countAllDepartureAirportsByAircraft($aircraft_icao, $filters = array())
5735 5735
 	{
5736
-		$filter_query = $this->getFilter($filters,true,true);
5737
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
5738
-		$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 
5736
+		$filter_query = $this->getFilter($filters, true, true);
5737
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
5738
+		$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 
5739 5739
 			    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.aircraft_icao = :aircraft_icao 
5740 5740
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5741 5741
 			    ORDER BY airport_departure_icao_count DESC";
@@ -5747,7 +5747,7 @@  discard block
 block discarded – undo
5747 5747
 		$airport_array = array();
5748 5748
 		$temp_array = array();
5749 5749
         
5750
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5750
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5751 5751
 		{
5752 5752
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5753 5753
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5768,11 +5768,11 @@  discard block
 block discarded – undo
5768 5768
 	* @return Array the airport list
5769 5769
 	*
5770 5770
 	*/
5771
-	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array())
5771
+	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao, $filters = array())
5772 5772
 	{
5773
-		$filter_query = $this->getFilter($filters,true,true);
5774
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
5775
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5773
+		$filter_query = $this->getFilter($filters, true, true);
5774
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
5775
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5776 5776
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
5777 5777
                     GROUP BY spotter_output.departure_airport_country
5778 5778
 					ORDER BY airport_departure_country_count DESC";
@@ -5784,7 +5784,7 @@  discard block
 block discarded – undo
5784 5784
 		$airport_array = array();
5785 5785
 		$temp_array = array();
5786 5786
         
5787
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5787
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5788 5788
 		{
5789 5789
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
5790 5790
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -5802,11 +5802,11 @@  discard block
 block discarded – undo
5802 5802
 	* @return Array the airport list
5803 5803
 	*
5804 5804
 	*/
5805
-	public function countAllDepartureAirportsByRegistration($registration,$filters = array())
5805
+	public function countAllDepartureAirportsByRegistration($registration, $filters = array())
5806 5806
 	{
5807
-		$filter_query = $this->getFilter($filters,true,true);
5808
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
5809
-		$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 
5807
+		$filter_query = $this->getFilter($filters, true, true);
5808
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
5809
+		$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 
5810 5810
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.registration = :registration 
5811 5811
                     GROUP BY spotter_output.departure_airport_icao
5812 5812
 					ORDER BY airport_departure_icao_count DESC";
@@ -5818,7 +5818,7 @@  discard block
 block discarded – undo
5818 5818
 		$airport_array = array();
5819 5819
 		$temp_array = array();
5820 5820
         
5821
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5821
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5822 5822
 		{
5823 5823
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5824 5824
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5839,11 +5839,11 @@  discard block
 block discarded – undo
5839 5839
 	* @return Array the airport list
5840 5840
 	*
5841 5841
 	*/
5842
-	public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array())
5842
+	public function countAllDepartureAirportCountriesByRegistration($registration, $filters = array())
5843 5843
 	{
5844
-		$filter_query = $this->getFilter($filters,true,true);
5845
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
5846
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5844
+		$filter_query = $this->getFilter($filters, true, true);
5845
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
5846
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5847 5847
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.registration = :registration 
5848 5848
                     GROUP BY spotter_output.departure_airport_country
5849 5849
 					ORDER BY airport_departure_country_count DESC";
@@ -5855,7 +5855,7 @@  discard block
 block discarded – undo
5855 5855
 		$airport_array = array();
5856 5856
 		$temp_array = array();
5857 5857
         
5858
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5858
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5859 5859
 		{
5860 5860
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
5861 5861
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -5873,11 +5873,11 @@  discard block
 block discarded – undo
5873 5873
 	* @return Array the airport list
5874 5874
 	*
5875 5875
 	*/
5876
-	public function countAllDepartureAirportsByAirport($airport_icao,$filters = array())
5876
+	public function countAllDepartureAirportsByAirport($airport_icao, $filters = array())
5877 5877
 	{
5878
-		$filter_query = $this->getFilter($filters,true,true);
5879
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
5880
-		$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 
5878
+		$filter_query = $this->getFilter($filters, true, true);
5879
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
5880
+		$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 
5881 5881
 			    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 
5882 5882
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5883 5883
 			    ORDER BY airport_departure_icao_count DESC";
@@ -5889,7 +5889,7 @@  discard block
 block discarded – undo
5889 5889
 		$airport_array = array();
5890 5890
 		$temp_array = array();
5891 5891
         
5892
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5892
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5893 5893
 		{
5894 5894
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5895 5895
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5910,11 +5910,11 @@  discard block
 block discarded – undo
5910 5910
 	* @return Array the airport list
5911 5911
 	*
5912 5912
 	*/
5913
-	public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array())
5913
+	public function countAllDepartureAirportCountriesByAirport($airport_icao, $filters = array())
5914 5914
 	{
5915
-		$filter_query = $this->getFilter($filters,true,true);
5916
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
5917
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5915
+		$filter_query = $this->getFilter($filters, true, true);
5916
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
5917
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5918 5918
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.arrival_airport_icao = :airport_icao 
5919 5919
                     GROUP BY spotter_output.departure_airport_country
5920 5920
 					ORDER BY airport_departure_country_count DESC";
@@ -5926,7 +5926,7 @@  discard block
 block discarded – undo
5926 5926
 		$airport_array = array();
5927 5927
 		$temp_array = array();
5928 5928
         
5929
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5929
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5930 5930
 		{
5931 5931
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
5932 5932
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -5945,11 +5945,11 @@  discard block
 block discarded – undo
5945 5945
 	* @return Array the airport list
5946 5946
 	*
5947 5947
 	*/
5948
-	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array())
5948
+	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer, $filters = array())
5949 5949
 	{
5950
-		$filter_query = $this->getFilter($filters,true,true);
5951
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
5952
-		$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 
5950
+		$filter_query = $this->getFilter($filters, true, true);
5951
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
5952
+		$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 
5953 5953
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
5954 5954
                     GROUP BY spotter_output.departure_airport_icao
5955 5955
 					ORDER BY airport_departure_icao_count DESC";
@@ -5961,7 +5961,7 @@  discard block
 block discarded – undo
5961 5961
 		$airport_array = array();
5962 5962
 		$temp_array = array();
5963 5963
         
5964
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
5964
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
5965 5965
 		{
5966 5966
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
5967 5967
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -5982,11 +5982,11 @@  discard block
 block discarded – undo
5982 5982
 	* @return Array the airport list
5983 5983
 	*
5984 5984
 	*/
5985
-	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
5985
+	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array())
5986 5986
 	{
5987
-		$filter_query = $this->getFilter($filters,true,true);
5988
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
5989
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5987
+		$filter_query = $this->getFilter($filters, true, true);
5988
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
5989
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
5990 5990
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
5991 5991
                     GROUP BY spotter_output.departure_airport_country
5992 5992
 					ORDER BY airport_departure_country_count DESC";
@@ -5998,7 +5998,7 @@  discard block
 block discarded – undo
5998 5998
 		$airport_array = array();
5999 5999
 		$temp_array = array();
6000 6000
         
6001
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6001
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6002 6002
 		{
6003 6003
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6004 6004
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6016,11 +6016,11 @@  discard block
 block discarded – undo
6016 6016
 	* @return Array the airport list
6017 6017
 	*
6018 6018
 	*/
6019
-	public function countAllDepartureAirportsByDate($date,$filters = array())
6019
+	public function countAllDepartureAirportsByDate($date, $filters = array())
6020 6020
 	{
6021 6021
 		global $globalTimezone, $globalDBdriver;
6022
-		$filter_query = $this->getFilter($filters,true,true);
6023
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
6022
+		$filter_query = $this->getFilter($filters, true, true);
6023
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
6024 6024
 		if ($globalTimezone != '') {
6025 6025
 			date_default_timezone_set($globalTimezone);
6026 6026
 			$datetime = new DateTime($date);
@@ -6028,12 +6028,12 @@  discard block
 block discarded – undo
6028 6028
 		} else $offset = '+00:00';
6029 6029
 
6030 6030
 		if ($globalDBdriver == 'mysql') {
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 DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :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";
6035 6035
 		} else {
6036
-			$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 
6036
+			$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 
6037 6037
 					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
6038 6038
 					GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6039 6039
 					ORDER BY airport_departure_icao_count DESC";
@@ -6045,7 +6045,7 @@  discard block
 block discarded – undo
6045 6045
 		$airport_array = array();
6046 6046
 		$temp_array = array();
6047 6047
         
6048
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6048
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6049 6049
 		{
6050 6050
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6051 6051
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6066,11 +6066,11 @@  discard block
 block discarded – undo
6066 6066
 	* @return Array the airport list
6067 6067
 	*
6068 6068
 	*/
6069
-	public function countAllDepartureAirportCountriesByDate($date,$filters = array())
6069
+	public function countAllDepartureAirportCountriesByDate($date, $filters = array())
6070 6070
 	{
6071 6071
 		global $globalTimezone, $globalDBdriver;
6072
-		$filter_query = $this->getFilter($filters,true,true);
6073
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
6072
+		$filter_query = $this->getFilter($filters, true, true);
6073
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
6074 6074
 		if ($globalTimezone != '') {
6075 6075
 			date_default_timezone_set($globalTimezone);
6076 6076
 			$datetime = new DateTime($date);
@@ -6078,12 +6078,12 @@  discard block
 block discarded – undo
6078 6078
 		} else $offset = '+00:00';
6079 6079
 
6080 6080
 		if ($globalDBdriver == 'mysql') {
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 DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
6083 6083
 					GROUP BY spotter_output.departure_airport_country
6084 6084
 					ORDER BY airport_departure_country_count DESC";
6085 6085
 		} else {
6086
-			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6086
+			$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6087 6087
 					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 
6088 6088
 					GROUP BY spotter_output.departure_airport_country
6089 6089
 					ORDER BY airport_departure_country_count DESC";
@@ -6095,7 +6095,7 @@  discard block
 block discarded – undo
6095 6095
 		$airport_array = array();
6096 6096
 		$temp_array = array();
6097 6097
         
6098
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6098
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6099 6099
 		{
6100 6100
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6101 6101
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6113,11 +6113,11 @@  discard block
 block discarded – undo
6113 6113
 	* @return Array the airport list
6114 6114
 	*
6115 6115
 	*/
6116
-	public function countAllDepartureAirportsByIdent($ident,$filters = array())
6116
+	public function countAllDepartureAirportsByIdent($ident, $filters = array())
6117 6117
 	{
6118
-		$filter_query = $this->getFilter($filters,true,true);
6119
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
6120
-		$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 
6118
+		$filter_query = $this->getFilter($filters, true, true);
6119
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
6120
+		$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 
6121 6121
 		    FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.ident = :ident 
6122 6122
                     GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
6123 6123
 		    ORDER BY airport_departure_icao_count DESC";
@@ -6129,7 +6129,7 @@  discard block
 block discarded – undo
6129 6129
 		$airport_array = array();
6130 6130
 		$temp_array = array();
6131 6131
         
6132
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6132
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6133 6133
 		{
6134 6134
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6135 6135
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6151,11 +6151,11 @@  discard block
 block discarded – undo
6151 6151
 	* @return Array the airport list
6152 6152
 	*
6153 6153
 	*/
6154
-	public function countAllDepartureAirportCountriesByIdent($ident,$filters = array())
6154
+	public function countAllDepartureAirportCountriesByIdent($ident, $filters = array())
6155 6155
 	{
6156
-		$filter_query = $this->getFilter($filters,true,true);
6157
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
6158
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6156
+		$filter_query = $this->getFilter($filters, true, true);
6157
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
6158
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6159 6159
 			FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.ident = :ident 
6160 6160
                     GROUP BY spotter_output.departure_airport_country
6161 6161
 					ORDER BY airport_departure_country_count DESC";
@@ -6167,7 +6167,7 @@  discard block
 block discarded – undo
6167 6167
 		$airport_array = array();
6168 6168
 		$temp_array = array();
6169 6169
         
6170
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6170
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6171 6171
 		{
6172 6172
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6173 6173
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6186,12 +6186,12 @@  discard block
 block discarded – undo
6186 6186
 	* @return Array the airport list
6187 6187
 	*
6188 6188
 	*/
6189
-	public function countAllDepartureAirportsByCountry($country,$filters = array())
6189
+	public function countAllDepartureAirportsByCountry($country, $filters = array())
6190 6190
 	{
6191
-		$filter_query = $this->getFilter($filters,true,true);
6192
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
6191
+		$filter_query = $this->getFilter($filters, true, true);
6192
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
6193 6193
 
6194
-		$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 
6194
+		$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 
6195 6195
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
6196 6196
 			    GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
6197 6197
 			    ORDER BY airport_departure_icao_count DESC";
@@ -6203,7 +6203,7 @@  discard block
 block discarded – undo
6203 6203
 		$airport_array = array();
6204 6204
 		$temp_array = array();
6205 6205
         
6206
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6206
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6207 6207
 		{
6208 6208
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
6209 6209
 			$temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count'];
@@ -6224,11 +6224,11 @@  discard block
 block discarded – undo
6224 6224
 	* @return Array the airport list
6225 6225
 	*
6226 6226
 	*/
6227
-	public function countAllDepartureAirportCountriesByCountry($country,$filters = array())
6227
+	public function countAllDepartureAirportCountriesByCountry($country, $filters = array())
6228 6228
 	{
6229
-		$filter_query = $this->getFilter($filters,true,true);
6230
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
6231
-		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6229
+		$filter_query = $this->getFilter($filters, true, true);
6230
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
6231
+		$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
6232 6232
 			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 
6233 6233
                     GROUP BY spotter_output.departure_airport_country
6234 6234
 					ORDER BY airport_departure_country_count DESC";
@@ -6240,7 +6240,7 @@  discard block
 block discarded – undo
6240 6240
 		$airport_array = array();
6241 6241
 		$temp_array = array();
6242 6242
         
6243
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6243
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6244 6244
 		{
6245 6245
 			$temp_array['departure_airport_country'] = $row['departure_airport_country'];
6246 6246
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
@@ -6258,11 +6258,11 @@  discard block
 block discarded – undo
6258 6258
 	* @return Array the airport list
6259 6259
 	*
6260 6260
 	*/
6261
-	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6261
+	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
6262 6262
 	{
6263 6263
 		global $globalDBdriver;
6264
-		$filter_query = $this->getFilter($filters,true,true);
6265
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6264
+		$filter_query = $this->getFilter($filters, true, true);
6265
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6266 6266
 				FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA'";
6267 6267
                 if ($olderthanmonths > 0) {
6268 6268
             		if ($globalDBdriver == 'mysql') {
@@ -6297,7 +6297,7 @@  discard block
 block discarded – undo
6297 6297
 		$airport_array = array();
6298 6298
 		$temp_array = array();
6299 6299
         
6300
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6300
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6301 6301
 		{
6302 6302
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6303 6303
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6320,11 +6320,11 @@  discard block
 block discarded – undo
6320 6320
 	* @return Array the airport list
6321 6321
 	*
6322 6322
 	*/
6323
-	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array())
6323
+	public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
6324 6324
 	{
6325 6325
 		global $globalDBdriver;
6326
-		$filter_query = $this->getFilter($filters,true,true);
6327
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6326
+		$filter_query = $this->getFilter($filters, true, true);
6327
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6328 6328
 			FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' ";
6329 6329
                 if ($olderthanmonths > 0) {
6330 6330
             		if ($globalDBdriver == 'mysql') {
@@ -6359,7 +6359,7 @@  discard block
 block discarded – undo
6359 6359
 		$airport_array = array();
6360 6360
 		$temp_array = array();
6361 6361
         
6362
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6362
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6363 6363
 		{
6364 6364
 			$temp_array['airline_icao'] = $row['airline_icao'];
6365 6365
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
@@ -6384,11 +6384,11 @@  discard block
 block discarded – undo
6384 6384
 	* @return Array the airport list
6385 6385
 	*
6386 6386
 	*/
6387
-	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6387
+	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
6388 6388
 	{
6389 6389
 		global $globalDBdriver;
6390
-		$filter_query = $this->getFilter($filters,true,true);
6391
-		$query  = "SELECT DISTINCT spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country 
6390
+		$filter_query = $this->getFilter($filters, true, true);
6391
+		$query = "SELECT DISTINCT spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country 
6392 6392
 			FROM airport,spotter_output".$filter_query." spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao";
6393 6393
                 if ($olderthanmonths > 0) {
6394 6394
             		if ($globalDBdriver == 'mysql') {
@@ -6422,7 +6422,7 @@  discard block
 block discarded – undo
6422 6422
 		$airport_array = array();
6423 6423
 		$temp_array = array();
6424 6424
         
6425
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6425
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6426 6426
 		{
6427 6427
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6428 6428
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6445,11 +6445,11 @@  discard block
 block discarded – undo
6445 6445
 	* @return Array the airport list
6446 6446
 	*
6447 6447
 	*/
6448
-	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array())
6448
+	public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array())
6449 6449
 	{
6450 6450
 		global $globalDBdriver;
6451
-		$filter_query = $this->getFilter($filters,true,true);
6452
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country 
6451
+		$filter_query = $this->getFilter($filters, true, true);
6452
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country 
6453 6453
 			FROM airport,spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao ";
6454 6454
                 if ($olderthanmonths > 0) {
6455 6455
             		if ($globalDBdriver == 'mysql') {
@@ -6484,7 +6484,7 @@  discard block
 block discarded – undo
6484 6484
 		$airport_array = array();
6485 6485
 		$temp_array = array();
6486 6486
         
6487
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6487
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6488 6488
 		{
6489 6489
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6490 6490
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6510,9 +6510,9 @@  discard block
 block discarded – undo
6510 6510
 	*/
6511 6511
 	public function countAllArrivalAirportsByAirline($airline_icao, $filters = array())
6512 6512
 	{
6513
-		$filter_query = $this->getFilter($filters,true,true);
6514
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
6515
-		$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 
6513
+		$filter_query = $this->getFilter($filters, true, true);
6514
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
6515
+		$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 
6516 6516
 			    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.airline_icao = :airline_icao 
6517 6517
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6518 6518
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -6523,7 +6523,7 @@  discard block
 block discarded – undo
6523 6523
 		$airport_array = array();
6524 6524
 		$temp_array = array();
6525 6525
         
6526
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6526
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6527 6527
 		{
6528 6528
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6529 6529
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6544,12 +6544,12 @@  discard block
 block discarded – undo
6544 6544
 	* @return Array the airport list
6545 6545
 	*
6546 6546
 	*/
6547
-	public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array())
6547
+	public function countAllArrivalAirportCountriesByAirline($airline_icao, $filters = array())
6548 6548
 	{
6549
-		$filter_query = $this->getFilter($filters,true,true);
6550
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
6549
+		$filter_query = $this->getFilter($filters, true, true);
6550
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
6551 6551
 					
6552
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6552
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6553 6553
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.airline_icao = :airline_icao 
6554 6554
                     GROUP BY spotter_output.arrival_airport_country
6555 6555
 					ORDER BY airport_arrival_country_count DESC";
@@ -6561,7 +6561,7 @@  discard block
 block discarded – undo
6561 6561
 		$airport_array = array();
6562 6562
 		$temp_array = array();
6563 6563
         
6564
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6564
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6565 6565
 		{
6566 6566
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6567 6567
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6579,11 +6579,11 @@  discard block
 block discarded – undo
6579 6579
 	* @return Array the airport list
6580 6580
 	*
6581 6581
 	*/
6582
-	public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array())
6582
+	public function countAllArrivalAirportsByAircraft($aircraft_icao, $filters = array())
6583 6583
 	{
6584
-		$filter_query = $this->getFilter($filters,true,true);
6585
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
6586
-		$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 
6584
+		$filter_query = $this->getFilter($filters, true, true);
6585
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
6586
+		$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 
6587 6587
 			    FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.aircraft_icao = :aircraft_icao 
6588 6588
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6589 6589
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -6595,7 +6595,7 @@  discard block
 block discarded – undo
6595 6595
 		$airport_array = array();
6596 6596
 		$temp_array = array();
6597 6597
         
6598
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6598
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6599 6599
 		{
6600 6600
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6601 6601
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6617,11 +6617,11 @@  discard block
 block discarded – undo
6617 6617
 	* @return Array the airport list
6618 6618
 	*
6619 6619
 	*/
6620
-	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array())
6620
+	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao, $filters = array())
6621 6621
 	{
6622
-		$filter_query = $this->getFilter($filters,true,true);
6623
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
6624
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6622
+		$filter_query = $this->getFilter($filters, true, true);
6623
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
6624
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6625 6625
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao
6626 6626
                     GROUP BY spotter_output.arrival_airport_country
6627 6627
 					ORDER BY airport_arrival_country_count DESC";
@@ -6633,7 +6633,7 @@  discard block
 block discarded – undo
6633 6633
 		$airport_array = array();
6634 6634
 		$temp_array = array();
6635 6635
         
6636
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6636
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6637 6637
 		{
6638 6638
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6639 6639
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6651,12 +6651,12 @@  discard block
 block discarded – undo
6651 6651
 	* @return Array the airport list
6652 6652
 	*
6653 6653
 	*/
6654
-	public function countAllArrivalAirportsByRegistration($registration,$filters = array())
6654
+	public function countAllArrivalAirportsByRegistration($registration, $filters = array())
6655 6655
 	{
6656
-		$filter_query = $this->getFilter($filters,true,true);
6657
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
6656
+		$filter_query = $this->getFilter($filters, true, true);
6657
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
6658 6658
 
6659
-		$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 
6659
+		$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 
6660 6660
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.registration = :registration 
6661 6661
                     GROUP BY spotter_output.arrival_airport_icao
6662 6662
 					ORDER BY airport_arrival_icao_count DESC";
@@ -6668,7 +6668,7 @@  discard block
 block discarded – undo
6668 6668
 		$airport_array = array();
6669 6669
 		$temp_array = array();
6670 6670
         
6671
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6671
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6672 6672
 		{
6673 6673
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6674 6674
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6689,11 +6689,11 @@  discard block
 block discarded – undo
6689 6689
 	* @return Array the airport list
6690 6690
 	*
6691 6691
 	*/
6692
-	public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array())
6692
+	public function countAllArrivalAirportCountriesByRegistration($registration, $filters = array())
6693 6693
 	{
6694
-		$filter_query = $this->getFilter($filters,true,true);
6695
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
6696
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6694
+		$filter_query = $this->getFilter($filters, true, true);
6695
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
6696
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6697 6697
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.registration = :registration 
6698 6698
                     GROUP BY spotter_output.arrival_airport_country
6699 6699
 					ORDER BY airport_arrival_country_count DESC";
@@ -6705,7 +6705,7 @@  discard block
 block discarded – undo
6705 6705
 		$airport_array = array();
6706 6706
 		$temp_array = array();
6707 6707
         
6708
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6708
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6709 6709
 		{
6710 6710
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6711 6711
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6724,11 +6724,11 @@  discard block
 block discarded – undo
6724 6724
 	* @return Array the airport list
6725 6725
 	*
6726 6726
 	*/
6727
-	public function countAllArrivalAirportsByAirport($airport_icao,$filters = array())
6727
+	public function countAllArrivalAirportsByAirport($airport_icao, $filters = array())
6728 6728
 	{
6729
-		$filter_query = $this->getFilter($filters,true,true);
6730
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
6731
-		$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 
6729
+		$filter_query = $this->getFilter($filters, true, true);
6730
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
6731
+		$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 
6732 6732
 			    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 
6733 6733
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6734 6734
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -6740,7 +6740,7 @@  discard block
 block discarded – undo
6740 6740
 		$airport_array = array();
6741 6741
 		$temp_array = array();
6742 6742
         
6743
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6743
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6744 6744
 		{
6745 6745
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6746 6746
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6761,11 +6761,11 @@  discard block
 block discarded – undo
6761 6761
 	* @return Array the airport list
6762 6762
 	*
6763 6763
 	*/
6764
-	public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array())
6764
+	public function countAllArrivalAirportCountriesByAirport($airport_icao, $filters = array())
6765 6765
 	{
6766
-		$filter_query = $this->getFilter($filters,true,true);
6767
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
6768
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6766
+		$filter_query = $this->getFilter($filters, true, true);
6767
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
6768
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6769 6769
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.departure_airport_icao = :airport_icao 
6770 6770
                     GROUP BY spotter_output.arrival_airport_country
6771 6771
 					ORDER BY airport_arrival_country_count DESC";
@@ -6777,7 +6777,7 @@  discard block
 block discarded – undo
6777 6777
 		$airport_array = array();
6778 6778
 		$temp_array = array();
6779 6779
         
6780
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6780
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6781 6781
 		{
6782 6782
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6783 6783
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6795,11 +6795,11 @@  discard block
 block discarded – undo
6795 6795
 	* @return Array the airport list
6796 6796
 	*
6797 6797
 	*/
6798
-	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array())
6798
+	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer, $filters = array())
6799 6799
 	{
6800
-		$filter_query = $this->getFilter($filters,true,true);
6801
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
6802
-		$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 
6800
+		$filter_query = $this->getFilter($filters, true, true);
6801
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
6802
+		$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 
6803 6803
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
6804 6804
                     GROUP BY spotter_output.arrival_airport_icao
6805 6805
 					ORDER BY airport_arrival_icao_count DESC";
@@ -6811,7 +6811,7 @@  discard block
 block discarded – undo
6811 6811
 		$airport_array = array();
6812 6812
 		$temp_array = array();
6813 6813
         
6814
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6814
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6815 6815
 		{
6816 6816
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6817 6817
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6833,11 +6833,11 @@  discard block
 block discarded – undo
6833 6833
 	* @return Array the airport list
6834 6834
 	*
6835 6835
 	*/
6836
-	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array())
6836
+	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array())
6837 6837
 	{
6838
-		$filter_query = $this->getFilter($filters,true,true);
6839
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
6840
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6838
+		$filter_query = $this->getFilter($filters, true, true);
6839
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
6840
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6841 6841
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer 
6842 6842
                     GROUP BY spotter_output.arrival_airport_country
6843 6843
 					ORDER BY airport_arrival_country_count DESC";
@@ -6849,7 +6849,7 @@  discard block
 block discarded – undo
6849 6849
 		$airport_array = array();
6850 6850
 		$temp_array = array();
6851 6851
         
6852
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6852
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6853 6853
 		{
6854 6854
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6855 6855
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6868,11 +6868,11 @@  discard block
 block discarded – undo
6868 6868
 	* @return Array the airport list
6869 6869
 	*
6870 6870
 	*/
6871
-	public function countAllArrivalAirportsByDate($date,$filters = array())
6871
+	public function countAllArrivalAirportsByDate($date, $filters = array())
6872 6872
 	{
6873 6873
 		global $globalTimezone, $globalDBdriver;
6874
-		$filter_query = $this->getFilter($filters,true,true);
6875
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
6874
+		$filter_query = $this->getFilter($filters, true, true);
6875
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
6876 6876
 		if ($globalTimezone != '') {
6877 6877
 			date_default_timezone_set($globalTimezone);
6878 6878
 			$datetime = new DateTime($date);
@@ -6880,12 +6880,12 @@  discard block
 block discarded – undo
6880 6880
 		} else $offset = '+00:00';
6881 6881
 
6882 6882
 		if ($globalDBdriver == 'mysql') {
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 DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :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";
6887 6887
 		} else {
6888
-			$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 
6888
+			$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 
6889 6889
 					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  
6890 6890
 					GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
6891 6891
 					ORDER BY airport_arrival_icao_count DESC";
@@ -6897,7 +6897,7 @@  discard block
 block discarded – undo
6897 6897
 		$airport_array = array();
6898 6898
 		$temp_array = array();
6899 6899
         
6900
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6900
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6901 6901
 		{
6902 6902
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6903 6903
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -6921,8 +6921,8 @@  discard block
 block discarded – undo
6921 6921
 	public function countAllArrivalAirportCountriesByDate($date, $filters = array())
6922 6922
 	{
6923 6923
 		global $globalTimezone, $globalDBdriver;
6924
-		$filter_query = $this->getFilter($filters,true,true);
6925
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
6924
+		$filter_query = $this->getFilter($filters, true, true);
6925
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
6926 6926
 		if ($globalTimezone != '') {
6927 6927
 			date_default_timezone_set($globalTimezone);
6928 6928
 			$datetime = new DateTime($date);
@@ -6930,12 +6930,12 @@  discard block
 block discarded – undo
6930 6930
 		} else $offset = '+00:00';
6931 6931
 
6932 6932
 		if ($globalDBdriver == 'mysql') {
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 DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date 
6935 6935
 					GROUP BY spotter_output.arrival_airport_country
6936 6936
 					ORDER BY airport_arrival_country_count DESC";
6937 6937
 		} else {
6938
-			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6938
+			$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
6939 6939
 					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 
6940 6940
 					GROUP BY spotter_output.arrival_airport_country
6941 6941
 					ORDER BY airport_arrival_country_count DESC";
@@ -6947,7 +6947,7 @@  discard block
 block discarded – undo
6947 6947
 		$airport_array = array();
6948 6948
 		$temp_array = array();
6949 6949
         
6950
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6950
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6951 6951
 		{
6952 6952
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
6953 6953
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -6965,11 +6965,11 @@  discard block
 block discarded – undo
6965 6965
 	* @return Array the airport list
6966 6966
 	*
6967 6967
 	*/
6968
-	public function countAllArrivalAirportsByIdent($ident,$filters = array())
6968
+	public function countAllArrivalAirportsByIdent($ident, $filters = array())
6969 6969
 	{
6970
-		$filter_query = $this->getFilter($filters,true,true);
6971
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
6972
-		$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 
6970
+		$filter_query = $this->getFilter($filters, true, true);
6971
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
6972
+		$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 
6973 6973
 		    FROM spotter_output".$filter_query." WHERE spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.ident = :ident  
6974 6974
                     GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6975 6975
 		    ORDER BY airport_arrival_icao_count DESC";
@@ -6981,7 +6981,7 @@  discard block
 block discarded – undo
6981 6981
 		$airport_array = array();
6982 6982
 		$temp_array = array();
6983 6983
         
6984
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
6984
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
6985 6985
 		{
6986 6986
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
6987 6987
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7004,9 +7004,9 @@  discard block
 block discarded – undo
7004 7004
 	*/
7005 7005
 	public function countAllArrivalAirportCountriesByIdent($ident, $filters = array())
7006 7006
 	{
7007
-		$filter_query = $this->getFilter($filters,true,true);
7008
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7009
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7007
+		$filter_query = $this->getFilter($filters, true, true);
7008
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7009
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7010 7010
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.ident = :ident 
7011 7011
                     GROUP BY spotter_output.arrival_airport_country
7012 7012
 					ORDER BY airport_arrival_country_count DESC";
@@ -7018,7 +7018,7 @@  discard block
 block discarded – undo
7018 7018
 		$airport_array = array();
7019 7019
 		$temp_array = array();
7020 7020
         
7021
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7021
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7022 7022
 		{
7023 7023
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7024 7024
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7037,11 +7037,11 @@  discard block
 block discarded – undo
7037 7037
 	* @return Array the airport list
7038 7038
 	*
7039 7039
 	*/
7040
-	public function countAllArrivalAirportsByCountry($country,$filters = array())
7040
+	public function countAllArrivalAirportsByCountry($country, $filters = array())
7041 7041
 	{
7042
-		$filter_query = $this->getFilter($filters,true,true);
7043
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7044
-		$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 
7042
+		$filter_query = $this->getFilter($filters, true, true);
7043
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7044
+		$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 
7045 7045
 			    FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country  
7046 7046
 			    GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
7047 7047
 			    ORDER BY airport_arrival_icao_count DESC";
@@ -7053,7 +7053,7 @@  discard block
 block discarded – undo
7053 7053
 		$airport_array = array();
7054 7054
 		$temp_array = array();
7055 7055
         
7056
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7056
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7057 7057
 		{
7058 7058
 			$temp_array['airport_arrival_icao'] = $row['arrival_airport_icao'];
7059 7059
 			$temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count'];
@@ -7074,11 +7074,11 @@  discard block
 block discarded – undo
7074 7074
 	* @return Array the airport list
7075 7075
 	*
7076 7076
 	*/
7077
-	public function countAllArrivalAirportCountriesByCountry($country,$filters = array())
7077
+	public function countAllArrivalAirportCountriesByCountry($country, $filters = array())
7078 7078
 	{
7079
-		$filter_query = $this->getFilter($filters,true,true);
7080
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7081
-		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7079
+		$filter_query = $this->getFilter($filters, true, true);
7080
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7081
+		$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7082 7082
 			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 
7083 7083
                     GROUP BY spotter_output.arrival_airport_country
7084 7084
 					ORDER BY airport_arrival_country_count DESC";
@@ -7090,7 +7090,7 @@  discard block
 block discarded – undo
7090 7090
 		$airport_array = array();
7091 7091
 		$temp_array = array();
7092 7092
         
7093
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7093
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7094 7094
 		{
7095 7095
 			$temp_array['arrival_airport_country'] = $row['arrival_airport_country'];
7096 7096
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
@@ -7111,7 +7111,7 @@  discard block
 block discarded – undo
7111 7111
 	*/
7112 7112
 	public function countAllDepartureCountries($filters = array())
7113 7113
 	{
7114
-		$filter_query = $this->getFilter($filters,true,true);
7114
+		$filter_query = $this->getFilter($filters, true, true);
7115 7115
 		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
7116 7116
 				FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.departure_airport_icao <> 'NA'";
7117 7117
 		$query .= " GROUP BY spotter_output.departure_airport_country
@@ -7125,7 +7125,7 @@  discard block
 block discarded – undo
7125 7125
 		$airport_array = array();
7126 7126
 		$temp_array = array();
7127 7127
         
7128
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7128
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7129 7129
 		{
7130 7130
 			$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count'];
7131 7131
 			$temp_array['airport_departure_country'] = $row['departure_airport_country'];
@@ -7143,9 +7143,9 @@  discard block
 block discarded – undo
7143 7143
 	* @return Array the airport arrival list
7144 7144
 	*
7145 7145
 	*/
7146
-	public function countAllArrivalCountries($limit = true,$filters = array())
7146
+	public function countAllArrivalCountries($limit = true, $filters = array())
7147 7147
 	{
7148
-		$filter_query = $this->getFilter($filters,true,true);
7148
+		$filter_query = $this->getFilter($filters, true, true);
7149 7149
 		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
7150 7150
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA'";
7151 7151
 		$query .= " GROUP BY spotter_output.arrival_airport_country
@@ -7159,7 +7159,7 @@  discard block
 block discarded – undo
7159 7159
 		$airport_array = array();
7160 7160
 		$temp_array = array();
7161 7161
         
7162
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7162
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7163 7163
 		{
7164 7164
 			$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count'];
7165 7165
 			$temp_array['airport_arrival_country'] = $row['arrival_airport_country'];
@@ -7182,8 +7182,8 @@  discard block
 block discarded – undo
7182 7182
 	*/
7183 7183
 	public function countAllRoutes($filters = array())
7184 7184
 	{
7185
-		$filter_query = $this->getFilter($filters,true,true);
7186
-		$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
7185
+		$filter_query = $this->getFilter($filters, true, true);
7186
+		$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
7187 7187
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> 'NA'
7188 7188
                     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
7189 7189
                     ORDER BY route_count DESC
@@ -7196,7 +7196,7 @@  discard block
 block discarded – undo
7196 7196
 		$routes_array = array();
7197 7197
 		$temp_array = array();
7198 7198
         
7199
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7199
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7200 7200
 		{
7201 7201
 			$temp_array['route_count'] = $row['route_count'];
7202 7202
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7223,11 +7223,11 @@  discard block
 block discarded – undo
7223 7223
 	* @return Array the route list
7224 7224
 	*
7225 7225
 	*/
7226
-	public function countAllRoutesByAircraft($aircraft_icao,$filters = array())
7226
+	public function countAllRoutesByAircraft($aircraft_icao, $filters = array())
7227 7227
 	{
7228
-		$filter_query = $this->getFilter($filters,true,true);
7229
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
7230
-		$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
7228
+		$filter_query = $this->getFilter($filters, true, true);
7229
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
7230
+		$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
7231 7231
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_icao = :aircraft_icao 
7232 7232
 			    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 
7233 7233
 			    ORDER BY route_count DESC";
@@ -7238,7 +7238,7 @@  discard block
 block discarded – undo
7238 7238
 		$routes_array = array();
7239 7239
 		$temp_array = array();
7240 7240
         
7241
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7241
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7242 7242
 		{
7243 7243
 			$temp_array['route_count'] = $row['route_count'];
7244 7244
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7265,9 +7265,9 @@  discard block
 block discarded – undo
7265 7265
 	*/
7266 7266
 	public function countAllRoutesByRegistration($registration, $filters = array())
7267 7267
 	{
7268
-		$filter_query = $this->getFilter($filters,true,true);
7268
+		$filter_query = $this->getFilter($filters, true, true);
7269 7269
 		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
7270
-		$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
7270
+		$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
7271 7271
 			FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.registration = :registration 
7272 7272
                     GROUP BY route
7273 7273
                     ORDER BY route_count DESC";
@@ -7279,7 +7279,7 @@  discard block
 block discarded – undo
7279 7279
 		$routes_array = array();
7280 7280
 		$temp_array = array();
7281 7281
         
7282
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7282
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7283 7283
 		{
7284 7284
 			$temp_array['route_count'] = $row['route_count'];
7285 7285
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7307,9 +7307,9 @@  discard block
 block discarded – undo
7307 7307
 	*/
7308 7308
 	public function countAllRoutesByAirline($airline_icao, $filters = array())
7309 7309
 	{
7310
-		$filter_query = $this->getFilter($filters,true,true);
7311
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
7312
-		$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
7310
+		$filter_query = $this->getFilter($filters, true, true);
7311
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
7312
+		$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
7313 7313
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao = :airline_icao 
7314 7314
 			    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 
7315 7315
 			    ORDER BY route_count DESC";
@@ -7321,7 +7321,7 @@  discard block
 block discarded – undo
7321 7321
 		$routes_array = array();
7322 7322
 		$temp_array = array();
7323 7323
         
7324
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7324
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7325 7325
 		{
7326 7326
 			$temp_array['route_count'] = $row['route_count'];
7327 7327
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7349,9 +7349,9 @@  discard block
 block discarded – undo
7349 7349
 	*/
7350 7350
 	public function countAllRoutesByAirport($airport_icao, $filters = array())
7351 7351
 	{
7352
-		$filter_query = $this->getFilter($filters,true,true);
7353
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
7354
-		$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
7352
+		$filter_query = $this->getFilter($filters, true, true);
7353
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
7354
+		$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
7355 7355
 			    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
7356 7356
 			    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 
7357 7357
 			    ORDER BY route_count DESC";
@@ -7362,7 +7362,7 @@  discard block
 block discarded – undo
7362 7362
 		$routes_array = array();
7363 7363
 		$temp_array = array();
7364 7364
         
7365
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7365
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7366 7366
 		{
7367 7367
 			$temp_array['route_count'] = $row['route_count'];
7368 7368
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7390,9 +7390,9 @@  discard block
 block discarded – undo
7390 7390
 	*/
7391 7391
 	public function countAllRoutesByCountry($country, $filters = array())
7392 7392
 	{
7393
-		$filter_query = $this->getFilter($filters,true,true);
7394
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
7395
-		$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
7393
+		$filter_query = $this->getFilter($filters, true, true);
7394
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
7395
+		$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
7396 7396
 			    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 
7397 7397
 			    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 
7398 7398
 			    ORDER BY route_count DESC";
@@ -7403,7 +7403,7 @@  discard block
 block discarded – undo
7403 7403
 		$routes_array = array();
7404 7404
 		$temp_array = array();
7405 7405
         
7406
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7406
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7407 7407
 		{
7408 7408
 			$temp_array['route_count'] = $row['route_count'];
7409 7409
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7431,8 +7431,8 @@  discard block
 block discarded – undo
7431 7431
 	public function countAllRoutesByDate($date, $filters = array())
7432 7432
 	{
7433 7433
 		global $globalTimezone, $globalDBdriver;
7434
-		$filter_query = $this->getFilter($filters,true,true);
7435
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
7434
+		$filter_query = $this->getFilter($filters, true, true);
7435
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
7436 7436
 		if ($globalTimezone != '') {
7437 7437
 			date_default_timezone_set($globalTimezone);
7438 7438
 			$datetime = new DateTime($date);
@@ -7440,12 +7440,12 @@  discard block
 block discarded – undo
7440 7440
 		} else $offset = '+00:00';
7441 7441
 		
7442 7442
 		if ($globalDBdriver == 'mysql') {
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 DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :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";
7447 7447
 		} else {
7448
-			$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
7448
+			$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
7449 7449
 				    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date  
7450 7450
 				    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
7451 7451
 				    ORDER BY route_count DESC";
@@ -7457,7 +7457,7 @@  discard block
 block discarded – undo
7457 7457
 		$routes_array = array();
7458 7458
 		$temp_array = array();
7459 7459
         
7460
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7460
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7461 7461
 		{
7462 7462
 			$temp_array['route_count'] = $row['route_count'];
7463 7463
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7484,9 +7484,9 @@  discard block
 block discarded – undo
7484 7484
 	*/
7485 7485
 	public function countAllRoutesByIdent($ident, $filters = array())
7486 7486
 	{
7487
-		$filter_query = $this->getFilter($filters,true,true);
7488
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
7489
-		$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
7487
+		$filter_query = $this->getFilter($filters, true, true);
7488
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
7489
+		$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
7490 7490
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.ident = :ident   
7491 7491
                     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
7492 7492
                     ORDER BY route_count DESC";
@@ -7498,7 +7498,7 @@  discard block
 block discarded – undo
7498 7498
 		$routes_array = array();
7499 7499
 		$temp_array = array();
7500 7500
         
7501
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7501
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7502 7502
 		{
7503 7503
 			$temp_array['route_count'] = $row['route_count'];
7504 7504
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7525,9 +7525,9 @@  discard block
 block discarded – undo
7525 7525
 	*/
7526 7526
 	public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array())
7527 7527
 	{
7528
-		$filter_query = $this->getFilter($filters,true,true);
7529
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
7530
-		$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
7528
+		$filter_query = $this->getFilter($filters, true, true);
7529
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
7530
+		$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
7531 7531
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer   
7532 7532
                     GROUP BY route
7533 7533
                     ORDER BY route_count DESC";
@@ -7539,7 +7539,7 @@  discard block
 block discarded – undo
7539 7539
 		$routes_array = array();
7540 7540
 		$temp_array = array();
7541 7541
         
7542
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7542
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7543 7543
 		{
7544 7544
 			$temp_array['route_count'] = $row['route_count'];
7545 7545
 			$temp_array['airport_departure_icao'] = $row['departure_airport_icao'];
@@ -7567,8 +7567,8 @@  discard block
 block discarded – undo
7567 7567
 	*/
7568 7568
 	public function countAllRoutesWithWaypoints($filters = array())
7569 7569
 	{
7570
-		$filter_query = $this->getFilter($filters,true,true);
7571
-		$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
7570
+		$filter_query = $this->getFilter($filters, true, true);
7571
+		$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
7572 7572
 		    FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.waypoints <> '' 
7573 7573
                     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
7574 7574
                     ORDER BY route_count DESC
@@ -7581,7 +7581,7 @@  discard block
 block discarded – undo
7581 7581
 		$routes_array = array();
7582 7582
 		$temp_array = array();
7583 7583
         
7584
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7584
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7585 7585
 		{
7586 7586
 			$temp_array['spotter_id'] = $row['spotter_id'];
7587 7587
 			$temp_array['route_count'] = $row['route_count'];
@@ -7606,11 +7606,11 @@  discard block
 block discarded – undo
7606 7606
 	* @return Array the callsign list
7607 7607
 	*
7608 7608
 	*/
7609
-	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array())
7609
+	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
7610 7610
 	{
7611 7611
 		global $globalDBdriver;
7612
-		$filter_query = $this->getFilter($filters,true,true);
7613
-		$query  = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
7612
+		$filter_query = $this->getFilter($filters, true, true);
7613
+		$query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
7614 7614
                     FROM spotter_output".$filter_query." spotter_output.ident <> '' ";
7615 7615
 		 if ($olderthanmonths > 0) {
7616 7616
 			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
@@ -7629,7 +7629,7 @@  discard block
 block discarded – undo
7629 7629
 		$callsign_array = array();
7630 7630
 		$temp_array = array();
7631 7631
         
7632
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7632
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7633 7633
 		{
7634 7634
 			$temp_array['callsign_icao'] = $row['ident'];
7635 7635
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -7651,8 +7651,8 @@  discard block
 block discarded – undo
7651 7651
 	public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
7652 7652
 	{
7653 7653
 		global $globalDBdriver;
7654
-		$filter_query = $this->getFilter($filters,true,true);
7655
-		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
7654
+		$filter_query = $this->getFilter($filters, true, true);
7655
+		$query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
7656 7656
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''  AND spotter_output.airline_icao <> '' ";
7657 7657
 		 if ($olderthanmonths > 0) {
7658 7658
 			if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
@@ -7671,7 +7671,7 @@  discard block
 block discarded – undo
7671 7671
 		$callsign_array = array();
7672 7672
 		$temp_array = array();
7673 7673
         
7674
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7674
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7675 7675
 		{
7676 7676
 			$temp_array['callsign_icao'] = $row['ident'];
7677 7677
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -7725,7 +7725,7 @@  discard block
 block discarded – undo
7725 7725
 		$date_array = array();
7726 7726
 		$temp_array = array();
7727 7727
         
7728
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7728
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7729 7729
 		{
7730 7730
 			$temp_array['date_name'] = $row['date_name'];
7731 7731
 			$temp_array['date_count'] = $row['date_count'];
@@ -7750,15 +7750,15 @@  discard block
 block discarded – undo
7750 7750
 			$datetime = new DateTime();
7751 7751
 			$offset = $datetime->format('P');
7752 7752
 		} else $offset = '+00:00';
7753
-		$filter_query = $this->getFilter($filters,true,true);
7753
+		$filter_query = $this->getFilter($filters, true, true);
7754 7754
 		if ($globalDBdriver == 'mysql') {
7755
-			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7755
+			$query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7756 7756
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
7757 7757
 								GROUP BY spotter_output.airline_icao, date_name 
7758 7758
 								ORDER BY date_count DESC
7759 7759
 								LIMIT 10 OFFSET 0";
7760 7760
 		} else {
7761
-			$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
7761
+			$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
7762 7762
 								FROM spotter_output 
7763 7763
 								WHERE spotter_output.airline_icao <> '' 
7764 7764
 								GROUP BY spotter_output.airline_icao, date_name 
@@ -7773,7 +7773,7 @@  discard block
 block discarded – undo
7773 7773
 		$date_array = array();
7774 7774
 		$temp_array = array();
7775 7775
         
7776
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7776
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7777 7777
 		{
7778 7778
 			$temp_array['date_name'] = $row['date_name'];
7779 7779
 			$temp_array['date_count'] = $row['date_count'];
@@ -7799,7 +7799,7 @@  discard block
 block discarded – undo
7799 7799
 			$datetime = new DateTime();
7800 7800
 			$offset = $datetime->format('P');
7801 7801
 		} else $offset = '+00:00';
7802
-		$filter_query = $this->getFilter($filters,true,true);
7802
+		$filter_query = $this->getFilter($filters, true, true);
7803 7803
 		if ($globalDBdriver == 'mysql') {
7804 7804
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7805 7805
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)";
@@ -7820,7 +7820,7 @@  discard block
 block discarded – undo
7820 7820
 		$date_array = array();
7821 7821
 		$temp_array = array();
7822 7822
         
7823
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7823
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7824 7824
 		{
7825 7825
 			$temp_array['date_name'] = $row['date_name'];
7826 7826
 			$temp_array['date_count'] = $row['date_count'];
@@ -7845,7 +7845,7 @@  discard block
 block discarded – undo
7845 7845
 			$datetime = new DateTime();
7846 7846
 			$offset = $datetime->format('P');
7847 7847
 		} else $offset = '+00:00';
7848
-		$filter_query = $this->getFilter($filters,true,true);
7848
+		$filter_query = $this->getFilter($filters, true, true);
7849 7849
 		if ($globalDBdriver == 'mysql') {
7850 7850
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7851 7851
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)";
@@ -7866,7 +7866,7 @@  discard block
 block discarded – undo
7866 7866
 		$date_array = array();
7867 7867
 		$temp_array = array();
7868 7868
         
7869
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7869
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7870 7870
 		{
7871 7871
 			$temp_array['date_name'] = $row['date_name'];
7872 7872
 			$temp_array['date_count'] = $row['date_count'];
@@ -7887,7 +7887,7 @@  discard block
 block discarded – undo
7887 7887
 	public function countAllDatesLastMonthByAirlines($filters = array())
7888 7888
 	{
7889 7889
 		global $globalTimezone, $globalDBdriver;
7890
-		$filter_query = $this->getFilter($filters,true,true);
7890
+		$filter_query = $this->getFilter($filters, true, true);
7891 7891
 		if ($globalTimezone != '') {
7892 7892
 			date_default_timezone_set($globalTimezone);
7893 7893
 			$datetime = new DateTime();
@@ -7895,13 +7895,13 @@  discard block
 block discarded – undo
7895 7895
 		} else $offset = '+00:00';
7896 7896
 		
7897 7897
 		if ($globalDBdriver == 'mysql') {
7898
-			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7898
+			$query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
7899 7899
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)
7900 7900
 								GROUP BY spotter_output.airline_icao, date_name 
7901 7901
 								ORDER BY spotter_output.date ASC";
7902 7902
 			$query_data = array(':offset' => $offset);
7903 7903
 		} else {
7904
-			$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
7904
+			$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
7905 7905
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= CURRENT_TIMESTAMP AT TIME ZONE INTERVAL :offset - INTERVAL '1 MONTHS'
7906 7906
 								GROUP BY spotter_output.airline_icao, date_name 
7907 7907
 								ORDER BY date_name ASC";
@@ -7914,7 +7914,7 @@  discard block
 block discarded – undo
7914 7914
 		$date_array = array();
7915 7915
 		$temp_array = array();
7916 7916
         
7917
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7917
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7918 7918
 		{
7919 7919
 			$temp_array['date_name'] = $row['date_name'];
7920 7920
 			$temp_array['date_count'] = $row['date_count'];
@@ -7961,7 +7961,7 @@  discard block
 block discarded – undo
7961 7961
 		$date_array = array();
7962 7962
 		$temp_array = array();
7963 7963
         
7964
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
7964
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
7965 7965
 		{
7966 7966
 			$temp_array['month_name'] = $row['month_name'];
7967 7967
 			$temp_array['year_name'] = $row['year_name'];
@@ -7982,7 +7982,7 @@  discard block
 block discarded – undo
7982 7982
 	public function countAllMonthsByAirlines($filters = array())
7983 7983
 	{
7984 7984
 		global $globalTimezone, $globalDBdriver;
7985
-		$filter_query = $this->getFilter($filters,true,true);
7985
+		$filter_query = $this->getFilter($filters, true, true);
7986 7986
 		if ($globalTimezone != '') {
7987 7987
 			date_default_timezone_set($globalTimezone);
7988 7988
 			$datetime = new DateTime();
@@ -7990,12 +7990,12 @@  discard block
 block discarded – undo
7990 7990
 		} else $offset = '+00:00';
7991 7991
 
7992 7992
 		if ($globalDBdriver == 'mysql') {
7993
-			$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
7993
+			$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
7994 7994
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
7995 7995
 								GROUP BY spotter_output.airline_icao, year_name, month_name 
7996 7996
 								ORDER BY date_count DESC";
7997 7997
 		} else {
7998
-			$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
7998
+			$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
7999 7999
 								FROM spotter_output 
8000 8000
 								WHERE spotter_output.airline_icao <> '' 
8001 8001
 								GROUP BY spotter_output.airline_icao, year_name, month_name 
@@ -8009,7 +8009,7 @@  discard block
 block discarded – undo
8009 8009
 		$date_array = array();
8010 8010
 		$temp_array = array();
8011 8011
         
8012
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8012
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8013 8013
 		{
8014 8014
 			$temp_array['month_name'] = $row['month_name'];
8015 8015
 			$temp_array['year_name'] = $row['year_name'];
@@ -8036,14 +8036,14 @@  discard block
 block discarded – undo
8036 8036
 			$datetime = new DateTime();
8037 8037
 			$offset = $datetime->format('P');
8038 8038
 		} else $offset = '+00:00';
8039
-		$filter_query = $this->getFilter($filters,true,true);
8039
+		$filter_query = $this->getFilter($filters, true, true);
8040 8040
 		if ($globalDBdriver == 'mysql') {
8041
-			$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
8041
+			$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
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";
8045 8045
 		} else {
8046
-			$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
8046
+			$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
8047 8047
 								FROM spotter_output".$filter_query." spotter_output.airline_type = 'military'
8048 8048
 								GROUP BY year_name, month_name 
8049 8049
 								ORDER BY date_count DESC";
@@ -8055,7 +8055,7 @@  discard block
 block discarded – undo
8055 8055
 		$date_array = array();
8056 8056
 		$temp_array = array();
8057 8057
         
8058
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8058
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8059 8059
 		{
8060 8060
 			$temp_array['month_name'] = $row['month_name'];
8061 8061
 			$temp_array['year_name'] = $row['year_name'];
@@ -8081,15 +8081,15 @@  discard block
 block discarded – undo
8081 8081
 			$datetime = new DateTime();
8082 8082
 			$offset = $datetime->format('P');
8083 8083
 		} else $offset = '+00:00';
8084
-		$filter_query = $this->getFilter($filters,true,true);
8084
+		$filter_query = $this->getFilter($filters, true, true);
8085 8085
 
8086 8086
 		if ($globalDBdriver == 'mysql') {
8087
-			$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
8087
+			$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
8088 8088
 								FROM spotter_output".$filter_query." owner_name <> ''
8089 8089
 								GROUP BY year_name, month_name
8090 8090
 								ORDER BY date_count DESC";
8091 8091
 		} else {
8092
-			$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
8092
+			$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
8093 8093
 								FROM spotter_output".$filter_query." owner_name <> ''
8094 8094
 								GROUP BY year_name, month_name
8095 8095
 								ORDER BY date_count DESC";
@@ -8101,7 +8101,7 @@  discard block
 block discarded – undo
8101 8101
 		$date_array = array();
8102 8102
 		$temp_array = array();
8103 8103
         
8104
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8104
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8105 8105
 		{
8106 8106
 			$temp_array['month_name'] = $row['month_name'];
8107 8107
 			$temp_array['year_name'] = $row['year_name'];
@@ -8122,7 +8122,7 @@  discard block
 block discarded – undo
8122 8122
 	public function countAllMonthsOwnersByAirlines($filters = array())
8123 8123
 	{
8124 8124
 		global $globalTimezone, $globalDBdriver;
8125
-		$filter_query = $this->getFilter($filters,true,true);
8125
+		$filter_query = $this->getFilter($filters, true, true);
8126 8126
 		if ($globalTimezone != '') {
8127 8127
 			date_default_timezone_set($globalTimezone);
8128 8128
 			$datetime = new DateTime();
@@ -8130,12 +8130,12 @@  discard block
 block discarded – undo
8130 8130
 		} else $offset = '+00:00';
8131 8131
 
8132 8132
 		if ($globalDBdriver == 'mysql') {
8133
-			$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
8133
+			$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
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";
8137 8137
 		} else {
8138
-			$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
8138
+			$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
8139 8139
 								FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' 
8140 8140
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8141 8141
 								ORDER BY date_count DESC";
@@ -8147,7 +8147,7 @@  discard block
 block discarded – undo
8147 8147
 		$date_array = array();
8148 8148
 		$temp_array = array();
8149 8149
         
8150
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8150
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8151 8151
 		{
8152 8152
 			$temp_array['month_name'] = $row['month_name'];
8153 8153
 			$temp_array['year_name'] = $row['year_name'];
@@ -8174,15 +8174,15 @@  discard block
 block discarded – undo
8174 8174
 			$datetime = new DateTime();
8175 8175
 			$offset = $datetime->format('P');
8176 8176
 		} else $offset = '+00:00';
8177
-		$filter_query = $this->getFilter($filters,true,true);
8177
+		$filter_query = $this->getFilter($filters, true, true);
8178 8178
 
8179 8179
 		if ($globalDBdriver == 'mysql') {
8180
-			$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
8180
+			$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
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";
8184 8184
 		} else {
8185
-			$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
8185
+			$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
8186 8186
 								FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL
8187 8187
 								GROUP BY year_name, month_name
8188 8188
 								ORDER BY date_count DESC";
@@ -8194,7 +8194,7 @@  discard block
 block discarded – undo
8194 8194
 		$date_array = array();
8195 8195
 		$temp_array = array();
8196 8196
         
8197
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8197
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8198 8198
 		{
8199 8199
 			$temp_array['month_name'] = $row['month_name'];
8200 8200
 			$temp_array['year_name'] = $row['year_name'];
@@ -8215,7 +8215,7 @@  discard block
 block discarded – undo
8215 8215
 	public function countAllMonthsPilotsByAirlines($filters = array())
8216 8216
 	{
8217 8217
 		global $globalTimezone, $globalDBdriver;
8218
-		$filter_query = $this->getFilter($filters,true,true);
8218
+		$filter_query = $this->getFilter($filters, true, true);
8219 8219
 		if ($globalTimezone != '') {
8220 8220
 			date_default_timezone_set($globalTimezone);
8221 8221
 			$datetime = new DateTime();
@@ -8223,12 +8223,12 @@  discard block
 block discarded – undo
8223 8223
 		} else $offset = '+00:00';
8224 8224
 
8225 8225
 		if ($globalDBdriver == 'mysql') {
8226
-			$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
8226
+			$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
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";
8230 8230
 		} else {
8231
-			$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
8231
+			$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
8232 8232
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL
8233 8233
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8234 8234
 								ORDER BY date_count DESC";
@@ -8240,7 +8240,7 @@  discard block
 block discarded – undo
8240 8240
 		$date_array = array();
8241 8241
 		$temp_array = array();
8242 8242
         
8243
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8243
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8244 8244
 		{
8245 8245
 			$temp_array['month_name'] = $row['month_name'];
8246 8246
 			$temp_array['year_name'] = $row['year_name'];
@@ -8262,7 +8262,7 @@  discard block
 block discarded – undo
8262 8262
 	public function countAllMonthsAirlines($filters = array())
8263 8263
 	{
8264 8264
 		global $globalTimezone, $globalDBdriver;
8265
-		$filter_query = $this->getFilter($filters,true,true);
8265
+		$filter_query = $this->getFilter($filters, true, true);
8266 8266
 		if ($globalTimezone != '') {
8267 8267
 			date_default_timezone_set($globalTimezone);
8268 8268
 			$datetime = new DateTime();
@@ -8270,12 +8270,12 @@  discard block
 block discarded – undo
8270 8270
 		} else $offset = '+00:00';
8271 8271
 
8272 8272
 		if ($globalDBdriver == 'mysql') {
8273
-			$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
8273
+			$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
8274 8274
 								FROM spotter_output".$filter_query." airline_icao <> '' 
8275 8275
 								GROUP BY year_name, month_name
8276 8276
 								ORDER BY date_count DESC";
8277 8277
 		} else {
8278
-			$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
8278
+			$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
8279 8279
 								FROM spotter_output".$filter_query." airline_icao <> '' 
8280 8280
 								GROUP BY year_name, month_name
8281 8281
 								ORDER BY date_count DESC";
@@ -8287,7 +8287,7 @@  discard block
 block discarded – undo
8287 8287
 		$date_array = array();
8288 8288
 		$temp_array = array();
8289 8289
         
8290
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8290
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8291 8291
 		{
8292 8292
 			$temp_array['month_name'] = $row['month_name'];
8293 8293
 			$temp_array['year_name'] = $row['year_name'];
@@ -8313,15 +8313,15 @@  discard block
 block discarded – undo
8313 8313
 			$datetime = new DateTime();
8314 8314
 			$offset = $datetime->format('P');
8315 8315
 		} else $offset = '+00:00';
8316
-		$filter_query = $this->getFilter($filters,true,true);
8316
+		$filter_query = $this->getFilter($filters, true, true);
8317 8317
 
8318 8318
 		if ($globalDBdriver == 'mysql') {
8319
-			$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
8319
+			$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
8320 8320
 								FROM spotter_output".$filter_query." aircraft_icao <> '' 
8321 8321
 								GROUP BY year_name, month_name
8322 8322
 								ORDER BY date_count DESC";
8323 8323
 		} else {
8324
-			$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
8324
+			$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
8325 8325
 								FROM spotter_output".$filter_query." aircraft_icao <> '' 
8326 8326
 								GROUP BY year_name, month_name
8327 8327
 								ORDER BY date_count DESC";
@@ -8333,7 +8333,7 @@  discard block
 block discarded – undo
8333 8333
 		$date_array = array();
8334 8334
 		$temp_array = array();
8335 8335
         
8336
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8336
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8337 8337
 		{
8338 8338
 			$temp_array['month_name'] = $row['month_name'];
8339 8339
 			$temp_array['year_name'] = $row['year_name'];
@@ -8355,7 +8355,7 @@  discard block
 block discarded – undo
8355 8355
 	public function countAllMonthsAircraftsByAirlines($filters = array())
8356 8356
 	{
8357 8357
 		global $globalTimezone, $globalDBdriver;
8358
-		$filter_query = $this->getFilter($filters,true,true);
8358
+		$filter_query = $this->getFilter($filters, true, true);
8359 8359
 		if ($globalTimezone != '') {
8360 8360
 			date_default_timezone_set($globalTimezone);
8361 8361
 			$datetime = new DateTime();
@@ -8363,12 +8363,12 @@  discard block
 block discarded – undo
8363 8363
 		} else $offset = '+00:00';
8364 8364
 
8365 8365
 		if ($globalDBdriver == 'mysql') {
8366
-			$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
8366
+			$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
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";
8370 8370
 		} else {
8371
-			$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
8371
+			$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
8372 8372
 								FROM spotter_output".$filter_query." aircraft_icao <> '' AND spotter_output.airline_icao <> '' 
8373 8373
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8374 8374
 								ORDER BY date_count DESC";
@@ -8380,7 +8380,7 @@  discard block
 block discarded – undo
8380 8380
 		$date_array = array();
8381 8381
 		$temp_array = array();
8382 8382
         
8383
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8383
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8384 8384
 		{
8385 8385
 			$temp_array['month_name'] = $row['month_name'];
8386 8386
 			$temp_array['year_name'] = $row['year_name'];
@@ -8407,15 +8407,15 @@  discard block
 block discarded – undo
8407 8407
 			$datetime = new DateTime();
8408 8408
 			$offset = $datetime->format('P');
8409 8409
 		} else $offset = '+00:00';
8410
-		$filter_query = $this->getFilter($filters,true,true);
8410
+		$filter_query = $this->getFilter($filters, true, true);
8411 8411
 
8412 8412
 		if ($globalDBdriver == 'mysql') {
8413
-			$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
8413
+			$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
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";
8417 8417
 		} else {
8418
-			$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
8418
+			$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
8419 8419
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' 
8420 8420
 								GROUP BY year_name, month_name
8421 8421
 								ORDER BY date_count DESC";
@@ -8427,7 +8427,7 @@  discard block
 block discarded – undo
8427 8427
 		$date_array = array();
8428 8428
 		$temp_array = array();
8429 8429
         
8430
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8430
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8431 8431
 		{
8432 8432
 			$temp_array['month_name'] = $row['month_name'];
8433 8433
 			$temp_array['year_name'] = $row['year_name'];
@@ -8449,7 +8449,7 @@  discard block
 block discarded – undo
8449 8449
 	public function countAllMonthsRealArrivalsByAirlines($filters = array())
8450 8450
 	{
8451 8451
 		global $globalTimezone, $globalDBdriver;
8452
-		$filter_query = $this->getFilter($filters,true,true);
8452
+		$filter_query = $this->getFilter($filters, true, true);
8453 8453
 		if ($globalTimezone != '') {
8454 8454
 			date_default_timezone_set($globalTimezone);
8455 8455
 			$datetime = new DateTime();
@@ -8457,12 +8457,12 @@  discard block
 block discarded – undo
8457 8457
 		} else $offset = '+00:00';
8458 8458
 
8459 8459
 		if ($globalDBdriver == 'mysql') {
8460
-			$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
8460
+			$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
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";
8464 8464
 		} else {
8465
-			$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
8465
+			$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
8466 8466
 								FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' 
8467 8467
 								GROUP BY spotter_output.airline_icao, year_name, month_name
8468 8468
 								ORDER BY date_count DESC";
@@ -8474,7 +8474,7 @@  discard block
 block discarded – undo
8474 8474
 		$date_array = array();
8475 8475
 		$temp_array = array();
8476 8476
         
8477
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8477
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8478 8478
 		{
8479 8479
 			$temp_array['month_name'] = $row['month_name'];
8480 8480
 			$temp_array['year_name'] = $row['year_name'];
@@ -8502,7 +8502,7 @@  discard block
 block discarded – undo
8502 8502
 			$datetime = new DateTime();
8503 8503
 			$offset = $datetime->format('P');
8504 8504
 		} else $offset = '+00:00';
8505
-		$filter_query = $this->getFilter($filters,true,true);
8505
+		$filter_query = $this->getFilter($filters, true, true);
8506 8506
 		if ($globalDBdriver == 'mysql') {
8507 8507
 			$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
8508 8508
 								FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)";
@@ -8523,7 +8523,7 @@  discard block
 block discarded – undo
8523 8523
 		$date_array = array();
8524 8524
 		$temp_array = array();
8525 8525
         
8526
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8526
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8527 8527
 		{
8528 8528
 			$temp_array['year_name'] = $row['year_name'];
8529 8529
 			$temp_array['month_name'] = $row['month_name'];
@@ -8543,7 +8543,7 @@  discard block
 block discarded – undo
8543 8543
 	* @return Array the hour list
8544 8544
 	*
8545 8545
 	*/
8546
-	public function countAllHours($orderby,$filters = array())
8546
+	public function countAllHours($orderby, $filters = array())
8547 8547
 	{
8548 8548
 		global $globalTimezone, $globalDBdriver;
8549 8549
 		if ($globalTimezone != '') {
@@ -8591,7 +8591,7 @@  discard block
 block discarded – undo
8591 8591
 		$hour_array = array();
8592 8592
 		$temp_array = array();
8593 8593
         
8594
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8594
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8595 8595
 		{
8596 8596
 			$temp_array['hour_name'] = $row['hour_name'];
8597 8597
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8611,7 +8611,7 @@  discard block
 block discarded – undo
8611 8611
 	public function countAllHoursByAirlines($orderby, $filters = array())
8612 8612
 	{
8613 8613
 		global $globalTimezone, $globalDBdriver;
8614
-		$filter_query = $this->getFilter($filters,true,true);
8614
+		$filter_query = $this->getFilter($filters, true, true);
8615 8615
 		if ($globalTimezone != '') {
8616 8616
 			date_default_timezone_set($globalTimezone);
8617 8617
 			$datetime = new DateTime();
@@ -8629,7 +8629,7 @@  discard block
 block discarded – undo
8629 8629
 		}
8630 8630
 		
8631 8631
 		if ($globalDBdriver == 'mysql') {
8632
-			$query  = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8632
+			$query = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8633 8633
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
8634 8634
 								GROUP BY spotter_output.airline_icao, hour_name 
8635 8635
 								".$orderby_sql;
@@ -8642,7 +8642,7 @@  discard block
 block discarded – undo
8642 8642
   */    
8643 8643
 		$query_data = array(':offset' => $offset);
8644 8644
 		} else {
8645
-			$query  = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8645
+			$query = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8646 8646
 								FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' 
8647 8647
 								GROUP BY spotter_output.airline_icao, hour_name 
8648 8648
 								".$orderby_sql;
@@ -8655,7 +8655,7 @@  discard block
 block discarded – undo
8655 8655
 		$hour_array = array();
8656 8656
 		$temp_array = array();
8657 8657
         
8658
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8658
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8659 8659
 		{
8660 8660
 			$temp_array['hour_name'] = $row['hour_name'];
8661 8661
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8678,34 +8678,34 @@  discard block
 block discarded – undo
8678 8678
 	public function countAllHoursByAirline($airline_icao, $filters = array())
8679 8679
 	{
8680 8680
 		global $globalTimezone, $globalDBdriver;
8681
-		$filter_query = $this->getFilter($filters,true,true);
8681
+		$filter_query = $this->getFilter($filters, true, true);
8682 8682
 		if ($globalTimezone != '') {
8683 8683
 			date_default_timezone_set($globalTimezone);
8684 8684
 			$datetime = new DateTime();
8685 8685
 			$offset = $datetime->format('P');
8686 8686
 		} else $offset = '+00:00';
8687 8687
 
8688
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
8688
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
8689 8689
 
8690 8690
 		if ($globalDBdriver == 'mysql') {
8691
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8691
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :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
 		} else {
8696
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8696
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8697 8697
 								FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao
8698 8698
 								GROUP BY hour_name 
8699 8699
 								ORDER BY hour_name ASC";
8700 8700
 		}
8701 8701
 		
8702 8702
 		$sth = $this->db->prepare($query);
8703
-		$sth->execute(array(':airline_icao' => $airline_icao,':offset' => $offset));
8703
+		$sth->execute(array(':airline_icao' => $airline_icao, ':offset' => $offset));
8704 8704
       
8705 8705
 		$hour_array = array();
8706 8706
 		$temp_array = array();
8707 8707
         
8708
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8708
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8709 8709
 		{
8710 8710
 			$temp_array['hour_name'] = $row['hour_name'];
8711 8711
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8728,8 +8728,8 @@  discard block
 block discarded – undo
8728 8728
 	public function countAllHoursByAircraft($aircraft_icao, $filters = array())
8729 8729
 	{
8730 8730
 		global $globalTimezone, $globalDBdriver;
8731
-		$filter_query = $this->getFilter($filters,true,true);
8732
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
8731
+		$filter_query = $this->getFilter($filters, true, true);
8732
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
8733 8733
 		if ($globalTimezone != '') {
8734 8734
 			date_default_timezone_set($globalTimezone);
8735 8735
 			$datetime = new DateTime();
@@ -8737,24 +8737,24 @@  discard block
 block discarded – undo
8737 8737
 		} else $offset = '+00:00';
8738 8738
 
8739 8739
 		if ($globalDBdriver == 'mysql') {
8740
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8740
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :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
 		} else {
8745
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8745
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8746 8746
 								FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao
8747 8747
 								GROUP BY hour_name 
8748 8748
 								ORDER BY hour_name ASC";
8749 8749
 		}
8750 8750
 		
8751 8751
 		$sth = $this->db->prepare($query);
8752
-		$sth->execute(array(':aircraft_icao' => $aircraft_icao,':offset' => $offset));
8752
+		$sth->execute(array(':aircraft_icao' => $aircraft_icao, ':offset' => $offset));
8753 8753
       
8754 8754
 		$hour_array = array();
8755 8755
 		$temp_array = array();
8756 8756
         
8757
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8757
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8758 8758
 		{
8759 8759
 			$temp_array['hour_name'] = $row['hour_name'];
8760 8760
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8775,8 +8775,8 @@  discard block
 block discarded – undo
8775 8775
 	public function countAllHoursByRegistration($registration, $filters = array())
8776 8776
 	{
8777 8777
 		global $globalTimezone, $globalDBdriver;
8778
-		$filter_query = $this->getFilter($filters,true,true);
8779
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
8778
+		$filter_query = $this->getFilter($filters, true, true);
8779
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
8780 8780
 		if ($globalTimezone != '') {
8781 8781
 			date_default_timezone_set($globalTimezone);
8782 8782
 			$datetime = new DateTime();
@@ -8784,24 +8784,24 @@  discard block
 block discarded – undo
8784 8784
 		} else $offset = '+00:00';
8785 8785
 
8786 8786
 		if ($globalDBdriver == 'mysql') {
8787
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8787
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :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
 		} else {
8792
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8792
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8793 8793
 								FROM spotter_output".$filter_query." spotter_output.registration = :registration
8794 8794
 								GROUP BY hour_name 
8795 8795
 								ORDER BY hour_name ASC";
8796 8796
 		}
8797 8797
 		
8798 8798
 		$sth = $this->db->prepare($query);
8799
-		$sth->execute(array(':registration' => $registration,':offset' => $offset));
8799
+		$sth->execute(array(':registration' => $registration, ':offset' => $offset));
8800 8800
       
8801 8801
 		$hour_array = array();
8802 8802
 		$temp_array = array();
8803 8803
         
8804
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8804
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8805 8805
 		{
8806 8806
 			$temp_array['hour_name'] = $row['hour_name'];
8807 8807
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8822,8 +8822,8 @@  discard block
 block discarded – undo
8822 8822
 	public function countAllHoursByAirport($airport_icao, $filters = array())
8823 8823
 	{
8824 8824
 		global $globalTimezone, $globalDBdriver;
8825
-		$filter_query = $this->getFilter($filters,true,true);
8826
-		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
8825
+		$filter_query = $this->getFilter($filters, true, true);
8826
+		$airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING);
8827 8827
 		if ($globalTimezone != '') {
8828 8828
 			date_default_timezone_set($globalTimezone);
8829 8829
 			$datetime = new DateTime();
@@ -8831,24 +8831,24 @@  discard block
 block discarded – undo
8831 8831
 		} else $offset = '+00:00';
8832 8832
 
8833 8833
 		if ($globalDBdriver == 'mysql') {
8834
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8834
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :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
 		} else {
8839
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8839
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8840 8840
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao)
8841 8841
 								GROUP BY hour_name 
8842 8842
 								ORDER BY hour_name ASC";
8843 8843
 		}
8844 8844
 		
8845 8845
 		$sth = $this->db->prepare($query);
8846
-		$sth->execute(array(':airport_icao' => $airport_icao,':offset' => $offset));
8846
+		$sth->execute(array(':airport_icao' => $airport_icao, ':offset' => $offset));
8847 8847
       
8848 8848
 		$hour_array = array();
8849 8849
 		$temp_array = array();
8850 8850
         
8851
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8851
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8852 8852
 		{
8853 8853
 			$temp_array['hour_name'] = $row['hour_name'];
8854 8854
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8867,11 +8867,11 @@  discard block
 block discarded – undo
8867 8867
 	* @return Array the hour list
8868 8868
 	*
8869 8869
 	*/
8870
-	public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array())
8870
+	public function countAllHoursByManufacturer($aircraft_manufacturer, $filters = array())
8871 8871
 	{
8872 8872
 		global $globalTimezone, $globalDBdriver;
8873
-		$filter_query = $this->getFilter($filters,true,true);
8874
-		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
8873
+		$filter_query = $this->getFilter($filters, true, true);
8874
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
8875 8875
 		if ($globalTimezone != '') {
8876 8876
 			date_default_timezone_set($globalTimezone);
8877 8877
 			$datetime = new DateTime();
@@ -8879,24 +8879,24 @@  discard block
 block discarded – undo
8879 8879
 		} else $offset = '+00:00';
8880 8880
 
8881 8881
 		if ($globalDBdriver == 'mysql') {
8882
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8882
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :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
 		} else {
8887
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8887
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8888 8888
 								FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer
8889 8889
 								GROUP BY hour_name 
8890 8890
 								ORDER BY hour_name ASC";
8891 8891
 		}
8892 8892
 		
8893 8893
 		$sth = $this->db->prepare($query);
8894
-		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer,':offset' => $offset));
8894
+		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer, ':offset' => $offset));
8895 8895
       
8896 8896
 		$hour_array = array();
8897 8897
 		$temp_array = array();
8898 8898
         
8899
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8899
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8900 8900
 		{
8901 8901
 			$temp_array['hour_name'] = $row['hour_name'];
8902 8902
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8918,8 +8918,8 @@  discard block
 block discarded – undo
8918 8918
 	public function countAllHoursByDate($date, $filters = array())
8919 8919
 	{
8920 8920
 		global $globalTimezone, $globalDBdriver;
8921
-		$filter_query = $this->getFilter($filters,true,true);
8922
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
8921
+		$filter_query = $this->getFilter($filters, true, true);
8922
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
8923 8923
 		if ($globalTimezone != '') {
8924 8924
 			date_default_timezone_set($globalTimezone);
8925 8925
 			$datetime = new DateTime($date);
@@ -8927,12 +8927,12 @@  discard block
 block discarded – undo
8927 8927
 		} else $offset = '+00:00';
8928 8928
 
8929 8929
 		if ($globalDBdriver == 'mysql') {
8930
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8930
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8931 8931
 								FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date
8932 8932
 								GROUP BY hour_name 
8933 8933
 								ORDER BY hour_name ASC";
8934 8934
 		} else {
8935
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8935
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8936 8936
 								FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date
8937 8937
 								GROUP BY hour_name 
8938 8938
 								ORDER BY hour_name ASC";
@@ -8944,7 +8944,7 @@  discard block
 block discarded – undo
8944 8944
 		$hour_array = array();
8945 8945
 		$temp_array = array();
8946 8946
         
8947
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8947
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8948 8948
 		{
8949 8949
 			$temp_array['hour_name'] = $row['hour_name'];
8950 8950
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -8966,8 +8966,8 @@  discard block
 block discarded – undo
8966 8966
 	public function countAllHoursByIdent($ident, $filters = array())
8967 8967
 	{
8968 8968
 		global $globalTimezone, $globalDBdriver;
8969
-		$filter_query = $this->getFilter($filters,true,true);
8970
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
8969
+		$filter_query = $this->getFilter($filters, true, true);
8970
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
8971 8971
 		if ($globalTimezone != '') {
8972 8972
 			date_default_timezone_set($globalTimezone);
8973 8973
 			$datetime = new DateTime();
@@ -8975,12 +8975,12 @@  discard block
 block discarded – undo
8975 8975
 		} else $offset = '+00:00';
8976 8976
 
8977 8977
 		if ($globalDBdriver == 'mysql') {
8978
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
8978
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :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";
8982 8982
 		} else {
8983
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8983
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
8984 8984
 								FROM spotter_output".$filter_query." spotter_output.ident = :ident 
8985 8985
 								GROUP BY hour_name 
8986 8986
 								ORDER BY hour_name ASC";
@@ -8988,12 +8988,12 @@  discard block
 block discarded – undo
8988 8988
       
8989 8989
 		
8990 8990
 		$sth = $this->db->prepare($query);
8991
-		$sth->execute(array(':ident' => $ident,':offset' => $offset));
8991
+		$sth->execute(array(':ident' => $ident, ':offset' => $offset));
8992 8992
       
8993 8993
 		$hour_array = array();
8994 8994
 		$temp_array = array();
8995 8995
         
8996
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
8996
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
8997 8997
 		{
8998 8998
 			$temp_array['hour_name'] = $row['hour_name'];
8999 8999
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9012,12 +9012,12 @@  discard block
 block discarded – undo
9012 9012
 	* @return Array the hour list
9013 9013
 	*
9014 9014
 	*/
9015
-	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array())
9015
+	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array())
9016 9016
 	{
9017 9017
 		global $globalTimezone, $globalDBdriver;
9018
-		$filter_query = $this->getFilter($filters,true,true);
9019
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
9020
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
9018
+		$filter_query = $this->getFilter($filters, true, true);
9019
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
9020
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
9021 9021
 		if ($globalTimezone != '') {
9022 9022
 			date_default_timezone_set($globalTimezone);
9023 9023
 			$datetime = new DateTime();
@@ -9025,24 +9025,24 @@  discard block
 block discarded – undo
9025 9025
 		} else $offset = '+00:00';
9026 9026
 
9027 9027
 		if ($globalDBdriver == 'mysql') {
9028
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9028
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :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
 		} else {
9033
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9033
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9034 9034
 								FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)
9035 9035
 								GROUP BY hour_name 
9036 9036
 								ORDER BY hour_name ASC";
9037 9037
 		}
9038 9038
 		
9039 9039
 		$sth = $this->db->prepare($query);
9040
-		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':offset' => $offset));
9040
+		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':offset' => $offset));
9041 9041
       
9042 9042
 		$hour_array = array();
9043 9043
 		$temp_array = array();
9044 9044
         
9045
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9045
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9046 9046
 		{
9047 9047
 			$temp_array['hour_name'] = $row['hour_name'];
9048 9048
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9063,8 +9063,8 @@  discard block
 block discarded – undo
9063 9063
 	public function countAllHoursByCountry($country, $filters = array())
9064 9064
 	{
9065 9065
 		global $globalTimezone, $globalDBdriver;
9066
-		$filter_query = $this->getFilter($filters,true,true);
9067
-		$country = filter_var($country,FILTER_SANITIZE_STRING);
9066
+		$filter_query = $this->getFilter($filters, true, true);
9067
+		$country = filter_var($country, FILTER_SANITIZE_STRING);
9068 9068
 		if ($globalTimezone != '') {
9069 9069
 			date_default_timezone_set($globalTimezone);
9070 9070
 			$datetime = new DateTime();
@@ -9072,24 +9072,24 @@  discard block
 block discarded – undo
9072 9072
 		} else $offset = '+00:00';
9073 9073
 
9074 9074
 		if ($globalDBdriver == 'mysql') {
9075
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9075
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :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
 		} else {
9080
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9080
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9081 9081
 								FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country
9082 9082
 								GROUP BY hour_name 
9083 9083
 								ORDER BY hour_name ASC";
9084 9084
 		}
9085 9085
 		
9086 9086
 		$sth = $this->db->prepare($query);
9087
-		$sth->execute(array(':country' => $country,':offset' => $offset));
9087
+		$sth->execute(array(':country' => $country, ':offset' => $offset));
9088 9088
       
9089 9089
 		$hour_array = array();
9090 9090
 		$temp_array = array();
9091 9091
         
9092
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9092
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9093 9093
 		{
9094 9094
 			$temp_array['hour_name'] = $row['hour_name'];
9095 9095
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9111,8 +9111,8 @@  discard block
 block discarded – undo
9111 9111
 	*/
9112 9112
 	public function countOverallAircrafts($filters = array())
9113 9113
 	{
9114
-		$filter_query = $this->getFilter($filters,true,true);
9115
-		$query  = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count  
9114
+		$filter_query = $this->getFilter($filters, true, true);
9115
+		$query = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count  
9116 9116
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''";
9117 9117
 		$sth = $this->db->prepare($query);
9118 9118
 		$sth->execute();
@@ -9127,8 +9127,8 @@  discard block
 block discarded – undo
9127 9127
 	*/
9128 9128
 	public function countOverallArrival($filters = array())
9129 9129
 	{
9130
-		$filter_query = $this->getFilter($filters,true,true);
9131
-		$query  = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count  
9130
+		$filter_query = $this->getFilter($filters, true, true);
9131
+		$query = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count  
9132 9132
                     FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> ''";
9133 9133
 		
9134 9134
 		$sth = $this->db->prepare($query);
@@ -9144,8 +9144,8 @@  discard block
 block discarded – undo
9144 9144
 	*/
9145 9145
 	public function countOverallPilots($filters = array())
9146 9146
 	{
9147
-		$filter_query = $this->getFilter($filters,true,true);
9148
-		$query  = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count  
9147
+		$filter_query = $this->getFilter($filters, true, true);
9148
+		$query = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count  
9149 9149
                     FROM spotter_output".$filter_query." spotter_output.pilot_id <> ''";
9150 9150
 		$sth = $this->db->prepare($query);
9151 9151
 		$sth->execute();
@@ -9160,8 +9160,8 @@  discard block
 block discarded – undo
9160 9160
 	*/
9161 9161
 	public function countOverallOwners($filters = array())
9162 9162
 	{
9163
-		$filter_query = $this->getFilter($filters,true,true);
9164
-		$query  = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count  
9163
+		$filter_query = $this->getFilter($filters, true, true);
9164
+		$query = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count  
9165 9165
                     FROM spotter_output".$filter_query." spotter_output.owner_name <> ''";
9166 9166
 		$sth = $this->db->prepare($query);
9167 9167
 		$sth->execute();
@@ -9194,8 +9194,8 @@  discard block
 block discarded – undo
9194 9194
 	*/
9195 9195
 	public function countOverallMilitaryFlights($filters = array())
9196 9196
 	{
9197
-		$filter_query = $this->getFilter($filters,true,true);
9198
-		$query  = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
9197
+		$filter_query = $this->getFilter($filters, true, true);
9198
+		$query = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
9199 9199
                     FROM airlines,spotter_output".$filter_query." spotter_output.airline_icao = airlines.icao AND airlines.type = 'military'";
9200 9200
       
9201 9201
 		$sth = $this->db->prepare($query);
@@ -9232,7 +9232,7 @@  discard block
 block discarded – undo
9232 9232
 	public function countAllHoursFromToday($filters = array())
9233 9233
 	{
9234 9234
 		global $globalTimezone, $globalDBdriver;
9235
-		$filter_query = $this->getFilter($filters,true,true);
9235
+		$filter_query = $this->getFilter($filters, true, true);
9236 9236
 		if ($globalTimezone != '') {
9237 9237
 			date_default_timezone_set($globalTimezone);
9238 9238
 			$datetime = new DateTime();
@@ -9240,12 +9240,12 @@  discard block
 block discarded – undo
9240 9240
 		} else $offset = '+00:00';
9241 9241
 
9242 9242
 		if ($globalDBdriver == 'mysql') {
9243
-			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9243
+			$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
9244 9244
 								FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = CURDATE()
9245 9245
 								GROUP BY hour_name 
9246 9246
 								ORDER BY hour_name ASC";
9247 9247
 		} else {
9248
-			$query  = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9248
+			$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
9249 9249
 								FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date)
9250 9250
 								GROUP BY hour_name 
9251 9251
 								ORDER BY hour_name ASC";
@@ -9257,7 +9257,7 @@  discard block
 block discarded – undo
9257 9257
 		$hour_array = array();
9258 9258
 		$temp_array = array();
9259 9259
         
9260
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9260
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9261 9261
 		{
9262 9262
 			$temp_array['hour_name'] = $row['hour_name'];
9263 9263
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -9276,14 +9276,14 @@  discard block
 block discarded – undo
9276 9276
 	public function getUpcomingFlights($limit = '', $sort = '', $filters = array())
9277 9277
 	{
9278 9278
 		global $global_query, $globalDBdriver, $globalTimezone;
9279
-		$filter_query = $this->getFilter($filters,true,true);
9279
+		$filter_query = $this->getFilter($filters, true, true);
9280 9280
 		date_default_timezone_set('UTC');
9281 9281
 		$limit_query = '';
9282 9282
 		if ($limit != "")
9283 9283
 		{
9284 9284
 			$limit_array = explode(",", $limit);
9285
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
9286
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
9285
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
9286
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
9287 9287
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
9288 9288
 			{
9289 9289
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
@@ -9336,7 +9336,7 @@  discard block
 block discarded – undo
9336 9336
 			    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')
9337 9337
 			    HAVING count(spotter_output.ident) > 5$orderby_query";
9338 9338
 			//echo $query;
9339
-			$spotter_array = $this->getDataFromDB($query.$limit_query,array(':timezone' => $globalTimezone));
9339
+			$spotter_array = $this->getDataFromDB($query.$limit_query, array(':timezone' => $globalTimezone));
9340 9340
 			/*
9341 9341
 			$sth = $this->db->prepare($query);
9342 9342
 			$sth->execute(array(':timezone' => $globalTimezone));
@@ -9355,9 +9355,9 @@  discard block
 block discarded – undo
9355 9355
 	*/
9356 9356
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
9357 9357
 	{
9358
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
9358
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
9359 9359
 
9360
-		$query  = "SELECT spotter_output.spotter_id
9360
+		$query = "SELECT spotter_output.spotter_id
9361 9361
 								FROM spotter_output 
9362 9362
 								WHERE spotter_output.flightaware_id = '".$flightaware_id."'";
9363 9363
         
@@ -9365,7 +9365,7 @@  discard block
 block discarded – undo
9365 9365
 		$sth = $this->db->prepare($query);
9366 9366
 		$sth->execute();
9367 9367
 
9368
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9368
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9369 9369
 		{
9370 9370
 			return $row['spotter_id'];
9371 9371
 		}
@@ -9390,23 +9390,23 @@  discard block
 block discarded – undo
9390 9390
 		}
9391 9391
 		
9392 9392
 		$current_date = date("Y-m-d H:i:s");
9393
-		$date = date("Y-m-d H:i:s",strtotime($dateString." UTC"));
9393
+		$date = date("Y-m-d H:i:s", strtotime($dateString." UTC"));
9394 9394
 		
9395 9395
 		$diff = abs(strtotime($current_date) - strtotime($date));
9396 9396
 
9397
-		$time_array['years'] = floor($diff / (365*60*60*24)); 
9397
+		$time_array['years'] = floor($diff/(365*60*60*24)); 
9398 9398
 		$years = $time_array['years'];
9399 9399
 		
9400
-		$time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
9400
+		$time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24));
9401 9401
 		$months = $time_array['months'];
9402 9402
 		
9403
-		$time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
9403
+		$time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24));
9404 9404
 		$days = $time_array['days'];
9405
-		$time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60));
9405
+		$time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60));
9406 9406
 		$hours = $time_array['hours'];
9407
-		$time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60);
9407
+		$time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60);
9408 9408
 		$minutes = $time_array['minutes'];
9409
-		$time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
9409
+		$time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
9410 9410
 		
9411 9411
 		return $time_array;	
9412 9412
 	}	
@@ -9432,63 +9432,63 @@  discard block
 block discarded – undo
9432 9432
 			$temp_array['direction_degree'] = $direction;
9433 9433
 			$temp_array['direction_shortname'] = "N";
9434 9434
 			$temp_array['direction_fullname'] = "North";
9435
-		} elseif ($direction >= 22.5 && $direction < 45){
9435
+		} elseif ($direction >= 22.5 && $direction < 45) {
9436 9436
 			$temp_array['direction_degree'] = $direction;
9437 9437
 			$temp_array['direction_shortname'] = "NNE";
9438 9438
 			$temp_array['direction_fullname'] = "North-Northeast";
9439
-		} elseif ($direction >= 45 && $direction < 67.5){
9439
+		} elseif ($direction >= 45 && $direction < 67.5) {
9440 9440
 			$temp_array['direction_degree'] = $direction;
9441 9441
 			$temp_array['direction_shortname'] = "NE";
9442 9442
 			$temp_array['direction_fullname'] = "Northeast";
9443
-		} elseif ($direction >= 67.5 && $direction < 90){
9443
+		} elseif ($direction >= 67.5 && $direction < 90) {
9444 9444
 			$temp_array['direction_degree'] = $direction;
9445 9445
 			$temp_array['direction_shortname'] = "ENE";
9446 9446
 			$temp_array['direction_fullname'] = "East-Northeast";
9447
-		} elseif ($direction >= 90 && $direction < 112.5){
9447
+		} elseif ($direction >= 90 && $direction < 112.5) {
9448 9448
 			$temp_array['direction_degree'] = $direction;
9449 9449
 			$temp_array['direction_shortname'] = "E";
9450 9450
 			$temp_array['direction_fullname'] = "East";
9451
-		} elseif ($direction >= 112.5 && $direction < 135){
9451
+		} elseif ($direction >= 112.5 && $direction < 135) {
9452 9452
 			$temp_array['direction_degree'] = $direction;
9453 9453
 			$temp_array['direction_shortname'] = "ESE";
9454 9454
 			$temp_array['direction_fullname'] = "East-Southeast";
9455
-		} elseif ($direction >= 135 && $direction < 157.5){
9455
+		} elseif ($direction >= 135 && $direction < 157.5) {
9456 9456
 			$temp_array['direction_degree'] = $direction;
9457 9457
 			$temp_array['direction_shortname'] = "SE";
9458 9458
 			$temp_array['direction_fullname'] = "Southeast";
9459
-		} elseif ($direction >= 157.5 && $direction < 180){
9459
+		} elseif ($direction >= 157.5 && $direction < 180) {
9460 9460
 			$temp_array['direction_degree'] = $direction;
9461 9461
 			$temp_array['direction_shortname'] = "SSE";
9462 9462
 			$temp_array['direction_fullname'] = "South-Southeast";
9463
-		} elseif ($direction >= 180 && $direction < 202.5){
9463
+		} elseif ($direction >= 180 && $direction < 202.5) {
9464 9464
 			$temp_array['direction_degree'] = $direction;
9465 9465
 			$temp_array['direction_shortname'] = "S";
9466 9466
 			$temp_array['direction_fullname'] = "South";
9467
-		} elseif ($direction >= 202.5 && $direction < 225){
9467
+		} elseif ($direction >= 202.5 && $direction < 225) {
9468 9468
 			$temp_array['direction_degree'] = $direction;
9469 9469
 			$temp_array['direction_shortname'] = "SSW";
9470 9470
 			$temp_array['direction_fullname'] = "South-Southwest";
9471
-		} elseif ($direction >= 225 && $direction < 247.5){
9471
+		} elseif ($direction >= 225 && $direction < 247.5) {
9472 9472
 			$temp_array['direction_degree'] = $direction;
9473 9473
 			$temp_array['direction_shortname'] = "SW";
9474 9474
 			$temp_array['direction_fullname'] = "Southwest";
9475
-		} elseif ($direction >= 247.5 && $direction < 270){
9475
+		} elseif ($direction >= 247.5 && $direction < 270) {
9476 9476
 			$temp_array['direction_degree'] = $direction;
9477 9477
 			$temp_array['direction_shortname'] = "WSW";
9478 9478
 			$temp_array['direction_fullname'] = "West-Southwest";
9479
-		} elseif ($direction >= 270 && $direction < 292.5){
9479
+		} elseif ($direction >= 270 && $direction < 292.5) {
9480 9480
 			$temp_array['direction_degree'] = $direction;
9481 9481
 			$temp_array['direction_shortname'] = "W";
9482 9482
 			$temp_array['direction_fullname'] = "West";
9483
-		} elseif ($direction >= 292.5 && $direction < 315){
9483
+		} elseif ($direction >= 292.5 && $direction < 315) {
9484 9484
 			$temp_array['direction_degree'] = $direction;
9485 9485
 			$temp_array['direction_shortname'] = "WNW";
9486 9486
 			$temp_array['direction_fullname'] = "West-Northwest";
9487
-		} elseif ($direction >= 315 && $direction < 337.5){
9487
+		} elseif ($direction >= 315 && $direction < 337.5) {
9488 9488
 			$temp_array['direction_degree'] = $direction;
9489 9489
 			$temp_array['direction_shortname'] = "NW";
9490 9490
 			$temp_array['direction_fullname'] = "Northwest";
9491
-		} elseif ($direction >= 337.5 && $direction < 360){
9491
+		} elseif ($direction >= 337.5 && $direction < 360) {
9492 9492
 			$temp_array['direction_degree'] = $direction;
9493 9493
 			$temp_array['direction_shortname'] = "NNW";
9494 9494
 			$temp_array['direction_fullname'] = "North-Northwest";
@@ -9541,9 +9541,9 @@  discard block
 block discarded – undo
9541 9541
 	*/
9542 9542
 	public function getAircraftRegistrationBymodeS($aircraft_modes)
9543 9543
 	{
9544
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
9544
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
9545 9545
 	
9546
-		$query  = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1";
9546
+		$query = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1";
9547 9547
 		
9548 9548
 		$sth = $this->db->prepare($query);
9549 9549
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -9566,9 +9566,9 @@  discard block
 block discarded – undo
9566 9566
 	*/
9567 9567
 	public function getAircraftTypeBymodeS($aircraft_modes)
9568 9568
 	{
9569
-		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
9569
+		$aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING);
9570 9570
 	
9571
-		$query  = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1";
9571
+		$query = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes LIMIT 1";
9572 9572
 		
9573 9573
 		$sth = $this->db->prepare($query);
9574 9574
 		$sth->execute(array(':aircraft_modes' => $aircraft_modes));
@@ -9589,11 +9589,11 @@  discard block
 block discarded – undo
9589 9589
 	* @param Float $longitude longitute of the flight
9590 9590
 	* @return String the countrie
9591 9591
 	*/
9592
-	public function getCountryFromLatitudeLongitude($latitude,$longitude)
9592
+	public function getCountryFromLatitudeLongitude($latitude, $longitude)
9593 9593
 	{
9594 9594
 		global $globalDBdriver, $globalDebug;
9595
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
9596
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
9595
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
9596
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
9597 9597
 	
9598 9598
 		$Connection = new Connection($this->db);
9599 9599
 		if (!$Connection->tableExists('countries')) return '';
@@ -9633,19 +9633,19 @@  discard block
 block discarded – undo
9633 9633
 	*/
9634 9634
 	public function convertAircraftRegistration($registration)
9635 9635
 	{
9636
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
9636
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
9637 9637
 		$registration_prefix = '';
9638 9638
 		$registration_1 = substr($registration, 0, 1);
9639 9639
 		$registration_2 = substr($registration, 0, 2);
9640 9640
 
9641 9641
 		//first get the prefix based on two characters
9642
-		$query  = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2";
9642
+		$query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2";
9643 9643
       
9644 9644
 		
9645 9645
 		$sth = $this->db->prepare($query);
9646 9646
 		$sth->execute(array(':registration_2' => $registration_2));
9647 9647
         
9648
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9648
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9649 9649
 		{
9650 9650
 			$registration_prefix = $row['registration_prefix'];
9651 9651
 		}
@@ -9653,11 +9653,11 @@  discard block
 block discarded – undo
9653 9653
 		//if we didn't find a two chracter prefix lets just search the one with one character
9654 9654
 		if ($registration_prefix == '')
9655 9655
 		{
9656
-			$query  = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1";
9656
+			$query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1";
9657 9657
 			$sth = $this->db->prepare($query);
9658 9658
 			$sth->execute(array(':registration_1' => $registration_1));
9659 9659
 	        
9660
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
9660
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9661 9661
 			{
9662 9662
 				$registration_prefix = $row['registration_prefix'];
9663 9663
 			}
@@ -9671,7 +9671,7 @@  discard block
 block discarded – undo
9671 9671
 			} else {
9672 9672
 				$registration = preg_replace("/^(.{1})/", "$1-", $registration);
9673 9673
 			}
9674
-		} else if(strlen($registration_prefix) == 2){
9674
+		} else if (strlen($registration_prefix) == 2) {
9675 9675
 			if (0 === strpos($registration, 'N')) {
9676 9676
 				$registration = preg_replace("/^(.{2})/", "$1", $registration);
9677 9677
 			} else {
@@ -9690,17 +9690,17 @@  discard block
 block discarded – undo
9690 9690
 	*/
9691 9691
 	public function countryFromAircraftRegistration($registration)
9692 9692
 	{
9693
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
9693
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
9694 9694
 		
9695 9695
 		$registration_prefix = '';
9696
-		$registration_test = explode('-',$registration);
9696
+		$registration_test = explode('-', $registration);
9697 9697
 		$country = '';
9698 9698
 		if ($registration_test[0] != $registration) {
9699 9699
 			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
9700 9700
 	      
9701 9701
 			$sth = $this->db->prepare($query);
9702 9702
 			$sth->execute(array(':registration_1' => $registration_test[0]));
9703
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
9703
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9704 9704
 			{
9705 9705
 				//$registration_prefix = $row['registration_prefix'];
9706 9706
 				$country = $row['country'];
@@ -9711,13 +9711,13 @@  discard block
 block discarded – undo
9711 9711
 
9712 9712
 			$country = '';
9713 9713
 			//first get the prefix based on two characters
9714
-			$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
9714
+			$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1";
9715 9715
       
9716 9716
 			
9717 9717
 			$sth = $this->db->prepare($query);
9718 9718
 			$sth->execute(array(':registration_2' => $registration_2));
9719 9719
         
9720
-			while($row = $sth->fetch(PDO::FETCH_ASSOC))
9720
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9721 9721
 			{
9722 9722
 				$registration_prefix = $row['registration_prefix'];
9723 9723
 				$country = $row['country'];
@@ -9726,12 +9726,12 @@  discard block
 block discarded – undo
9726 9726
 			//if we didn't find a two chracter prefix lets just search the one with one character
9727 9727
 			if ($registration_prefix == "")
9728 9728
 			{
9729
-				$query  = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
9729
+				$query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1";
9730 9730
 	      
9731 9731
 				$sth = $this->db->prepare($query);
9732 9732
 				$sth->execute(array(':registration_1' => $registration_1));
9733 9733
 	        
9734
-				while($row = $sth->fetch(PDO::FETCH_ASSOC))
9734
+				while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9735 9735
 				{
9736 9736
 					//$registration_prefix = $row['registration_prefix'];
9737 9737
 					$country = $row['country'];
@@ -9748,9 +9748,9 @@  discard block
 block discarded – undo
9748 9748
 	* @param String $flightaware_id flightaware_id from spotter_output table
9749 9749
 	* @param String $highlight New highlight value
9750 9750
 	*/
9751
-	public function setHighlightFlight($flightaware_id,$highlight) {
9751
+	public function setHighlightFlight($flightaware_id, $highlight) {
9752 9752
 		
9753
-		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
9753
+		$query = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
9754 9754
 		$sth = $this->db->prepare($query);
9755 9755
 		$sth->execute(array(':flightaware_id' => $flightaware_id, ':highlight' => $highlight));
9756 9756
 	}
@@ -9779,7 +9779,7 @@  discard block
 block discarded – undo
9779 9779
 		
9780 9780
 		$bitly_data = json_decode($bitly_data);
9781 9781
 		$bitly_url = '';
9782
-		if ($bitly_data->status_txt = "OK"){
9782
+		if ($bitly_data->status_txt = "OK") {
9783 9783
 			$bitly_url = $bitly_data->data->url;
9784 9784
 		}
9785 9785
 
@@ -9789,7 +9789,7 @@  discard block
 block discarded – undo
9789 9789
 
9790 9790
 	public function getOrderBy()
9791 9791
 	{
9792
-		$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"));
9792
+		$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"));
9793 9793
 		
9794 9794
 		return $orderby;
9795 9795
 		
@@ -9923,14 +9923,14 @@  discard block
 block discarded – undo
9923 9923
 		}
9924 9924
 		$sth = $this->db->prepare($query);
9925 9925
 		$sth->execute();
9926
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9926
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9927 9927
 		{
9928 9928
 			$departure_airport_array = $this->getAllAirportInfo($row['fromairport_icao']);
9929 9929
 			$arrival_airport_array = $this->getAllAirportInfo($row['toairport_icao']);
9930 9930
 			if (count($departure_airport_array) > 0 && count($arrival_airport_array) > 0) {
9931
-				$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";
9931
+				$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";
9932 9932
 				$sthu = $this->db->prepare($update_query);
9933
-				$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']));
9933
+				$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']));
9934 9934
 			}
9935 9935
 		}
9936 9936
 		
@@ -9943,7 +9943,7 @@  discard block
 block discarded – undo
9943 9943
 		}
9944 9944
 		$sth = $this->db->prepare($query);
9945 9945
 		$sth->execute();
9946
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9946
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9947 9947
 		{
9948 9948
 			if (is_numeric(substr($row['ident'], -1, 1)))
9949 9949
 			{
@@ -9952,11 +9952,11 @@  discard block
 block discarded – undo
9952 9952
 				elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
9953 9953
 				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
9954 9954
 				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
9955
-				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
9955
+				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource);
9956 9956
 				if (isset($airline_array[0]['name'])) {
9957
-					$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";
9957
+					$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";
9958 9958
 					$sthu = $this->db->prepare($update_query);
9959
-					$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']));
9959
+					$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']));
9960 9960
 				}
9961 9961
 			}
9962 9962
 		}
@@ -9976,18 +9976,18 @@  discard block
 block discarded – undo
9976 9976
 		}
9977 9977
 		$sth = $this->db->prepare($query);
9978 9978
 		$sth->execute();
9979
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
9979
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
9980 9980
 		{
9981 9981
 			if ($row['aircraft_icao'] != '') {
9982 9982
 				$aircraft_name = $this->getAllAircraftInfo($row['aircraft_icao']);
9983
-				if ($row['registration'] != ""){
9983
+				if ($row['registration'] != "") {
9984 9984
 					$image_array = $Image->getSpotterImage($row['registration']);
9985 9985
 					if (!isset($image_array[0]['registration'])) {
9986 9986
 						$Image->addSpotterImage($row['registration']);
9987 9987
 					}
9988 9988
 				}
9989 9989
 				if (count($aircraft_name) > 0) {
9990
-					$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";
9990
+					$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";
9991 9991
 					$sthu = $this->db->prepare($update_query);
9992 9992
 					$sthu->execute(array(':aircraft_name' => $aircraft_name[0]['type'], ':aircraft_manufacturer' => $aircraft_name[0]['manufacturer'], ':spotter_id' => $row['spotter_id']));
9993 9993
 				}
@@ -10002,10 +10002,10 @@  discard block
 block discarded – undo
10002 10002
 		$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";
10003 10003
 		$sth = $this->db->prepare($query);
10004 10004
 		$sth->execute();
10005
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
10005
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
10006 10006
 		{
10007 10007
 			if ($row['last_latitude'] != '' && $row['last_longitude'] != '') {
10008
-				$closestAirports = $this->closestAirports($row['last_latitude'],$row['last_longitude'],$globalClosestMinDist);
10008
+				$closestAirports = $this->closestAirports($row['last_latitude'], $row['last_longitude'], $globalClosestMinDist);
10009 10009
 				$airport_icao = '';
10010 10010
 				 if (isset($closestAirports[0])) {
10011 10011
 					if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) {
@@ -10019,7 +10019,7 @@  discard block
 block discarded – undo
10019 10019
 								break;
10020 10020
 							}
10021 10021
 						}
10022
-					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) {
10022
+					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100 + 1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude'] + 5000))) {
10023 10023
 						$airport_icao = $closestAirports[0]['icao'];
10024 10024
 						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";
10025 10025
 					} else {
@@ -10030,28 +10030,28 @@  discard block
 block discarded – undo
10030 10030
 				}
10031 10031
 				if ($row['real_arrival_airport_icao'] != $airport_icao) {
10032 10032
 					if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n";
10033
-					$update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
10033
+					$update_query = "UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
10034 10034
 					$sthu = $this->db->prepare($update_query);
10035
-					$sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id']));
10035
+					$sthu->execute(array(':airport_icao' => $airport_icao, ':spotter_id' => $row['spotter_id']));
10036 10036
 				}
10037 10037
 			}
10038 10038
 		}
10039 10039
 	}
10040 10040
 	
10041
-	public function closestAirports($origLat,$origLon,$dist = 10) {
10041
+	public function closestAirports($origLat, $origLon, $dist = 10) {
10042 10042
 		global $globalDBdriver;
10043
-		$dist = number_format($dist*0.621371,2,'.',''); // convert km to mile
10043
+		$dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile
10044 10044
 /*
10045 10045
 		$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 
10046 10046
                       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)) 
10047 10047
                       having distance < $dist ORDER BY distance limit 100;";
10048 10048
 */
10049 10049
 		if ($globalDBdriver == 'mysql') {
10050
-			$query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance 
10050
+			$query = "SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance 
10051 10051
 	                      FROM airport WHERE longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
10052 10052
 	                      AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;";
10053 10053
                 } else {
10054
-			$query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2))) as distance 
10054
+			$query = "SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2))) as distance 
10055 10055
 	                      FROM airport WHERE CAST(longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
10056 10056
 	                      AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;";
10057 10057
     		}
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
 
@@ -1740,7 +1844,9 @@  discard block
 block discarded – undo
1740 1844
 		{
1741 1845
 			$highlight = $row['highlight'];
1742 1846
 		}
1743
-		if (isset($highlight)) return $highlight;
1847
+		if (isset($highlight)) {
1848
+			return $highlight;
1849
+		}
1744 1850
 	}
1745 1851
 
1746 1852
 	
@@ -1768,7 +1874,9 @@  discard block
 block discarded – undo
1768 1874
 		$sth->closeCursor();
1769 1875
 		if (count($row) > 0) {
1770 1876
 			return $row['usage'];
1771
-		} else return '';
1877
+		} else {
1878
+			return '';
1879
+		}
1772 1880
 	}
1773 1881
 
1774 1882
 	/**
@@ -1793,7 +1901,9 @@  discard block
 block discarded – undo
1793 1901
 		$sth->closeCursor();
1794 1902
 		if (count($row) > 0) {
1795 1903
 			return $row['icao'];
1796
-		} else return '';
1904
+		} else {
1905
+			return '';
1906
+		}
1797 1907
 	}
1798 1908
 
1799 1909
 	/**
@@ -1821,7 +1931,9 @@  discard block
 block discarded – undo
1821 1931
 			$airport_longitude = $row['longitude'];
1822 1932
 			$Common = new Common();
1823 1933
 			return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude);
1824
-		} else return '';
1934
+		} else {
1935
+			return '';
1936
+		}
1825 1937
 	}
1826 1938
 	
1827 1939
 	/**
@@ -1933,7 +2045,9 @@  discard block
 block discarded – undo
1933 2045
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1934 2046
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1935 2047
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1936
-		} else return array();
2048
+		} else {
2049
+			return array();
2050
+		}
1937 2051
 		if ($globalDBdriver == 'mysql') {
1938 2052
 			$query  = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'";
1939 2053
 		} else {
@@ -1968,7 +2082,9 @@  discard block
 block discarded – undo
1968 2082
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1969 2083
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1970 2084
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1971
-		} else return array();
2085
+		} else {
2086
+			return array();
2087
+		}
1972 2088
 		//$query  = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong;
1973 2089
 		$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.")";
1974 2090
 		//$query  = "SELECT waypoints.* FROM waypoints";
@@ -2003,7 +2119,9 @@  discard block
 block discarded – undo
2003 2119
 	public function getAllAirlineInfo($airline_icao, $fromsource = NULL)
2004 2120
 	{
2005 2121
 		global $globalUseRealAirlines;
2006
-		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL;
2122
+		if (isset($globalUseRealAirlines) && $globalUseRealAirlines) {
2123
+			$fromsource = NULL;
2124
+		}
2007 2125
 		$airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING));
2008 2126
 		if ($airline_icao == 'NA') {
2009 2127
 			$airline_array = array();
@@ -2053,7 +2171,9 @@  discard block
 block discarded – undo
2053 2171
 				$sth->execute(array(':fromsource' => $fromsource));
2054 2172
 				$row = $sth->fetch(PDO::FETCH_ASSOC);
2055 2173
 				$sth->closeCursor();
2056
-				if ($row['nb'] == 0) $result = $this->getAllAirlineInfo($airline_icao);
2174
+				if ($row['nb'] == 0) {
2175
+					$result = $this->getAllAirlineInfo($airline_icao);
2176
+				}
2057 2177
 			}
2058 2178
 			return $result;
2059 2179
 		}
@@ -2117,15 +2237,20 @@  discard block
 block discarded – undo
2117 2237
 				'A320-211' => 'A320',
2118 2238
 				'747-8i' => 'B748',
2119 2239
 				'A380' => 'A388');
2120
-		if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type];
2240
+		if (isset($all_aircraft[$aircraft_type])) {
2241
+			return $all_aircraft[$aircraft_type];
2242
+		}
2121 2243
 
2122 2244
 		$query  = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1";
2123 2245
 		$aircraft_type = strtoupper($aircraft_type);
2124 2246
 		$sth = $this->db->prepare($query);
2125 2247
 		$sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,));
2126 2248
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
2127
-		if (isset($result[0]['icao'])) return $result[0]['icao'];
2128
-		else return '';
2249
+		if (isset($result[0]['icao'])) {
2250
+			return $result[0]['icao'];
2251
+		} else {
2252
+			return '';
2253
+		}
2129 2254
 	}
2130 2255
 	
2131 2256
 	/**
@@ -2148,7 +2273,9 @@  discard block
 block discarded – undo
2148 2273
 		$sth->closeCursor();
2149 2274
 		if (isset($row['icaotypecode'])) {
2150 2275
 			return $row['icaotypecode'];
2151
-		} else return '';
2276
+		} else {
2277
+			return '';
2278
+		}
2152 2279
 	}
2153 2280
 
2154 2281
 	/**
@@ -2170,7 +2297,9 @@  discard block
 block discarded – undo
2170 2297
 		$sth->closeCursor();
2171 2298
 		if (isset($row['operator_correct'])) {
2172 2299
 			return $row['operator_correct'];
2173
-		} else return $operator;
2300
+		} else {
2301
+			return $operator;
2302
+		}
2174 2303
 	}
2175 2304
 
2176 2305
 	/**
@@ -2183,7 +2312,9 @@  discard block
 block discarded – undo
2183 2312
 	public function getRouteInfo($callsign)
2184 2313
 	{
2185 2314
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2186
-                if ($callsign == '') return array();
2315
+                if ($callsign == '') {
2316
+                	return array();
2317
+                }
2187 2318
 		$query  = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1";
2188 2319
 		
2189 2320
 		$sth = $this->db->prepare($query);
@@ -2193,7 +2324,9 @@  discard block
 block discarded – undo
2193 2324
 		$sth->closeCursor();
2194 2325
 		if (count($row) > 0) {
2195 2326
 			return $row;
2196
-		} else return array();
2327
+		} else {
2328
+			return array();
2329
+		}
2197 2330
 	}
2198 2331
 	
2199 2332
 	/**
@@ -2246,7 +2379,9 @@  discard block
 block discarded – undo
2246 2379
 			$result = $sth->fetch(PDO::FETCH_ASSOC);
2247 2380
 			$sth->closeCursor();
2248 2381
 			return $result;
2249
-		} else return array();
2382
+		} else {
2383
+			return array();
2384
+		}
2250 2385
 	}
2251 2386
 	
2252 2387
   
@@ -2403,8 +2538,11 @@  discard block
 block discarded – undo
2403 2538
 		$query .= " ORDER BY spotter_output.source_name ASC";
2404 2539
 
2405 2540
 		$sth = $this->db->prepare($query);
2406
-		if (!empty($query_values)) $sth->execute($query_values);
2407
-		else $sth->execute();
2541
+		if (!empty($query_values)) {
2542
+			$sth->execute($query_values);
2543
+		} else {
2544
+			$sth->execute();
2545
+		}
2408 2546
 
2409 2547
 		$source_array = array();
2410 2548
 		$temp_array = array();
@@ -2437,9 +2575,13 @@  discard block
 block discarded – undo
2437 2575
 								WHERE spotter_output.airline_icao <> '' 
2438 2576
 								ORDER BY spotter_output.airline_name ASC";
2439 2577
 			*/
2440
-			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource;
2441
-			elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim';
2442
-			elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao';
2578
+			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
2579
+				$forsource = $globalAirlinesSource;
2580
+			} elseif (isset($globalVATSIM) && $globalVATSIM) {
2581
+				$forsource = 'vatsim';
2582
+			} elseif (isset($globalIVAO) && $globalIVAO) {
2583
+				$forsource = 'ivao';
2584
+			}
2443 2585
 			if ($forsource === NULL) {
2444 2586
 				$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";
2445 2587
 				$query_data = array();
@@ -2731,7 +2873,9 @@  discard block
 block discarded – undo
2731 2873
 			date_default_timezone_set($globalTimezone);
2732 2874
 			$datetime = new DateTime();
2733 2875
 			$offset = $datetime->format('P');
2734
-		} else $offset = '+00:00';
2876
+		} else {
2877
+			$offset = '+00:00';
2878
+		}
2735 2879
 		if ($airport_icao == '') {
2736 2880
 			if ($globalDBdriver == 'mysql') {
2737 2881
 				$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";
@@ -2763,7 +2907,9 @@  discard block
 block discarded – undo
2763 2907
 			date_default_timezone_set($globalTimezone);
2764 2908
 			$datetime = new DateTime();
2765 2909
 			$offset = $datetime->format('P');
2766
-		} else $offset = '+00:00';
2910
+		} else {
2911
+			$offset = '+00:00';
2912
+		}
2767 2913
 		if ($airport_icao == '') {
2768 2914
 			if ($globalDBdriver == 'mysql') {
2769 2915
 				$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";
@@ -2796,7 +2942,9 @@  discard block
 block discarded – undo
2796 2942
 			date_default_timezone_set($globalTimezone);
2797 2943
 			$datetime = new DateTime();
2798 2944
 			$offset = $datetime->format('P');
2799
-		} else $offset = '+00:00';
2945
+		} else {
2946
+			$offset = '+00:00';
2947
+		}
2800 2948
 		if ($airport_icao == '') {
2801 2949
 			if ($globalDBdriver == 'mysql') {
2802 2950
 				$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 
@@ -2835,7 +2983,9 @@  discard block
 block discarded – undo
2835 2983
 			date_default_timezone_set($globalTimezone);
2836 2984
 			$datetime = new DateTime();
2837 2985
 			$offset = $datetime->format('P');
2838
-		} else $offset = '+00:00';
2986
+		} else {
2987
+			$offset = '+00:00';
2988
+		}
2839 2989
 		if ($airport_icao == '') {
2840 2990
 			if ($globalDBdriver == 'mysql') {
2841 2991
 				$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 
@@ -2880,7 +3030,9 @@  discard block
 block discarded – undo
2880 3030
 			date_default_timezone_set($globalTimezone);
2881 3031
 			$datetime = new DateTime();
2882 3032
 			$offset = $datetime->format('P');
2883
-		} else $offset = '+00:00';
3033
+		} else {
3034
+			$offset = '+00:00';
3035
+		}
2884 3036
 		if ($airport_icao == '') {
2885 3037
 			if ($globalDBdriver == 'mysql') {
2886 3038
 				$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";
@@ -2915,7 +3067,9 @@  discard block
 block discarded – undo
2915 3067
 			date_default_timezone_set($globalTimezone);
2916 3068
 			$datetime = new DateTime();
2917 3069
 			$offset = $datetime->format('P');
2918
-		} else $offset = '+00:00';
3070
+		} else {
3071
+			$offset = '+00:00';
3072
+		}
2919 3073
 		if ($airport_icao == '') {
2920 3074
 			if ($globalDBdriver == 'mysql') {
2921 3075
 				$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 
@@ -2957,7 +3111,9 @@  discard block
 block discarded – undo
2957 3111
 			date_default_timezone_set($globalTimezone);
2958 3112
 			$datetime = new DateTime();
2959 3113
 			$offset = $datetime->format('P');
2960
-		} else $offset = '+00:00';
3114
+		} else {
3115
+			$offset = '+00:00';
3116
+		}
2961 3117
 		if ($airport_icao == '') {
2962 3118
 			if ($globalDBdriver == 'mysql') {
2963 3119
 				$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";
@@ -2991,7 +3147,9 @@  discard block
 block discarded – undo
2991 3147
 			date_default_timezone_set($globalTimezone);
2992 3148
 			$datetime = new DateTime();
2993 3149
 			$offset = $datetime->format('P');
2994
-		} else $offset = '+00:00';
3150
+		} else {
3151
+			$offset = '+00:00';
3152
+		}
2995 3153
 		if ($airport_icao == '') {
2996 3154
 			if ($globalDBdriver == 'mysql') {
2997 3155
 				$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 
@@ -3039,7 +3197,9 @@  discard block
 block discarded – undo
3039 3197
 			date_default_timezone_set($globalTimezone);
3040 3198
 			$datetime = new DateTime();
3041 3199
 			$offset = $datetime->format('P');
3042
-		} else $offset = '+00:00';
3200
+		} else {
3201
+			$offset = '+00:00';
3202
+		}
3043 3203
 
3044 3204
 		if ($globalDBdriver == 'mysql') {
3045 3205
 			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date
@@ -3159,7 +3319,9 @@  discard block
 block discarded – undo
3159 3319
 	*/	
3160 3320
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
3161 3321
 	{
3162
-		if ($groundspeed == '') $groundspeed = NULL;
3322
+		if ($groundspeed == '') {
3323
+			$groundspeed = NULL;
3324
+		}
3163 3325
 		$query = 'UPDATE spotter_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_ground = :last_ground, last_seen = :last_seen, real_arrival_airport_icao = :real_arrival_airport_icao, real_arrival_airport_time = :real_arrival_airport_time, last_ground_speed = :last_ground_speed WHERE flightaware_id = :flightaware_id';
3164 3326
                 $query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident);
3165 3327
 
@@ -3209,10 +3371,18 @@  discard block
 block discarded – undo
3209 3371
 		$Image = new Image($this->db);
3210 3372
 		$Common = new Common();
3211 3373
 		
3212
-		if (!isset($globalIVAO)) $globalIVAO = FALSE;
3213
-		if (!isset($globalVATSIM)) $globalVATSIM = FALSE;
3214
-		if (!isset($globalphpVMS)) $globalphpVMS = FALSE;
3215
-		if (!isset($globalVAM)) $globalVAM = FALSE;
3374
+		if (!isset($globalIVAO)) {
3375
+			$globalIVAO = FALSE;
3376
+		}
3377
+		if (!isset($globalVATSIM)) {
3378
+			$globalVATSIM = FALSE;
3379
+		}
3380
+		if (!isset($globalphpVMS)) {
3381
+			$globalphpVMS = FALSE;
3382
+		}
3383
+		if (!isset($globalVAM)) {
3384
+			$globalVAM = FALSE;
3385
+		}
3216 3386
 		date_default_timezone_set('UTC');
3217 3387
 		
3218 3388
 		//getting the registration
@@ -3225,23 +3395,33 @@  discard block
 block discarded – undo
3225 3395
 				if ($ModeS != '') {
3226 3396
 					$timeelapsed = microtime(true);
3227 3397
 					$registration = $this->getAircraftRegistrationBymodeS($ModeS);
3228
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3398
+					if ($globalDebugTimeElapsed) {
3399
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3400
+					}
3229 3401
 				} else {
3230 3402
 					$myhex = explode('-',$flightaware_id);
3231 3403
 					if (count($myhex) > 0) {
3232 3404
 						$timeelapsed = microtime(true);
3233 3405
 						$registration = $this->getAircraftRegistrationBymodeS($myhex[0]);
3234
-						if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3406
+						if ($globalDebugTimeElapsed) {
3407
+							echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3408
+						}
3235 3409
 					}
3236 3410
 				}
3237 3411
 			}
3238 3412
 		}
3239 3413
 		$fromsource = NULL;
3240
-		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
3241
-		elseif ($format_source == 'vatsimtxt') $fromsource = 'vatsim';
3242
-		elseif ($format_source == 'whazzup') $fromsource = 'ivao';
3243
-		elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
3244
-		elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
3414
+		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
3415
+			$fromsource = $globalAirlinesSource;
3416
+		} elseif ($format_source == 'vatsimtxt') {
3417
+			$fromsource = 'vatsim';
3418
+		} elseif ($format_source == 'whazzup') {
3419
+			$fromsource = 'ivao';
3420
+		} elseif (isset($globalVATSIM) && $globalVATSIM) {
3421
+			$fromsource = 'vatsim';
3422
+		} elseif (isset($globalIVAO) && $globalIVAO) {
3423
+			$fromsource = 'ivao';
3424
+		}
3245 3425
 		//getting the airline information
3246 3426
 		if ($ident != "")
3247 3427
 		{
@@ -3265,15 +3445,21 @@  discard block
 block discarded – undo
3265 3445
 					if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){
3266 3446
 						$airline_array = $this->getAllAirlineInfo("NA");
3267 3447
 					}
3268
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3448
+					if ($globalDebugTimeElapsed) {
3449
+						echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3450
+					}
3269 3451
 
3270 3452
 				} else {
3271 3453
 					$timeelapsed = microtime(true);
3272 3454
 					$airline_array = $this->getAllAirlineInfo("NA");
3273
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3455
+					if ($globalDebugTimeElapsed) {
3456
+						echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3457
+					}
3274 3458
 				}
3275 3459
 			}
3276
-		} else $airline_array = array();
3460
+		} else {
3461
+			$airline_array = array();
3462
+		}
3277 3463
 		
3278 3464
 		//getting the aircraft information
3279 3465
 		$aircraft_array = array();
@@ -3287,27 +3473,37 @@  discard block
 block discarded – undo
3287 3473
 				{
3288 3474
 					$timeelapsed = microtime(true);
3289 3475
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3290
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3476
+					if ($globalDebugTimeElapsed) {
3477
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3478
+					}
3291 3479
 				} else {
3292 3480
 					$timeelapsed = microtime(true);
3293 3481
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3294
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3482
+					if ($globalDebugTimeElapsed) {
3483
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3484
+					}
3295 3485
 				}
3296 3486
 			}
3297 3487
 		} else {
3298 3488
 			if ($ModeS != '') {
3299 3489
 				$timeelapsed = microtime(true);
3300 3490
 				$aircraft_icao = $this->getAllAircraftType($ModeS);
3301
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3491
+				if ($globalDebugTimeElapsed) {
3492
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3493
+				}
3302 3494
 				if ($aircraft_icao == "" || $aircraft_icao == "XXXX")
3303 3495
 				{
3304 3496
 					$timeelapsed = microtime(true);
3305 3497
 					$aircraft_array = $this->getAllAircraftInfo("NA");
3306
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3498
+					if ($globalDebugTimeElapsed) {
3499
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3500
+					}
3307 3501
 				} else {
3308 3502
 					$timeelapsed = microtime(true);
3309 3503
 					$aircraft_array = $this->getAllAircraftInfo($aircraft_icao);
3310
-					if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3504
+					if ($globalDebugTimeElapsed) {
3505
+						echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3506
+					}
3311 3507
 				}
3312 3508
 			}
3313 3509
 		}
@@ -3322,7 +3518,9 @@  discard block
 block discarded – undo
3322 3518
 			} else {
3323 3519
 				$timeelapsed = microtime(true);
3324 3520
 				$departure_airport_array = $this->getAllAirportInfo($departure_airport_icao);
3325
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3521
+				if ($globalDebugTimeElapsed) {
3522
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3523
+				}
3326 3524
 			}
3327 3525
 		}
3328 3526
 		
@@ -3336,7 +3534,9 @@  discard block
 block discarded – undo
3336 3534
 			} else {
3337 3535
 				$timeelapsed = microtime(true);
3338 3536
 				$arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao);
3339
-				if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3537
+				if ($globalDebugTimeElapsed) {
3538
+					echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3539
+				}
3340 3540
 			}
3341 3541
 		}
3342 3542
 
@@ -3371,7 +3571,9 @@  discard block
 block discarded – undo
3371 3571
 			{
3372 3572
 				return false;
3373 3573
 			}
3374
-		} else $altitude = 0;
3574
+		} else {
3575
+			$altitude = 0;
3576
+		}
3375 3577
 		
3376 3578
 		if ($heading != "")
3377 3579
 		{
@@ -3400,7 +3602,9 @@  discard block
 block discarded – undo
3400 3602
 		{
3401 3603
 			$timeelapsed = microtime(true);
3402 3604
 			$image_array = $Image->getSpotterImage($registration);
3403
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3605
+			if ($globalDebugTimeElapsed) {
3606
+				echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3607
+			}
3404 3608
 			if (!isset($image_array[0]['registration']))
3405 3609
 			{
3406 3610
 				//echo "Add image !!!! \n";
@@ -3408,14 +3612,21 @@  discard block
 block discarded – undo
3408 3612
 			}
3409 3613
 			$timeelapsed = microtime(true);
3410 3614
 			$owner_info = $this->getAircraftOwnerByRegistration($registration);
3411
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3412
-			if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner']));
3615
+			if ($globalDebugTimeElapsed) {
3616
+				echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3617
+			}
3618
+			if ($owner_info['owner'] != '') {
3619
+				$aircraft_owner = ucwords(strtolower($owner_info['owner']));
3620
+			}
3413 3621
 		}
3414 3622
     
3415 3623
 		if ($globalIVAO && $aircraft_icao != '')
3416 3624
 		{
3417
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3418
-            		else $airline_icao = '';
3625
+            		if (isset($airline_array[0]['icao'])) {
3626
+            			$airline_icao = $airline_array[0]['icao'];
3627
+            		} else {
3628
+            			$airline_icao = '';
3629
+            		}
3419 3630
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3420 3631
 			if (!isset($image_array[0]['registration']))
3421 3632
 			{
@@ -3460,16 +3671,28 @@  discard block
 block discarded – undo
3460 3671
                 {
3461 3672
                         $arrival_airport_array = $this->getAllAirportInfo('NA');
3462 3673
                 }
3463
-                if ($registration == '') $registration = 'NA';
3674
+                if ($registration == '') {
3675
+                	$registration = 'NA';
3676
+                }
3464 3677
                 if ($latitude == '' && $longitude == '') {
3465 3678
             		$latitude = 0;
3466 3679
             		$longitude = 0;
3467 3680
             	}
3468
-                if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
3469
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
3470
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
3471
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
3472
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3681
+                if ($squawk == '' || $Common->isInteger($squawk) === false) {
3682
+                	$squawk = NULL;
3683
+                }
3684
+                if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) {
3685
+                	$verticalrate = NULL;
3686
+                }
3687
+                if ($heading == '' || $Common->isInteger($heading) === false) {
3688
+                	$heading = 0;
3689
+                }
3690
+                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) {
3691
+                	$groundspeed = 0;
3692
+                }
3693
+                if (!isset($aircraft_owner)) {
3694
+                	$aircraft_owner = NULL;
3695
+                }
3473 3696
                 $query  = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) 
3474 3697
                 VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name,:departure_airport_city,:departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date, :departure_airport_time, :arrival_airport_time, :squawk, :route_stop, :highlight, :ModeS, :pilot_id, :pilot_name, :verticalrate, :owner_name,:ground, :format_source, :source_name)";
3475 3698
 
@@ -3480,9 +3703,13 @@  discard block
 block discarded – undo
3480 3703
 		if ($airline_type == '') {
3481 3704
 			$timeelapsed = microtime(true);
3482 3705
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3483
-			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3706
+			if ($globalDebugTimeElapsed) {
3707
+				echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3708
+			}
3709
+		}
3710
+		if ($airline_type == null) {
3711
+			$airline_type = '';
3484 3712
 		}
3485
-		if ($airline_type == null) $airline_type = '';
3486 3713
                 $aircraft_type = $aircraft_array[0]['type'];
3487 3714
                 $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3488 3715
                 $departure_airport_name = $departure_airport_array[0]['name'];
@@ -3617,7 +3844,9 @@  discard block
 block discarded – undo
3617 3844
 			}
3618 3845
 		}
3619 3846
 		$query .= "GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC";
3620
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
3847
+		if ($limit) {
3848
+			$query .= " LIMIT 10 OFFSET 0";
3849
+		}
3621 3850
 		
3622 3851
 		$sth = $this->db->prepare($query);
3623 3852
 		$sth->execute();
@@ -3662,7 +3891,9 @@  discard block
 block discarded – undo
3662 3891
 			}
3663 3892
 		}
3664 3893
 		$query .= "GROUP BY spotter_output.pilot_id,spotter_output.pilot_name ORDER BY pilot_count DESC";
3665
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
3894
+		if ($limit) {
3895
+			$query .= " LIMIT 10 OFFSET 0";
3896
+		}
3666 3897
       
3667 3898
 		
3668 3899
 		$sth = $this->db->prepare($query);
@@ -3707,7 +3938,9 @@  discard block
 block discarded – undo
3707 3938
 			}
3708 3939
 		}
3709 3940
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.pilot_id,spotter_output.pilot_name ORDER BY pilot_count DESC";
3710
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
3941
+		if ($limit) {
3942
+			$query .= " LIMIT 10 OFFSET 0";
3943
+		}
3711 3944
       
3712 3945
 		
3713 3946
 		$sth = $this->db->prepare($query);
@@ -3754,7 +3987,9 @@  discard block
 block discarded – undo
3754 3987
 			}
3755 3988
 		}
3756 3989
 		$query .= "GROUP BY spotter_output.owner_name ORDER BY owner_count DESC";
3757
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
3990
+		if ($limit) {
3991
+			$query .= " LIMIT 10 OFFSET 0";
3992
+		}
3758 3993
       
3759 3994
 		
3760 3995
 		$sth = $this->db->prepare($query);
@@ -3799,7 +4034,9 @@  discard block
 block discarded – undo
3799 4034
 			}
3800 4035
 		}
3801 4036
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.owner_name ORDER BY owner_count DESC";
3802
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4037
+		if ($limit) {
4038
+			$query .= " LIMIT 10 OFFSET 0";
4039
+		}
3803 4040
       
3804 4041
 		
3805 4042
 		$sth = $this->db->prepare($query);
@@ -4042,7 +4279,9 @@  discard block
 block discarded – undo
4042 4279
 			date_default_timezone_set($globalTimezone);
4043 4280
 			$datetime = new DateTime($date);
4044 4281
 			$offset = $datetime->format('P');
4045
-		} else $offset = '+00:00';
4282
+		} else {
4283
+			$offset = '+00:00';
4284
+		}
4046 4285
 
4047 4286
 		if ($globalDBdriver == 'mysql') {
4048 4287
 			$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
@@ -4090,7 +4329,9 @@  discard block
 block discarded – undo
4090 4329
 			date_default_timezone_set($globalTimezone);
4091 4330
 			$datetime = new DateTime($date);
4092 4331
 			$offset = $datetime->format('P');
4093
-		} else $offset = '+00:00';
4332
+		} else {
4333
+			$offset = '+00:00';
4334
+		}
4094 4335
 		
4095 4336
 		if ($globalDBdriver == 'mysql') {
4096 4337
 			$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
@@ -4308,7 +4549,9 @@  discard block
 block discarded – undo
4308 4549
 		 			FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA' 
4309 4550
 					GROUP BY spotter_output.airline_country
4310 4551
 					ORDER BY airline_country_count DESC";
4311
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4552
+		if ($limit) {
4553
+			$query .= " LIMIT 10 OFFSET 0";
4554
+		}
4312 4555
       
4313 4556
 		$sth = $this->db->prepare($query);
4314 4557
 		$sth->execute();
@@ -4336,7 +4579,9 @@  discard block
 block discarded – undo
4336 4579
 		global $globalDBdriver;
4337 4580
 		//$filter_query = $this->getFilter($filters,true,true);
4338 4581
 		$Connection= new Connection($this->db);
4339
-		if (!$Connection->tableExists('countries')) return array();
4582
+		if (!$Connection->tableExists('countries')) {
4583
+			return array();
4584
+		}
4340 4585
 		/*
4341 4586
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
4342 4587
 					FROM countries c, spotter_output s
@@ -4361,7 +4606,9 @@  discard block
 block discarded – undo
4361 4606
 		}
4362 4607
 
4363 4608
 		$query .= "GROUP BY c.name ORDER BY nb DESC";
4364
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4609
+		if ($limit) {
4610
+			$query .= " LIMIT 10 OFFSET 0";
4611
+		}
4365 4612
       
4366 4613
 		
4367 4614
 		$sth = $this->db->prepare($query);
@@ -4411,7 +4658,9 @@  discard block
 block discarded – undo
4411 4658
 		}
4412 4659
 
4413 4660
 		$query .= " GROUP BY spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC";
4414
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4661
+		if ($limit) {
4662
+			$query .= " LIMIT 10 OFFSET 0";
4663
+		}
4415 4664
  
4416 4665
 		$sth = $this->db->prepare($query);
4417 4666
 		$sth->execute();
@@ -4457,7 +4706,9 @@  discard block
 block discarded – undo
4457 4706
 		}
4458 4707
 
4459 4708
 		$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";
4460
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4709
+		if ($limit) {
4710
+			$query .= " LIMIT 10 OFFSET 0";
4711
+		}
4461 4712
  
4462 4713
 		$sth = $this->db->prepare($query);
4463 4714
 		$sth->execute();
@@ -4510,7 +4761,9 @@  discard block
 block discarded – undo
4510 4761
 			if($row['registration'] != "")
4511 4762
 			{
4512 4763
 				$image_array = $Image->getSpotterImage($row['registration']);
4513
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4764
+				if (isset($image_array[0]['image_thumbnail'])) {
4765
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4766
+				}
4514 4767
 			}
4515 4768
 			$temp_array['registration_count'] = $row['registration_count'];
4516 4769
 
@@ -4585,7 +4838,9 @@  discard block
 block discarded – undo
4585 4838
 			if($row['registration'] != "")
4586 4839
 			{
4587 4840
 				$image_array = $Image->getSpotterImage($row['registration']);
4588
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4841
+				if (isset($image_array[0]['image_thumbnail'])) {
4842
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4843
+				}
4589 4844
 			}
4590 4845
 			$temp_array['registration_count'] = $row['registration_count'];
4591 4846
 
@@ -4692,7 +4947,9 @@  discard block
 block discarded – undo
4692 4947
 			if($row['registration'] != "")
4693 4948
 			{
4694 4949
 				$image_array = $Image->getSpotterImage($row['registration']);
4695
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4950
+				if (isset($image_array[0]['image_thumbnail'])) {
4951
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4952
+				}
4696 4953
 			}
4697 4954
 			$temp_array['registration_count'] = $row['registration_count'];
4698 4955
 			$aircraft_array[] = $temp_array;
@@ -4817,7 +5074,9 @@  discard block
 block discarded – undo
4817 5074
 			date_default_timezone_set($globalTimezone);
4818 5075
 			$datetime = new DateTime($date);
4819 5076
 			$offset = $datetime->format('P');
4820
-		} else $offset = '+00:00';
5077
+		} else {
5078
+			$offset = '+00:00';
5079
+		}
4821 5080
 
4822 5081
 		if ($globalDBdriver == 'mysql') {
4823 5082
 			$query  = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
@@ -4864,7 +5123,9 @@  discard block
 block discarded – undo
4864 5123
 			date_default_timezone_set($globalTimezone);
4865 5124
 			$datetime = new DateTime($date);
4866 5125
 			$offset = $datetime->format('P');
4867
-		} else $offset = '+00:00';
5126
+		} else {
5127
+			$offset = '+00:00';
5128
+		}
4868 5129
 
4869 5130
 		if ($globalDBdriver == 'mysql') {
4870 5131
 			$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 
@@ -4893,7 +5154,9 @@  discard block
 block discarded – undo
4893 5154
 			if($row['registration'] != "")
4894 5155
 			{
4895 5156
 				$image_array = $Image->getSpotterImage($row['registration']);
4896
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5157
+				if (isset($image_array[0]['image_thumbnail'])) {
5158
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5159
+				}
4897 5160
 			}
4898 5161
 			$temp_array['registration_count'] = $row['registration_count'];
4899 5162
  
@@ -4918,7 +5181,9 @@  discard block
 block discarded – undo
4918 5181
 			date_default_timezone_set($globalTimezone);
4919 5182
 			$datetime = new DateTime($date);
4920 5183
 			$offset = $datetime->format('P');
4921
-		} else $offset = '+00:00';
5184
+		} else {
5185
+			$offset = '+00:00';
5186
+		}
4922 5187
 
4923 5188
 		if ($globalDBdriver == 'mysql') {
4924 5189
 			$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
@@ -5016,8 +5281,11 @@  discard block
 block discarded – undo
5016 5281
 			if($row['registration'] != "")
5017 5282
 			{
5018 5283
 				$image_array = $Image->getSpotterImage($row['registration']);
5019
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5020
-				else $temp_array['image_thumbnail'] = '';
5284
+				if (isset($image_array[0]['image_thumbnail'])) {
5285
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5286
+				} else {
5287
+					$temp_array['image_thumbnail'] = '';
5288
+				}
5021 5289
 			}
5022 5290
 			$temp_array['registration_count'] = $row['registration_count'];
5023 5291
 			$aircraft_array[] = $temp_array;
@@ -5124,7 +5392,9 @@  discard block
 block discarded – undo
5124 5392
 			if($row['registration'] != "")
5125 5393
 			{
5126 5394
 				$image_array = $Image->getSpotterImage($row['registration']);
5127
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5395
+				if (isset($image_array[0]['image_thumbnail'])) {
5396
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5397
+				}
5128 5398
 			}
5129 5399
 			$temp_array['registration_count'] = $row['registration_count'];
5130 5400
           
@@ -5241,7 +5511,9 @@  discard block
 block discarded – undo
5241 5511
 			if($row['registration'] != "")
5242 5512
 			{
5243 5513
 				$image_array = $Image->getSpotterImage($row['registration']);
5244
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5514
+				if (isset($image_array[0]['image_thumbnail'])) {
5515
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5516
+				}
5245 5517
 			}
5246 5518
 			$temp_array['registration_count'] = $row['registration_count'];
5247 5519
           
@@ -5353,7 +5625,9 @@  discard block
 block discarded – undo
5353 5625
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5354 5626
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5355 5627
                 $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5356
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5628
+		if ($limit) {
5629
+			$query .= " LIMIT 10 OFFSET 0";
5630
+		}
5357 5631
 		
5358 5632
 		$sth = $this->db->prepare($query);
5359 5633
 		$sth->execute();
@@ -5372,7 +5646,9 @@  discard block
 block discarded – undo
5372 5646
 			if($row['registration'] != "")
5373 5647
 			{
5374 5648
 				$image_array = $Image->getSpotterImage($row['registration']);
5375
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5649
+				if (isset($image_array[0]['image_thumbnail'])) {
5650
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5651
+				}
5376 5652
 			}
5377 5653
           
5378 5654
 			$aircraft_array[] = $temp_array;
@@ -5413,7 +5689,9 @@  discard block
 block discarded – undo
5413 5689
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5414 5690
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5415 5691
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
5416
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5692
+		if ($limit) {
5693
+			$query .= " LIMIT 10 OFFSET 0";
5694
+		}
5417 5695
 		
5418 5696
 		$sth = $this->db->prepare($query);
5419 5697
 		$sth->execute();
@@ -5433,7 +5711,9 @@  discard block
 block discarded – undo
5433 5711
 			if($row['registration'] != "")
5434 5712
 			{
5435 5713
 				$image_array = $Image->getSpotterImage($row['registration']);
5436
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5714
+				if (isset($image_array[0]['image_thumbnail'])) {
5715
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
5716
+				}
5437 5717
 			}
5438 5718
           
5439 5719
 			$aircraft_array[] = $temp_array;
@@ -5474,7 +5754,9 @@  discard block
 block discarded – undo
5474 5754
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5475 5755
                 $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5476 5756
 				ORDER BY airport_departure_icao_count DESC";
5477
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5757
+		if ($limit) {
5758
+			$query .= " LIMIT 10 OFFSET 0";
5759
+		}
5478 5760
       
5479 5761
 		$sth = $this->db->prepare($query);
5480 5762
 		$sth->execute();
@@ -5526,7 +5808,9 @@  discard block
 block discarded – undo
5526 5808
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5527 5809
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5528 5810
 				ORDER BY airport_departure_icao_count DESC";
5529
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5811
+		if ($limit) {
5812
+			$query .= " LIMIT 10 OFFSET 0";
5813
+		}
5530 5814
       
5531 5815
 		$sth = $this->db->prepare($query);
5532 5816
 		$sth->execute();
@@ -5578,7 +5862,9 @@  discard block
 block discarded – undo
5578 5862
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5579 5863
                 $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5580 5864
 				ORDER BY airport_departure_icao_count DESC";
5581
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5865
+		if ($limit) {
5866
+			$query .= " LIMIT 10 OFFSET 0";
5867
+		}
5582 5868
     		//echo $query;
5583 5869
 		$sth = $this->db->prepare($query);
5584 5870
 		$sth->execute();
@@ -5630,7 +5916,9 @@  discard block
 block discarded – undo
5630 5916
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5631 5917
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5632 5918
 				ORDER BY airport_departure_icao_count DESC";
5633
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5919
+		if ($limit) {
5920
+			$query .= " LIMIT 10 OFFSET 0";
5921
+		}
5634 5922
       
5635 5923
 		$sth = $this->db->prepare($query);
5636 5924
 		$sth->execute();
@@ -6025,7 +6313,9 @@  discard block
 block discarded – undo
6025 6313
 			date_default_timezone_set($globalTimezone);
6026 6314
 			$datetime = new DateTime($date);
6027 6315
 			$offset = $datetime->format('P');
6028
-		} else $offset = '+00:00';
6316
+		} else {
6317
+			$offset = '+00:00';
6318
+		}
6029 6319
 
6030 6320
 		if ($globalDBdriver == 'mysql') {
6031 6321
 			$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 
@@ -6075,7 +6365,9 @@  discard block
 block discarded – undo
6075 6365
 			date_default_timezone_set($globalTimezone);
6076 6366
 			$datetime = new DateTime($date);
6077 6367
 			$offset = $datetime->format('P');
6078
-		} else $offset = '+00:00';
6368
+		} else {
6369
+			$offset = '+00:00';
6370
+		}
6079 6371
 
6080 6372
 		if ($globalDBdriver == 'mysql') {
6081 6373
 			$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
@@ -6288,7 +6580,9 @@  discard block
 block discarded – undo
6288 6580
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6289 6581
                 $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6290 6582
 					ORDER BY airport_arrival_icao_count DESC";
6291
-		if ($limit) $query .= " LIMIT 10";
6583
+		if ($limit) {
6584
+			$query .= " LIMIT 10";
6585
+		}
6292 6586
       
6293 6587
 		
6294 6588
 		$sth = $this->db->prepare($query);
@@ -6308,7 +6602,9 @@  discard block
 block discarded – undo
6308 6602
 			if ($icaoaskey) {
6309 6603
 				$icao = $row['arrival_airport_icao'];
6310 6604
 				$airport_array[$icao] = $temp_array;
6311
-			} else $airport_array[] = $temp_array;
6605
+			} else {
6606
+				$airport_array[] = $temp_array;
6607
+			}
6312 6608
 		}
6313 6609
 
6314 6610
 		return $airport_array;
@@ -6350,7 +6646,9 @@  discard block
 block discarded – undo
6350 6646
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6351 6647
                 $query .= "GROUP BY spotter_output.airline_icao,spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
6352 6648
 					ORDER BY airport_arrival_icao_count DESC";
6353
-		if ($limit) $query .= " LIMIT 10";
6649
+		if ($limit) {
6650
+			$query .= " LIMIT 10";
6651
+		}
6354 6652
       
6355 6653
 		
6356 6654
 		$sth = $this->db->prepare($query);
@@ -6371,7 +6669,9 @@  discard block
 block discarded – undo
6371 6669
 			if ($icaoaskey) {
6372 6670
 				$icao = $row['arrival_airport_icao'];
6373 6671
 				$airport_array[$icao] = $temp_array;
6374
-			} else $airport_array[] = $temp_array;
6672
+			} else {
6673
+				$airport_array[] = $temp_array;
6674
+			}
6375 6675
 		}
6376 6676
 
6377 6677
 		return $airport_array;
@@ -6413,7 +6713,9 @@  discard block
 block discarded – undo
6413 6713
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6414 6714
                 $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6415 6715
 					ORDER BY airport_arrival_icao_count DESC";
6416
-		if ($limit) $query .= " LIMIT 10";
6716
+		if ($limit) {
6717
+			$query .= " LIMIT 10";
6718
+		}
6417 6719
       
6418 6720
 		
6419 6721
 		$sth = $this->db->prepare($query);
@@ -6433,7 +6735,9 @@  discard block
 block discarded – undo
6433 6735
 			if ($icaoaskey) {
6434 6736
 				$icao = $row['arrival_airport_icao'];
6435 6737
 				$airport_array[$icao] = $temp_array;
6436
-			} else $airport_array[] = $temp_array;
6738
+			} else {
6739
+				$airport_array[] = $temp_array;
6740
+			}
6437 6741
 		}
6438 6742
 
6439 6743
 		return $airport_array;
@@ -6475,7 +6779,9 @@  discard block
 block discarded – undo
6475 6779
                 //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
6476 6780
                 $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
6477 6781
 					ORDER BY airport_arrival_icao_count DESC";
6478
-		if ($limit) $query .= " LIMIT 10";
6782
+		if ($limit) {
6783
+			$query .= " LIMIT 10";
6784
+		}
6479 6785
       
6480 6786
 		
6481 6787
 		$sth = $this->db->prepare($query);
@@ -6496,7 +6802,9 @@  discard block
 block discarded – undo
6496 6802
 			if ($icaoaskey) {
6497 6803
 				$icao = $row['arrival_airport_icao'];
6498 6804
 				$airport_array[$icao] = $temp_array;
6499
-			} else $airport_array[] = $temp_array;
6805
+			} else {
6806
+				$airport_array[] = $temp_array;
6807
+			}
6500 6808
 		}
6501 6809
 
6502 6810
 		return $airport_array;
@@ -6877,7 +7185,9 @@  discard block
 block discarded – undo
6877 7185
 			date_default_timezone_set($globalTimezone);
6878 7186
 			$datetime = new DateTime($date);
6879 7187
 			$offset = $datetime->format('P');
6880
-		} else $offset = '+00:00';
7188
+		} else {
7189
+			$offset = '+00:00';
7190
+		}
6881 7191
 
6882 7192
 		if ($globalDBdriver == 'mysql') {
6883 7193
 			$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 
@@ -6927,7 +7237,9 @@  discard block
 block discarded – undo
6927 7237
 			date_default_timezone_set($globalTimezone);
6928 7238
 			$datetime = new DateTime($date);
6929 7239
 			$offset = $datetime->format('P');
6930
-		} else $offset = '+00:00';
7240
+		} else {
7241
+			$offset = '+00:00';
7242
+		}
6931 7243
 
6932 7244
 		if ($globalDBdriver == 'mysql') {
6933 7245
 			$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
@@ -7150,7 +7462,9 @@  discard block
 block discarded – undo
7150 7462
 			FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA'";
7151 7463
 		$query .= " GROUP BY spotter_output.arrival_airport_country
7152 7464
 					ORDER BY airport_arrival_country_count DESC";
7153
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
7465
+		if ($limit) {
7466
+			$query .= " LIMIT 10 OFFSET 0";
7467
+		}
7154 7468
       
7155 7469
 		
7156 7470
 		$sth = $this->db->prepare($query);
@@ -7437,7 +7751,9 @@  discard block
 block discarded – undo
7437 7751
 			date_default_timezone_set($globalTimezone);
7438 7752
 			$datetime = new DateTime($date);
7439 7753
 			$offset = $datetime->format('P');
7440
-		} else $offset = '+00:00';
7754
+		} else {
7755
+			$offset = '+00:00';
7756
+		}
7441 7757
 		
7442 7758
 		if ($globalDBdriver == 'mysql') {
7443 7759
 			$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
@@ -7613,15 +7929,23 @@  discard block
 block discarded – undo
7613 7929
 		$query  = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao  
7614 7930
                     FROM spotter_output".$filter_query." spotter_output.ident <> '' ";
7615 7931
 		 if ($olderthanmonths > 0) {
7616
-			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
7617
-			else $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
7932
+			if ($globalDBdriver == 'mysql') {
7933
+				$query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
7934
+			} else {
7935
+				$query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
7936
+			}
7618 7937
 		}
7619 7938
 		if ($sincedate != '') {
7620
-			if ($globalDBdriver == 'mysql') $query .= " AND spotter_output.date > '".$sincedate."'";
7621
-			else $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
7939
+			if ($globalDBdriver == 'mysql') {
7940
+				$query .= " AND spotter_output.date > '".$sincedate."'";
7941
+			} else {
7942
+				$query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
7943
+			}
7622 7944
 		}
7623 7945
 		$query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
7624
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
7946
+		if ($limit) {
7947
+			$query .= " LIMIT 10 OFFSET 0";
7948
+		}
7625 7949
       		
7626 7950
 		$sth = $this->db->prepare($query);
7627 7951
 		$sth->execute();
@@ -7655,15 +7979,23 @@  discard block
 block discarded – undo
7655 7979
 		$query  = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name  
7656 7980
                     FROM spotter_output".$filter_query." spotter_output.ident <> ''  AND spotter_output.airline_icao <> '' ";
7657 7981
 		 if ($olderthanmonths > 0) {
7658
-			if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7659
-			else $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
7982
+			if ($globalDBdriver == 'mysql') {
7983
+				$query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
7984
+			} else {
7985
+				$query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
7986
+			}
7660 7987
 		}
7661 7988
 		if ($sincedate != '') {
7662
-			if ($globalDBdriver == 'mysql') $query .= "AND spotter_output.date > '".$sincedate."' ";
7663
-			else $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
7989
+			if ($globalDBdriver == 'mysql') {
7990
+				$query .= "AND spotter_output.date > '".$sincedate."' ";
7991
+			} else {
7992
+				$query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) ";
7993
+			}
7664 7994
 		}
7665 7995
 		$query .= "GROUP BY spotter_output.airline_icao, spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC";
7666
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
7996
+		if ($limit) {
7997
+			$query .= " LIMIT 10 OFFSET 0";
7998
+		}
7667 7999
       		
7668 8000
 		$sth = $this->db->prepare($query);
7669 8001
 		$sth->execute();
@@ -7700,7 +8032,9 @@  discard block
 block discarded – undo
7700 8032
 			date_default_timezone_set($globalTimezone);
7701 8033
 			$datetime = new DateTime();
7702 8034
 			$offset = $datetime->format('P');
7703
-		} else $offset = '+00:00';
8035
+		} else {
8036
+			$offset = '+00:00';
8037
+		}
7704 8038
 
7705 8039
 		if ($globalDBdriver == 'mysql') {
7706 8040
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7749,7 +8083,9 @@  discard block
 block discarded – undo
7749 8083
 			date_default_timezone_set($globalTimezone);
7750 8084
 			$datetime = new DateTime();
7751 8085
 			$offset = $datetime->format('P');
7752
-		} else $offset = '+00:00';
8086
+		} else {
8087
+			$offset = '+00:00';
8088
+		}
7753 8089
 		$filter_query = $this->getFilter($filters,true,true);
7754 8090
 		if ($globalDBdriver == 'mysql') {
7755 8091
 			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7798,7 +8134,9 @@  discard block
 block discarded – undo
7798 8134
 			date_default_timezone_set($globalTimezone);
7799 8135
 			$datetime = new DateTime();
7800 8136
 			$offset = $datetime->format('P');
7801
-		} else $offset = '+00:00';
8137
+		} else {
8138
+			$offset = '+00:00';
8139
+		}
7802 8140
 		$filter_query = $this->getFilter($filters,true,true);
7803 8141
 		if ($globalDBdriver == 'mysql') {
7804 8142
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7844,7 +8182,9 @@  discard block
 block discarded – undo
7844 8182
 			date_default_timezone_set($globalTimezone);
7845 8183
 			$datetime = new DateTime();
7846 8184
 			$offset = $datetime->format('P');
7847
-		} else $offset = '+00:00';
8185
+		} else {
8186
+			$offset = '+00:00';
8187
+		}
7848 8188
 		$filter_query = $this->getFilter($filters,true,true);
7849 8189
 		if ($globalDBdriver == 'mysql') {
7850 8190
 			$query  = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7892,7 +8232,9 @@  discard block
 block discarded – undo
7892 8232
 			date_default_timezone_set($globalTimezone);
7893 8233
 			$datetime = new DateTime();
7894 8234
 			$offset = $datetime->format('P');
7895
-		} else $offset = '+00:00';
8235
+		} else {
8236
+			$offset = '+00:00';
8237
+		}
7896 8238
 		
7897 8239
 		if ($globalDBdriver == 'mysql') {
7898 8240
 			$query  = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -7940,7 +8282,9 @@  discard block
 block discarded – undo
7940 8282
 			date_default_timezone_set($globalTimezone);
7941 8283
 			$datetime = new DateTime();
7942 8284
 			$offset = $datetime->format('P');
7943
-		} else $offset = '+00:00';
8285
+		} else {
8286
+			$offset = '+00:00';
8287
+		}
7944 8288
 
7945 8289
 		if ($globalDBdriver == 'mysql') {
7946 8290
 			$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
@@ -7987,7 +8331,9 @@  discard block
 block discarded – undo
7987 8331
 			date_default_timezone_set($globalTimezone);
7988 8332
 			$datetime = new DateTime();
7989 8333
 			$offset = $datetime->format('P');
7990
-		} else $offset = '+00:00';
8334
+		} else {
8335
+			$offset = '+00:00';
8336
+		}
7991 8337
 
7992 8338
 		if ($globalDBdriver == 'mysql') {
7993 8339
 			$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
@@ -8035,7 +8381,9 @@  discard block
 block discarded – undo
8035 8381
 			date_default_timezone_set($globalTimezone);
8036 8382
 			$datetime = new DateTime();
8037 8383
 			$offset = $datetime->format('P');
8038
-		} else $offset = '+00:00';
8384
+		} else {
8385
+			$offset = '+00:00';
8386
+		}
8039 8387
 		$filter_query = $this->getFilter($filters,true,true);
8040 8388
 		if ($globalDBdriver == 'mysql') {
8041 8389
 			$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
@@ -8080,7 +8428,9 @@  discard block
 block discarded – undo
8080 8428
 			date_default_timezone_set($globalTimezone);
8081 8429
 			$datetime = new DateTime();
8082 8430
 			$offset = $datetime->format('P');
8083
-		} else $offset = '+00:00';
8431
+		} else {
8432
+			$offset = '+00:00';
8433
+		}
8084 8434
 		$filter_query = $this->getFilter($filters,true,true);
8085 8435
 
8086 8436
 		if ($globalDBdriver == 'mysql') {
@@ -8127,7 +8477,9 @@  discard block
 block discarded – undo
8127 8477
 			date_default_timezone_set($globalTimezone);
8128 8478
 			$datetime = new DateTime();
8129 8479
 			$offset = $datetime->format('P');
8130
-		} else $offset = '+00:00';
8480
+		} else {
8481
+			$offset = '+00:00';
8482
+		}
8131 8483
 
8132 8484
 		if ($globalDBdriver == 'mysql') {
8133 8485
 			$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
@@ -8173,7 +8525,9 @@  discard block
 block discarded – undo
8173 8525
 			date_default_timezone_set($globalTimezone);
8174 8526
 			$datetime = new DateTime();
8175 8527
 			$offset = $datetime->format('P');
8176
-		} else $offset = '+00:00';
8528
+		} else {
8529
+			$offset = '+00:00';
8530
+		}
8177 8531
 		$filter_query = $this->getFilter($filters,true,true);
8178 8532
 
8179 8533
 		if ($globalDBdriver == 'mysql') {
@@ -8220,7 +8574,9 @@  discard block
 block discarded – undo
8220 8574
 			date_default_timezone_set($globalTimezone);
8221 8575
 			$datetime = new DateTime();
8222 8576
 			$offset = $datetime->format('P');
8223
-		} else $offset = '+00:00';
8577
+		} else {
8578
+			$offset = '+00:00';
8579
+		}
8224 8580
 
8225 8581
 		if ($globalDBdriver == 'mysql') {
8226 8582
 			$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
@@ -8267,7 +8623,9 @@  discard block
 block discarded – undo
8267 8623
 			date_default_timezone_set($globalTimezone);
8268 8624
 			$datetime = new DateTime();
8269 8625
 			$offset = $datetime->format('P');
8270
-		} else $offset = '+00:00';
8626
+		} else {
8627
+			$offset = '+00:00';
8628
+		}
8271 8629
 
8272 8630
 		if ($globalDBdriver == 'mysql') {
8273 8631
 			$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
@@ -8312,7 +8670,9 @@  discard block
 block discarded – undo
8312 8670
 			date_default_timezone_set($globalTimezone);
8313 8671
 			$datetime = new DateTime();
8314 8672
 			$offset = $datetime->format('P');
8315
-		} else $offset = '+00:00';
8673
+		} else {
8674
+			$offset = '+00:00';
8675
+		}
8316 8676
 		$filter_query = $this->getFilter($filters,true,true);
8317 8677
 
8318 8678
 		if ($globalDBdriver == 'mysql') {
@@ -8360,7 +8720,9 @@  discard block
 block discarded – undo
8360 8720
 			date_default_timezone_set($globalTimezone);
8361 8721
 			$datetime = new DateTime();
8362 8722
 			$offset = $datetime->format('P');
8363
-		} else $offset = '+00:00';
8723
+		} else {
8724
+			$offset = '+00:00';
8725
+		}
8364 8726
 
8365 8727
 		if ($globalDBdriver == 'mysql') {
8366 8728
 			$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
@@ -8406,7 +8768,9 @@  discard block
 block discarded – undo
8406 8768
 			date_default_timezone_set($globalTimezone);
8407 8769
 			$datetime = new DateTime();
8408 8770
 			$offset = $datetime->format('P');
8409
-		} else $offset = '+00:00';
8771
+		} else {
8772
+			$offset = '+00:00';
8773
+		}
8410 8774
 		$filter_query = $this->getFilter($filters,true,true);
8411 8775
 
8412 8776
 		if ($globalDBdriver == 'mysql') {
@@ -8454,7 +8818,9 @@  discard block
 block discarded – undo
8454 8818
 			date_default_timezone_set($globalTimezone);
8455 8819
 			$datetime = new DateTime();
8456 8820
 			$offset = $datetime->format('P');
8457
-		} else $offset = '+00:00';
8821
+		} else {
8822
+			$offset = '+00:00';
8823
+		}
8458 8824
 
8459 8825
 		if ($globalDBdriver == 'mysql') {
8460 8826
 			$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
@@ -8501,7 +8867,9 @@  discard block
 block discarded – undo
8501 8867
 			date_default_timezone_set($globalTimezone);
8502 8868
 			$datetime = new DateTime();
8503 8869
 			$offset = $datetime->format('P');
8504
-		} else $offset = '+00:00';
8870
+		} else {
8871
+			$offset = '+00:00';
8872
+		}
8505 8873
 		$filter_query = $this->getFilter($filters,true,true);
8506 8874
 		if ($globalDBdriver == 'mysql') {
8507 8875
 			$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
@@ -8550,7 +8918,9 @@  discard block
 block discarded – undo
8550 8918
 			date_default_timezone_set($globalTimezone);
8551 8919
 			$datetime = new DateTime();
8552 8920
 			$offset = $datetime->format('P');
8553
-		} else $offset = '+00:00';
8921
+		} else {
8922
+			$offset = '+00:00';
8923
+		}
8554 8924
 
8555 8925
 		$orderby_sql = '';
8556 8926
 		if ($orderby == "hour")
@@ -8616,7 +8986,9 @@  discard block
 block discarded – undo
8616 8986
 			date_default_timezone_set($globalTimezone);
8617 8987
 			$datetime = new DateTime();
8618 8988
 			$offset = $datetime->format('P');
8619
-		} else $offset = '+00:00';
8989
+		} else {
8990
+			$offset = '+00:00';
8991
+		}
8620 8992
 
8621 8993
 		$orderby_sql = '';
8622 8994
 		if ($orderby == "hour")
@@ -8683,7 +9055,9 @@  discard block
 block discarded – undo
8683 9055
 			date_default_timezone_set($globalTimezone);
8684 9056
 			$datetime = new DateTime();
8685 9057
 			$offset = $datetime->format('P');
8686
-		} else $offset = '+00:00';
9058
+		} else {
9059
+			$offset = '+00:00';
9060
+		}
8687 9061
 
8688 9062
 		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
8689 9063
 
@@ -8734,7 +9108,9 @@  discard block
 block discarded – undo
8734 9108
 			date_default_timezone_set($globalTimezone);
8735 9109
 			$datetime = new DateTime();
8736 9110
 			$offset = $datetime->format('P');
8737
-		} else $offset = '+00:00';
9111
+		} else {
9112
+			$offset = '+00:00';
9113
+		}
8738 9114
 
8739 9115
 		if ($globalDBdriver == 'mysql') {
8740 9116
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -8781,7 +9157,9 @@  discard block
 block discarded – undo
8781 9157
 			date_default_timezone_set($globalTimezone);
8782 9158
 			$datetime = new DateTime();
8783 9159
 			$offset = $datetime->format('P');
8784
-		} else $offset = '+00:00';
9160
+		} else {
9161
+			$offset = '+00:00';
9162
+		}
8785 9163
 
8786 9164
 		if ($globalDBdriver == 'mysql') {
8787 9165
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -8828,7 +9206,9 @@  discard block
 block discarded – undo
8828 9206
 			date_default_timezone_set($globalTimezone);
8829 9207
 			$datetime = new DateTime();
8830 9208
 			$offset = $datetime->format('P');
8831
-		} else $offset = '+00:00';
9209
+		} else {
9210
+			$offset = '+00:00';
9211
+		}
8832 9212
 
8833 9213
 		if ($globalDBdriver == 'mysql') {
8834 9214
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -8876,7 +9256,9 @@  discard block
 block discarded – undo
8876 9256
 			date_default_timezone_set($globalTimezone);
8877 9257
 			$datetime = new DateTime();
8878 9258
 			$offset = $datetime->format('P');
8879
-		} else $offset = '+00:00';
9259
+		} else {
9260
+			$offset = '+00:00';
9261
+		}
8880 9262
 
8881 9263
 		if ($globalDBdriver == 'mysql') {
8882 9264
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -8924,7 +9306,9 @@  discard block
 block discarded – undo
8924 9306
 			date_default_timezone_set($globalTimezone);
8925 9307
 			$datetime = new DateTime($date);
8926 9308
 			$offset = $datetime->format('P');
8927
-		} else $offset = '+00:00';
9309
+		} else {
9310
+			$offset = '+00:00';
9311
+		}
8928 9312
 
8929 9313
 		if ($globalDBdriver == 'mysql') {
8930 9314
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -8972,7 +9356,9 @@  discard block
 block discarded – undo
8972 9356
 			date_default_timezone_set($globalTimezone);
8973 9357
 			$datetime = new DateTime();
8974 9358
 			$offset = $datetime->format('P');
8975
-		} else $offset = '+00:00';
9359
+		} else {
9360
+			$offset = '+00:00';
9361
+		}
8976 9362
 
8977 9363
 		if ($globalDBdriver == 'mysql') {
8978 9364
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9022,7 +9408,9 @@  discard block
 block discarded – undo
9022 9408
 			date_default_timezone_set($globalTimezone);
9023 9409
 			$datetime = new DateTime();
9024 9410
 			$offset = $datetime->format('P');
9025
-		} else $offset = '+00:00';
9411
+		} else {
9412
+			$offset = '+00:00';
9413
+		}
9026 9414
 
9027 9415
 		if ($globalDBdriver == 'mysql') {
9028 9416
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9069,7 +9457,9 @@  discard block
 block discarded – undo
9069 9457
 			date_default_timezone_set($globalTimezone);
9070 9458
 			$datetime = new DateTime();
9071 9459
 			$offset = $datetime->format('P');
9072
-		} else $offset = '+00:00';
9460
+		} else {
9461
+			$offset = '+00:00';
9462
+		}
9073 9463
 
9074 9464
 		if ($globalDBdriver == 'mysql') {
9075 9465
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9237,7 +9627,9 @@  discard block
 block discarded – undo
9237 9627
 			date_default_timezone_set($globalTimezone);
9238 9628
 			$datetime = new DateTime();
9239 9629
 			$offset = $datetime->format('P');
9240
-		} else $offset = '+00:00';
9630
+		} else {
9631
+			$offset = '+00:00';
9632
+		}
9241 9633
 
9242 9634
 		if ($globalDBdriver == 'mysql') {
9243 9635
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -9423,7 +9815,9 @@  discard block
 block discarded – undo
9423 9815
 	*/
9424 9816
 	public function parseDirection($direction = 0)
9425 9817
 	{
9426
-		if ($direction == '') $direction = 0;
9818
+		if ($direction == '') {
9819
+			$direction = 0;
9820
+		}
9427 9821
 		$direction_array = array();
9428 9822
 		$temp_array = array();
9429 9823
 
@@ -9524,7 +9918,9 @@  discard block
 block discarded – undo
9524 9918
 		if (isset($result->AirlineFlightInfoResult))
9525 9919
 		{
9526 9920
 			$registration = $result->AirlineFlightInfoResult->tailnumber;
9527
-		} else return '';
9921
+		} else {
9922
+			return '';
9923
+		}
9528 9924
 		
9529 9925
 		$registration = $this->convertAircraftRegistration($registration);
9530 9926
 		
@@ -9553,7 +9949,9 @@  discard block
 block discarded – undo
9553 9949
 		if (count($row) > 0) {
9554 9950
 		    //return $row['Registration'];
9555 9951
 		    return $row['registration'];
9556
-		} else return '';
9952
+		} else {
9953
+			return '';
9954
+		}
9557 9955
 	
9558 9956
 	}
9559 9957
 
@@ -9576,9 +9974,14 @@  discard block
 block discarded – undo
9576 9974
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
9577 9975
 		$sth->closeCursor();
9578 9976
 		if (count($row) > 0) {
9579
-		    if ($row['type_flight'] == null) return '';
9580
-		    else return $row['type_flight'];
9581
-		} else return '';
9977
+		    if ($row['type_flight'] == null) {
9978
+		    	return '';
9979
+		    } else {
9980
+		    	return $row['type_flight'];
9981
+		    }
9982
+		} else {
9983
+			return '';
9984
+		}
9582 9985
 	
9583 9986
 	}
9584 9987
 
@@ -9596,7 +9999,9 @@  discard block
 block discarded – undo
9596 9999
 		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
9597 10000
 	
9598 10001
 		$Connection = new Connection($this->db);
9599
-		if (!$Connection->tableExists('countries')) return '';
10002
+		if (!$Connection->tableExists('countries')) {
10003
+			return '';
10004
+		}
9600 10005
 	
9601 10006
 		try {
9602 10007
 			/*
@@ -9616,9 +10021,13 @@  discard block
 block discarded – undo
9616 10021
 			$sth->closeCursor();
9617 10022
 			if (count($row) > 0) {
9618 10023
 				return $row;
9619
-			} else return '';
10024
+			} else {
10025
+				return '';
10026
+			}
9620 10027
 		} catch (PDOException $e) {
9621
-			if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n";
10028
+			if (isset($globalDebug) && $globalDebug) {
10029
+				echo 'Error : '.$e->getMessage()."\n";
10030
+			}
9622 10031
 			return '';
9623 10032
 		}
9624 10033
 	
@@ -9766,7 +10175,9 @@  discard block
 block discarded – undo
9766 10175
 	{
9767 10176
 		global $globalBitlyAccessToken;
9768 10177
 		
9769
-		if ($globalBitlyAccessToken == '') return $url;
10178
+		if ($globalBitlyAccessToken == '') {
10179
+			return $url;
10180
+		}
9770 10181
         
9771 10182
 		$google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url;
9772 10183
 		
@@ -9915,7 +10326,9 @@  discard block
 block discarded – undo
9915 10326
 		
9916 10327
 
9917 10328
 		// routes
9918
-		if ($globalDebug) print "Routes...\n";
10329
+		if ($globalDebug) {
10330
+			print "Routes...\n";
10331
+		}
9919 10332
 		if ($globalDBdriver == 'mysql') {
9920 10333
 			$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)";
9921 10334
 		} else {
@@ -9934,7 +10347,9 @@  discard block
 block discarded – undo
9934 10347
 			}
9935 10348
 		}
9936 10349
 		
9937
-		if ($globalDebug) print "Airlines...\n";
10350
+		if ($globalDebug) {
10351
+			print "Airlines...\n";
10352
+		}
9938 10353
 		//airlines
9939 10354
 		if ($globalDBdriver == 'mysql') {
9940 10355
 			$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)";
@@ -9948,10 +10363,15 @@  discard block
 block discarded – undo
9948 10363
 			if (is_numeric(substr($row['ident'], -1, 1)))
9949 10364
 			{
9950 10365
 				$fromsource = NULL;
9951
-				if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
9952
-				elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao';
9953
-				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
9954
-				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
10366
+				if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') {
10367
+					$fromsource = 'vatsim';
10368
+				} elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') {
10369
+					$fromsource = 'ivao';
10370
+				} elseif (isset($globalVATSIM) && $globalVATSIM) {
10371
+					$fromsource = 'vatsim';
10372
+				} elseif (isset($globalIVAO) && $globalIVAO) {
10373
+					$fromsource = 'ivao';
10374
+				}
9955 10375
 				$airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource);
9956 10376
 				if (isset($airline_array[0]['name'])) {
9957 10377
 					$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";
@@ -9961,13 +10381,17 @@  discard block
 block discarded – undo
9961 10381
 			}
9962 10382
 		}
9963 10383
 
9964
-		if ($globalDebug) print "Remove Duplicate in aircraft_modes...\n";
10384
+		if ($globalDebug) {
10385
+			print "Remove Duplicate in aircraft_modes...\n";
10386
+		}
9965 10387
 		//duplicate modes
9966 10388
 		$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";
9967 10389
 		$sth = $this->db->prepare($query);
9968 10390
 		$sth->execute();
9969 10391
 		
9970
-		if ($globalDebug) print "Aircraft...\n";
10392
+		if ($globalDebug) {
10393
+			print "Aircraft...\n";
10394
+		}
9971 10395
 		//aircraft
9972 10396
 		if ($globalDBdriver == 'mysql') {
9973 10397
 			$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)";
@@ -10010,26 +10434,38 @@  discard block
 block discarded – undo
10010 10434
 				 if (isset($closestAirports[0])) {
10011 10435
 					if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) {
10012 10436
 						$airport_icao = $closestAirports[0]['icao'];
10013
-						if ($globalDebug) echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10437
+						if ($globalDebug) {
10438
+							echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10439
+						}
10014 10440
 					} elseif (count($closestAirports > 1) && $row['arrival_airport_icao'] != '' && $row['arrival_airport_icao'] != 'NA') {
10015 10441
 						foreach ($closestAirports as $airport) {
10016 10442
 							if ($row['arrival_airport_icao'] == $airport['icao']) {
10017 10443
 								$airport_icao = $airport['icao'];
10018
-								if ($globalDebug) echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10444
+								if ($globalDebug) {
10445
+									echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n";
10446
+								}
10019 10447
 								break;
10020 10448
 							}
10021 10449
 						}
10022 10450
 					} elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) {
10023 10451
 						$airport_icao = $closestAirports[0]['icao'];
10024
-						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";
10452
+						if ($globalDebug) {
10453
+							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";
10454
+						}
10025 10455
 					} else {
10026
-						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";
10456
+						if ($globalDebug) {
10457
+							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";
10458
+						}
10027 10459
 					}
10028 10460
 				} else {
10029
-					if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n";
10461
+					if ($globalDebug) {
10462
+						echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n";
10463
+					}
10030 10464
 				}
10031 10465
 				if ($row['real_arrival_airport_icao'] != $airport_icao) {
10032
-					if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n";
10466
+					if ($globalDebug) {
10467
+						echo "Updating airport to ".$airport_icao."...\n";
10468
+					}
10033 10469
 					$update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id";
10034 10470
 					$sthu = $this->db->prepare($update_query);
10035 10471
 					$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.