Completed
Push — master ( 8dd7e7...5dc73e )
by Yannick
74:32 queued 45:11
created
live-czml.php 1 patch
Spacing   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -66,11 +66,11 @@  discard block
 block discarded – undo
66 66
     $s3 = sin($bank/2);
67 67
     $c1c2 = $c1*$c2;
68 68
     $s1s2 = $s1*$s2;
69
-    $w =$c1c2*$c3 - $s1s2*$s3;
70
-    $x =$c1c2*$s3 + $s1s2*$c3;
71
-    $y =$s1*$c2*$c3 + $c1*$s2*$s3;
72
-    $z =$c1*$s2*$c3 - $s1*$c2*$s3;
73
-    return array('x' => $x,'y' => $y,'z' => $z,'w' => $w);
69
+    $w = $c1c2*$c3 - $s1s2*$s3;
70
+    $x = $c1c2*$s3 + $s1s2*$c3;
71
+    $y = $s1*$c2*$c3 + $c1*$s2*$s3;
72
+    $z = $c1*$s2*$c3 - $s1*$c2*$s3;
73
+    return array('x' => $x, 'y' => $y, 'z' => $z, 'w' => $w);
74 74
 //    return array('x' => '0.0','y' => '-0.931','z' => '0.0','w' => '0.365');
75 75
 
76 76
 }
@@ -91,18 +91,18 @@  discard block
 block discarded – undo
91 91
 $min = false;
92 92
 $allhistory = false;
93 93
 $filter['source'] = array();
94
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
95
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
96
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
97
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
98
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
99
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
100
-if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
101
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
102
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
103
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
104
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
105
-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') $filter['source'] = array_merge($filter['source'], array('vatsimtxt'));
95
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup'));
96
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars'));
97
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs'));
98
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs'));
99
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING);
100
+if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'], FILTER_SANITIZE_STRING);
101
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING);
102
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING);
103
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING);
104
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING);
105
+if (isset($_COOKIE['filter_race']) && $_COOKIE['filter_race'] != 'all') $filter['race'] = filter_var($_COOKIE['filter_race'], FILTER_SANITIZE_NUMBER_INT);
106 106
 /*
107 107
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
108 108
 	$min = true;
@@ -149,17 +149,17 @@  discard block
 block discarded – undo
149 149
 	$from_archive = true;
150 150
 //	$begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
151 151
 //	$enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
152
-	$begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT);
153
-	$enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT);
154
-	$archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT);
155
-	$begindate = date('Y-m-d H:i:s',$begindate);
156
-	$enddate = date('Y-m-d H:i:s',$enddate);
152
+	$begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT);
153
+	$enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT);
154
+	$archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT);
155
+	$begindate = date('Y-m-d H:i:s', $begindate);
156
+	$enddate = date('Y-m-d H:i:s', $enddate);
157 157
 	if ($tracker) {
158
-		$spotter_array = $TrackerArchive->getMinLiveTrackerDataPlayback($begindate,$enddate,$filter);
158
+		$spotter_array = $TrackerArchive->getMinLiveTrackerDataPlayback($begindate, $enddate, $filter);
159 159
 	} elseif ($marine) {
160
-		$spotter_array = $MarineArchive->getMinLiveMarineDataPlayback($begindate,$enddate,$filter);
160
+		$spotter_array = $MarineArchive->getMinLiveMarineDataPlayback($begindate, $enddate, $filter);
161 161
 	} else {
162
-		$spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter);
162
+		$spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate, $enddate, $filter);
163 163
 	}
164 164
 } elseif (isset($_COOKIE['archive']) && isset($_COOKIE['archive_begin']) && isset($_COOKIE['archive_end']) && isset($_COOKIE['archive_speed'])) {
165 165
 	$from_archive = true;
@@ -176,36 +176,36 @@  discard block
 block discarded – undo
176 176
 	}
177 177
 	$enddate = $_COOKIE['archive_end'];
178 178
 	$enddateinitial = $_COOKIE['archive_end'];
179
-	$archivespeed = filter_var($_COOKIE['archive_speed'],FILTER_SANITIZE_NUMBER_INT);
180
-	$begindate = date('Y-m-d H:i:s',$begindate);
181
-	$enddate = date('Y-m-d H:i:s',$enddate);
179
+	$archivespeed = filter_var($_COOKIE['archive_speed'], FILTER_SANITIZE_NUMBER_INT);
180
+	$begindate = date('Y-m-d H:i:s', $begindate);
181
+	$enddate = date('Y-m-d H:i:s', $enddate);
182 182
 	//echo 'Begin : '.$begindate.' - End : '.$enddate."\n";
183 183
 	if ($tracker) {
184
-		$spotter_array = $TrackerArchive->getMinLiveTrackerData($begindate,$enddate,$filter);
184
+		$spotter_array = $TrackerArchive->getMinLiveTrackerData($begindate, $enddate, $filter);
185 185
 	} elseif ($marine) {
186
-		$spotter_array = $MarineArchive->getMinLiveMarineData($begindate,$enddate,$filter);
186
+		$spotter_array = $MarineArchive->getMinLiveMarineData($begindate, $enddate, $filter);
187 187
 	} else {
188
-		$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter);
188
+		$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter);
189 189
 	}
190 190
 } elseif ($tracker) {
191 191
 	$coord = array();
192 192
 	if (isset($_GET['coord']) && $_GET['coord'] != '') {
193
-		$coord = explode(',',$_GET['coord']);
194
-		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) 
193
+		$coord = explode(',', $_GET['coord']);
194
+		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) 
195 195
 		    && $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)) {
196 196
 			$coord = array();
197 197
 		}
198 198
 	}
199 199
 	$previous_filter = $filter;
200 200
 	if ((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrackTracker']) && $_COOKIE['MapTrackTracker'] != '')) {
201
-		$filter = array_merge($filter,array('id' => $_COOKIE['MapTrackTracker']));
202
-		$spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord,$filter,false);
201
+		$filter = array_merge($filter, array('id' => $_COOKIE['MapTrackTracker']));
202
+		$spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord, $filter, false);
203 203
 	/*
204 204
 	} elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && !empty($coord)) {
205 205
 		$spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord,$filter,true,$_COOKIE['MapTrack']);
206 206
 	*/
207 207
 	} elseif (!isset($_COOKIE['singlemodel']) || $_COOKIE['singlemodel'] == 'false') {
208
-		$spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord,$filter,false);
208
+		$spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord, $filter, false);
209 209
 	} else {
210 210
 		$spotter_array = array();
211 211
 	}
@@ -214,20 +214,20 @@  discard block
 block discarded – undo
214 214
 	$coord = array();
215 215
 	//if (isset($_GET['coord']) && $_GET['coord'] != '') {
216 216
 	if (!((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrackMarine']) && $_COOKIE['MapTrackMarine'] != '')) && isset($_GET['coord']) && $_GET['coord'] != '') {
217
-		$coord = explode(',',$_GET['coord']);
218
-		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) 
217
+		$coord = explode(',', $_GET['coord']);
218
+		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) 
219 219
 		    && $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)) {
220 220
 			$coord = array();
221 221
 		}
222 222
 	}
223 223
 	$previous_filter = $filter;
224 224
 	if ((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrackMarine']) && $_COOKIE['MapTrackMarine'] != '')) {
225
-		$filter = array_merge($filter,array('id' => $_COOKIE['MapTrackMarine']));
226
-		$spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,false);
225
+		$filter = array_merge($filter, array('id' => $_COOKIE['MapTrackMarine']));
226
+		$spotter_array = $MarineLive->getMinLastLiveMarineData($coord, $filter, false);
227 227
 	} elseif (isset($_COOKIE['MapTrackMarine']) && $_COOKIE['MapTrackMarine'] != '' && !empty($coord)) {
228
-		$spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,false,$_COOKIE['MapTrack']);
228
+		$spotter_array = $MarineLive->getMinLastLiveMarineData($coord, $filter, false, $_COOKIE['MapTrack']);
229 229
 	} elseif (!isset($_COOKIE['singlemodel']) || $_COOKIE['singlemodel'] == 'false') {
230
-		$spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,false);
230
+		$spotter_array = $MarineLive->getMinLastLiveMarineData($coord, $filter, false);
231 231
 	} else {
232 232
 		$spotter_array = array();
233 233
 	}
@@ -235,8 +235,8 @@  discard block
 block discarded – undo
235 235
 } else {
236 236
 	$coord = array();
237 237
 	if (!((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '')) && isset($_GET['coord']) && $_GET['coord'] != '') {
238
-		$coord = explode(',',$_GET['coord']);
239
-		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) 
238
+		$coord = explode(',', $_GET['coord']);
239
+		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) 
240 240
 		    && $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)) {
241 241
 			$coord = array();
242 242
 		}
@@ -244,14 +244,14 @@  discard block
 block discarded – undo
244 244
 	$previous_filter = $filter;
245 245
 	if (((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') || (!isset($_COOKIE['singlemodel']) && isset($globalMap3DSelected) && $globalMap3DSelected)) && (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '')) {
246 246
 		//$filter = array_merge($filter,array('id' => $_COOKIE['MapTrack']));
247
-		$spotter_array = $SpotterLive->getMinLastLiveSpotterDataByID($_COOKIE['MapTrack'],$filter,false);
247
+		$spotter_array = $SpotterLive->getMinLastLiveSpotterDataByID($_COOKIE['MapTrack'], $filter, false);
248 248
 		//$spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,false);
249 249
 	} elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '') {
250 250
 		//$spotter_array = $SpotterLive->getMinLastLiveSpotterDataByID($_COOKIE['MapTrack'],$filter,false);
251 251
 		//if (empty($spotter_array)) $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,false,$_COOKIE['MapTrack']);
252
-		$spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,false,$_COOKIE['MapTrack']);
252
+		$spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord, $filter, false, $_COOKIE['MapTrack']);
253 253
 	} elseif (!isset($_COOKIE['singlemodel']) || $_COOKIE['singlemodel'] == 'false') {
254
-		$spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,false);
254
+		$spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord, $filter, false);
255 255
 	} else {
256 256
 		$spotter_array = array();
257 257
 	}
@@ -261,19 +261,19 @@  discard block
 block discarded – undo
261 261
 if (!empty($spotter_array) && isset($coord)) {
262 262
 	if ($tracker) {
263 263
 		if (isset($_GET['archive'])) {
264
-			$flightcnt = $TrackerArchive->getLiveTrackerCount($begindate,$enddate,$filter);
264
+			$flightcnt = $TrackerArchive->getLiveTrackerCount($begindate, $enddate, $filter);
265 265
 		} else {
266 266
 			$flightcnt = $TrackerLive->getLiveTrackerCount($filter);
267 267
 		}
268 268
 	} elseif ($marine) {
269 269
 		if (isset($_GET['archive'])) {
270
-			$flightcnt = $MarineArchive->getLiveMarineCount($begindate,$enddate,$filter);
270
+			$flightcnt = $MarineArchive->getLiveMarineCount($begindate, $enddate, $filter);
271 271
 		} else {
272 272
 			$flightcnt = $MarineLive->getLiveMarineCount($filter);
273 273
 		}
274 274
 	} else {
275 275
 		if (isset($_GET['archive'])) {
276
-			$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter);
276
+			$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter);
277 277
 		} else {
278 278
 			$flightcnt = $SpotterLive->getLiveSpotterCount($filter);
279 279
 		}
@@ -281,17 +281,17 @@  discard block
 block discarded – undo
281 281
 	if ($flightcnt == '') $flightcnt = 0;
282 282
 } else $flightcnt = 0;
283 283
 
284
-$sqltime = round(microtime(true)-$begintime,2);
284
+$sqltime = round(microtime(true) - $begintime, 2);
285 285
 $minitime = time();
286 286
 $minitracktime_begin = time();
287 287
 $minitracktime = $minitracktime_begin;
288 288
 $maxitime = 0;
289
-$lastupdate = filter_input(INPUT_GET,'update',FILTER_SANITIZE_NUMBER_INT);
289
+$lastupdate = filter_input(INPUT_GET, 'update', FILTER_SANITIZE_NUMBER_INT);
290 290
 $modelsdb = array();
291 291
 if (file_exists(dirname(__FILE__).'/models/modelsdb')) {
292
-	if (($handle = fopen(dirname(__FILE__).'/models/modelsdb','r')) !== FALSE) {
293
-		while (($row = fgetcsv($handle,1000)) !== FALSE) {
294
-			if (isset($row[1]) ){
292
+	if (($handle = fopen(dirname(__FILE__).'/models/modelsdb', 'r')) !== FALSE) {
293
+		while (($row = fgetcsv($handle, 1000)) !== FALSE) {
294
+			if (isset($row[1])) {
295 295
 				$model = $row[0];
296 296
 				$modelsdb[$model] = $row[1];
297 297
 			}
@@ -301,9 +301,9 @@  discard block
 block discarded – undo
301 301
 }
302 302
 $modelsdb2 = array();
303 303
 if (file_exists(dirname(__FILE__).'/models/gltf2/modelsdb')) {
304
-	if (($handle = fopen(dirname(__FILE__).'/models/gltf2/modelsdb','r')) !== FALSE) {
305
-		while (($row = fgetcsv($handle,1000)) !== FALSE) {
306
-			if (isset($row[1]) ){
304
+	if (($handle = fopen(dirname(__FILE__).'/models/gltf2/modelsdb', 'r')) !== FALSE) {
305
+		while (($row = fgetcsv($handle, 1000)) !== FALSE) {
306
+			if (isset($row[1])) {
307 307
 				$model = $row[0];
308 308
 				$glb = $row[1];
309 309
 				if (isset($row[2])) {
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
 if (!empty($spotter_array) && is_array($spotter_array))
350 350
 {
351 351
 	$nblatlong = 0;
352
-	foreach($spotter_array as $spotter_item)
352
+	foreach ($spotter_array as $spotter_item)
353 353
 	{
354 354
 		$j++;
355 355
 		//if (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'airwhere') $heightrelative = 'RELATIVE_TO_GROUND';
@@ -403,16 +403,16 @@  discard block
 block discarded – undo
403 403
 			}
404 404
 			if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",';
405 405
 			if (isset($spotter_item['format_source'])) $output .= '"format": "'.$spotter_item['format_source'].'",';
406
-			if (isset($spotter_item['ident'])) $output.= '"ident": '.json_encode($spotter_item['ident']).',';
406
+			if (isset($spotter_item['ident'])) $output .= '"ident": '.json_encode($spotter_item['ident']).',';
407 407
 			if ($tracker) {
408 408
 				if (isset($spotter_item['type'])) $output .= '"tracker_type": '.json_encode($spotter_item['type']).',';
409
-				$output.= '"type": "tracker"';
409
+				$output .= '"type": "tracker"';
410 410
 			} elseif ($marine) {
411 411
 				if (isset($spotter_item['type'])) $output .= '"marine_type": '.json_encode($spotter_item['type']).',';
412 412
 				if (isset($spotter_item['captain_name'])) $output .= '"captain": '.json_encode($spotter_item['captain_name']).',';
413 413
 				if (isset($spotter_item['race_name'])) $output .= '"race": '.json_encode($spotter_item['race_name']).',';
414 414
 				if (isset($spotter_item['race_rank'])) $output .= '"rank": "'.$spotter_item['race_rank'].'",';
415
-				$output.= '"type": "marine"';
415
+				$output .= '"type": "marine"';
416 416
 			} else {
417 417
 				if ($one3dmodel === false && isset($globalMap3DLiveries) && $globalMap3DLiveries) {
418 418
 					$aircraft_icao = $spotter_item['aircraft_icao'];
@@ -426,14 +426,14 @@  discard block
 block discarded – undo
426 426
 						if (isset($airline_icao)) {
427 427
 							$imagefile = $aircraft_icao.'-'.$airline_icao.'.png';
428 428
 							if (file_exists(dirname(__FILE__).'/models/gltf2/liveries/'.$imagefile)) {
429
-								$output.= '"liveries": "'.$globalURL.'/models/gltf2/liveries/'.$imagefile.'",';
429
+								$output .= '"liveries": "'.$globalURL.'/models/gltf2/liveries/'.$imagefile.'",';
430 430
 							}
431 431
 						}
432 432
 					}
433 433
 					//if ($ident != '') $output.= '"ident": "'.$ident.'",';
434 434
 				}
435
-				$output.= '"gltf2": %gltf2%,';
436
-				$output.= '"type": "flight"';
435
+				$output .= '"gltf2": %gltf2%,';
436
+				$output .= '"type": "flight"';
437 437
 			}
438 438
 			$output .= '},';
439 439
 
@@ -808,8 +808,8 @@  discard block
 block discarded – undo
808 808
 					$output .= '},';
809 809
 				}
810 810
 			}
811
-			if (isset($onground) && $onground) $output = str_replace('%onground%','true',$output);
812
-			else $output = str_replace('%onground%','false',$output);
811
+			if (isset($onground) && $onground) $output = str_replace('%onground%', 'true', $output);
812
+			else $output = str_replace('%onground%', 'false', $output);
813 813
 
814 814
 	//		$output .= '"heightReference": "CLAMP_TO_GROUND",';
815 815
 			//$output .= '"heightReference": "'.$heightrelative.'",';
@@ -825,7 +825,7 @@  discard block
 block discarded – undo
825 825
 			if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']);
826 826
 			if (isset($_COOKIE['MapTrack']) && $id == $_COOKIE['MapTrack'] && $minitracktime > strtotime($spotter_item['date'])) $minitracktime = strtotime($spotter_item['date']);
827 827
 			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
828
-			$output .= '"'.date("c",strtotime($spotter_item['date'])).'", ';
828
+			$output .= '"'.date("c", strtotime($spotter_item['date'])).'", ';
829 829
 			$output .= $spotter_item['longitude'].', ';
830 830
 			$output .= $spotter_item['latitude'];
831 831
 			$prevlong = $spotter_item['longitude'];
@@ -853,8 +853,8 @@  discard block
 block discarded – undo
853 853
 			//$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0));
854 854
 			//$orientation .= '"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w'];
855 855
 		} else {
856
-			$nblatlong = $nblatlong+1;
857
-			$output .= ',"'.date("c",strtotime($spotter_item['date'])).'", ';
856
+			$nblatlong = $nblatlong + 1;
857
+			$output .= ',"'.date("c", strtotime($spotter_item['date'])).'", ';
858 858
 			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
859 859
 			if ($spotter_item['ground_speed'] == 0) {
860 860
 				$output .= $prevlong.', ';
@@ -895,26 +895,26 @@  discard block
 block discarded – undo
895 895
 $output .= ']';
896 896
 if (isset($globalArchive) && $globalArchive === TRUE) {
897 897
 	if (isset($begindateinitial)) {
898
-		$output = str_replace('%minitime%',date("c",$begindateinitial),$output);
899
-	} elseif ((time()-$globalLiveInterval) > $minitime) {
900
-		if (time()-$globalLiveInterval > $maxitime) {
901
-			$output = str_replace('%minitime%',date("c",$maxitime),$output);
898
+		$output = str_replace('%minitime%', date("c", $begindateinitial), $output);
899
+	} elseif ((time() - $globalLiveInterval) > $minitime) {
900
+		if (time() - $globalLiveInterval > $maxitime) {
901
+			$output = str_replace('%minitime%', date("c", $maxitime), $output);
902 902
 		} else {
903
-			$output = str_replace('%minitime%',date("c",time()-$globalLiveInterval),$output);
903
+			$output = str_replace('%minitime%', date("c", time() - $globalLiveInterval), $output);
904 904
 		}
905 905
 	}
906
-	else $output = str_replace('%minitime%',date("c",$minitime),$output);
906
+	else $output = str_replace('%minitime%', date("c", $minitime), $output);
907 907
 } elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && $minitracktime != $minitracktime_begin) {
908
-	$output = str_replace('%minitime%',date("c",$minitracktime),$output);
908
+	$output = str_replace('%minitime%', date("c", $minitracktime), $output);
909 909
 } else {
910
-	$output = str_replace('%minitime%',date("c",$minitime),$output);
910
+	$output = str_replace('%minitime%', date("c", $minitime), $output);
911 911
 }
912 912
 if (isset($enddateinitial)) {
913
-	$output = str_replace('%maxitime%',date("c",$enddateinitial),$output);
913
+	$output = str_replace('%maxitime%', date("c", $enddateinitial), $output);
914 914
 } else {
915
-	$output = str_replace('%maxitime%',date("c",$maxitime),$output);
915
+	$output = str_replace('%maxitime%', date("c", $maxitime), $output);
916 916
 }
917
-if ($gltf2) $output = str_replace('%gltf2%','true',$output);
918
-else $output = str_replace('%gltf2%','false',$output);
917
+if ($gltf2) $output = str_replace('%gltf2%', 'true', $output);
918
+else $output = str_replace('%gltf2%', 'false', $output);
919 919
 print $output;
920 920
 ?>
Please login to merge, or discard this patch.