Completed
Push — master ( 7dfb92...6193f6 )
by Yannick
35:52
created
js/map-marine.2d.js.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -516,8 +516,8 @@  discard block
 block discarded – undo
516 516
 			}
517 517
                     }
518 518
 		    <?php
519
-            		} else {
520
-            	    ?>
519
+					} else {
520
+					?>
521 521
 		    if (map.getZoom() > 7) {
522 522
                 	var style = {
523 523
                     	    "color": "#1a3151",
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
                 	layer_marine_data.addLayer(layer);
537 537
 		    }
538 538
 <?php
539
-            		}
539
+					}
540 540
 ?>
541 541
 				}
542 542
 			    }
Please login to merge, or discard this patch.
archive-geojson.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 // This script can be slow...
3 3
 set_time_limit(0);
4
-ini_set('max_execution_time',6000);
4
+ini_set('max_execution_time', 6000);
5 5
 require_once('require/class.Connection.php');
6 6
 require_once('require/class.Common.php');
7 7
 
@@ -63,24 +63,24 @@  discard block
 block discarded – undo
63 63
 $min = false;
64 64
 $allhistory = false;
65 65
 $filter['source'] = array();
66
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
67
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
68
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
69
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
70
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
71
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
72
-if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
73
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
74
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
75
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
76
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
66
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt'));
67
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup'));
68
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars'));
69
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs'));
70
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs'));
71
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING);
72
+if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'], FILTER_SANITIZE_STRING);
73
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING);
74
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING);
75
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING);
76
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING);
77 77
 
78 78
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
79 79
 	$min = true;
80 80
 } else $min = false;
81 81
 
82 82
 if (isset($_GET['ident'])) {
83
-	$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
83
+	$ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING);
84 84
 	$from_archive = true;
85 85
 	if ($tracker) {
86 86
 		$spotter_array = $TrackerArchive->getLastArchiveTrackerDataByIdent($ident);
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	$allhistory = true;
95 95
 }
96 96
 elseif (isset($_GET['flightaware_id'])) {
97
-	$flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
97
+	$flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING);
98 98
 	$from_archive = true;
99 99
 	if ($tracker) {
100 100
 		$spotter_array = $TrackerArchive->getLastArchiveTrackerDataById($flightaware_id);
@@ -109,26 +109,26 @@  discard block
 block discarded – undo
109 109
 }
110 110
 elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed'])) {
111 111
 	$from_archive = true;
112
-	$begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT);
112
+	$begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT);
113 113
 	if (isset($globalAircraftMaxUpdate)) $begindate = $begindate - $globalAircraftMaxUpdate;
114 114
 	else $begindate = $begindate - 3000;
115
-	$enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT);
116
-	$archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT);
117
-	$part = filter_input(INPUT_GET,'part',FILTER_SANITIZE_NUMBER_INT);
115
+	$enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT);
116
+	$archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT);
117
+	$part = filter_input(INPUT_GET, 'part', FILTER_SANITIZE_NUMBER_INT);
118 118
 	if ($part == '') $part = 0;
119 119
 	
120 120
 	if ($begindate != '' && $enddate != '') {
121
-		$begindate = date('Y-m-d H:i:s',$begindate);
122
-		$enddate = date('Y-m-d H:i:s',$enddate);
121
+		$begindate = date('Y-m-d H:i:s', $begindate);
122
+		$enddate = date('Y-m-d H:i:s', $enddate);
123 123
 		//$spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter);
124 124
 		if ($tracker) {
125
-			$spotter_array = $TrackerArchive->getMinLiveTrackerData($begindate,$enddate,$filter);
125
+			$spotter_array = $TrackerArchive->getMinLiveTrackerData($begindate, $enddate, $filter);
126 126
 		}
127 127
 		elseif ($marine) {
128
-			$spotter_array = $MarineArchive->getMinLiveMarineData($begindate,$enddate,$filter);
128
+			$spotter_array = $MarineArchive->getMinLiveMarineData($begindate, $enddate, $filter);
129 129
 		}
130 130
 		else {
131
-			$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter,$part);
131
+			$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter, $part);
132 132
 		}
133 133
 	}
134 134
 }
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 	if ($flightcnt == '') $flightcnt = 0;
140 140
 } else $flightcnt = 0;
141 141
 
142
-$sqltime = round(microtime(true)-$begintime,2);
142
+$sqltime = round(microtime(true) - $begintime, 2);
143 143
 
144 144
 $pfi = '';
145 145
 //var_dump($spotter_array);
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 $begin = true;
155 155
 if (!empty($spotter_array) && is_array($spotter_array)) {
156 156
 	$output .= '"features": [';
157
-	foreach($spotter_array as $spotter_item) {
157
+	foreach ($spotter_array as $spotter_item) {
158 158
 		$j++;
159 159
 		date_default_timezone_set('UTC');
160 160
 		if ($tracker) {
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 		if ($begin) {
179 179
 			if ($j > 1) {
180 180
 				if (isset($output_time)) {
181
-					$output_time  = substr($output_time, 0, -1);
181
+					$output_time = substr($output_time, 0, -1);
182 182
 					$output .= '"time": ['.$output_time.']';
183 183
 				}
184 184
 				$output .= '},';
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 				$output .= '"type": "LineString",';
188 188
 				$output .= '"coordinates": [';
189 189
 				if (isset($output_history)) {
190
-					$output_history  = substr($output_history, 0, -1);
190
+					$output_history = substr($output_history, 0, -1);
191 191
 					$output .= $output_history;
192 192
 				}
193 193
 				$output .= ']}},';
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 			$output .= '"fi": "'.$pfi.'",';
219 219
 			if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
220 220
 			if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') {
221
-				$output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",';
221
+				$output .= '"c": "'.str_replace('\\', '', $spotter_item['ident']).'",';
222 222
 				//"
223 223
 			} else {
224 224
 				$output .= '"c": "NA",';
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 
353 353
 	if ($j > 1) {
354 354
 		if (isset($output_time)) {
355
-			$output_time  = substr($output_time, 0, -1);
355
+			$output_time = substr($output_time, 0, -1);
356 356
 			$output .= '"time": ['.$output_time.']';
357 357
 		}
358 358
 		$output .= '},';
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
 		$output .= '"type": "LineString",';
362 362
 		$output .= '"coordinates": [';
363 363
 		if (isset($output_history)) {
364
-			$output_history  = substr($output_history, 0, -1);
364
+			$output_history = substr($output_history, 0, -1);
365 365
 			$output .= $output_history;
366 366
 		}
367 367
 		$output .= ']';
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
 	$output  = substr($output, 0, -1);
373 373
 	$output .= ']';
374 374
 	$output .= ',"initial_sqltime": "'.$sqltime.'",';
375
-	$output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",';
375
+	$output .= '"totaltime": "'.round(microtime(true) - $begintime, 2).'",';
376 376
 	if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
377 377
 	$output .= '"fc": "'.$flightcnt.'"';
378 378
 } else {
Please login to merge, or discard this patch.
js/map-aircraft.2d.js.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -6,8 +6,8 @@  discard block
 block discarded – undo
6 6
 if (!isset($globalJsonCompress)) $compress = true;
7 7
 else $compress = $globalJsonCompress;
8 8
 
9
-if (isset($_GET['ident'])) $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
10
-if (isset($_GET['flightaware_id'])) $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
9
+if (isset($_GET['ident'])) $ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING);
10
+if (isset($_GET['flightaware_id'])) $flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING);
11 11
 ?>
12 12
 <?php
13 13
 if (isset($_COOKIE['IconColor'])) $IconColor = $_COOKIE['IconColor'];
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 			if (typeof props != 'undefined') {
227 227
 				var thedate = new Date(props);
228 228
 				$("#thedate").html(thedate.toUTCString());
229
-			//	$("#archivebox").html('<h4><?php echo str_replace("'","\'",_("Archive Date & Time")); ?></h4>' +  '<b><i class="fa fa-spinner fa-pulse fa-2x fa-fw margin-bottom"></i></b>');
229
+			//	$("#archivebox").html('<h4><?php echo str_replace("'", "\'", _("Archive Date & Time")); ?></h4>' +  '<b><i class="fa fa-spinner fa-pulse fa-2x fa-fw margin-bottom"></i></b>');
230 230
 			}
231 231
 		}
232 232
 	}
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 <?php
374 374
 		} else {
375 375
 ?>
376
-					var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
376
+					var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000);
377 377
 					return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
378 378
 <?php
379 379
 		}
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
 							/*
391 391
 							shadowUrl: iconURLShadowpath,
392 392
 							shadowSize: [<?php print $globalAircraftSize; ?>, <?php print $globalAircraftSize; ?>],
393
-							shadowAnchor: [<?php print ($globalAircraftSize/2)+1; ?>, <?php print $globalAircraftSize; ?>]
393
+							shadowAnchor: [<?php print ($globalAircraftSize/2) + 1; ?>, <?php print $globalAircraftSize; ?>]
394 394
 							*/
395 395
 						})
396 396
 					})
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
 <?php
425 425
 		} else {
426 426
 ?>
427
-						var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
427
+						var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000);
428 428
 						return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
429 429
 <?php
430 430
 		}
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
 <?php
473 473
 		} else {
474 474
 ?>
475
-							var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
475
+							var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000);
476 476
 							return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
477 477
 <?php
478 478
 		}
Please login to merge, or discard this patch.
js/map-tracker.2d.js.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -575,8 +575,8 @@  discard block
 block discarded – undo
575 575
 			}
576 576
                     }
577 577
 		    <?php
578
-            		} else {
579
-            	    ?>
578
+					} else {
579
+					?>
580 580
 		    if (map.getZoom() > 7) {
581 581
                 	var style = {
582 582
                     	    "color": "#1a3151",
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
                 	layer_tracker_data.addLayer(layer);
596 596
 		    }
597 597
 <?php
598
-            		}
598
+					}
599 599
 ?>
600 600
 				}
601 601
 			    }
@@ -740,11 +740,11 @@  discard block
 block discarded – undo
740 740
 $( document ).ready(function() {
741 741
 	map.on('moveend', function() {
742 742
 <?php
743
-    if (isset($globalMapUseBbox) && $globalMapUseBbox && (!isset($archive) || $archive === false)) {
743
+	if (isset($globalMapUseBbox) && $globalMapUseBbox && (!isset($archive) || $archive === false)) {
744 744
 ?>
745 745
 		getLiveTrackerData(1);
746 746
 <?php
747
-    }
747
+	}
748 748
 ?>
749 749
 	});
750 750
 
Please login to merge, or discard this patch.
js/map-tracker.3d.js.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -98,21 +98,21 @@  discard block
 block discarded – undo
98 98
 			var entityid = entity.id;
99 99
 			var lastupdateentity = entity.properties.valueOf('lastupdate')._lastupdate._value;
100 100
 			<?php 
101
-			    if (isset($globalMapUseBbox) && $globalMapUseBbox) {
101
+				if (isset($globalMapUseBbox) && $globalMapUseBbox) {
102 102
 			?>
103 103
 			if (lastupdateentity != lastupdatetracker) {
104 104
 				viewer.dataSources.get(dsn).entities.remove(entity);
105 105
 				czmldstracker.entities.removeById(entityid);
106 106
 			}
107 107
 			<?php
108
-			    } else {
108
+				} else {
109 109
 			?>
110 110
 			if (parseInt(lastupdateentity) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) print $globalMapRefresh*2000; else print '60000'; ?>)) {
111 111
 				viewer.dataSources.get(dsn).entities.remove(entity);
112 112
 				czmldstracker.entities.removeById(entityid);
113 113
 			}
114 114
 			<?php
115
-			    }
115
+				}
116 116
 			?>
117 117
 		}
118 118
 	}
@@ -145,15 +145,15 @@  discard block
 block discarded – undo
145 145
 function updateTrackerData() {
146 146
 	lastupdatetracker = Date.now();
147 147
 <?php
148
-    if (isset($globalMapUseBbox) && $globalMapUseBbox) {
148
+	if (isset($globalMapUseBbox) && $globalMapUseBbox) {
149 149
 ?>
150 150
 	var livetrackerdata = czmldstracker.process('<?php print $globalURL; ?>/live-czml.php?tracker&coord='+bbox()+'&update=' + lastupdatetracker);
151 151
 <?php
152
-    } else {
152
+	} else {
153 153
 ?>
154 154
 	var livetrackerdata = czmldstracker.process('<?php print $globalURL; ?>/live-czml.php?tracker&update=' + lastupdatetracker);
155 155
 <?php
156
-    }
156
+	}
157 157
 ?>  
158 158
 	livetrackerdata.then(function (data) { 
159 159
 		displayTrackerData(data);
@@ -209,13 +209,13 @@  discard block
 block discarded – undo
209 209
 }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
210 210
 camera.moveEnd.addEventListener(function() {
211 211
 <?php
212
-    if (isset($globalMapUseBbox) && $globalMapUseBbox) {
212
+	if (isset($globalMapUseBbox) && $globalMapUseBbox) {
213 213
 ?>
214 214
 	if (typeof archive == 'undefined' || archive == false) {
215 215
 		updateTrackerData();
216 216
 	}
217 217
 <?php
218
-    }
218
+	}
219 219
 ?>
220 220
 });
221 221
 
Please login to merge, or discard this patch.
js/map-aircraft.3d.js.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -289,8 +289,8 @@  discard block
 block discarded – undo
289 289
 			var entityid = entity.id;
290 290
 			var lastupdateentity = entity.properties.lastupdate;
291 291
 			<?php 
292
-			    if (isset($globalMapUseBbox) && $globalMapUseBbox) {
293
-			    // Remove flights not in latest CZML
292
+				if (isset($globalMapUseBbox) && $globalMapUseBbox) {
293
+				// Remove flights not in latest CZML
294 294
 			?>
295 295
 			if (lastupdateentity != lastupdate) {
296 296
 				console.log('Remove...');
@@ -298,14 +298,14 @@  discard block
 block discarded – undo
298 298
 				czmlds.entities.removeById(entityid);
299 299
 			}
300 300
 			<?php
301
-			    } else {
301
+				} else {
302 302
 			?>
303 303
 			if (parseInt(lastupdateentity) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) print $globalMapRefresh*2000; else print '60000'; ?>)) {
304 304
 				viewer.dataSources.get(dsn).entities.remove(entity);
305 305
 				czmlds.entities.removeById(entityid);
306 306
 			}
307 307
 			<?php
308
-			    }
308
+				}
309 309
 			?>
310 310
 		}
311 311
 	}
@@ -762,12 +762,12 @@  discard block
 block discarded – undo
762 762
 }
763 763
 
764 764
 <?php
765
-    if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) {
765
+	if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) {
766 766
 ?>
767 767
 update_atcLayer();
768 768
 setInterval(function(){update_atcLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
769 769
 <?php
770
-    }
770
+	}
771 771
 ?>
772 772
 
773 773
 function iconColor(color) {
Please login to merge, or discard this patch.
js/map.2d.js.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
 	};
386 386
 
387 387
 <?php
388
-    if (isset($globalTSK) && $globalTSK && isset($_GET['tsk'])) {
388
+	if (isset($globalTSK) && $globalTSK && isset($_GET['tsk'])) {
389 389
 ?>
390 390
 	function tskPopup (feature, layer) {
391 391
 		var output = '';
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
 	};
421 421
 	update_tsk();
422 422
 <?php
423
-    }
423
+	}
424 424
 ?>
425 425
 	map.on('moveend', function() {
426 426
 		if (map.hasLayer(locationsLayer) == true) {
@@ -434,10 +434,10 @@  discard block
 block discarded – undo
434 434
 		setInterval(function(){if (noTimeout) { map.removeLayer(locationsLayer); update_locationsLayer();} },<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
435 435
 	}
436 436
 <?php
437
-    // Add support for custom json via $globalMapJson
438
-    if (isset($globalMapJson) && is_array($globalMapJson)) {
437
+	// Add support for custom json via $globalMapJson
438
+	if (isset($globalMapJson) && is_array($globalMapJson)) {
439 439
 	foreach ($globalMapJson as $json) {
440
-	    if (isset($json['url'])) {
440
+		if (isset($json['url'])) {
441 441
 ?>
442 442
 update_genLayer('<?php print $json['url']; ?>');
443 443
 <?php
@@ -446,9 +446,9 @@  discard block
 block discarded – undo
446 446
 setInterval(function(){if (noTimeout) update_genLayer('<?php print $json['url']; ?>')}, <?php print $json['refresh']; ?>);
447 447
 <?php
448 448
 		}
449
-	    }
449
+		}
450
+	}
450 451
 	}
451
-    }
452 452
 
453 453
 ?>
454 454
 //adds the bootstrap tooltip to the map icons
Please login to merge, or discard this patch.
live-czml.php 1 patch
Spacing   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -59,11 +59,11 @@  discard block
 block discarded – undo
59 59
     $s3 = sin($bank/2);
60 60
     $c1c2 = $c1*$c2;
61 61
     $s1s2 = $s1*$s2;
62
-    $w =$c1c2*$c3 - $s1s2*$s3;
63
-    $x =$c1c2*$s3 + $s1s2*$c3;
64
-    $y =$s1*$c2*$c3 + $c1*$s2*$s3;
65
-    $z =$c1*$s2*$c3 - $s1*$c2*$s3;
66
-    return array('x' => $x,'y' => $y,'z' => $z,'w' => $w);
62
+    $w = $c1c2*$c3 - $s1s2*$s3;
63
+    $x = $c1c2*$s3 + $s1s2*$c3;
64
+    $y = $s1*$c2*$c3 + $c1*$s2*$s3;
65
+    $z = $c1*$s2*$c3 - $s1*$c2*$s3;
66
+    return array('x' => $x, 'y' => $y, 'z' => $z, 'w' => $w);
67 67
 //    return array('x' => '0.0','y' => '-0.931','z' => '0.0','w' => '0.365');
68 68
 
69 69
 }
@@ -84,17 +84,17 @@  discard block
 block discarded – undo
84 84
 $min = false;
85 85
 $allhistory = false;
86 86
 $filter['source'] = array();
87
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
88
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
89
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
90
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
91
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
92
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
93
-if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
94
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
95
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
96
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
97
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
87
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt'));
88
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup'));
89
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars'));
90
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs'));
91
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs'));
92
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING);
93
+if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'], FILTER_SANITIZE_STRING);
94
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING);
95
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING);
96
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING);
97
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING);
98 98
 /*
99 99
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
100 100
 	$min = true;
@@ -141,17 +141,17 @@  discard block
 block discarded – undo
141 141
 	$from_archive = true;
142 142
 //	$begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
143 143
 //	$enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
144
-	$begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT);
145
-	$enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT);
146
-	$archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT);
147
-	$begindate = date('Y-m-d H:i:s',$begindate);
148
-	$enddate = date('Y-m-d H:i:s',$enddate);
144
+	$begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT);
145
+	$enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT);
146
+	$archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT);
147
+	$begindate = date('Y-m-d H:i:s', $begindate);
148
+	$enddate = date('Y-m-d H:i:s', $enddate);
149 149
 	if ($tracker) {
150
-		$spotter_array = $TrackerArchive->getMinLiveTrackerDataPlayback($begindate,$enddate,$filter);
150
+		$spotter_array = $TrackerArchive->getMinLiveTrackerDataPlayback($begindate, $enddate, $filter);
151 151
 	} elseif ($marine) {
152
-		$spotter_array = $MarineArchive->getMinLiveMarineDataPlayback($begindate,$enddate,$filter);
152
+		$spotter_array = $MarineArchive->getMinLiveMarineDataPlayback($begindate, $enddate, $filter);
153 153
 	} else {
154
-		$spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter);
154
+		$spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate, $enddate, $filter);
155 155
 	}
156 156
 } elseif (isset($_COOKIE['archive']) && isset($_COOKIE['archive_begin']) && isset($_COOKIE['archive_end']) && isset($_COOKIE['archive_speed'])) {
157 157
 	$from_archive = true;
@@ -168,36 +168,36 @@  discard block
 block discarded – undo
168 168
 	}
169 169
 	$enddate = $_COOKIE['archive_end'];
170 170
 	$enddateinitial = $_COOKIE['archive_end'];
171
-	$archivespeed = filter_var($_COOKIE['archive_speed'],FILTER_SANITIZE_NUMBER_INT);
172
-	$begindate = date('Y-m-d H:i:s',$begindate);
173
-	$enddate = date('Y-m-d H:i:s',$enddate);
171
+	$archivespeed = filter_var($_COOKIE['archive_speed'], FILTER_SANITIZE_NUMBER_INT);
172
+	$begindate = date('Y-m-d H:i:s', $begindate);
173
+	$enddate = date('Y-m-d H:i:s', $enddate);
174 174
 	//echo 'Begin : '.$begindate.' - End : '.$enddate."\n";
175 175
 	if ($tracker) {
176
-		$spotter_array = $TrackerArchive->getMinLiveTrackerData($begindate,$enddate,$filter);
176
+		$spotter_array = $TrackerArchive->getMinLiveTrackerData($begindate, $enddate, $filter);
177 177
 	} elseif ($marine) {
178
-		$spotter_array = $MarineArchive->getMinLiveMarineData($begindate,$enddate,$filter);
178
+		$spotter_array = $MarineArchive->getMinLiveMarineData($begindate, $enddate, $filter);
179 179
 	} else {
180
-		$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter);
180
+		$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter);
181 181
 	}
182 182
 } elseif ($tracker) {
183 183
 	$coord = array();
184 184
 	if (isset($_GET['coord']) && $_GET['coord'] != '') {
185
-		$coord = explode(',',$_GET['coord']);
186
-		if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) 
185
+		$coord = explode(',', $_GET['coord']);
186
+		if (!(filter_var($coord[0], FILTER_VALIDATE_FLOAT) && filter_var($coord[1], FILTER_VALIDATE_FLOAT) && filter_var($coord[2], FILTER_VALIDATE_FLOAT) && filter_var($coord[3], FILTER_VALIDATE_FLOAT) 
187 187
 		    && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) {
188 188
 			$coord = array();
189 189
 		}
190 190
 	}
191 191
 	$previous_filter = $filter;
192 192
 	if ((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrackTracker']) && $_COOKIE['MapTrackTracker'] != '')) {
193
-		$filter = array_merge($filter,array('id' => $_COOKIE['MapTrackTracker']));
194
-		$spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord,$filter,true);
193
+		$filter = array_merge($filter, array('id' => $_COOKIE['MapTrackTracker']));
194
+		$spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord, $filter, true);
195 195
 	/*
196 196
 	} elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && !empty($coord)) {
197 197
 		$spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord,$filter,true,$_COOKIE['MapTrack']);
198 198
 	*/
199 199
 	} elseif (!isset($_COOKIE['singlemodel']) || $_COOKIE['singlemodel'] == 'false') {
200
-		$spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord,$filter,true);
200
+		$spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord, $filter, true);
201 201
 	} else {
202 202
 		$spotter_array = array();
203 203
 	}
@@ -205,22 +205,22 @@  discard block
 block discarded – undo
205 205
 } elseif ($marine) {
206 206
 	$coord = array();
207 207
 	if (isset($_GET['coord']) && $_GET['coord'] != '') {
208
-		$coord = explode(',',$_GET['coord']);
209
-		if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) 
208
+		$coord = explode(',', $_GET['coord']);
209
+		if (!(filter_var($coord[0], FILTER_VALIDATE_FLOAT) && filter_var($coord[1], FILTER_VALIDATE_FLOAT) && filter_var($coord[2], FILTER_VALIDATE_FLOAT) && filter_var($coord[3], FILTER_VALIDATE_FLOAT) 
210 210
 		    && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) {
211 211
 			$coord = array();
212 212
 		}
213 213
 	}
214 214
 	$previous_filter = $filter;
215 215
 	if ((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrackMarine']) && $_COOKIE['MapTrackMarine'] != '')) {
216
-		$filter = array_merge($filter,array('id' => $_COOKIE['MapTrackMarine']));
217
-		$spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,true);
216
+		$filter = array_merge($filter, array('id' => $_COOKIE['MapTrackMarine']));
217
+		$spotter_array = $MarineLive->getMinLastLiveMarineData($coord, $filter, true);
218 218
 	/*
219 219
 	} elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && !empty($coord)) {
220 220
 		$spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,true,$_COOKIE['MapTrack']);
221 221
 	*/
222 222
 	} elseif (!isset($_COOKIE['singlemodel']) || $_COOKIE['singlemodel'] == 'false') {
223
-		$spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,true);
223
+		$spotter_array = $MarineLive->getMinLastLiveMarineData($coord, $filter, true);
224 224
 	} else {
225 225
 		$spotter_array = array();
226 226
 	}
@@ -228,20 +228,20 @@  discard block
 block discarded – undo
228 228
 } else {
229 229
 	$coord = array();
230 230
 	if (!((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '')) && isset($_GET['coord']) && $_GET['coord'] != '') {
231
-		$coord = explode(',',$_GET['coord']);
232
-		if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) 
231
+		$coord = explode(',', $_GET['coord']);
232
+		if (!(filter_var($coord[0], FILTER_VALIDATE_FLOAT) && filter_var($coord[1], FILTER_VALIDATE_FLOAT) && filter_var($coord[2], FILTER_VALIDATE_FLOAT) && filter_var($coord[3], FILTER_VALIDATE_FLOAT) 
233 233
 		    && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) {
234 234
 			$coord = array();
235 235
 		}
236 236
 	}
237 237
 	$previous_filter = $filter;
238 238
 	if ((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '')) {
239
-		$filter = array_merge($filter,array('id' => $_COOKIE['MapTrack']));
240
-		$spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,true);
239
+		$filter = array_merge($filter, array('id' => $_COOKIE['MapTrack']));
240
+		$spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord, $filter, true);
241 241
 	} elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && !empty($coord)) {
242
-		$spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,true,$_COOKIE['MapTrack']);
242
+		$spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord, $filter, true, $_COOKIE['MapTrack']);
243 243
 	} elseif (!isset($_COOKIE['singlemodel']) || $_COOKIE['singlemodel'] == 'false') {
244
-		$spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,true);
244
+		$spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord, $filter, true);
245 245
 	} else {
246 246
 		$spotter_array = array();
247 247
 	}
@@ -251,19 +251,19 @@  discard block
 block discarded – undo
251 251
 if (!empty($spotter_array) && isset($coord)) {
252 252
 	if ($tracker) {
253 253
 		if (isset($_GET['archive'])) {
254
-			$flightcnt = $TrackerLive->getLiveTrackerCount($begindate,$enddate,$filter);
254
+			$flightcnt = $TrackerLive->getLiveTrackerCount($begindate, $enddate, $filter);
255 255
 		} else {
256 256
 			$flightcnt = $TrackerLive->getLiveTrackerCount($filter);
257 257
 		}
258 258
 	} elseif ($marine) {
259 259
 		if (isset($_GET['archive'])) {
260
-			$flightcnt = $MarineLive->getLiveMarineCount($begindate,$enddate,$filter);
260
+			$flightcnt = $MarineLive->getLiveMarineCount($begindate, $enddate, $filter);
261 261
 		} else {
262 262
 			$flightcnt = $MarineLive->getLiveMarineCount($filter);
263 263
 		}
264 264
 	} else {
265 265
 		if (isset($_GET['archive'])) {
266
-			$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter);
266
+			$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter);
267 267
 		} else {
268 268
 			$flightcnt = $SpotterLive->getLiveSpotterCount($filter);
269 269
 		}
@@ -271,17 +271,17 @@  discard block
 block discarded – undo
271 271
 	if ($flightcnt == '') $flightcnt = 0;
272 272
 } else $flightcnt = 0;
273 273
 
274
-$sqltime = round(microtime(true)-$begintime,2);
274
+$sqltime = round(microtime(true) - $begintime, 2);
275 275
 $minitime = time();
276 276
 $minitracktime_begin = time();
277 277
 $minitracktime = $minitracktime_begin;
278 278
 $maxitime = 0;
279
-$lastupdate = filter_input(INPUT_GET,'update',FILTER_SANITIZE_NUMBER_INT);
279
+$lastupdate = filter_input(INPUT_GET, 'update', FILTER_SANITIZE_NUMBER_INT);
280 280
 $modelsdb = array();
281 281
 if (file_exists(dirname(__FILE__).'/models/modelsdb')) {
282
-	if (($handle = fopen(dirname(__FILE__).'/models/modelsdb','r')) !== FALSE) {
283
-		while (($row = fgetcsv($handle,1000)) !== FALSE) {
284
-			if (isset($row[1]) ){
282
+	if (($handle = fopen(dirname(__FILE__).'/models/modelsdb', 'r')) !== FALSE) {
283
+		while (($row = fgetcsv($handle, 1000)) !== FALSE) {
284
+			if (isset($row[1])) {
285 285
 				$model = $row[0];
286 286
 				$modelsdb[$model] = $row[1];
287 287
 			}
@@ -291,9 +291,9 @@  discard block
 block discarded – undo
291 291
 }
292 292
 $modelsdb2 = array();
293 293
 if (file_exists(dirname(__FILE__).'/models/gltf2/modelsdb')) {
294
-	if (($handle = fopen(dirname(__FILE__).'/models/gltf2/modelsdb','r')) !== FALSE) {
295
-		while (($row = fgetcsv($handle,1000)) !== FALSE) {
296
-			if (isset($row[1]) ){
294
+	if (($handle = fopen(dirname(__FILE__).'/models/gltf2/modelsdb', 'r')) !== FALSE) {
295
+		while (($row = fgetcsv($handle, 1000)) !== FALSE) {
296
+			if (isset($row[1])) {
297 297
 				$model = $row[0];
298 298
 				$glb = $row[1];
299 299
 				if (isset($row[2])) {
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 if (!empty($spotter_array) && is_array($spotter_array))
340 340
 {
341 341
 	$nblatlong = 0;
342
-	foreach($spotter_array as $spotter_item)
342
+	foreach ($spotter_array as $spotter_item)
343 343
 	{
344 344
 		$j++;
345 345
 		//if (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'airwhere') $heightrelative = 'RELATIVE_TO_GROUND';
@@ -393,13 +393,13 @@  discard block
 block discarded – undo
393 393
 			}
394 394
 			if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",';
395 395
 			if (isset($spotter_item['format_source'])) $output .= '"format": "'.$spotter_item['format_source'].'",';
396
-			if (isset($spotter_item['ident'])) $output.= '"ident": "'.$spotter_item['ident'].'",';
396
+			if (isset($spotter_item['ident'])) $output .= '"ident": "'.$spotter_item['ident'].'",';
397 397
 			if ($tracker) {
398 398
 				if (isset($spotter_item['type'])) $output .= '"tracker_type": "'.$spotter_item['type'].'",';
399
-				$output.= '"type": "tracker"';
399
+				$output .= '"type": "tracker"';
400 400
 			} elseif ($marine) {
401 401
 				if (isset($spotter_item['type'])) $output .= '"marine_type": "'.$spotter_item['type'].'",';
402
-				$output.= '"type": "marine"';
402
+				$output .= '"type": "marine"';
403 403
 			} else {
404 404
 				if ($one3dmodel === false && isset($globalMap3DLiveries) && $globalMap3DLiveries) {
405 405
 					$aircraft_icao = $spotter_item['aircraft_icao'];
@@ -413,14 +413,14 @@  discard block
 block discarded – undo
413 413
 						if (isset($airline_icao)) {
414 414
 							$imagefile = $aircraft_icao.'-'.$airline_icao.'.png';
415 415
 							if (file_exists(dirname(__FILE__).'/models/gltf2/liveries/'.$imagefile)) {
416
-								$output.= '"liveries": "'.$globalURL.'/models/gltf2/liveries/'.$imagefile.'",';
416
+								$output .= '"liveries": "'.$globalURL.'/models/gltf2/liveries/'.$imagefile.'",';
417 417
 							}
418 418
 						}
419 419
 					}
420 420
 					//if ($ident != '') $output.= '"ident": "'.$ident.'",';
421 421
 				}
422
-				$output.= '"gltf2": %gltf2%,';
423
-				$output.= '"type": "flight"';
422
+				$output .= '"gltf2": %gltf2%,';
423
+				$output .= '"type": "flight"';
424 424
 			}
425 425
 			$output .= '},';
426 426
 
@@ -791,8 +791,8 @@  discard block
 block discarded – undo
791 791
 					$output .= '},';
792 792
 				}
793 793
 			}
794
-			if (isset($onground) && $onground) $output = str_replace('%onground%','true',$output);
795
-			else $output = str_replace('%onground%','false',$output);
794
+			if (isset($onground) && $onground) $output = str_replace('%onground%', 'true', $output);
795
+			else $output = str_replace('%onground%', 'false', $output);
796 796
 
797 797
 	//		$output .= '"heightReference": "CLAMP_TO_GROUND",';
798 798
 			//$output .= '"heightReference": "'.$heightrelative.'",';
@@ -808,7 +808,7 @@  discard block
 block discarded – undo
808 808
 			if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']);
809 809
 			if (isset($_COOKIE['MapTrack']) && $id == $_COOKIE['MapTrack'] && $minitracktime > strtotime($spotter_item['date'])) $minitracktime = strtotime($spotter_item['date']);
810 810
 			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
811
-			$output .= '"'.date("c",strtotime($spotter_item['date'])).'", ';
811
+			$output .= '"'.date("c", strtotime($spotter_item['date'])).'", ';
812 812
 			$output .= $spotter_item['longitude'].', ';
813 813
 			$output .= $spotter_item['latitude'];
814 814
 			$prevlong = $spotter_item['longitude'];
@@ -836,8 +836,8 @@  discard block
 block discarded – undo
836 836
 			//$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0));
837 837
 			//$orientation .= '"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w'];
838 838
 		} else {
839
-			$nblatlong = $nblatlong+1;
840
-			$output .= ',"'.date("c",strtotime($spotter_item['date'])).'", ';
839
+			$nblatlong = $nblatlong + 1;
840
+			$output .= ',"'.date("c", strtotime($spotter_item['date'])).'", ';
841 841
 			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
842 842
 			if ($spotter_item['ground_speed'] == 0) {
843 843
 				$output .= $prevlong.', ';
@@ -878,26 +878,26 @@  discard block
 block discarded – undo
878 878
 $output .= ']';
879 879
 if (isset($globalArchive) && $globalArchive === TRUE) {
880 880
 	if (isset($begindateinitial)) {
881
-		$output = str_replace('%minitime%',date("c",$begindateinitial),$output);
882
-	} elseif ((time()-$globalLiveInterval) > $minitime) {
883
-		if (time()-$globalLiveInterval > $maxitime) {
884
-			$output = str_replace('%minitime%',date("c",$maxitime),$output);
881
+		$output = str_replace('%minitime%', date("c", $begindateinitial), $output);
882
+	} elseif ((time() - $globalLiveInterval) > $minitime) {
883
+		if (time() - $globalLiveInterval > $maxitime) {
884
+			$output = str_replace('%minitime%', date("c", $maxitime), $output);
885 885
 		} else {
886
-			$output = str_replace('%minitime%',date("c",time()-$globalLiveInterval),$output);
886
+			$output = str_replace('%minitime%', date("c", time() - $globalLiveInterval), $output);
887 887
 		}
888 888
 	}
889
-	else $output = str_replace('%minitime%',date("c",$minitime),$output);
889
+	else $output = str_replace('%minitime%', date("c", $minitime), $output);
890 890
 } elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && $minitracktime != $minitracktime_begin) {
891
-	$output = str_replace('%minitime%',date("c",$minitracktime),$output);
891
+	$output = str_replace('%minitime%', date("c", $minitracktime), $output);
892 892
 } else {
893
-	$output = str_replace('%minitime%',date("c",$minitime),$output);
893
+	$output = str_replace('%minitime%', date("c", $minitime), $output);
894 894
 }
895 895
 if (isset($enddateinitial)) {
896
-	$output = str_replace('%maxitime%',date("c",$enddateinitial),$output);
896
+	$output = str_replace('%maxitime%', date("c", $enddateinitial), $output);
897 897
 } else {
898
-	$output = str_replace('%maxitime%',date("c",$maxitime),$output);
898
+	$output = str_replace('%maxitime%', date("c", $maxitime), $output);
899 899
 }
900
-if ($gltf2) $output = str_replace('%gltf2%','true',$output);
901
-else $output = str_replace('%gltf2%','false',$output);
900
+if ($gltf2) $output = str_replace('%gltf2%', 'true', $output);
901
+else $output = str_replace('%gltf2%', 'false', $output);
902 902
 print $output;
903 903
 ?>
Please login to merge, or discard this patch.
require/class.SpotterLive.php 1 patch
Spacing   +136 added lines, -136 removed lines patch added patch discarded remove patch
@@ -17,62 +17,62 @@  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, $globalDBdriver;
22 22
 		$filters = array();
23 23
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
24 24
 			if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
25 25
 				$filters = $globalStatsFilters[$globalFilterName];
26 26
 			} else {
27
-				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
27
+				$filter = array_merge($filter, $globalStatsFilters[$globalFilterName]);
28 28
 			}
29 29
 		}
30 30
 		if (isset($filter[0]['source'])) {
31
-			$filters = array_merge($filters,$filter);
31
+			$filters = array_merge($filters, $filter);
32 32
 		}
33
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
33
+		if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
34 34
 		$filter_query_join = '';
35 35
 		$filter_query_where = '';
36
-		foreach($filters as $flt) {
36
+		foreach ($filters as $flt) {
37 37
 			if (isset($flt['airlines']) && !empty($flt['airlines'])) {
38 38
 				if ($flt['airlines'][0] != '' && $flt['airlines'][0] != 'all') {
39 39
 					if (isset($flt['source'])) {
40
-						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id";
40
+						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id";
41 41
 					} else {
42
-						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id";
42
+						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id";
43 43
 					}
44 44
 				}
45 45
 			}
46 46
 			if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) {
47 47
 				if (isset($flt['source'])) {
48
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id";
48
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id";
49 49
 				} else {
50
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id";
50
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id";
51 51
 				}
52 52
 			}
53 53
 			if (isset($flt['idents']) && !empty($flt['idents'])) {
54 54
 				if (isset($flt['source'])) {
55
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id";
55
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id";
56 56
 				} else {
57
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id";
57
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id";
58 58
 				}
59 59
 			}
60 60
 			if (isset($flt['registrations']) && !empty($flt['registrations'])) {
61 61
 				if (isset($flt['source'])) {
62
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','",$flt['registrations'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id";
62
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','", $flt['registrations'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id";
63 63
 				} else {
64
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','",$flt['registrations'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id";
64
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','", $flt['registrations'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id";
65 65
 				}
66 66
 			}
67 67
 			if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id']) && isset($flt['idents']) && empty($flt['idents'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']) && !isset($flt['idents']) && !isset($flt['registrations']))) {
68 68
 				if (isset($flt['source'])) {
69
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) ssf ON ssf.flightaware_id = spotter_live.flightaware_id";
69
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) ssf ON ssf.flightaware_id = spotter_live.flightaware_id";
70 70
 				}
71 71
 			}
72 72
 		}
73 73
 		if (isset($filter['airlines']) && !empty($filter['airlines'])) {
74 74
 			if ($filter['airlines'][0] != '' && $filter['airlines'][0] != 'all') {
75
-				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) sai ON sai.flightaware_id = spotter_live.flightaware_id";
75
+				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) sai ON sai.flightaware_id = spotter_live.flightaware_id";
76 76
 			}
77 77
 		}
78 78
 		if (isset($filter['alliance']) && !empty($filter['alliance'])) {
@@ -82,13 +82,13 @@  discard block
 block discarded – undo
82 82
 			$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 ";
83 83
 		}
84 84
 		if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) {
85
-			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) sp ON sp.flightaware_id = spotter_live.flightaware_id";
85
+			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) sp ON sp.flightaware_id = spotter_live.flightaware_id";
86 86
 		}
87 87
 		if (isset($filter['source']) && !empty($filter['source'])) {
88 88
 			if (count($filter['source']) == 1) {
89 89
 				$filter_query_where .= " AND format_source = '".$filter['source'][0]."'";
90 90
 			} else {
91
-				$filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')";
91
+				$filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')";
92 92
 			}
93 93
 		}
94 94
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
@@ -121,15 +121,15 @@  discard block
 block discarded – undo
121 121
 					$filter_query_date .= " AND EXTRACT(DAY FROM spotter_output.date) = '".$filter['day']."'";
122 122
 				}
123 123
 			}
124
-			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.flightaware_id = spotter_live.flightaware_id";
124
+			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.flightaware_id = spotter_live.flightaware_id";
125 125
 		}
126 126
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
127
-			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
127
+			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
128 128
 		}
129 129
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
130 130
 		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
131 131
 		if ($filter_query_where != '') {
132
-			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
132
+			$filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where);
133 133
 		}
134 134
 		$filter_query = $filter_query_join.$filter_query_where;
135 135
 		return $filter_query;
@@ -152,8 +152,8 @@  discard block
 block discarded – undo
152 152
 		if ($limit != '')
153 153
 		{
154 154
 			$limit_array = explode(',', $limit);
155
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
156
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
155
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
156
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
157 157
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
158 158
 			{
159 159
 				$limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0];
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 		} else {
178 178
 			$query  = "SELECT spotter_live.* 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".$filter_query.$orderby_query;
179 179
 		}
180
-		$spotter_array = $Spotter->getDataFromDB($query.$limit_query,array(),'',true);
180
+		$spotter_array = $Spotter->getDataFromDB($query.$limit_query, array(), '', true);
181 181
 
182 182
 		return $spotter_array;
183 183
 	}
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 	{
193 193
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
194 194
 		date_default_timezone_set('UTC');
195
-		$filter_query = $this->getFilter($filter,true,true);
195
+		$filter_query = $this->getFilter($filter, true, true);
196 196
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
197 197
 		if ($globalDBdriver == 'mysql') {
198 198
 			if (isset($globalArchive) && $globalArchive === TRUE) {
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 		try {
216 216
 			$sth = $this->db->prepare($query);
217 217
 			$sth->execute();
218
-		} catch(PDOException $e) {
218
+		} catch (PDOException $e) {
219 219
 			echo $e->getMessage();
220 220
 			die;
221 221
 		}
@@ -229,20 +229,20 @@  discard block
 block discarded – undo
229 229
 	* @return Array the spotter information
230 230
 	*
231 231
 	*/
232
-	public function getMinLastLiveSpotterData($coord = array(),$filter = array(), $limit = false, $id = '')
232
+	public function getMinLastLiveSpotterData($coord = array(), $filter = array(), $limit = false, $id = '')
233 233
 	{
234 234
 		global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap3DAircraftsLimit;
235 235
 		date_default_timezone_set('UTC');
236 236
 		$usecoord = false;
237 237
 		if (is_array($coord) && !empty($coord)) {
238
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
239
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
240
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
241
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
238
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
239
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
240
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
241
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
242 242
 			$usecoord = true;
243 243
 		}
244
-		$id = filter_var($id,FILTER_SANITIZE_STRING);
245
-		$filter_query = $this->getFilter($filter,true,true);
244
+		$id = filter_var($id, FILTER_SANITIZE_STRING);
245
+		$filter_query = $this->getFilter($filter, true, true);
246 246
 
247 247
 		if (!isset($globalLiveInterval) || $globalLiveInterval == '') $globalLiveInterval = '200';
248 248
 		if (!isset($globalMap3DAircraftsLimit) || $globalMap3DAircraftsLimit == '') $globalMap3DAircraftsLimit = '300';
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 				WHERE spotter_archive.latitude <> '0' AND spotter_archive.longitude <> '0' 
255 255
 				ORDER BY spotter_archive.flightaware_id, spotter_archive.date";
256 256
 				*/
257
-				$query  = 'SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source, spotter_archive.registration 
257
+				$query = 'SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source, spotter_archive.registration 
258 258
 				FROM spotter_archive INNER JOIN (SELECT flightaware_id FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date) l ON l.flightaware_id = spotter_archive.flightaware_id ";
259 259
 				if ($usecoord) $query .= "AND (spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
260 260
 				if ($id != '') $query .= "OR spotter_archive.flightaware_id = :id ";
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 				ORDER BY flightaware_id, date";
269 269
 				if ($limit) $query .= " LIMIT ".$globalMap3DAircraftsLimit;
270 270
 			} else {
271
-				$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, spotter_live.date, spotter_live.format_source, spotter_live.registration 
271
+				$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, spotter_live.date, spotter_live.format_source, spotter_live.registration 
272 272
 				FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date ";
273 273
 				if ($usecoord) $query .= "AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
274 274
 				if ($id != '') $query .= "OR spotter_live.flightaware_id = :id ";
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 				WHERE spotter_archive.latitude <> '0' AND spotter_archive.longitude <> '0' 
285 285
 				ORDER BY spotter_archive.flightaware_id, spotter_archive.date";
286 286
                                */
287
-				$query  = "SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source, spotter_archive.registration 
287
+				$query = "SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source, spotter_archive.registration 
288 288
 				FROM spotter_archive INNER JOIN (SELECT flightaware_id FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date) l ON l.flightaware_id = spotter_archive.flightaware_id ";
289 289
 				if ($usecoord) $query .= "AND (spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
290 290
 				if ($id != '') $query .= "OR spotter_archive.flightaware_id = :id ";
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
 		try {
312 312
 			$sth = $this->db->prepare($query);
313 313
 			$sth->execute($query_values);
314
-		} catch(PDOException $e) {
314
+		} catch (PDOException $e) {
315 315
 			echo $e->getMessage();
316 316
 			die;
317 317
 		}
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 	public function getLiveSpotterCount($filter = array())
329 329
 	{
330 330
 		global $globalDBdriver, $globalLiveInterval;
331
-		$filter_query = $this->getFilter($filter,true,true);
331
+		$filter_query = $this->getFilter($filter, true, true);
332 332
 
333 333
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
334 334
 		if ($globalDBdriver == 'mysql') {
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
 		try {
342 342
 			$sth = $this->db->prepare($query);
343 343
 			$sth->execute();
344
-		} catch(PDOException $e) {
344
+		} catch (PDOException $e) {
345 345
 			echo $e->getMessage();
346 346
 			die;
347 347
 		}
@@ -364,10 +364,10 @@  discard block
 block discarded – undo
364 364
 		$filter_query = $this->getFilter($filter);
365 365
 
366 366
 		if (is_array($coord)) {
367
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
368
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
369
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
370
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
367
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
368
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
369
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
370
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
371 371
 		} else return array();
372 372
 		if ($globalDBdriver == 'mysql') {
373 373
 			$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;
@@ -390,23 +390,23 @@  discard block
 block discarded – undo
390 390
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
391 391
 		$Spotter = new Spotter($this->db);
392 392
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
393
-		$filter_query = $this->getFilter($filter,true,true);
393
+		$filter_query = $this->getFilter($filter, true, true);
394 394
 
395 395
 		if (is_array($coord)) {
396
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
397
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
398
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
399
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
396
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
397
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
398
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
399
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
400 400
 		} else return array();
401 401
 		if ($globalDBdriver == 'mysql') {
402 402
 			if (isset($globalArchive) && $globalArchive === TRUE) {
403
-				$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.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
403
+				$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.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
404 404
 				FROM spotter_live 
405 405
 				'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= spotter_live.date 
406 406
 				AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.'
407 407
 				AND spotter_live.latitude <> 0 AND spotter_live.longitude <> 0 ORDER BY date DESC';
408 408
 			} else {
409
-				$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.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
409
+				$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.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
410 410
 				FROM spotter_live 
411 411
 				INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate 
412 412
 				    FROM spotter_live l 
@@ -418,14 +418,14 @@  discard block
 block discarded – undo
418 418
 			}
419 419
 		} else {
420 420
 			if (isset($globalArchive) && $globalArchive === TRUE) {
421
-				$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.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
421
+				$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.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
422 422
 				FROM spotter_live 
423 423
 				".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date 
424 424
 				AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." 
425 425
 				AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong." 
426 426
 				AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' ORDER BY date DESC";
427 427
 			} else {
428
-				$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.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
428
+				$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.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
429 429
 				FROM spotter_live 
430 430
 				INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate 
431 431
 				    FROM spotter_live l 
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 		try {
441 441
 			$sth = $this->db->prepare($query);
442 442
 			$sth->execute();
443
-		} catch(PDOException $e) {
443
+		} catch (PDOException $e) {
444 444
 			echo $e->getMessage();
445 445
 			die;
446 446
 		}
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
                 if ($interval == '1m')
490 490
                 {
491 491
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
492
-                } else if ($interval == '15m'){
492
+                } else if ($interval == '15m') {
493 493
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date ';
494 494
                 } 
495 495
             }
@@ -497,14 +497,14 @@  discard block
 block discarded – undo
497 497
          $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';   
498 498
         }
499 499
 
500
-                $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 
500
+                $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 
501 501
                    WHERE spotter_live.latitude <> '' 
502 502
                                    AND spotter_live.longitude <> '' 
503 503
                    ".$additional_query."
504 504
                    HAVING distance < :radius  
505 505
                                    ORDER BY distance";
506 506
 
507
-                $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
507
+                $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius));
508 508
 
509 509
                 return $spotter_array;
510 510
         }
@@ -522,9 +522,9 @@  discard block
 block discarded – undo
522 522
 		date_default_timezone_set('UTC');
523 523
 
524 524
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
525
-                $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';
525
+                $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';
526 526
 
527
-		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true);
527
+		$spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident), '', true);
528 528
 
529 529
 		return $spotter_array;
530 530
 	}
@@ -535,16 +535,16 @@  discard block
 block discarded – undo
535 535
 	* @return Array the spotter information
536 536
 	*
537 537
 	*/
538
-	public function getDateLiveSpotterDataByIdent($ident,$date)
538
+	public function getDateLiveSpotterDataByIdent($ident, $date)
539 539
 	{
540 540
 		$Spotter = new Spotter($this->db);
541 541
 		date_default_timezone_set('UTC');
542 542
 
543 543
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
544
-                $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';
544
+                $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';
545 545
 
546
-                $date = date('c',$date);
547
-		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
546
+                $date = date('c', $date);
547
+		$spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date));
548 548
 
549 549
 		return $spotter_array;
550 550
 	}
@@ -560,8 +560,8 @@  discard block
 block discarded – undo
560 560
 		$Spotter = new Spotter($this->db);
561 561
 		date_default_timezone_set('UTC');
562 562
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
563
-		$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';
564
-		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id),'',true);
563
+		$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';
564
+		$spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id), '', true);
565 565
 		return $spotter_array;
566 566
 	}
567 567
 
@@ -571,15 +571,15 @@  discard block
 block discarded – undo
571 571
 	* @return Array the spotter information
572 572
 	*
573 573
 	*/
574
-	public function getDateLiveSpotterDataById($id,$date)
574
+	public function getDateLiveSpotterDataById($id, $date)
575 575
 	{
576 576
 		$Spotter = new Spotter($this->db);
577 577
 		date_default_timezone_set('UTC');
578 578
 
579 579
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
580
-		$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';
581
-		$date = date('c',$date);
582
-		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
580
+		$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';
581
+		$date = date('c', $date);
582
+		$spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true);
583 583
 		return $spotter_array;
584 584
 	}
585 585
 
@@ -595,13 +595,13 @@  discard block
 block discarded – undo
595 595
 		date_default_timezone_set('UTC');
596 596
 
597 597
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
598
-                $query  = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
598
+                $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
599 599
 
600 600
     		try {
601 601
 			
602 602
 			$sth = $this->db->prepare($query);
603 603
 			$sth->execute(array(':ident' => $ident));
604
-		} catch(PDOException $e) {
604
+		} catch (PDOException $e) {
605 605
 			echo $e->getMessage();
606 606
 			die;
607 607
 		}
@@ -616,7 +616,7 @@  discard block
 block discarded – undo
616 616
 	* @return Array the spotter information
617 617
 	*
618 618
 	*/
619
-	public function getAllLiveSpotterDataById($id,$liveinterval = false)
619
+	public function getAllLiveSpotterDataById($id, $liveinterval = false)
620 620
 	{
621 621
 		global $globalDBdriver, $globalLiveInterval;
622 622
 		date_default_timezone_set('UTC');
@@ -635,7 +635,7 @@  discard block
 block discarded – undo
635 635
 		try {
636 636
 			$sth = $this->db->prepare($query);
637 637
 			$sth->execute(array(':id' => $id));
638
-		} catch(PDOException $e) {
638
+		} catch (PDOException $e) {
639 639
 			echo $e->getMessage();
640 640
 			die;
641 641
 		}
@@ -653,12 +653,12 @@  discard block
 block discarded – undo
653 653
 	{
654 654
 		date_default_timezone_set('UTC');
655 655
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
656
-		$query  = self::$global_query.' WHERE spotter_live.ident = :ident';
656
+		$query = self::$global_query.' WHERE spotter_live.ident = :ident';
657 657
     		try {
658 658
 			
659 659
 			$sth = $this->db->prepare($query);
660 660
 			$sth->execute(array(':ident' => $ident));
661
-		} catch(PDOException $e) {
661
+		} catch (PDOException $e) {
662 662
 			echo $e->getMessage();
663 663
 			die;
664 664
 		}
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
 			
689 689
 			$sth = $this->db->prepare($query);
690 690
 			$sth->execute();
691
-		} catch(PDOException $e) {
691
+		} catch (PDOException $e) {
692 692
 			return "error";
693 693
 		}
694 694
 
@@ -711,14 +711,14 @@  discard block
 block discarded – undo
711 711
 				
712 712
 				$sth = $this->db->prepare($query);
713 713
 				$sth->execute();
714
-			} catch(PDOException $e) {
714
+			} catch (PDOException $e) {
715 715
 				return "error";
716 716
 			}
717 717
 			$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
718 718
                         $i = 0;
719
-                        $j =0;
719
+                        $j = 0;
720 720
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
721
-			foreach($all as $row)
721
+			foreach ($all as $row)
722 722
 			{
723 723
 				$i++;
724 724
 				$j++;
@@ -726,9 +726,9 @@  discard block
 block discarded – undo
726 726
 					if ($globalDebug) echo ".";
727 727
 				    	try {
728 728
 						
729
-						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
729
+						$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
730 730
 						$sth->execute();
731
-					} catch(PDOException $e) {
731
+					} catch (PDOException $e) {
732 732
 						return "error";
733 733
 					}
734 734
                                 	$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
@@ -739,9 +739,9 @@  discard block
 block discarded – undo
739 739
 			if ($i > 0) {
740 740
     				try {
741 741
 					
742
-					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
742
+					$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
743 743
 					$sth->execute();
744
-				} catch(PDOException $e) {
744
+				} catch (PDOException $e) {
745 745
 					return "error";
746 746
 				}
747 747
 			}
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
 				
755 755
 				$sth = $this->db->prepare($query);
756 756
 				$sth->execute();
757
-			} catch(PDOException $e) {
757
+			} catch (PDOException $e) {
758 758
 				return "error";
759 759
 			}
760 760
 /*			$query_delete = "DELETE FROM spotter_live WHERE flightaware_id IN (";
@@ -802,13 +802,13 @@  discard block
 block discarded – undo
802 802
 	public function deleteLiveSpotterDataByIdent($ident)
803 803
 	{
804 804
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
805
-		$query  = 'DELETE FROM spotter_live WHERE ident = :ident';
805
+		$query = 'DELETE FROM spotter_live WHERE ident = :ident';
806 806
         
807 807
     		try {
808 808
 			
809 809
 			$sth = $this->db->prepare($query);
810 810
 			$sth->execute(array(':ident' => $ident));
811
-		} catch(PDOException $e) {
811
+		} catch (PDOException $e) {
812 812
 			return "error";
813 813
 		}
814 814
 
@@ -824,13 +824,13 @@  discard block
 block discarded – undo
824 824
 	public function deleteLiveSpotterDataById($id)
825 825
 	{
826 826
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
827
-		$query  = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
827
+		$query = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
828 828
         
829 829
     		try {
830 830
 			
831 831
 			$sth = $this->db->prepare($query);
832 832
 			$sth->execute(array(':id' => $id));
833
-		} catch(PDOException $e) {
833
+		} catch (PDOException $e) {
834 834
 			return "error";
835 835
 		}
836 836
 
@@ -848,13 +848,13 @@  discard block
 block discarded – undo
848 848
 	{
849 849
 		global $globalDBdriver, $globalTimezone;
850 850
 		if ($globalDBdriver == 'mysql') {
851
-			$query  = 'SELECT spotter_live.ident FROM spotter_live 
851
+			$query = 'SELECT spotter_live.ident FROM spotter_live 
852 852
 				WHERE spotter_live.ident = :ident 
853 853
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
854 854
 				AND spotter_live.date < UTC_TIMESTAMP()';
855 855
 			$query_data = array(':ident' => $ident);
856 856
 		} else {
857
-			$query  = "SELECT spotter_live.ident FROM spotter_live 
857
+			$query = "SELECT spotter_live.ident FROM spotter_live 
858 858
 				WHERE spotter_live.ident = :ident 
859 859
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
860 860
 				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -863,8 +863,8 @@  discard block
 block discarded – undo
863 863
 		
864 864
 		$sth = $this->db->prepare($query);
865 865
 		$sth->execute($query_data);
866
-		$ident_result='';
867
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
866
+		$ident_result = '';
867
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
868 868
 		{
869 869
 			$ident_result = $row['ident'];
870 870
 		}
@@ -881,13 +881,13 @@  discard block
 block discarded – undo
881 881
 	{
882 882
 		global $globalDBdriver, $globalTimezone;
883 883
 		if ($globalDBdriver == 'mysql') {
884
-			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
884
+			$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
885 885
 				WHERE spotter_live.ident = :ident 
886 886
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 MINUTE)'; 
887 887
 //				AND spotter_live.date < UTC_TIMESTAMP()";
888 888
 			$query_data = array(':ident' => $ident);
889 889
 		} else {
890
-			$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
890
+			$query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
891 891
 				WHERE spotter_live.ident = :ident 
892 892
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '20 MINUTES'";
893 893
 //				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -896,8 +896,8 @@  discard block
 block discarded – undo
896 896
 		
897 897
 		$sth = $this->db->prepare($query);
898 898
 		$sth->execute($query_data);
899
-		$ident_result='';
900
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
899
+		$ident_result = '';
900
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
901 901
 		{
902 902
 			$ident_result = $row['flightaware_id'];
903 903
 		}
@@ -914,13 +914,13 @@  discard block
 block discarded – undo
914 914
 	{
915 915
 		global $globalDBdriver, $globalTimezone;
916 916
 		if ($globalDBdriver == 'mysql') {
917
-			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
917
+			$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
918 918
 				WHERE spotter_live.flightaware_id = :id 
919 919
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; 
920 920
 //				AND spotter_live.date < UTC_TIMESTAMP()";
921 921
 			$query_data = array(':id' => $id);
922 922
 		} else {
923
-			$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
923
+			$query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
924 924
 				WHERE spotter_live.flightaware_id = :id 
925 925
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'";
926 926
 //				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -929,8 +929,8 @@  discard block
 block discarded – undo
929 929
 		
930 930
 		$sth = $this->db->prepare($query);
931 931
 		$sth->execute($query_data);
932
-		$ident_result='';
933
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
932
+		$ident_result = '';
933
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
934 934
 		{
935 935
 			$ident_result = $row['flightaware_id'];
936 936
 		}
@@ -947,13 +947,13 @@  discard block
 block discarded – undo
947 947
 	{
948 948
 		global $globalDBdriver, $globalTimezone;
949 949
 		if ($globalDBdriver == 'mysql') {
950
-			$query  = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
950
+			$query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
951 951
 				WHERE spotter_live.ModeS = :modes 
952 952
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 MINUTE)'; 
953 953
 //				AND spotter_live.date < UTC_TIMESTAMP()";
954 954
 			$query_data = array(':modes' => $modes);
955 955
 		} else {
956
-			$query  = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
956
+			$query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
957 957
 				WHERE spotter_live.ModeS = :modes 
958 958
 				AND spotter_live.date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 MINUTE'";
959 959
 //			//	AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
@@ -962,8 +962,8 @@  discard block
 block discarded – undo
962 962
 		
963 963
 		$sth = $this->db->prepare($query);
964 964
 		$sth->execute($query_data);
965
-		$ident_result='';
966
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
965
+		$ident_result = '';
966
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
967 967
 		{
968 968
 			//$ident_result = $row['spotter_live_id'];
969 969
 			$ident_result = $row['flightaware_id'];
@@ -988,8 +988,8 @@  discard block
 block discarded – undo
988 988
 				return array();
989 989
 			} else {
990 990
 				$q_array = explode(" ", $q);
991
-				foreach ($q_array as $q_item){
992
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
991
+				foreach ($q_array as $q_item) {
992
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
993 993
 					$additional_query .= " AND (";
994 994
 					$additional_query .= "(spotter_live.aircraft_icao like '%".$q_item."%') OR ";
995 995
 					$additional_query .= "(spotter_live.aircraft_name like '%".$q_item."%') OR ";
@@ -1004,11 +1004,11 @@  discard block
 block discarded – undo
1004 1004
 			}
1005 1005
 		}
1006 1006
 		if ($globalDBdriver == 'mysql') {
1007
-			$query  = "SELECT spotter_live.* FROM spotter_live 
1007
+			$query = "SELECT spotter_live.* FROM spotter_live 
1008 1008
 			    WHERE spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." 
1009 1009
 			    AND spotter_live.date < UTC_TIMESTAMP()";
1010 1010
 		} else {
1011
-			$query  = "SELECT spotter_live.* FROM spotter_live 
1011
+			$query = "SELECT spotter_live.* FROM spotter_live 
1012 1012
 			    WHERE spotter_live.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." 
1013 1013
 			    AND spotter_live.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
1014 1014
 		}
@@ -1028,7 +1028,7 @@  discard block
 block discarded – undo
1028 1028
 	* @return String success or false
1029 1029
 	*
1030 1030
 	*/
1031
-	public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '',$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 = '')
1031
+	public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '', $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 = '')
1032 1032
 	{
1033 1033
 		global $globalURL, $globalArchive, $globalDebug;
1034 1034
 		$Common = new Common();
@@ -1128,27 +1128,27 @@  discard block
 block discarded – undo
1128 1128
 		if ($date == '') $date = date("Y-m-d H:i:s", time());
1129 1129
 
1130 1130
         
1131
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
1132
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
1133
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
1134
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
1135
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
1136
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1137
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1138
-		$waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING);
1139
-		$altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1140
-		$altitude_real = filter_var($altitude_real,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1141
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
1142
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1143
-		$squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT);
1144
-		$route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING);
1145
-		$ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING);
1146
-		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING);
1147
-		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
1148
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
1149
-		$source_name = filter_var($source_name,FILTER_SANITIZE_STRING);
1150
-		$over_country = filter_var($over_country,FILTER_SANITIZE_STRING);
1151
-		$verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT);
1131
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
1132
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
1133
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
1134
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
1135
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
1136
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1137
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1138
+		$waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING);
1139
+		$altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1140
+		$altitude_real = filter_var($altitude_real, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1141
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
1142
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1143
+		$squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT);
1144
+		$route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING);
1145
+		$ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING);
1146
+		$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING);
1147
+		$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
1148
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
1149
+		$source_name = filter_var($source_name, FILTER_SANITIZE_STRING);
1150
+		$over_country = filter_var($over_country, FILTER_SANITIZE_STRING);
1151
+		$verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT);
1152 1152
 
1153 1153
 		$airline_name = '';
1154 1154
 		$airline_icao = '';
@@ -1170,10 +1170,10 @@  discard block
 block discarded – undo
1170 1170
 		$arrival_airport_country = '';
1171 1171
 		
1172 1172
             	
1173
-            	if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
1174
-            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
1175
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
1176
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
1173
+            	if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
1174
+            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
1175
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
1176
+            	if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
1177 1177
 		
1178 1178
 		$query = '';
1179 1179
 		if ($globalArchive) {
@@ -1184,19 +1184,19 @@  discard block
 block discarded – undo
1184 1184
 		$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, real_altitude) 
1185 1185
 		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, :real_altitude)';
1186 1186
 
1187
-		$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,':real_altitude' => $altitude_real);
1187
+		$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, ':real_altitude' => $altitude_real);
1188 1188
 		try {
1189 1189
 			
1190 1190
 			$sth = $this->db->prepare($query);
1191 1191
 			$sth->execute($query_values);
1192 1192
 			$sth->closeCursor();
1193
-		} catch(PDOException $e) {
1193
+		} catch (PDOException $e) {
1194 1194
 			return "error : ".$e->getMessage();
1195 1195
 		}
1196 1196
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
1197 1197
 		    if ($globalDebug) echo '(Add to SBS archive : ';
1198 1198
 		    $SpotterArchive = new SpotterArchive($this->db);
1199
-		    $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, $altitude_real,$heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country);
1199
+		    $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, $altitude_real, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name, $verticalrate, $format_source, $source_name, $over_country);
1200 1200
 		    if ($globalDebug) echo $result.')';
1201 1201
 		} elseif ($globalDebug && $putinarchive !== true) {
1202 1202
 			echo '(Not adding to archive)';
@@ -1209,7 +1209,7 @@  discard block
 block discarded – undo
1209 1209
 
1210 1210
 	public function getOrderBy()
1211 1211
 	{
1212
-		$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"));
1212
+		$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"));
1213 1213
 		return $orderby;
1214 1214
 	}
1215 1215
 
Please login to merge, or discard this patch.