Completed
Push — master ( c6a0c8...02f1f2 )
by Yannick
32:23
created
live-czml.php 2 patches
Spacing   +83 added lines, -83 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,18 +84,18 @@  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);
98
-if (isset($_COOKIE['filter_race']) && $_COOKIE['filter_race'] != 'all') $filter['race'] = filter_var($_COOKIE['filter_race'],FILTER_SANITIZE_NUMBER_INT);
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
+if (isset($_COOKIE['filter_race']) && $_COOKIE['filter_race'] != 'all') $filter['race'] = filter_var($_COOKIE['filter_race'], FILTER_SANITIZE_NUMBER_INT);
99 99
 /*
100 100
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
101 101
 	$min = true;
@@ -142,17 +142,17 @@  discard block
 block discarded – undo
142 142
 	$from_archive = true;
143 143
 //	$begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
144 144
 //	$enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
145
-	$begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT);
146
-	$enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT);
147
-	$archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT);
148
-	$begindate = date('Y-m-d H:i:s',$begindate);
149
-	$enddate = date('Y-m-d H:i:s',$enddate);
145
+	$begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT);
146
+	$enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT);
147
+	$archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT);
148
+	$begindate = date('Y-m-d H:i:s', $begindate);
149
+	$enddate = date('Y-m-d H:i:s', $enddate);
150 150
 	if ($tracker) {
151
-		$spotter_array = $TrackerArchive->getMinLiveTrackerDataPlayback($begindate,$enddate,$filter);
151
+		$spotter_array = $TrackerArchive->getMinLiveTrackerDataPlayback($begindate, $enddate, $filter);
152 152
 	} elseif ($marine) {
153
-		$spotter_array = $MarineArchive->getMinLiveMarineDataPlayback($begindate,$enddate,$filter);
153
+		$spotter_array = $MarineArchive->getMinLiveMarineDataPlayback($begindate, $enddate, $filter);
154 154
 	} else {
155
-		$spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter);
155
+		$spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate, $enddate, $filter);
156 156
 	}
157 157
 } elseif (isset($_COOKIE['archive']) && isset($_COOKIE['archive_begin']) && isset($_COOKIE['archive_end']) && isset($_COOKIE['archive_speed'])) {
158 158
 	$from_archive = true;
@@ -169,36 +169,36 @@  discard block
 block discarded – undo
169 169
 	}
170 170
 	$enddate = $_COOKIE['archive_end'];
171 171
 	$enddateinitial = $_COOKIE['archive_end'];
172
-	$archivespeed = filter_var($_COOKIE['archive_speed'],FILTER_SANITIZE_NUMBER_INT);
173
-	$begindate = date('Y-m-d H:i:s',$begindate);
174
-	$enddate = date('Y-m-d H:i:s',$enddate);
172
+	$archivespeed = filter_var($_COOKIE['archive_speed'], FILTER_SANITIZE_NUMBER_INT);
173
+	$begindate = date('Y-m-d H:i:s', $begindate);
174
+	$enddate = date('Y-m-d H:i:s', $enddate);
175 175
 	//echo 'Begin : '.$begindate.' - End : '.$enddate."\n";
176 176
 	if ($tracker) {
177
-		$spotter_array = $TrackerArchive->getMinLiveTrackerData($begindate,$enddate,$filter);
177
+		$spotter_array = $TrackerArchive->getMinLiveTrackerData($begindate, $enddate, $filter);
178 178
 	} elseif ($marine) {
179
-		$spotter_array = $MarineArchive->getMinLiveMarineData($begindate,$enddate,$filter);
179
+		$spotter_array = $MarineArchive->getMinLiveMarineData($begindate, $enddate, $filter);
180 180
 	} else {
181
-		$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter);
181
+		$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter);
182 182
 	}
183 183
 } elseif ($tracker) {
184 184
 	$coord = array();
185 185
 	if (isset($_GET['coord']) && $_GET['coord'] != '') {
186
-		$coord = explode(',',$_GET['coord']);
187
-		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) 
186
+		$coord = explode(',', $_GET['coord']);
187
+		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) 
188 188
 		    && $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)) {
189 189
 			$coord = array();
190 190
 		}
191 191
 	}
192 192
 	$previous_filter = $filter;
193 193
 	if ((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrackTracker']) && $_COOKIE['MapTrackTracker'] != '')) {
194
-		$filter = array_merge($filter,array('id' => $_COOKIE['MapTrackTracker']));
195
-		$spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord,$filter,false);
194
+		$filter = array_merge($filter, array('id' => $_COOKIE['MapTrackTracker']));
195
+		$spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord, $filter, false);
196 196
 	/*
197 197
 	} elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && !empty($coord)) {
198 198
 		$spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord,$filter,true,$_COOKIE['MapTrack']);
199 199
 	*/
200 200
 	} elseif (!isset($_COOKIE['singlemodel']) || $_COOKIE['singlemodel'] == 'false') {
201
-		$spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord,$filter,false);
201
+		$spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord, $filter, false);
202 202
 	} else {
203 203
 		$spotter_array = array();
204 204
 	}
@@ -207,20 +207,20 @@  discard block
 block discarded – undo
207 207
 	$coord = array();
208 208
 	//if (isset($_GET['coord']) && $_GET['coord'] != '') {
209 209
 	if (!((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrackMarine']) && $_COOKIE['MapTrackMarine'] != '')) && isset($_GET['coord']) && $_GET['coord'] != '') {
210
-		$coord = explode(',',$_GET['coord']);
211
-		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
+		$coord = explode(',', $_GET['coord']);
211
+		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) 
212 212
 		    && $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)) {
213 213
 			$coord = array();
214 214
 		}
215 215
 	}
216 216
 	$previous_filter = $filter;
217 217
 	if ((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrackMarine']) && $_COOKIE['MapTrackMarine'] != '')) {
218
-		$filter = array_merge($filter,array('id' => $_COOKIE['MapTrackMarine']));
219
-		$spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,false);
218
+		$filter = array_merge($filter, array('id' => $_COOKIE['MapTrackMarine']));
219
+		$spotter_array = $MarineLive->getMinLastLiveMarineData($coord, $filter, false);
220 220
 	} elseif (isset($_COOKIE['MapTrackMarine']) && $_COOKIE['MapTrackMarine'] != '' && !empty($coord)) {
221
-		$spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,false,$_COOKIE['MapTrack']);
221
+		$spotter_array = $MarineLive->getMinLastLiveMarineData($coord, $filter, false, $_COOKIE['MapTrack']);
222 222
 	} elseif (!isset($_COOKIE['singlemodel']) || $_COOKIE['singlemodel'] == 'false') {
223
-		$spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,false);
223
+		$spotter_array = $MarineLive->getMinLastLiveMarineData($coord, $filter, false);
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,false);
239
+		$filter = array_merge($filter, array('id' => $_COOKIE['MapTrack']));
240
+		$spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord, $filter, false);
241 241
 	} elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && !empty($coord)) {
242
-		$spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,false,$_COOKIE['MapTrack']);
242
+		$spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord, $filter, false, $_COOKIE['MapTrack']);
243 243
 	} elseif (!isset($_COOKIE['singlemodel']) || $_COOKIE['singlemodel'] == 'false') {
244
-		$spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,false);
244
+		$spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord, $filter, false);
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 = $TrackerArchive->getLiveTrackerCount($begindate,$enddate,$filter);
254
+			$flightcnt = $TrackerArchive->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 = $MarineArchive->getLiveMarineCount($begindate,$enddate,$filter);
260
+			$flightcnt = $MarineArchive->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,16 +393,16 @@  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 402
 				if (isset($spotter_item['captain_name'])) $output .= '"captain": '.json_encode($spotter_item['captain_name']).',';
403 403
 				if (isset($spotter_item['race_name'])) $output .= '"race": '.json_encode($spotter_item['race_name']).',';
404 404
 				if (isset($spotter_item['race_rank'])) $output .= '"rank": "'.$spotter_item['race_rank'].'",';
405
-				$output.= '"type": "marine"';
405
+				$output .= '"type": "marine"';
406 406
 			} else {
407 407
 				if ($one3dmodel === false && isset($globalMap3DLiveries) && $globalMap3DLiveries) {
408 408
 					$aircraft_icao = $spotter_item['aircraft_icao'];
@@ -416,14 +416,14 @@  discard block
 block discarded – undo
416 416
 						if (isset($airline_icao)) {
417 417
 							$imagefile = $aircraft_icao.'-'.$airline_icao.'.png';
418 418
 							if (file_exists(dirname(__FILE__).'/models/gltf2/liveries/'.$imagefile)) {
419
-								$output.= '"liveries": "'.$globalURL.'/models/gltf2/liveries/'.$imagefile.'",';
419
+								$output .= '"liveries": "'.$globalURL.'/models/gltf2/liveries/'.$imagefile.'",';
420 420
 							}
421 421
 						}
422 422
 					}
423 423
 					//if ($ident != '') $output.= '"ident": "'.$ident.'",';
424 424
 				}
425
-				$output.= '"gltf2": %gltf2%,';
426
-				$output.= '"type": "flight"';
425
+				$output .= '"gltf2": %gltf2%,';
426
+				$output .= '"type": "flight"';
427 427
 			}
428 428
 			$output .= '},';
429 429
 
@@ -798,8 +798,8 @@  discard block
 block discarded – undo
798 798
 					$output .= '},';
799 799
 				}
800 800
 			}
801
-			if (isset($onground) && $onground) $output = str_replace('%onground%','true',$output);
802
-			else $output = str_replace('%onground%','false',$output);
801
+			if (isset($onground) && $onground) $output = str_replace('%onground%', 'true', $output);
802
+			else $output = str_replace('%onground%', 'false', $output);
803 803
 
804 804
 	//		$output .= '"heightReference": "CLAMP_TO_GROUND",';
805 805
 			//$output .= '"heightReference": "'.$heightrelative.'",';
@@ -815,7 +815,7 @@  discard block
 block discarded – undo
815 815
 			if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']);
816 816
 			if (isset($_COOKIE['MapTrack']) && $id == $_COOKIE['MapTrack'] && $minitracktime > strtotime($spotter_item['date'])) $minitracktime = strtotime($spotter_item['date']);
817 817
 			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
818
-			$output .= '"'.date("c",strtotime($spotter_item['date'])).'", ';
818
+			$output .= '"'.date("c", strtotime($spotter_item['date'])).'", ';
819 819
 			$output .= $spotter_item['longitude'].', ';
820 820
 			$output .= $spotter_item['latitude'];
821 821
 			$prevlong = $spotter_item['longitude'];
@@ -843,8 +843,8 @@  discard block
 block discarded – undo
843 843
 			//$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0));
844 844
 			//$orientation .= '"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w'];
845 845
 		} else {
846
-			$nblatlong = $nblatlong+1;
847
-			$output .= ',"'.date("c",strtotime($spotter_item['date'])).'", ';
846
+			$nblatlong = $nblatlong + 1;
847
+			$output .= ',"'.date("c", strtotime($spotter_item['date'])).'", ';
848 848
 			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
849 849
 			if ($spotter_item['ground_speed'] == 0) {
850 850
 				$output .= $prevlong.', ';
@@ -885,26 +885,26 @@  discard block
 block discarded – undo
885 885
 $output .= ']';
886 886
 if (isset($globalArchive) && $globalArchive === TRUE) {
887 887
 	if (isset($begindateinitial)) {
888
-		$output = str_replace('%minitime%',date("c",$begindateinitial),$output);
889
-	} elseif ((time()-$globalLiveInterval) > $minitime) {
890
-		if (time()-$globalLiveInterval > $maxitime) {
891
-			$output = str_replace('%minitime%',date("c",$maxitime),$output);
888
+		$output = str_replace('%minitime%', date("c", $begindateinitial), $output);
889
+	} elseif ((time() - $globalLiveInterval) > $minitime) {
890
+		if (time() - $globalLiveInterval > $maxitime) {
891
+			$output = str_replace('%minitime%', date("c", $maxitime), $output);
892 892
 		} else {
893
-			$output = str_replace('%minitime%',date("c",time()-$globalLiveInterval),$output);
893
+			$output = str_replace('%minitime%', date("c", time() - $globalLiveInterval), $output);
894 894
 		}
895 895
 	}
896
-	else $output = str_replace('%minitime%',date("c",$minitime),$output);
896
+	else $output = str_replace('%minitime%', date("c", $minitime), $output);
897 897
 } elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && $minitracktime != $minitracktime_begin) {
898
-	$output = str_replace('%minitime%',date("c",$minitracktime),$output);
898
+	$output = str_replace('%minitime%', date("c", $minitracktime), $output);
899 899
 } else {
900
-	$output = str_replace('%minitime%',date("c",$minitime),$output);
900
+	$output = str_replace('%minitime%', date("c", $minitime), $output);
901 901
 }
902 902
 if (isset($enddateinitial)) {
903
-	$output = str_replace('%maxitime%',date("c",$enddateinitial),$output);
903
+	$output = str_replace('%maxitime%', date("c", $enddateinitial), $output);
904 904
 } else {
905
-	$output = str_replace('%maxitime%',date("c",$maxitime),$output);
905
+	$output = str_replace('%maxitime%', date("c", $maxitime), $output);
906 906
 }
907
-if ($gltf2) $output = str_replace('%gltf2%','true',$output);
908
-else $output = str_replace('%gltf2%','false',$output);
907
+if ($gltf2) $output = str_replace('%gltf2%', 'true', $output);
908
+else $output = str_replace('%gltf2%', 'false', $output);
909 909
 print $output;
910 910
 ?>
Please login to merge, or discard this patch.
Braces   +144 added lines, -52 removed lines patch added patch discarded remove patch
@@ -19,8 +19,12 @@  discard block
 block discarded – undo
19 19
 }
20 20
 $tracker = false;
21 21
 $marine = false;
22
-if (isset($_GET['tracker'])) $tracker = true;
23
-if (isset($_GET['marine'])) $marine = true;
22
+if (isset($_GET['tracker'])) {
23
+	$tracker = true;
24
+}
25
+if (isset($_GET['marine'])) {
26
+	$marine = true;
27
+}
24 28
 if ($tracker) {
25 29
 	require_once('require/class.Tracker.php');
26 30
 	require_once('require/class.TrackerLive.php');
@@ -77,25 +81,52 @@  discard block
 block discarded – undo
77 81
 }
78 82
 header('Content-Type: text/javascript');
79 83
 
80
-if (!isset($globalJsonCompress)) $compress = true;
81
-else $compress = $globalJsonCompress;
84
+if (!isset($globalJsonCompress)) {
85
+	$compress = true;
86
+} else {
87
+	$compress = $globalJsonCompress;
88
+}
82 89
 
83 90
 $from_archive = false;
84 91
 $min = false;
85 92
 $allhistory = false;
86 93
 $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);
98
-if (isset($_COOKIE['filter_race']) && $_COOKIE['filter_race'] != 'all') $filter['race'] = filter_var($_COOKIE['filter_race'],FILTER_SANITIZE_NUMBER_INT);
94
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') {
95
+	$filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
96
+}
97
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') {
98
+	$filter['source'] = array_merge($filter['source'],array('whazzup'));
99
+}
100
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') {
101
+	$filter['source'] = array_merge($filter['source'],array('phpvmacars'));
102
+}
103
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') {
104
+	$filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
105
+}
106
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') {
107
+	$filter['source'] = array_merge($filter['source'],array('aprs'));
108
+}
109
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') {
110
+	$filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
111
+}
112
+if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') {
113
+	$filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
114
+}
115
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') {
116
+	$filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
117
+}
118
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') {
119
+	$filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
120
+}
121
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') {
122
+	$filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
123
+}
124
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') {
125
+	$filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
126
+}
127
+if (isset($_COOKIE['filter_race']) && $_COOKIE['filter_race'] != 'all') {
128
+	$filter['race'] = filter_var($_COOKIE['filter_race'],FILTER_SANITIZE_NUMBER_INT);
129
+}
99 130
 /*
100 131
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
101 132
 	$min = true;
@@ -268,8 +299,12 @@  discard block
 block discarded – undo
268 299
 			$flightcnt = $SpotterLive->getLiveSpotterCount($filter);
269 300
 		}
270 301
 	}
271
-	if ($flightcnt == '') $flightcnt = 0;
272
-} else $flightcnt = 0;
302
+	if ($flightcnt == '') {
303
+		$flightcnt = 0;
304
+	}
305
+	} else {
306
+	$flightcnt = 0;
307
+}
273 308
 
274 309
 $sqltime = round(microtime(true)-$begintime,2);
275 310
 $minitime = time();
@@ -315,7 +350,9 @@  discard block
 block discarded – undo
315 350
 $gltf2 = false;
316 351
 $scale = 1.0;
317 352
 $minimumpixelsize = 20;
318
-if (isset($archivespeed)) $speed = $archivespeed;
353
+if (isset($archivespeed)) {
354
+	$speed = $archivespeed;
355
+}
319 356
 $output = '[';
320 357
 if ($tracker) {
321 358
 	$output .= '{"id" : "document", "name" : "tracker","version" : "1.0"';
@@ -351,9 +388,13 @@  discard block
 block discarded – undo
351 388
 			$image = "images/placeholder_thumb.png";
352 389
 		}
353 390
 
354
-                if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id'];
355
-                elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid'];
356
-                elseif (isset($spotter_item['fammarine_id'])) $id = $spotter_item['fammarine_id'];
391
+                if (isset($spotter_item['flightaware_id'])) {
392
+                	$id = $spotter_item['flightaware_id'];
393
+                } elseif (isset($spotter_item['famtrackid'])) {
394
+                	$id = $spotter_item['famtrackid'];
395
+                } elseif (isset($spotter_item['fammarine_id'])) {
396
+                	$id = $spotter_item['fammarine_id'];
397
+                }
357 398
                 if ($prev_flightaware_id != $id) {
358 399
 			if ($prev_flightaware_id != '') {
359 400
 				/*
@@ -391,17 +432,33 @@  discard block
 block discarded – undo
391 432
 			if (isset($spotter_item['squawk'])) {
392 433
 				$output .= '"squawk": "'.$spotter_item['squawk'].'",';
393 434
 			}
394
-			if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",';
395
-			if (isset($spotter_item['format_source'])) $output .= '"format": "'.$spotter_item['format_source'].'",';
396
-			if (isset($spotter_item['ident'])) $output.= '"ident": "'.$spotter_item['ident'].'",';
435
+			if (isset($spotter_item['registration'])) {
436
+				$output .= '"registration": "'.$spotter_item['registration'].'",';
437
+			}
438
+			if (isset($spotter_item['format_source'])) {
439
+				$output .= '"format": "'.$spotter_item['format_source'].'",';
440
+			}
441
+			if (isset($spotter_item['ident'])) {
442
+				$output.= '"ident": "'.$spotter_item['ident'].'",';
443
+			}
397 444
 			if ($tracker) {
398
-				if (isset($spotter_item['type'])) $output .= '"tracker_type": "'.$spotter_item['type'].'",';
445
+				if (isset($spotter_item['type'])) {
446
+					$output .= '"tracker_type": "'.$spotter_item['type'].'",';
447
+				}
399 448
 				$output.= '"type": "tracker"';
400 449
 			} elseif ($marine) {
401
-				if (isset($spotter_item['type'])) $output .= '"marine_type": "'.$spotter_item['type'].'",';
402
-				if (isset($spotter_item['captain_name'])) $output .= '"captain": '.json_encode($spotter_item['captain_name']).',';
403
-				if (isset($spotter_item['race_name'])) $output .= '"race": '.json_encode($spotter_item['race_name']).',';
404
-				if (isset($spotter_item['race_rank'])) $output .= '"rank": "'.$spotter_item['race_rank'].'",';
450
+				if (isset($spotter_item['type'])) {
451
+					$output .= '"marine_type": "'.$spotter_item['type'].'",';
452
+				}
453
+				if (isset($spotter_item['captain_name'])) {
454
+					$output .= '"captain": '.json_encode($spotter_item['captain_name']).',';
455
+				}
456
+				if (isset($spotter_item['race_name'])) {
457
+					$output .= '"race": '.json_encode($spotter_item['race_name']).',';
458
+				}
459
+				if (isset($spotter_item['race_rank'])) {
460
+					$output .= '"rank": "'.$spotter_item['race_rank'].'",';
461
+				}
405 462
 				$output.= '"type": "marine"';
406 463
 			} else {
407 464
 				if ($one3dmodel === false && isset($globalMap3DLiveries) && $globalMap3DLiveries) {
@@ -452,7 +509,9 @@  discard block
 block discarded – undo
452 509
 							$spotter_item['engine_type'] = $aircraft_info[0]['engine_type'];
453 510
 							$spotter_item['wake_category'] = $aircraft_info[0]['wake_category'];
454 511
 							$spotter_item['engine_count'] = $aircraft_info[0]['engine_count'];
455
-						} else $aircraft_shadow = '';
512
+						} else {
513
+							$aircraft_shadow = '';
514
+						}
456 515
 	    					$output .= ' "billboard" : {"image" : "'.$globalURL.'/images/aircrafts/new/'.$aircraft_shadow.'","scale" : 0.5';
457 516
 						if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true' && isset($_COOKIE['IconColor'])) {
458 517
 							$rgb = $Common->hex2rgb($_COOKIE['IconColor']);
@@ -460,7 +519,9 @@  discard block
 block discarded – undo
460 519
 						}
461 520
 						$output .= '},';
462 521
 					}
463
-				} else $output .= ' "billboard" : {"image" : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAfCAYAAACVgY94AAAACXBIWXMAAC4jAAAuIwF4pT92AAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK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GRqK9LnduVPRIu2BPqwD65IYbS7Qpql7Ql9YoJcy9bwzkgPrfOCj5G33+h54E/g0PAr5thq4ApgyEgNrc27aWwVaPTA1QJ4BjgTGFvhteV40EgPrgvTP7qlmZqFnl9WD+b2posN83E/NrEkOjlI/U1fkfUYa/pe5IE3qZPW8jFOqiyN7p3pAPX04c7AxYSoDDcAjKT2LgLXA6IR2M3Bviv59wDTgQGTPH84Qd8+HXfHcoUws2zM0HMjuUPep+xP2PWpnwtw0GJsldbBpewQwE/gbeDyt7H1gcW53O7AC+A3Yn6+/W+Ld9SnWA15DAVhc8xK2TuA9YHrCuhV4EngFuBx4YagG6qv8cF+T52kB2Zy+e1I8taUacNV+uBdXO7ABmJwJpwx8XQvF9TUCWM64tiQhbq/oMv+7BwFWpQzNT8vbVQul/wwAGzzdmXU1xuUAAAAASUVORK5CYII=","scale" : 0.5},';
522
+				} else {
523
+					$output .= ' "billboard" : {"image" : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAfCAYAAACVgY94AAAACXBIWXMAAC4jAAAuIwF4pT92AAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAK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taUacNV+uBdXO7ABmJwJpwx8XQvF9TUCWM64tiQhbq/oMv+7BwFWpQzNT8vbVQul/wwAGzzdmXU1xuUAAAAASUVORK5CYII=","scale" : 0.5},';
524
+				}
464 525
 			} elseif ($one3dmodel) {
465 526
 				if (isset($globalMap3DForceModel) && $globalMap3DForceModel != '') {
466 527
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$globalMap3DForceModel.'","scale" : '.$scale.',"minimumPixelSize": '.$minimumpixelsize.'';
@@ -500,7 +561,9 @@  discard block
 block discarded – undo
500 561
 							$spotter_item['engine_type'] = $aircraft_info[0]['engine_type'];
501 562
 							$spotter_item['wake_category'] = $aircraft_info[0]['wake_category'];
502 563
 							$spotter_item['engine_count'] = $aircraft_info[0]['engine_count'];
503
-						} else $aircraft_shadow = '';
564
+						} else {
565
+							$aircraft_shadow = '';
566
+						}
504 567
 						if ($aircraft_shadow != '') {
505 568
 							if (isset($modelsdb2[$aircraft_shadow])) {
506 569
 								$output .= '"model": {"gltf" : "'.$globalURL.'/models/gltf2/'.$modelsdb2[$aircraft_shadow]['glb'].'","scale" : '.$scale.',"minimumPixelSize": '.$modelsdb2[$aircraft_shadow]['size'];
@@ -655,7 +718,9 @@  discard block
 block discarded – undo
655 718
 								}
656 719
 								$output .= '},';
657 720
 								//if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
658
-								if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
721
+								if ($spotter_item['aircraft_icao'] != '') {
722
+									$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
723
+								}
659 724
 								$modelsdb[$aircraft_icao] = 'Cesium_Air.glb';
660 725
 							}
661 726
 						} elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') {
@@ -677,7 +742,9 @@  discard block
 block discarded – undo
677 742
 							}
678 743
 							$output .= '},';
679 744
 							//if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
680
-							if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
745
+							if ($spotter_item['aircraft_icao'] != '') {
746
+								$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
747
+							}
681 748
 							$modelsdb[$aircraft_icao] = 'Cesium_Air.glb';
682 749
 						}
683 750
 					} else {
@@ -690,7 +757,9 @@  discard block
 block discarded – undo
690 757
 						}
691 758
 						$output .= '},';
692 759
 						//if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
693
-						if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
760
+						if ($spotter_item['aircraft_icao'] != '') {
761
+							$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
762
+						}
694 763
 						$modelsdb[$aircraft_icao] = 'Cesium_Air.glb';
695 764
 					}
696 765
 				} elseif ($tracker && isset($spotter_item['type'])) {
@@ -798,8 +867,11 @@  discard block
 block discarded – undo
798 867
 					$output .= '},';
799 868
 				}
800 869
 			}
801
-			if (isset($onground) && $onground) $output = str_replace('%onground%','true',$output);
802
-			else $output = str_replace('%onground%','false',$output);
870
+			if (isset($onground) && $onground) {
871
+				$output = str_replace('%onground%','true',$output);
872
+			} else {
873
+				$output = str_replace('%onground%','false',$output);
874
+			}
803 875
 
804 876
 	//		$output .= '"heightReference": "CLAMP_TO_GROUND",';
805 877
 			//$output .= '"heightReference": "'.$heightrelative.'",';
@@ -812,9 +884,15 @@  discard block
 block discarded – undo
812 884
 	//		$output .= '"interpolationDegree" : 5,';
813 885
 	//		$output .= '"epoch" : "'.date("c",strtotime($spotter_item['date'])).'", ';
814 886
 			$output .= '"cartographicDegrees": [';
815
-			if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']);
816
-			if (isset($_COOKIE['MapTrack']) && $id == $_COOKIE['MapTrack'] && $minitracktime > strtotime($spotter_item['date'])) $minitracktime = strtotime($spotter_item['date']);
817
-			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
887
+			if ($minitime > strtotime($spotter_item['date'])) {
888
+				$minitime = strtotime($spotter_item['date']);
889
+			}
890
+			if (isset($_COOKIE['MapTrack']) && $id == $_COOKIE['MapTrack'] && $minitracktime > strtotime($spotter_item['date'])) {
891
+				$minitracktime = strtotime($spotter_item['date']);
892
+			}
893
+			if ($maxitime < strtotime($spotter_item['date'])) {
894
+				$maxitime = strtotime($spotter_item['date']);
895
+			}
818 896
 			$output .= '"'.date("c",strtotime($spotter_item['date'])).'", ';
819 897
 			$output .= $spotter_item['longitude'].', ';
820 898
 			$output .= $spotter_item['latitude'];
@@ -837,7 +915,9 @@  discard block
 block discarded – undo
837 915
 					$output .= ', '.round($spotter_item['altitude']*30.48);
838 916
 					$prevalt = round($spotter_item['altitude']*30.48);
839 917
 				}
840
-			} else $output .= ', 0';
918
+			} else {
919
+				$output .= ', 0';
920
+			}
841 921
 			//$orientation = '"orientation" : { ';
842 922
 			//$orientation .= '"unitQuaternion": [';
843 923
 			//$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0));
@@ -845,13 +925,18 @@  discard block
 block discarded – undo
845 925
 		} else {
846 926
 			$nblatlong = $nblatlong+1;
847 927
 			$output .= ',"'.date("c",strtotime($spotter_item['date'])).'", ';
848
-			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
928
+			if ($maxitime < strtotime($spotter_item['date'])) {
929
+				$maxitime = strtotime($spotter_item['date']);
930
+			}
849 931
 			if ($spotter_item['ground_speed'] == 0) {
850 932
 				$output .= $prevlong.', ';
851 933
 				$output .= $prevlat;
852 934
 				//if (!$marine && (!isset($onground) || !$onground)) $output .= ', '.$prevalt;
853
-				if (!$marine) $output .= ', '.$prevalt;
854
-				else $output .= ', 0';
935
+				if (!$marine) {
936
+					$output .= ', '.$prevalt;
937
+				} else {
938
+					$output .= ', 0';
939
+				}
855 940
 			} else {
856 941
 				$output .= $spotter_item['longitude'].', ';
857 942
 				$output .= $spotter_item['latitude'];
@@ -864,14 +949,17 @@  discard block
 block discarded – undo
864 949
 							$output .= ', 0';
865 950
 						}
866 951
 					} else {
867
-						if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') $output .= ', '.round($spotter_item['real_altitude']*0.3048);
868
-						elseif ($tracker) {
952
+						if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') {
953
+							$output .= ', '.round($spotter_item['real_altitude']*0.3048);
954
+						} elseif ($tracker) {
869 955
 							$output .= ', '.round($spotter_item['altitude']*0.3048);
870 956
 						} else {
871 957
 							$output .= ', '.round($spotter_item['altitude']*30.48);
872 958
 						}
873 959
 					}
874
-				} else $output .= ', 0';
960
+				} else {
961
+					$output .= ', 0';
962
+				}
875 963
 			}
876 964
 			//$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0));
877 965
 			//$orientation .= ',"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w'];
@@ -892,9 +980,10 @@  discard block
 block discarded – undo
892 980
 		} else {
893 981
 			$output = str_replace('%minitime%',date("c",time()-$globalLiveInterval),$output);
894 982
 		}
983
+	} else {
984
+		$output = str_replace('%minitime%',date("c",$minitime),$output);
895 985
 	}
896
-	else $output = str_replace('%minitime%',date("c",$minitime),$output);
897
-} elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && $minitracktime != $minitracktime_begin) {
986
+	} elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && $minitracktime != $minitracktime_begin) {
898 987
 	$output = str_replace('%minitime%',date("c",$minitracktime),$output);
899 988
 } else {
900 989
 	$output = str_replace('%minitime%',date("c",$minitime),$output);
@@ -904,7 +993,10 @@  discard block
 block discarded – undo
904 993
 } else {
905 994
 	$output = str_replace('%maxitime%',date("c",$maxitime),$output);
906 995
 }
907
-if ($gltf2) $output = str_replace('%gltf2%','true',$output);
908
-else $output = str_replace('%gltf2%','false',$output);
996
+if ($gltf2) {
997
+	$output = str_replace('%gltf2%','true',$output);
998
+} else {
999
+	$output = str_replace('%gltf2%','false',$output);
1000
+}
909 1001
 print $output;
910 1002
 ?>
Please login to merge, or discard this patch.