Completed
Push — master ( 79cbb4...2c41c0 )
by Yannick
30:50
created
index.php 1 patch
Indentation   +97 added lines, -97 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
     <?php }; if (isset($globalSatellite) && $globalSatellite) { ?><td><div id="ibxsatellite"><h4><?php echo _("Satellites Displayed"); ?></h4><br /><i class="fa fa-spinner fa-pulse fa-fw"></i></div></td><?php } ?>
48 48
 </tr></table></div>
49 49
 <?php
50
-    if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
50
+	if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
51 51
 ?>
52 52
 <script src="<?php echo $globalURL; ?>/js/map.3d.js.php"></script>
53 53
 <?php
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 <script src="<?php echo $globalURL; ?>/js/map-marine.3d.js.php"></script>
72 72
 <?php
73 73
 	}
74
-    }
74
+	}
75 75
 ?>
76 76
 
77 77
 <div id="sidebar" class="sidebar collapsed">
@@ -82,34 +82,34 @@  discard block
 block discarded – undo
82 82
 	<li><a href="#" onclick="getUserLocation(); return false;" title="<?php echo _("Plot your Location"); ?>"><i class="fa fa-map-marker"></i></a></li>
83 83
 	<li><a href="#" onclick="getCompassDirection(); return false;" title="<?php echo _("Compass Mode"); ?>"><i class="fa fa-compass"></i></a></li>
84 84
 <?php
85
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
85
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
86 86
 	if (isset($globalArchive) && $globalArchive == TRUE) {
87 87
 ?>
88 88
 	<li><a href="#archive" role="tab" title="<?php echo _("Archive"); ?>"><i class="fa fa-archive"></i></a></li>
89 89
 <?php
90 90
 	}
91
-    }
91
+	}
92 92
 ?>
93 93
 	<li><a href="#home" role="tab" title="<?php echo _("Layers"); ?>"><i class="fa fa-map"></i></a></li>
94 94
 	<li><a href="#filters" role="tab" title="<?php echo _("Filters"); ?>"><i class="fa fa-filter"></i></a></li>
95 95
 	<li><a href="#settings" role="tab" title="<?php echo _("Settings"); ?>"><i class="fa fa-gears"></i></a></li>
96 96
 <?php
97
-    if (isset($globalMap3D) && $globalMap3D) {
97
+	if (isset($globalMap3D) && $globalMap3D) {
98 98
 	if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
99 99
 ?>
100 100
 	<li><a href="#" onclick="show3D(); return false;" role="tab" title="3D"><b>3D</b></a></li>
101 101
 <?php
102
-	    if (isset($globalSatellite) && $globalSatellite) {
102
+		if (isset($globalSatellite) && $globalSatellite) {
103 103
 ?>
104 104
 	<li><a href="#satellites" role="tab" title="<?php echo _("Satellites"); ?>"><i class="satellite"></i></a></li>
105 105
 <?php
106
-	    }
106
+		}
107 107
 	} else {
108 108
 ?>
109 109
 	<li><a href="#" onclick="show2D(); return false;" role="tab" title="2D"><b>2D</b></a></li>
110 110
 <?php
111 111
 	}
112
-    }
112
+	}
113 113
 ?>
114 114
     </ul>
115 115
 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 ?>
185 185
         </div>
186 186
 <?php
187
-    if (isset($globalArchive) && $globalArchive == TRUE) {
187
+	if (isset($globalArchive) && $globalArchive == TRUE) {
188 188
 ?>
189 189
         <div class="sidebar-pane" id="archive">
190 190
 	    <h1 class="sidebar-header"><?php echo _("Playback"); ?> <i>Bêta</i><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 	    </form>
244 244
 	</div>
245 245
 <?php
246
-    }
246
+	}
247 247
 ?>
248 248
         <div class="sidebar-pane" id="settings">
249 249
 	    <h1 class="sidebar-header"><?php echo _("Settings"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
@@ -254,56 +254,56 @@  discard block
 block discarded – undo
254 254
 			    <?php
255 255
 				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider;
256 256
 				else $MapType = $_COOKIE['MapType'];
257
-			    ?>
257
+				?>
258 258
 			    <?php
259 259
 				if (isset($globalBingMapKey) && $globalBingMapKey != '') {
260
-			    ?>
260
+				?>
261 261
 			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option>
262 262
 			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option>
263 263
 			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option>
264 264
 			    <?php
265 265
 				}
266
-			    ?>
266
+				?>
267 267
 			    <?php
268
-			        if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
269
-			    ?>
268
+					if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
269
+				?>
270 270
 			    <?php
271
-				    if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
272
-			    ?>
271
+					if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
272
+				?>
273 273
 			    <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option>
274 274
 			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option>
275 275
 			    <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option>
276 276
 			    <?php
277
-				    }
278
-			    ?>
277
+					}
278
+				?>
279 279
 			    <?php
280
-				    if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
281
-			    ?>
280
+					if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
281
+				?>
282 282
 			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option>
283 283
 			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option>
284 284
 			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option>
285 285
 			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option>
286 286
 			    <?php
287
-				    }
288
-			    ?>
287
+					}
288
+				?>
289 289
 			    <?php
290
-				    if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
291
-			    ?>
290
+					if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
291
+				?>
292 292
 			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option>
293 293
 			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option>
294 294
 			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option>
295 295
 			    <?php
296
-				    }
297
-			    ?>
296
+					}
297
+				?>
298 298
 			    <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option>
299 299
 			    <?php
300 300
 				}
301
-			    ?>
301
+				?>
302 302
 			    <?php
303
-				    if (isset($globalMapboxToken) && $globalMapboxToken != '') {
303
+					if (isset($globalMapboxToken) && $globalMapboxToken != '') {
304 304
 					if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default';
305 305
 					else $MapBoxId = $_COOKIE['MapTypeId'];
306
-			    ?>
306
+				?>
307 307
 			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option>
308 308
 			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option>
309 309
 			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option>
@@ -317,13 +317,13 @@  discard block
 block discarded – undo
317 317
 			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option>
318 318
 			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option>
319 319
 			    <?php
320
-				    }
321
-			    ?>
320
+					}
321
+				?>
322 322
 			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option>
323 323
 			</select>
324 324
 		    </li>
325 325
 <?php
326
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
326
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
327 327
 ?>
328 328
 		    <li><?php echo _("Type of Terrain:"); ?>
329 329
 			<select  class="selectpicker" onchange="terrainType(this);">
@@ -334,10 +334,10 @@  discard block
 block discarded – undo
334 334
 			</select>
335 335
 		    </li>
336 336
 <?php
337
-    }
337
+	}
338 338
 ?>
339 339
 <?php
340
-    if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
340
+	if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
341 341
 ?>
342 342
 <?php
343 343
 	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
 		    <li><div class="checkbox"><label><input type="checkbox" name="satelliteestimation" value="1" onclick="clickSatelliteEstimation(this)" <?php if ((isset($_COOKIE['satelliteestimation']) && $_COOKIE['satelliteestimation'] == 'true') || (!isset($_COOKIE['satelliteestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['satelliteestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Satellites animate between updates"); ?></label></div></li>
355 355
 <?php
356 356
 	}
357
-    }
357
+	}
358 358
 ?>
359 359
 		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true' || !isset($_COOKIE['displayairports'])) print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li>
360 360
 		    <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) print 'checked'; ?> ><?php echo _("Display ground station on map"); ?></label></div></li>
@@ -366,81 +366,81 @@  discard block
 block discarded – undo
366 366
 		    <li><div class="checkbox"><label><input type="checkbox" name="displayfires" value="1" onclick="clickDisplayFires(this)" <?php if ((isset($_COOKIE['show_Fires']) && $_COOKIE['show_Fires'] == 'true') || (!isset($_COOKIE['show_Fires']) && (isset($globalMapFires) && $globalMapFires === TRUE))) print 'checked'; ?> ><?php echo _("Display fires on map"); ?></label></div></li>
367 367
 <?php
368 368
 	}
369
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
369
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
370 370
 ?>
371 371
 		    <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) print 'checked'; ?> ><?php echo _("Show mini-map"); ?></label></div></li>
372 372
 <?php
373
-    }
374
-    if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
373
+	}
374
+	if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
375 375
 ?>
376 376
 		    <li><div class="checkbox"><label><input type="checkbox" name="displaysanta" value="1" onclick="clickSanta(this)"><i class="fa fa-snowflake-o" aria-hidden="true"></i> <?php echo _("Show Santa Claus now"); ?> <i class="fa fa-snowflake-o" aria-hidden="true"></i></label></div></li>
377 377
 <?php
378
-    }
378
+	}
379 379
 ?>
380 380
 		    <?php
381 381
 			if (function_exists('array_column')) {
382
-			    if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
383
-		    ?>
382
+				if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
383
+			?>
384 384
 		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
385 385
 		    <?php
386
-			    }
386
+				}
387 387
 			} elseif (isset($globalSources)) {
388
-			    $dispolar = false;
389
-			    foreach ($globalSources as $testsource) {
390
-			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
391
-			    }
392
-			    if ($dispolar) {
393
-		    ?>
388
+				$dispolar = false;
389
+				foreach ($globalSources as $testsource) {
390
+					if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
391
+				}
392
+				if ($dispolar) {
393
+			?>
394 394
 		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
395 395
 		    <?php
396
-			    }
397
-		        }
398
-		    ?>
396
+				}
397
+				}
398
+			?>
399 399
 <?php
400
-    if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
400
+	if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
401 401
 ?>
402 402
 
403 403
 		    <?php
404 404
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
405
-		    	    if (extension_loaded('gd') && function_exists('gd_info')) {
406
-		    ?>
405
+					if (extension_loaded('gd') && function_exists('gd_info')) {
406
+			?>
407 407
 		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') print 'checked'; ?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
408 408
 		    <?php 
409 409
 				if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') {
410
-		    ?>
410
+			?>
411 411
 		    <li><?php echo _("Aircraft icon color:"); ?>
412 412
 			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print '1a3151'; ?>">
413 413
 		    </li>
414 414
 		    <?php
415 415
 				}
416
-			    }
417
-		        }
418
-		    ?>
416
+				}
417
+				}
418
+			?>
419 419
 		    <?php
420 420
 			if (isset($globalMarine) && $globalMarine === TRUE) {
421
-			    if (extension_loaded('gd') && function_exists('gd_info')) {
422
-		    ?>
421
+				if (extension_loaded('gd') && function_exists('gd_info')) {
422
+			?>
423 423
 		    <li><?php echo _("Marine icon color:"); ?>
424 424
 			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print '1a3151'; ?>">
425 425
 		    </li>
426 426
 		    <?php
427
-			    }
428
-		        }
429
-		    ?>
427
+				}
428
+				}
429
+			?>
430 430
 		    <?php
431 431
 			if (isset($globalTracker) && $globalTracker === TRUE) {
432
-			    if (extension_loaded('gd') && function_exists('gd_info')) {
433
-		    ?>
432
+				if (extension_loaded('gd') && function_exists('gd_info')) {
433
+			?>
434 434
 		    <li><?php echo _("Tracker icon color:"); ?>
435 435
 			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) print $_COOKIE['TrackerIconColor']; elseif (isset($globalTrackerIconColor)) print $globalTrackerIconColor; else print '1a3151'; ?>">
436 436
 		    </li>
437 437
 		    <?php
438
-			    }
439
-		        }
440
-		    ?>
438
+				}
439
+				}
440
+			?>
441 441
 		    <?php
442 442
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
443
-		    ?>
443
+			?>
444 444
 		    <li><?php echo _("Show airport icon at zoom level:"); ?>
445 445
 			<div class="range">
446 446
 			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?>">
@@ -449,9 +449,9 @@  discard block
 block discarded – undo
449 449
 		    </li>
450 450
 		    <?php
451 451
 			}
452
-		    ?>
452
+			?>
453 453
 <?php
454
-    } elseif (isset($_COOKIE['MapFormat']) || $_COOKIE['MapFOrmat'] == '3d') {
454
+	} elseif (isset($_COOKIE['MapFormat']) || $_COOKIE['MapFOrmat'] == '3d') {
455 455
 ?>
456 456
 <?php
457 457
 	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
 		    </li>
484 484
 <?php
485 485
 	}
486
-    }
486
+	}
487 487
 ?>
488 488
 		    <li><?php echo _("Distance unit:"); ?>
489 489
 			<select class="selectpicker" onchange="unitdistance(this);">
@@ -516,19 +516,19 @@  discard block
 block discarded – undo
516 516
 		    <ul>
517 517
 		    <?php
518 518
 			if (!isset($globalAircraft) || $globalAircraft) {
519
-		    ?>
519
+			?>
520 520
 		    <?php
521 521
 			if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) {
522
-		    ?>
522
+			?>
523 523
 			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) print 'checked'; ?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
524 524
 			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) print 'checked'; ?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
525 525
 			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) print 'checked'; ?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
526 526
 		    <?php
527 527
 			}
528
-		    ?>
528
+			?>
529 529
 		    <?php
530 530
 			if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) {
531
-		    ?>
531
+			?>
532 532
 			<?php if (isset($globalSBS1) && $globalSBS1) { ?>
533 533
 			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) print 'checked'; ?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
534 534
 			<?php } ?>
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
 			<?php } ?>
538 538
 		    <?php
539 539
 			}
540
-		    ?>
540
+			?>
541 541
 		    <li><?php echo _("Display airlines:"); ?>
542 542
 		    <br/>
543 543
 			<select class="selectpicker" multiple onchange="airlines(this);" id="display_airlines">
@@ -557,14 +557,14 @@  discard block
 block discarded – undo
557 557
 						echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>';
558 558
 					}
559 559
 				}
560
-			    ?>
560
+				?>
561 561
 			</select>
562 562
 		    </li>
563 563
 		    <?php
564 564
 			$Spotter = new Spotter();
565 565
 			$allalliancenames = $Spotter->getAllAllianceNames();
566 566
 			if (!empty($allalliancenames)) {
567
-		    ?>
567
+			?>
568 568
 		    <li><?php echo _("Display alliance:"); ?>
569 569
 		    <br/>
570 570
 			<select class="selectpicker" onchange="alliance(this);" id="display_alliance">
@@ -578,18 +578,18 @@  discard block
 block discarded – undo
578 578
 						echo '<option value="'.$alliance_name.'">'.$alliance_name.'</option>';
579 579
 					}
580 580
 				}
581
-			    ?>
581
+				?>
582 582
 			</select>
583 583
 		    </li>
584 584
 		    <?php
585 585
 			}
586
-		    ?>
586
+			?>
587 587
 		    <?php
588 588
 			}
589
-		    ?>
589
+			?>
590 590
 		    <?php
591 591
 			if (isset($globalAPRS) && $globalAPRS) {
592
-		    ?>
592
+			?>
593 593
 		    <li><?php echo _("Display APRS sources name:"); ?>
594 594
 			<select class="selectpicker" multiple onchange="sources(this);">
595 595
 			    <?php
@@ -613,18 +613,18 @@  discard block
 block discarded – undo
613 613
 						echo '<option value="'.$src['name'].'">'.$src['name'].'</option>';
614 614
 					}
615 615
 				}
616
-			    ?>
616
+				?>
617 617
 			</select>
618 618
 		    </li>
619 619
 		    <?php
620 620
 			}
621
-		    ?>
621
+			?>
622 622
 		    <?php
623 623
 			if (!isset($globalAircraft) || $globalAircraft) {
624
-		    ?>
624
+			?>
625 625
 		    <?php
626
-			    if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS)) {
627
-		    ?>
626
+				if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS)) {
627
+			?>
628 628
 		    <li><?php echo _("Display airlines of type:"); ?><br/>
629 629
 			<select class="selectpicker" onchange="airlinestype(this);">
630 630
 			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
@@ -634,21 +634,21 @@  discard block
 block discarded – undo
634 634
 			</select>
635 635
 		    </li>
636 636
 		    <?php
637
-			    }
638
-		    ?>
637
+				}
638
+			?>
639 639
 		    <?php
640 640
 			}
641
-		    ?>
641
+			?>
642 642
 		    <?php
643 643
 			if (isset($globalMarine) && $globalMarine) {
644
-		    ?>
644
+			?>
645 645
 		    <li>
646 646
 			<?php echo _("Display vessels with MMSI:"); ?>
647 647
 			<input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) print $_COOKIE['filter_mmsi']; ?>" />
648 648
 		    </li>
649 649
 		    <?php
650 650
 			}
651
-		    ?>
651
+			?>
652 652
 		    <li>
653 653
 			<?php echo _("Display with ident:"); ?>
654 654
 			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" />
@@ -661,7 +661,7 @@  discard block
 block discarded – undo
661 661
 	    </form>
662 662
     	</div>
663 663
 <?php
664
-    if (isset($globalSatellite) && $globalSatellite) {
664
+	if (isset($globalSatellite) && $globalSatellite) {
665 665
 ?>
666 666
         <div class="sidebar-pane" id="satellites">
667 667
 	    <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
@@ -701,14 +701,14 @@  discard block
 block discarded – undo
701 701
 						print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>';
702 702
 					}
703 703
 				}
704
-			    ?>
704
+				?>
705 705
 			</select>
706 706
 		    </li>
707 707
 		</ul>
708 708
 	    </form>
709 709
 	</div>
710 710
 <?php
711
-    }
711
+	}
712 712
 ?>
713 713
     </div>
714 714
 </div>
Please login to merge, or discard this patch.
require/class.APRS.php 1 patch
Indentation   +166 added lines, -166 removed lines patch added patch discarded remove patch
@@ -3,10 +3,10 @@  discard block
 block discarded – undo
3 3
 require_once(dirname(__FILE__).'/class.Common.php');
4 4
 require_once(dirname(__FILE__).'/class.GeoidHeight.php');
5 5
 class aprs {
6
-    private $socket;
7
-    private $connected = false;
6
+	private $socket;
7
+	private $connected = false;
8 8
 
9
-    protected $symbols = array('/!' => 'Police',
9
+	protected $symbols = array('/!' => 'Police',
10 10
 	'/#' => 'DIGI',
11 11
 	'/$' => 'Phone',
12 12
 	'/%' => 'DX Cluster',
@@ -166,13 +166,13 @@  discard block
 block discarded – undo
166 166
 	'\~' => 'TNC Stream SW');
167 167
 	
168 168
 
169
-    private function urshift($n, $s) {
169
+	private function urshift($n, $s) {
170 170
 	return ($n >= 0) ? ($n >> $s) :
171
-	    (($n & 0x7fffffff) >> $s) | 
171
+		(($n & 0x7fffffff) >> $s) | 
172 172
 		(0x40000000 >> ($s - 1));
173
-    }
173
+	}
174 174
 
175
-    public function parse($input) {
175
+	public function parse($input) {
176 176
 	global $globalDebug;
177 177
 	$debug = false;
178 178
 	$result = array();
@@ -184,8 +184,8 @@  discard block
 block discarded – undo
184 184
 	
185 185
 	/* Check that end was found and body has at least one byte. */
186 186
 	if ($splitpos == 0 || $splitpos + 1 == $input_len || $splitpos === FALSE) {
187
-	    if ($globalDebug) echo '!!! APRS invalid : '.$input."\n";
188
-	    return false;
187
+		if ($globalDebug) echo '!!! APRS invalid : '.$input."\n";
188
+		return false;
189 189
 	}
190 190
 	
191 191
 	if ($debug) echo 'input : '.$input."\n";
@@ -199,34 +199,34 @@  discard block
 block discarded – undo
199 199
 	/* Parse source, target and path. */
200 200
 	//FLRDF0A52>APRS,qAS,LSTB
201 201
 	if (preg_match('/^([A-Z0-9\\-]{1,9})>(.*)$/',$header,$matches)) {
202
-	    $ident = $matches[1];
203
-	    $all_elements = $matches[2];
204
-	    if ($ident == 'AIRCRAFT') {
202
+		$ident = $matches[1];
203
+		$all_elements = $matches[2];
204
+		if ($ident == 'AIRCRAFT') {
205 205
 		$result['format_source'] = 'famaprs';
206 206
 		$result['source_type'] = 'modes';
207
-	    } elseif ($ident == 'MARINE') {
207
+		} elseif ($ident == 'MARINE') {
208 208
 		$result['format_source'] = 'famaprs';
209 209
 		$result['source_type'] = 'ais';
210
-	    } else {
210
+		} else {
211 211
 		if ($debug) echo 'ident : '.$ident."\n";
212 212
 		$result['ident'] = $ident;
213
-	    }
213
+		}
214 214
 	} else {
215
-	    if ($debug) 'No ident'."\n";
216
-	    return false;
215
+		if ($debug) 'No ident'."\n";
216
+		return false;
217 217
 	}
218 218
 	$elements = explode(',',$all_elements);
219 219
 	$source = end($elements);
220 220
 	$result['source'] = $source;
221 221
 	foreach ($elements as $element) {
222
-	    if (preg_match('/^([a-zA-Z0-9-]{1,9})([*]?)$/',$element)) {
223
-	        //echo "ok";
224
-	        //if ($element == 'TCPIP*') return false;
225
-	    } elseif (!preg_match('/^([0-9A-F]{32})$/',$element)) {
222
+		if (preg_match('/^([a-zA-Z0-9-]{1,9})([*]?)$/',$element)) {
223
+			//echo "ok";
224
+			//if ($element == 'TCPIP*') return false;
225
+		} elseif (!preg_match('/^([0-9A-F]{32})$/',$element)) {
226 226
 		if ($debug) echo 'element : '.$element."\n";
227 227
 		return false;
228
-	    }
229
-	    /*
228
+		}
229
+		/*
230 230
 	    } elseif (preg_match('/^([0-9A-F]{32})$/',$element)) {
231 231
 		//echo "ok";
232 232
 	    } else {
@@ -253,48 +253,48 @@  discard block
 block discarded – undo
253 253
 	$body_parse = substr($body,1);
254 254
 	//echo 'Body : '.$body."\n";
255 255
 	if (preg_match('/^;(.){9}\*/',$body,$matches)) {
256
-	    $body_parse = substr($body_parse,10);
257
-	    $find = true;
258
-	    //echo $body_parse."\n";
256
+		$body_parse = substr($body_parse,10);
257
+		$find = true;
258
+		//echo $body_parse."\n";
259 259
 	}
260 260
 	if (preg_match('/^`(.*)\//',$body,$matches)) {
261
-	    $body_parse = substr($body_parse,strlen($matches[1])-1);
262
-	    $find = true;
263
-	    //echo $body_parse."\n";
261
+		$body_parse = substr($body_parse,strlen($matches[1])-1);
262
+		$find = true;
263
+		//echo $body_parse."\n";
264 264
 	}
265 265
 	if (preg_match("/^'(.*)\//",$body,$matches)) {
266
-	    $body_parse = substr($body_parse,strlen($matches[1])-1);
267
-	    $find = true;
268
-	    //echo $body_parse."\n";
266
+		$body_parse = substr($body_parse,strlen($matches[1])-1);
267
+		$find = true;
268
+		//echo $body_parse."\n";
269 269
 	}
270 270
 	if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([zh\\/])/',$body_parse,$matches)) {
271
-	    $find = true;
272
-	    //print_r($matches);
273
-	    $timestamp = $matches[0];
274
-	    if ($matches[4] == 'h') {
271
+		$find = true;
272
+		//print_r($matches);
273
+		$timestamp = $matches[0];
274
+		if ($matches[4] == 'h') {
275 275
 		$timestamp = strtotime(date('Ymd').' '.$matches[1].':'.$matches[2].':'.$matches[3]);
276 276
 		//echo 'timestamp : '.$timestamp.' - now : '.time()."\n";
277 277
 		/*
278 278
 		if (time() + 3900 < $timestamp) $timestamp -= 86400;
279 279
 		elseif (time() - 82500 > $timestamp) $timestamp += 86400;
280 280
 		*/
281
-	    } elseif ($matches[4] == 'z' || $matches[4] == '/') {
281
+		} elseif ($matches[4] == 'z' || $matches[4] == '/') {
282 282
 		// This work or not ?
283 283
 		$timestamp = strtotime(date('Ym').$matches[1].' '.$matches[2].':'.$matches[3]);
284
-	    }
285
-	    $body_parse = substr($body_parse,7);
286
-	    $result['timestamp'] = $timestamp;
287
-	    //echo date('Ymd H:i:s',$timestamp);
284
+		}
285
+		$body_parse = substr($body_parse,7);
286
+		$result['timestamp'] = $timestamp;
287
+		//echo date('Ymd H:i:s',$timestamp);
288 288
 	}
289 289
 	if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})/',$body_parse,$matches)) {
290
-	    $find = true;
291
-	    $timestamp = strtotime(date('Y').$matches[1].$matches[2].' '.$matches[3].':'.$matches[4]);
292
-	    $body_parse = substr($body_parse,8);
293
-	    $result['timestamp'] = $timestamp;
294
-	    //echo date('Ymd H:i:s',$timestamp);
290
+		$find = true;
291
+		$timestamp = strtotime(date('Y').$matches[1].$matches[2].' '.$matches[3].':'.$matches[4]);
292
+		$body_parse = substr($body_parse,8);
293
+		$result['timestamp'] = $timestamp;
294
+		//echo date('Ymd H:i:s',$timestamp);
295 295
 	}
296 296
 	//if (strlen($body_parse) > 19) {
297
-	    if (preg_match('/^([0-9]{2})([0-7 ][0-9 ]\\.[0-9 ]{2})([NnSs])(.)([0-9]{3})([0-7 ][0-9 ]\\.[0-9 ]{2})([EeWw])(.)/',$body_parse,$matches)) {
297
+		if (preg_match('/^([0-9]{2})([0-7 ][0-9 ]\\.[0-9 ]{2})([NnSs])(.)([0-9]{3})([0-7 ][0-9 ]\\.[0-9 ]{2})([EeWw])(.)/',$body_parse,$matches)) {
298 298
 		$find = true;
299 299
 		// 4658.70N/00707.78Ez
300 300
 		//print_r(str_split($body_parse));
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 		$lon = intval($lon_deg);
314 314
 		if ($lat > 89 || $lon > 179) return false;
315 315
 	    
316
-	    /*
316
+		/*
317 317
 	    $tmp_5b = str_replace('.','',$lat_min);
318 318
 	    if (preg_match('/^([0-9]{0,4})( {0,4})$/',$tmp_5b,$matches)) {
319 319
 	        print_r($matches);
@@ -327,9 +327,9 @@  discard block
 block discarded – undo
327 327
 		$result['longitude'] = $longitude;
328 328
 		$body_parse = substr($body_parse,18);
329 329
 		$body_parse_len = strlen($body_parse);
330
-	    }
331
-	    $body_parse_len = strlen($body_parse);
332
-	    if ($body_parse_len > 0) {
330
+		}
331
+		$body_parse_len = strlen($body_parse);
332
+		if ($body_parse_len > 0) {
333 333
 		/*
334 334
 		if (!isset($result['timestamp']) && !isset($result['latitude'])) {
335 335
 			$body_split = str_split($body);
@@ -363,95 +363,95 @@  discard block
 block discarded – undo
363 363
 			if (isset($this->symbols[$symbol_code])) $result['symbol'] = $this->symbols[$symbol_code];
364 364
 			if ($symbol_code != '_') {
365 365
 			}
366
-		    //$body_parse = substr($body_parse,1);
367
-		    //$body_parse = trim($body_parse);
368
-		    //$body_parse_len = strlen($body_parse);
369
-		    if ($body_parse_len >= 7) {
366
+			//$body_parse = substr($body_parse,1);
367
+			//$body_parse = trim($body_parse);
368
+			//$body_parse_len = strlen($body_parse);
369
+			if ($body_parse_len >= 7) {
370 370
 			
371
-		        if (preg_match('/^([0-9\\. ]{3})\\/([0-9\\. ]{3})/',$body_parse)) {
372
-		    	    $course = substr($body_parse,0,3);
373
-		    	    $tmp_s = intval($course);
374
-		    	    if ($tmp_s >= 1 && $tmp_s <= 360) $result['heading'] = intval($course);
375
-		    	    $speed = substr($body_parse,4,3);
376
-		    	    if ($speed != '...') {
377
-		    		//$result['speed'] = round($speed*1.852);
378
-		    		$result['speed'] = intval($speed);
379
-		    	    }
380
-		    	    $body_parse = substr($body_parse,7);
381
-		        }
382
-		        // Check PHGR, PHG, RNG
383
-		    } 
384
-		    /*
371
+				if (preg_match('/^([0-9\\. ]{3})\\/([0-9\\. ]{3})/',$body_parse)) {
372
+					$course = substr($body_parse,0,3);
373
+					$tmp_s = intval($course);
374
+					if ($tmp_s >= 1 && $tmp_s <= 360) $result['heading'] = intval($course);
375
+					$speed = substr($body_parse,4,3);
376
+					if ($speed != '...') {
377
+					//$result['speed'] = round($speed*1.852);
378
+					$result['speed'] = intval($speed);
379
+					}
380
+					$body_parse = substr($body_parse,7);
381
+				}
382
+				// Check PHGR, PHG, RNG
383
+			} 
384
+			/*
385 385
 		    else if ($body_parse_len > 0) {
386 386
 			$rest = $body_parse;
387 387
 		    }
388 388
 		    */
389
-		    if (strlen($body_parse) > 0) {
390
-		        if (preg_match('/\\/A=(-[0-9]{5}|[0-9]{6})/',$body_parse,$matches)) {
391
-		            $altitude = intval($matches[1]);
392
-		            //$result['altitude'] = round($altitude*0.3048);
393
-		            $result['altitude'] = $altitude;
394
-		            //$body_parse = trim(substr($body_parse,strlen($matches[0])));
395
-		            $body_parse = trim(preg_replace('/\\/A=(-[0-9]{5}|[0-9]{6})/','',$body_parse));
396
-		        }
397
-		    }
389
+			if (strlen($body_parse) > 0) {
390
+				if (preg_match('/\\/A=(-[0-9]{5}|[0-9]{6})/',$body_parse,$matches)) {
391
+					$altitude = intval($matches[1]);
392
+					//$result['altitude'] = round($altitude*0.3048);
393
+					$result['altitude'] = $altitude;
394
+					//$body_parse = trim(substr($body_parse,strlen($matches[0])));
395
+					$body_parse = trim(preg_replace('/\\/A=(-[0-9]{5}|[0-9]{6})/','',$body_parse));
396
+				}
397
+			}
398 398
 		    
399
-		    // Telemetry
400
-		    /*
399
+			// Telemetry
400
+			/*
401 401
 		    if (preg_match('/^([0-9]+),(-?)([0-9]{1,6}|[0-9]+\\.[0-9]+|\\.[0-9]+)?,(-?)([0-9]{1,6}|[0-9]+\\.[0-9]+|\\.[0-9]+)?,(-?)([0-9]{1,6}|[0-9]+\\.[0-9]+|\\.[0-9]+)?,(-?)([0-9]{1,6}|[0-9]+\\.[0-9]+|\\.[0-9]+)?,(-?)([0-9]{1,6}|[0-9]+\\.[0-9]+|\\.[0-9]+)?,([01]{0,8})/',$body_parse,$matches)) {
402 402
 		        // Nothing yet...
403 403
 		    }
404 404
 		    */
405
-		    // DAO
405
+			// DAO
406 406
 		    
407
-		    if (preg_match('/^!([0-9A-Z]{3})/',$body_parse,$matches)) {
407
+			if (preg_match('/^!([0-9A-Z]{3})/',$body_parse,$matches)) {
408 408
 			    
409
-			    $dao = $matches[1];
410
-			    if (preg_match('/^([A-Z])([0-9]{2})/',$dao)) {
409
+				$dao = $matches[1];
410
+				if (preg_match('/^([A-Z])([0-9]{2})/',$dao)) {
411 411
 				$dao_split = str_split($dao);
412
-			        $lat_off = (($dao_split[1])-48.0)*0.001/60.0;
413
-			        $lon_off = (($dao_split[2])-48.0)*0.001/60.0;
412
+					$lat_off = (($dao_split[1])-48.0)*0.001/60.0;
413
+					$lon_off = (($dao_split[2])-48.0)*0.001/60.0;
414 414
 			    
415 415
 				if ($result['latitude'] < 0) $result['latitude'] -= $lat_off;
416 416
 				else $result['latitude'] += $lat_off;
417 417
 				if ($result['longitude'] < 0) $result['longitude'] -= $lon_off;
418 418
 				else $result['longitude'] += $lon_off;
419
-			    }
419
+				}
420 420
 			    
421
-		            $body_parse = substr($body_parse,6);
422
-		    }
423
-		    //echo 'bodyparse : '.$body_parse."\n";
424
-		    if (preg_match('/CS=([0-9A-Z_]*)/',$body_parse,$matches)) {
421
+					$body_parse = substr($body_parse,6);
422
+			}
423
+			//echo 'bodyparse : '.$body_parse."\n";
424
+			if (preg_match('/CS=([0-9A-Z_]*)/',$body_parse,$matches)) {
425 425
 			$result['ident'] = str_replace('_',' ',$matches[1]);
426
-		    }
427
-		    if (preg_match('/SQ=([0-9]{4})/',$body_parse,$matches)) {
426
+			}
427
+			if (preg_match('/SQ=([0-9]{4})/',$body_parse,$matches)) {
428 428
 			$result['squawk'] = $matches[1];
429
-		    }
430
-		    if (preg_match('/AI=([0-9A-Z]{4})/',$body_parse,$matches)) {
429
+			}
430
+			if (preg_match('/AI=([0-9A-Z]{4})/',$body_parse,$matches)) {
431 431
 			$result['aircraft_icao'] = $matches[1];
432
-		    }
433
-		    if (preg_match('/VR=([0-9]*)/',$body_parse,$matches)) {
432
+			}
433
+			if (preg_match('/VR=([0-9]*)/',$body_parse,$matches)) {
434 434
 			$result['verticalrate'] = $matches[1];
435
-		    }
436
-		    if (preg_match('/TI=([0-9]*)/',$body_parse,$matches)) {
435
+			}
436
+			if (preg_match('/TI=([0-9]*)/',$body_parse,$matches)) {
437 437
 			$result['typeid'] = $matches[1];
438
-		    }
439
-		    if (preg_match('/SI=([0-9]*)/',$body_parse,$matches)) {
438
+			}
439
+			if (preg_match('/SI=([0-9]*)/',$body_parse,$matches)) {
440 440
 			$result['statusid'] = $matches[1];
441
-		    }
442
-		    if (preg_match('/IMO=([0-9]{7})/',$body_parse,$matches)) {
441
+			}
442
+			if (preg_match('/IMO=([0-9]{7})/',$body_parse,$matches)) {
443 443
 			$result['imo'] = $matches[1];
444
-		    }
445
-		    if (preg_match('/AD=([0-9]*)/',$body_parse,$matches)) {
444
+			}
445
+			if (preg_match('/AD=([0-9]*)/',$body_parse,$matches)) {
446 446
 			$result['arrival_date'] = $matches[1];
447
-		    }
448
-		    if (preg_match('/AC=([0-9A-Z_]*)/',$body_parse,$matches)) {
447
+			}
448
+			if (preg_match('/AC=([0-9A-Z_]*)/',$body_parse,$matches)) {
449 449
 			$result['arrival_code'] = str_replace('_',' ',$matches[1]);
450
-		    }
451
-		    // OGN comment
450
+			}
451
+			// OGN comment
452 452
 		   // echo "Before OGN : ".$body_parse."\n";
453
-		    //if (preg_match('/^id([0-9A-F]{8}) ([+-])([0-9]{3,4})fpm ([+-])([0-9.]{3,4})rot (.*)$/',$body_parse,$matches)) {
454
-		    if (preg_match('/^id([0-9A-F]{8})/',$body_parse,$matches)) {
453
+			//if (preg_match('/^id([0-9A-F]{8}) ([+-])([0-9]{3,4})fpm ([+-])([0-9.]{3,4})rot (.*)$/',$body_parse,$matches)) {
454
+			if (preg_match('/^id([0-9A-F]{8})/',$body_parse,$matches)) {
455 455
 			$id = $matches[1];
456 456
 			//$mode = substr($id,0,2);
457 457
 			$address = substr($id,2);
@@ -481,42 +481,42 @@  discard block
 block discarded – undo
481 481
 			$stealth = (intval(substr($id,0,2), 16) & 0b10000000) != 0;
482 482
 			$result['stealth'] = $stealth;
483 483
 			$result['address'] = $address;
484
-		    }
484
+			}
485 485
 		    
486
-		    //Comment
487
-		    $result['comment'] = trim($body_parse);
486
+			//Comment
487
+			$result['comment'] = trim($body_parse);
488 488
 		//} else {
489
-		    // parse weather
490
-		    //$body_parse = substr($body_parse,1);
491
-		    //$body_parse_len = strlen($body_parse);
492
-		    //echo 'weather'."\n";
493
-		    if (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
494
-			    $result['wind_dir'] = intval($matches[1]);
495
-			    $result['wind_speed'] = round(intval($matches[2])*1.60934,1);
496
-			    $result['wind_gust'] = round(intval($matches[3])*1.60934,1);
497
-			    $result['temp'] = round(5/9*((intval($matches[4]))-32),1);
498
-		    	    $body_parse = substr($body_parse,strlen($matches[0])+1);
499
-		    } elseif (preg_match('/^_{0,1}c([0-9 \\.\\-]{3})s([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
489
+			// parse weather
490
+			//$body_parse = substr($body_parse,1);
491
+			//$body_parse_len = strlen($body_parse);
492
+			//echo 'weather'."\n";
493
+			if (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
494
+				$result['wind_dir'] = intval($matches[1]);
495
+				$result['wind_speed'] = round(intval($matches[2])*1.60934,1);
496
+				$result['wind_gust'] = round(intval($matches[3])*1.60934,1);
497
+				$result['temp'] = round(5/9*((intval($matches[4]))-32),1);
498
+					$body_parse = substr($body_parse,strlen($matches[0])+1);
499
+			} elseif (preg_match('/^_{0,1}c([0-9 \\.\\-]{3})s([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
500 500
 			$result['wind_dir'] = intval($matches[1]);
501 501
 			$result['wind_speed'] = round($matches[2]*1.60934,1);
502 502
 			$result['wind_gust'] = round($matches[3]*1.60934,1);
503 503
 			$result['temp'] = round(5/9*(($matches[4])-32),1);
504
-		        $body_parse = substr($body_parse,strlen($matches[0])+1);
505
-		    } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
504
+				$body_parse = substr($body_parse,strlen($matches[0])+1);
505
+			} elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
506 506
 			$result['wind_dir'] = intval($matches[1]);
507 507
 			$result['wind_speed'] = round($matches[2]*1.60934,1);
508 508
 			$result['wind_gust'] = round($matches[3]*1.60934,1);
509
-		        $body_parse = substr($body_parse,strlen($matches[0])+1);
510
-		    } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)/',$body_parse,$matches)) {
509
+				$body_parse = substr($body_parse,strlen($matches[0])+1);
510
+			} elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)/',$body_parse,$matches)) {
511 511
 			$result['wind_dir'] = intval($matches[1]);
512 512
 			$result['wind_speed'] = round($matches[2]*1.60934,1);
513 513
 			$result['wind_gust'] = round($matches[3]*1.60934,1);
514
-		        $body_parse = substr($body_parse,strlen($matches[0])+1);
515
-		    }
516
-		    //if (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9]+)t(-?[0-9 \\.]{1,3})/',$body_parse,$matches)) {
517
-		    //g012t088r000p000P000h38b10110
518
-		    //g011t086r000p000P000h29b10198
519
-		    if (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3,4})r([0-9 \\.]{3})p([0-9 \\.]{3})P([0-9 \\.]{3})h([0-9 \\.]{2,3})b([0-9 \\.]{5})/',$body_parse,$matches)) {
514
+				$body_parse = substr($body_parse,strlen($matches[0])+1);
515
+			}
516
+			//if (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9]+)t(-?[0-9 \\.]{1,3})/',$body_parse,$matches)) {
517
+			//g012t088r000p000P000h38b10110
518
+			//g011t086r000p000P000h29b10198
519
+			if (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3,4})r([0-9 \\.]{3})p([0-9 \\.]{3})P([0-9 \\.]{3})h([0-9 \\.]{2,3})b([0-9 \\.]{5})/',$body_parse,$matches)) {
520 520
 			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
521 521
 			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
522 522
 			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
@@ -524,8 +524,8 @@  discard block
 block discarded – undo
524 524
 			if ($matches[5] != '...') $result['precipitation24h'] = round((intval($matches[5])/100)*25.1,1);
525 525
 			if ($matches[6] != '...') $result['humidity'] = intval($matches[6]);
526 526
 			if ($matches[7] != '...') $result['pressure'] = round((intval($matches[7])/10),1);
527
-		        $body_parse = substr($body_parse,strlen($matches[0]));
528
-		    } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3,4})r([0-9 \\.]{3})P([0-9 \\.]{3})p([0-9 \\.]{3})h([0-9 \\.]{2,3})b([0-9 \\.]{5})/',$body_parse,$matches)) {
527
+				$body_parse = substr($body_parse,strlen($matches[0]));
528
+			} elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3,4})r([0-9 \\.]{3})P([0-9 \\.]{3})p([0-9 \\.]{3})h([0-9 \\.]{2,3})b([0-9 \\.]{5})/',$body_parse,$matches)) {
529 529
 			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
530 530
 			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
531 531
 			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
@@ -533,8 +533,8 @@  discard block
 block discarded – undo
533 533
 			if ($matches[4] != '...') $result['precipitation24h'] = round((intval($matches[4])/100)*25.1,1);
534 534
 			if ($matches[6] != '...') $result['humidity'] = intval($matches[6]);
535 535
 			if ($matches[7] != '...') $result['pressure'] = round((intval($matches[7])/10),1);
536
-		        $body_parse = substr($body_parse,strlen($matches[0]));
537
-		    } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})P([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) {
536
+				$body_parse = substr($body_parse,strlen($matches[0]));
537
+			} elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})P([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) {
538 538
 			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
539 539
 			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
540 540
 			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
@@ -542,58 +542,58 @@  discard block
 block discarded – undo
542 542
 			if ($matches[5] != '...') $result['precipitation24h'] = round((intval($matches[5])/100)*25.1,1);
543 543
 			if ($matches[7] != '...') $result['humidity'] = intval($matches[7]);
544 544
 			if ($matches[6] != '...') $result['pressure'] = round((intval($matches[6])/10),1);
545
-		        $body_parse = substr($body_parse,strlen($matches[0]));
546
-		    } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})P([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) {
545
+				$body_parse = substr($body_parse,strlen($matches[0]));
546
+			} elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})P([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) {
547 547
 			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
548 548
 			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
549 549
 			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
550 550
 			if ($matches[4] != '...') $result['precipitation24h'] = round((intval($matches[4])/100)*25.1,1);
551 551
 			if ($matches[6] != '...') $result['humidity'] = intval($matches[6]);
552 552
 			if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1);
553
-		        $body_parse = substr($body_parse,strlen($matches[0]));
554
-		    } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) {
553
+				$body_parse = substr($body_parse,strlen($matches[0]));
554
+			} elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) {
555 555
 			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
556 556
 			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
557 557
 			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
558 558
 			if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1);
559 559
 			if ($matches[6] != '...') $result['humidity'] = intval($matches[6]);
560 560
 			if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1);
561
-		        $body_parse = substr($body_parse,strlen($matches[0]));
562
-		    } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) {
561
+				$body_parse = substr($body_parse,strlen($matches[0]));
562
+			} elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) {
563 563
 			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
564 564
 			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
565 565
 			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
566 566
 			if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1);
567 567
 			if ($matches[5] != '...') $result['humidity'] = intval($matches[5]);
568 568
 			if ($matches[6] != '...') $result['pressure'] = round((intval($matches[6])/10),1);
569
-		        $body_parse = substr($body_parse,strlen($matches[0]));
570
-		    } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) {
569
+				$body_parse = substr($body_parse,strlen($matches[0]));
570
+			} elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) {
571 571
 			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
572 572
 			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
573 573
 			if ($matches[2] != '...') $result['humidity'] = intval($matches[3]);
574 574
 			if ($matches[4] != '...') $result['pressure'] = round((intval($matches[4])/10),1);
575
-		        $body_parse = substr($body_parse,strlen($matches[0]));
576
-		    } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{2,3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) {
575
+				$body_parse = substr($body_parse,strlen($matches[0]));
576
+			} elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{2,3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) {
577 577
 			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
578 578
 			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
579 579
 			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
580 580
 			if ($matches[4] != '...') $result['humidity'] = intval($matches[4]);
581 581
 			if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1);
582
-		        $body_parse = substr($body_parse,strlen($matches[0]));
583
-		    }
584
-		    $result['comment'] = trim($body_parse);
582
+				$body_parse = substr($body_parse,strlen($matches[0]));
583
+			}
584
+			$result['comment'] = trim($body_parse);
585 585
 		}
586 586
 		} else $result['comment'] = trim($body_parse);
587 587
 
588
-	    }
588
+		}
589 589
 	//}
590 590
 	if (isset($result['latitude'])) $result['latitude'] = round($result['latitude'],4);
591 591
 	if (isset($result['longitude'])) $result['longitude'] = round($result['longitude'],4);
592 592
 	if ($debug) print_r($result);
593 593
 	return $result;
594
-    }
594
+	}
595 595
     
596
-    public function connect() {
596
+	public function connect() {
597 597
 	global $globalAPRSversion, $globalServerAPRSssid, $globalServerAPRSpass,$globalName, $globalServerAPRShost, $globalServerAPRSport;
598 598
 	$aprs_connect = 0;
599 599
 	$aprs_keep = 120;
@@ -617,24 +617,24 @@  discard block
 block discarded – undo
617 617
 		socket_set_option($this->socket,SOL_SOCKET,SO_KEEPALIVE,1);
618 618
 		while ($msgin = socket_read($this->socket, 1000,PHP_NORMAL_READ)) {
619 619
 			if (strpos($msgin, "$aprs_ssid verified") !== FALSE) {
620
-			    echo 'APRS user verified !'."\n";
621
-			    $this->connected = true;
622
-			    return true;
623
-			    break;
620
+				echo 'APRS user verified !'."\n";
621
+				$this->connected = true;
622
+				return true;
623
+				break;
624 624
 			}
625 625
 			if (time()-$authstart > 5) {
626
-			    echo 'APRS timeout'."\n";
627
-			    break;
626
+				echo 'APRS timeout'."\n";
627
+				break;
628 628
 			}
629 629
 		}
630 630
 	}
631
-    }
631
+	}
632 632
 
633
-    public function disconnect() {
633
+	public function disconnect() {
634 634
 	socket_close($this->socket);
635
-    }
635
+	}
636 636
     
637
-    public function send($data) {
637
+	public function send($data) {
638 638
 	global $globalDebug;
639 639
 	if ($this->connected === false) $this->connect();
640 640
 	$send = socket_send( $this->socket  , $data , strlen($data),0);
@@ -643,7 +643,7 @@  discard block
 block discarded – undo
643 643
 		socket_close($this->socket);
644 644
 		$this->connect();
645 645
 	}
646
-    }
646
+	}
647 647
 }
648 648
 
649 649
 class APRSSpotter extends APRS {
Please login to merge, or discard this patch.
live-czml.php 1 patch
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -39,30 +39,30 @@  discard block
 block discarded – undo
39 39
 
40 40
 
41 41
 function quaternionrotate($heading, $attitude = 0, $bank = 0) {
42
-    // Assuming the angles are in radians.
43
-    $c1 = cos($heading/2);
44
-    $s1 = sin($heading/2);
45
-    $c2 = cos($attitude/2);
46
-    $s2 = sin($attitude/2);
47
-    $c3 = cos($bank/2);
48
-    $s3 = sin($bank/2);
49
-    $c1c2 = $c1*$c2;
50
-    $s1s2 = $s1*$s2;
51
-    $w =$c1c2*$c3 - $s1s2*$s3;
52
-    $x =$c1c2*$s3 + $s1s2*$c3;
53
-    $y =$s1*$c2*$c3 + $c1*$s2*$s3;
54
-    $z =$c1*$s2*$c3 - $s1*$c2*$s3;
55
-    return array('x' => $x,'y' => $y,'z' => $z,'w' => $w);
42
+	// Assuming the angles are in radians.
43
+	$c1 = cos($heading/2);
44
+	$s1 = sin($heading/2);
45
+	$c2 = cos($attitude/2);
46
+	$s2 = sin($attitude/2);
47
+	$c3 = cos($bank/2);
48
+	$s3 = sin($bank/2);
49
+	$c1c2 = $c1*$c2;
50
+	$s1s2 = $s1*$s2;
51
+	$w =$c1c2*$c3 - $s1s2*$s3;
52
+	$x =$c1c2*$s3 + $s1s2*$c3;
53
+	$y =$s1*$c2*$c3 + $c1*$s2*$s3;
54
+	$z =$c1*$s2*$c3 - $s1*$c2*$s3;
55
+	return array('x' => $x,'y' => $y,'z' => $z,'w' => $w);
56 56
 //    return array('x' => '0.0','y' => '-0.931','z' => '0.0','w' => '0.365');
57 57
 
58 58
 }
59 59
 
60 60
 
61 61
 if (isset($_GET['download'])) {
62
-    if ($_GET['download'] == "true")
63
-    {
62
+	if ($_GET['download'] == "true")
63
+	{
64 64
 	header('Content-disposition: attachment; filename="flightairmap.json"');
65
-    }
65
+	}
66 66
 }
67 67
 header('Content-Type: text/javascript');
68 68
 
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 	if (isset($_GET['coord']) && $_GET['coord'] != '') {
156 156
 		$coord = explode(',',$_GET['coord']);
157 157
 		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) 
158
-		    && $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)) {
158
+			&& $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)) {
159 159
 			$coord = array();
160 160
 		}
161 161
 	}
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 	if (isset($_GET['coord']) && $_GET['coord'] != '') {
166 166
 		$coord = explode(',',$_GET['coord']);
167 167
 		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) 
168
-		    && $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)) {
168
+			&& $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)) {
169 169
 			$coord = array();
170 170
 		}
171 171
 	}
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 	if (isset($_GET['coord']) && $_GET['coord'] != '') {
176 176
 		$coord = explode(',',$_GET['coord']);
177 177
 		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) 
178
-		    && $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)) {
178
+			&& $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)) {
179 179
 			$coord = array();
180 180
 		}
181 181
 	}
@@ -265,10 +265,10 @@  discard block
 block discarded – undo
265 265
 			$image = "images/placeholder_thumb.png";
266 266
 		}
267 267
 
268
-                if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id'];
269
-                elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid'];
270
-                elseif (isset($spotter_item['fammarine_id'])) $id = $spotter_item['fammarine_id'];
271
-                if ($prev_flightaware_id != $id) {
268
+				if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id'];
269
+				elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid'];
270
+				elseif (isset($spotter_item['fammarine_id'])) $id = $spotter_item['fammarine_id'];
271
+				if ($prev_flightaware_id != $id) {
272 272
 			if ($prev_flightaware_id != '') {
273 273
 				/*
274 274
 				if ($nblatlong == 1) {
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 							$spotter_item['wake_category'] = $aircraft_info[0]['wake_category'];
349 349
 							$spotter_item['engine_count'] = $aircraft_info[0]['engine_count'];
350 350
 						} else $aircraft_shadow = '';
351
-	    					$output .= ' "billboard" : {"image" : "'.$globalURL.'/images/aircrafts/new/'.$aircraft_shadow.'","scale" : 0.5';
351
+							$output .= ' "billboard" : {"image" : "'.$globalURL.'/images/aircrafts/new/'.$aircraft_shadow.'","scale" : 0.5';
352 352
 						if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true' && isset($_COOKIE['IconColor'])) {
353 353
 							$rgb = $Common->hex2rgb($_COOKIE['IconColor']);
354 354
 							$output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}';
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
 							$rgb = $Common->hex2rgb($_COOKIE['IconColor']);
380 380
 							$output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}';
381 381
 						}
382
-    						$output .= '},';
382
+							$output .= '},';
383 383
 					} elseif (isset($modelsdb[$aircraft_icao]) && $aircraft_icao != '') {
384 384
 						$output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$modelsdb[$aircraft_icao].'","scale" : 1.0,"minimumPixelSize": 20';
385 385
 						$output .= ',"heightReference": "'.$heightrelative.'"';
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 							$rgb = $Common->hex2rgb($_COOKIE['IconColor']);
388 388
 							$output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}';
389 389
 						}
390
-    						$output .= '},';
390
+							$output .= '},';
391 391
 					} elseif ($aircraft_icao != '') {
392 392
 						$aircraft_info = $Spotter->getAllAircraftInfo($aircraft_icao);
393 393
 						if (isset($aircraft_info[0]['engine_type'])) {
Please login to merge, or discard this patch.
live-geojson.php 1 patch
Indentation   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -5,23 +5,23 @@  discard block
 block discarded – undo
5 5
 $marine = false;
6 6
 $usecoord = false;
7 7
 if (isset($_GET['tracker'])) {
8
-    $tracker = true;
8
+	$tracker = true;
9 9
 }
10 10
 if (isset($_GET['marine'])) {
11
-    $marine = true;
11
+	$marine = true;
12 12
 }
13 13
 if ($tracker) {
14
-    require_once('require/class.Tracker.php');
15
-    require_once('require/class.TrackerLive.php');
16
-    require_once('require/class.TrackerArchive.php');
14
+	require_once('require/class.Tracker.php');
15
+	require_once('require/class.TrackerLive.php');
16
+	require_once('require/class.TrackerArchive.php');
17 17
 } elseif ($marine) {
18
-    require_once('require/class.Marine.php');
19
-    require_once('require/class.MarineLive.php');
20
-    require_once('require/class.MarineArchive.php');
18
+	require_once('require/class.Marine.php');
19
+	require_once('require/class.MarineLive.php');
20
+	require_once('require/class.MarineArchive.php');
21 21
 } else {
22
-    require_once('require/class.Spotter.php');
23
-    require_once('require/class.SpotterLive.php');
24
-    require_once('require/class.SpotterArchive.php');
22
+	require_once('require/class.Spotter.php');
23
+	require_once('require/class.SpotterLive.php');
24
+	require_once('require/class.SpotterArchive.php');
25 25
 }
26 26
 
27 27
 $begintime = microtime(true);
@@ -41,10 +41,10 @@  discard block
 block discarded – undo
41 41
 $Common = new Common();
42 42
 
43 43
 if (isset($_GET['download'])) {
44
-    if ($_GET['download'] == "true")
45
-    {
44
+	if ($_GET['download'] == "true")
45
+	{
46 46
 	header('Content-disposition: attachment; filename="flightairmap.json"');
47
-    }
47
+	}
48 48
 }
49 49
 header('Content-Type: text/javascript');
50 50
 
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	$usecoord = true;
109 109
 	$coord = explode(',',$_GET['coord']);
110 110
 	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) 
111
-	    && $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) {
111
+		&& $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) {
112 112
 		if ($tracker) {
113 113
 			$spotter_array = $TrackerLive->getLiveTrackerDatabyCoord($coord,$filter);
114 114
 		} elseif ($marine) {
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	$usecoord = true;
122 122
 	$coord = explode(',',$_GET['coord']);
123 123
 	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) 
124
-	    && $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) {
124
+		&& $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) {
125 125
 		if ($tracker) {
126 126
 			$spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord,$filter);
127 127
 		} elseif ($marine) {
@@ -538,17 +538,17 @@  discard block
 block discarded – undo
538 538
 				if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history'];
539 539
 				
540 540
 				if (
541
-				    (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') 
542
-				    || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory)
541
+					(isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') 
542
+					|| ((isset($globalMapHistory) && $globalMapHistory) || $allhistory)
543 543
 				//    || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id']))
544 544
 				//    || (isset($history) && $history != '' && $history != 'NA' && $history == $spotter_item['ident'])
545
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
546
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])
547
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id']))
548
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id'])
549
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid']))
550
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid'])
551
-				    ) {
545
+					|| (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
546
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])
547
+					|| (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id']))
548
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id'])
549
+					|| (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid']))
550
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid'])
551
+					) {
552 552
 					if ($tracker) {
553 553
 						if ($from_archive || $globalArchive) {
554 554
 							$spotter_history_array = $TrackerArchive->getAllArchiveTrackerDataById($spotter_item['famtrackid']);
@@ -637,65 +637,65 @@  discard block
 block discarded – undo
637 637
 				}
638 638
 				
639 639
 				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
640
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
641
-				     && (isset($spotter_item['departure_airport']) 
642
-				        && $spotter_item['departure_airport'] != 'NA' 
643
-				        && isset($spotter_item['arrival_airport']) 
644
-				        && $spotter_item['arrival_airport'] != 'NA' 
645
-				        && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") 
646
-				    	    || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) {
647
-				    if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
648
-				    else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
649
-				    if (isset($spotter_item['departure_airport_latitude'])) {
640
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
641
+					 && (isset($spotter_item['departure_airport']) 
642
+						&& $spotter_item['departure_airport'] != 'NA' 
643
+						&& isset($spotter_item['arrival_airport']) 
644
+						&& $spotter_item['arrival_airport'] != 'NA' 
645
+						&& ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") 
646
+							|| (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) {
647
+					if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
648
+					else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
649
+					if (isset($spotter_item['departure_airport_latitude'])) {
650 650
 					$output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],';
651
-				    } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') {
651
+					} elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') {
652 652
 					$dairport = $Spotter->getAllAirportInfo($spotter_item['departure_airport']);
653 653
 					if (isset($dairport[0]['latitude'])) {
654
-					    $output_air .= '['.$dairport[0]['longitude'].','.$dairport[0]['latitude'].'],';
654
+						$output_air .= '['.$dairport[0]['longitude'].','.$dairport[0]['latitude'].'],';
655 655
 					}
656
-				    }
657
-				    if (isset($spotter_item['arrival_airport_latitude'])) {
656
+					}
657
+					if (isset($spotter_item['arrival_airport_latitude'])) {
658 658
 					$output_air .= '['.$spotter_item['arrival_airport_longitude'].','.$spotter_item['arrival_airport_latitude'].'],';
659
-				    } elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
659
+					} elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
660 660
 					$aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']);
661 661
 					if (isset($aairport[0]['latitude'])) {
662
-					    $output_air .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].'],';
662
+						$output_air .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].'],';
663 663
 					}
664
-				    }
665
-				    $output_air  = substr($output_air, 0, -1);
666
-				    $output_air .= ']}},';
667
-				    $output .= $output_air;
668
-				    unset($output_air);
664
+					}
665
+					$output_air  = substr($output_air, 0, -1);
666
+					$output_air .= ']}},';
667
+					$output .= $output_air;
668
+					unset($output_air);
669 669
 				}
670 670
 
671 671
 				//if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA' && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) {
672 672
 				//if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) {
673 673
 				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
674
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
675
-				     && (isset($spotter_item['arrival_airport']) 
676
-				        && $spotter_item['arrival_airport'] != 'NA' 
677
-				        && ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == "true") 
678
-				    	    || (!isset($_COOKIE['MapRemainaingRoute']) && (!isset($globalMapRemainingRoute) 
679
-				    	    || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) {
680
-				    $havedata = false;
681
-				    if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
682
-				    else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
683
-				    $output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],';
674
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
675
+					 && (isset($spotter_item['arrival_airport']) 
676
+						&& $spotter_item['arrival_airport'] != 'NA' 
677
+						&& ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == "true") 
678
+							|| (!isset($_COOKIE['MapRemainaingRoute']) && (!isset($globalMapRemainingRoute) 
679
+							|| (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) {
680
+					$havedata = false;
681
+					if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
682
+					else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
683
+					$output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],';
684 684
 
685
-				    if (isset($spotter_item['arrival_airport_latitude'])) {
685
+					if (isset($spotter_item['arrival_airport_latitude'])) {
686 686
 					$output_dest .= '['.$spotter_item['arrival_airport_longitude'].','.$spotter_item['arrival_airport_latitude'].']';
687 687
 					$havedata = true;
688
-				    } elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
688
+					} elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
689 689
 					$aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']);
690 690
 					if (isset($aairport[0]['latitude'])) {
691
-					    $output_dest .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].']';
692
-					    $havedata = true;
691
+						$output_dest .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].']';
692
+						$havedata = true;
693 693
 					}
694
-				    }
695
-				    //$output_dest  = substr($output_dest, 0, -1);
696
-				    $output_dest .= ']}},';
697
-				    if ($havedata) $output .= $output_dest;
698
-				    unset($output_dest);
694
+					}
695
+					//$output_dest  = substr($output_dest, 0, -1);
696
+					$output_dest .= ']}},';
697
+					if ($havedata) $output .= $output_dest;
698
+					unset($output_dest);
699 699
 				}
700 700
 			}
701 701
 			$output  = substr($output, 0, -1);
Please login to merge, or discard this patch.
require/class.AIS.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 		return ($dec);
58 58
 	}
59 59
 	
60
-    /*
60
+	/*
61 61
     $ais_map64 = array(
62 62
        '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', // 48
63 63
        ':', ';', '<', '=', '>', '?', '@', 'A', 'B', 'C',
@@ -97,13 +97,13 @@  discard block
 block discarded – undo
97 97
 		//  ' ' --- '?', // 0x20 - 0x3F
98 98
 		//  '@' --- '_', // 0x40 - 0x5F
99 99
 		$ais_chars = array(
100
-		    '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
101
-		    'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
102
-		    'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']',
103
-		    '^', '_', ' ', '!', '\"', '#', '$', '%', '&', '\'',
104
-		    '(', ')', '*', '+', ',', '-', '.', '/', '0', '1',
105
-		    '2', '3', '4', '5', '6', '7', '8', '9', ':', ';',
106
-		    '<', '=', '>', '?'
100
+			'@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
101
+			'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
102
+			'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']',
103
+			'^', '_', ' ', '!', '\"', '#', '$', '%', '&', '\'',
104
+			'(', ')', '*', '+', ',', '-', '.', '/', '0', '1',
105
+			'2', '3', '4', '5', '6', '7', '8', '9', ':', ';',
106
+			'<', '=', '>', '?'
107 107
 		);
108 108
 		// "
109 109
 		$rv = '';
@@ -421,8 +421,8 @@  discard block
 block discarded – undo
421 421
 				}
422 422
 				if ($num_seq > 1) { // for multipart messages
423 423
 					if ($cmsg_sid != $msg_sid // different msg_sid
424
-					    || $msg_sid == -1 // invalid initial msg_sid
425
-					    || ($seq - $pseq) != 1 // not insequence
424
+						|| $msg_sid == -1 // invalid initial msg_sid
425
+						|| ($seq - $pseq) != 1 // not insequence
426 426
 					) {  // invalid for multipart message
427 427
 						$msg_sid = -1;
428 428
 						$cmsg_sid = -1;
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 				$itu = $itu.$pcs[5]; // get itu message
436 436
 				$filler += (int)$pcs[6][0]; // get filler
437 437
 				if ($num_seq == 1 // valid single message
438
-				    || $num_seq == $pseq // valid multi-part message
438
+					|| $num_seq == $pseq // valid multi-part message
439 439
 				) {
440 440
 					/*
441 441
 					if ($num_seq != 1) { // test
@@ -520,13 +520,13 @@  discard block
 block discarded – undo
520 520
 		else $pad = '';
521 521
 		$rv = '';
522 522
 		$ais_chars = array(
523
-		    '@'=>0, 'A'=>1, 'B'=>2, 'C'=>3, 'D'=>4, 'E'=>5, 'F'=>6, 'G'=>7, 'H'=>8, 'I'=>9,
524
-		    'J'=>10, 'K'=>11, 'L'=>12, 'M'=>13, 'N'=>14, 'O'=>15, 'P'=>16, 'Q'=>17, 'R'=>18, 'S'=>19,
525
-		    'T'=>20, 'U'=>21, 'V'=>22, 'W'=>23, 'X'=>24, 'Y'=>25, 'Z'=>26, '['=>27, '\\'=>28, ']'=>29,
526
-		    '^'=>30, '_'=>31, ' '=>32, '!'=>33, '\"'=>34, '#'=>35, '$'=>36, '%'=>37, '&'=>38, '\''=>39,
527
-		    '('=>40, ')'=>41, '*'=>42, '+'=>43, ','=>44, '-'=>45, '.'=>46, '/'=>47, '0'=>48, '1'=>49,
528
-		    '2'=>50, '3'=>51, '4'=>52, '5'=>53, '6'=>54, '7'=>55, '8'=>56, '9'=>57, ':'=>58, ';'=>59,
529
-		    '<'=>60, '='=>61, '>'=>62, '?'=>63
523
+			'@'=>0, 'A'=>1, 'B'=>2, 'C'=>3, 'D'=>4, 'E'=>5, 'F'=>6, 'G'=>7, 'H'=>8, 'I'=>9,
524
+			'J'=>10, 'K'=>11, 'L'=>12, 'M'=>13, 'N'=>14, 'O'=>15, 'P'=>16, 'Q'=>17, 'R'=>18, 'S'=>19,
525
+			'T'=>20, 'U'=>21, 'V'=>22, 'W'=>23, 'X'=>24, 'Y'=>25, 'Z'=>26, '['=>27, '\\'=>28, ']'=>29,
526
+			'^'=>30, '_'=>31, ' '=>32, '!'=>33, '\"'=>34, '#'=>35, '$'=>36, '%'=>37, '&'=>38, '\''=>39,
527
+			'('=>40, ')'=>41, '*'=>42, '+'=>43, ','=>44, '-'=>45, '.'=>46, '/'=>47, '0'=>48, '1'=>49,
528
+			'2'=>50, '3'=>51, '4'=>52, '5'=>53, '6'=>54, '7'=>55, '8'=>56, '9'=>57, ':'=>58, ';'=>59,
529
+			'<'=>60, '='=>61, '>'=>62, '?'=>63
530 530
 		);
531 531
 		// "
532 532
 		$_a = str_split($name);
Please login to merge, or discard this patch.
require/class.MarineLive.php 1 patch
Indentation   +191 added lines, -191 removed lines patch added patch discarded remove patch
@@ -13,10 +13,10 @@  discard block
 block discarded – undo
13 13
 
14 14
 
15 15
 	/**
16
-	* Get SQL query part for filter used
17
-	* @param Array $filter the filter
18
-	* @return Array the SQL part
19
-	*/
16
+	 * Get SQL query part for filter used
17
+	 * @param Array $filter the filter
18
+	 * @return Array the SQL part
19
+	 */
20 20
 	public function getFilter($filter = array(),$where = false,$and = false) {
21 21
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
22 22
 		$filters = array();
@@ -90,11 +90,11 @@  discard block
 block discarded – undo
90 90
 	}
91 91
 
92 92
 	/**
93
-	* Gets all the spotter information based on the latest data entry
94
-	*
95
-	* @return Array the spotter information
96
-	*
97
-	*/
93
+	 * Gets all the spotter information based on the latest data entry
94
+	 *
95
+	 * @return Array the spotter information
96
+	 *
97
+	 */
98 98
 	public function getLiveMarineData($limit = '', $sort = '', $filter = array())
99 99
 	{
100 100
 		global $globalDBdriver, $globalLiveInterval;
@@ -137,11 +137,11 @@  discard block
 block discarded – undo
137 137
 	}
138 138
 
139 139
 	/**
140
-	* Gets Minimal Live Spotter data
141
-	*
142
-	* @return Array the spotter information
143
-	*
144
-	*/
140
+	 * Gets Minimal Live Spotter data
141
+	 *
142
+	 * @return Array the spotter information
143
+	 *
144
+	 */
145 145
 	public function getMinLiveMarineData($filter = array())
146 146
 	{
147 147
 		global $globalDBdriver, $globalLiveInterval;
@@ -171,11 +171,11 @@  discard block
 block discarded – undo
171 171
 	}
172 172
 
173 173
 	/**
174
-	* Gets Minimal Live Spotter data since xx seconds
175
-	*
176
-	* @return Array the spotter information
177
-	*
178
-	*/
174
+	 * Gets Minimal Live Spotter data since xx seconds
175
+	 *
176
+	 * @return Array the spotter information
177
+	 *
178
+	 */
179 179
 	public function getMinLastLiveMarineData($coord = array(),$filter = array(), $limit = false)
180 180
 	{
181 181
 		global $globalDBdriver, $globalLiveInterval, $globalMap3DMarinesLimit, $globalArchive;
@@ -246,11 +246,11 @@  discard block
 block discarded – undo
246 246
 	}
247 247
 
248 248
 	/**
249
-	* Gets number of latest data entry
250
-	*
251
-	* @return String number of entry
252
-	*
253
-	*/
249
+	 * Gets number of latest data entry
250
+	 *
251
+	 * @return String number of entry
252
+	 *
253
+	 */
254 254
 	public function getLiveMarineCount($filter = array())
255 255
 	{
256 256
 		global $globalDBdriver, $globalLiveInterval;
@@ -275,11 +275,11 @@  discard block
 block discarded – undo
275 275
 	}
276 276
 
277 277
 	/**
278
-	* Gets all the spotter information based on the latest data entry and coord
279
-	*
280
-	* @return Array the spotter information
281
-	*
282
-	*/
278
+	 * Gets all the spotter information based on the latest data entry and coord
279
+	 *
280
+	 * @return Array the spotter information
281
+	 *
282
+	 */
283 283
 	public function getLiveMarineDatabyCoord($coord, $filter = array())
284 284
 	{
285 285
 		global $globalDBdriver, $globalLiveInterval;
@@ -303,11 +303,11 @@  discard block
 block discarded – undo
303 303
 	}
304 304
 
305 305
 	/**
306
-	* Gets all the spotter information based on the latest data entry and coord
307
-	*
308
-	* @return Array the spotter information
309
-	*
310
-	*/
306
+	 * Gets all the spotter information based on the latest data entry and coord
307
+	 *
308
+	 * @return Array the spotter information
309
+	 *
310
+	 */
311 311
 	public function getMinLiveMarineDatabyCoord($coord, $filter = array())
312 312
 	{
313 313
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
@@ -376,11 +376,11 @@  discard block
 block discarded – undo
376 376
 	}
377 377
 
378 378
 	/**
379
-	* Gets all the spotter information based on a user's latitude and longitude
380
-	*
381
-	* @return Array the spotter information
382
-	*
383
-	*/
379
+	 * Gets all the spotter information based on a user's latitude and longitude
380
+	 *
381
+	 * @return Array the spotter information
382
+	 *
383
+	 */
384 384
 	public function getLatestMarineForLayar($lat, $lng, $radius, $interval)
385 385
 	{
386 386
 		$Marine = new Marine($this->db);
@@ -393,75 +393,75 @@  discard block
 block discarded – undo
393 393
 		if ($lng != '')
394 394
 		{
395 395
 			if (!is_numeric($lng))
396
-                        {
397
-                                return false;
398
-                        }
399
-                }
400
-
401
-                if ($radius != '')
402
-                {
403
-                        if (!is_numeric($radius))
404
-                        {
405
-                                return false;
406
-                        }
407
-                }
396
+						{
397
+								return false;
398
+						}
399
+				}
400
+
401
+				if ($radius != '')
402
+				{
403
+						if (!is_numeric($radius))
404
+						{
405
+								return false;
406
+						}
407
+				}
408 408
 		$additional_query = '';
409 409
 		if ($interval != '')
410
-                {
411
-                        if (!is_string($interval))
412
-                        {
413
-                                //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';
414
-			        return false;
415
-                        } else {
416
-                if ($interval == '1m')
417
-                {
418
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';
419
-                } else if ($interval == '15m'){
420
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= marine_live.date ';
421
-                } 
422
-            }
423
-                } else {
424
-         $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';   
425
-        }
426
-
427
-                $query  = "SELECT marine_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM marine_live 
410
+				{
411
+						if (!is_string($interval))
412
+						{
413
+								//$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';
414
+					return false;
415
+						} else {
416
+				if ($interval == '1m')
417
+				{
418
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';
419
+				} else if ($interval == '15m'){
420
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= marine_live.date ';
421
+				} 
422
+			}
423
+				} else {
424
+		 $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';   
425
+		}
426
+
427
+				$query  = "SELECT marine_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM marine_live 
428 428
                    WHERE marine_live.latitude <> '' 
429 429
                                    AND marine_live.longitude <> '' 
430 430
                    ".$additional_query."
431 431
                    HAVING distance < :radius  
432 432
                                    ORDER BY distance";
433 433
 
434
-                $spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
434
+				$spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
435 435
 
436
-                return $spotter_array;
437
-        }
436
+				return $spotter_array;
437
+		}
438 438
 
439 439
     
440
-        /**
441
-	* Gets all the spotter information based on a particular callsign
442
-	*
443
-	* @return Array the spotter information
444
-	*
445
-	*/
440
+		/**
441
+		 * Gets all the spotter information based on a particular callsign
442
+		 *
443
+		 * @return Array the spotter information
444
+		 *
445
+		 */
446 446
 	public function getLastLiveMarineDataByIdent($ident)
447 447
 	{
448 448
 		$Marine = new Marine($this->db);
449 449
 		date_default_timezone_set('UTC');
450 450
 
451 451
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
452
-                $query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
452
+				$query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
453 453
 
454 454
 		$spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident),'',true);
455 455
 
456 456
 		return $spotter_array;
457 457
 	}
458 458
 
459
-        /**
460
-	* Gets all the spotter information based on a particular callsign
461
-	*
462
-	* @return Array the spotter information
463
-	*
464
-	*/
459
+		/**
460
+		 * Gets all the spotter information based on a particular callsign
461
+		 *
462
+		 * @return Array the spotter information
463
+		 *
464
+		 */
465 465
 	public function getDateLiveMarineDataByIdent($ident,$date)
466 466
 	{
467 467
 		$Marine = new Marine($this->db);
@@ -474,11 +474,11 @@  discard block
 block discarded – undo
474 474
 	}
475 475
 
476 476
 	/**
477
-	* Gets all the spotter information based on a particular MMSI
478
-	*
479
-	* @return Array the spotter information
480
-	*
481
-	*/
477
+	 * Gets all the spotter information based on a particular MMSI
478
+	 *
479
+	 * @return Array the spotter information
480
+	 *
481
+	 */
482 482
 	public function getDateLiveMarineDataByMMSI($mmsi,$date)
483 483
 	{
484 484
 		$Marine = new Marine($this->db);
@@ -490,51 +490,51 @@  discard block
 block discarded – undo
490 490
 		return $spotter_array;
491 491
 	}
492 492
 
493
-        /**
494
-	* Gets last spotter information based on a particular callsign
495
-	*
496
-	* @return Array the spotter information
497
-	*
498
-	*/
493
+		/**
494
+		 * Gets last spotter information based on a particular callsign
495
+		 *
496
+		 * @return Array the spotter information
497
+		 *
498
+		 */
499 499
 	public function getLastLiveMarineDataById($id)
500 500
 	{
501 501
 		$Marine = new Marine($this->db);
502 502
 		date_default_timezone_set('UTC');
503 503
 
504 504
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
505
-                $query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
505
+				$query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
506 506
 
507 507
 		$spotter_array = $Marine->getDataFromDB($query,array(':id' => $id),'',true);
508 508
 
509 509
 		return $spotter_array;
510 510
 	}
511 511
 
512
-        /**
513
-	* Gets last spotter information based on a particular callsign
514
-	*
515
-	* @return Array the spotter information
516
-	*
517
-	*/
512
+		/**
513
+		 * Gets last spotter information based on a particular callsign
514
+		 *
515
+		 * @return Array the spotter information
516
+		 *
517
+		 */
518 518
 	public function getDateLiveMarineDataById($id,$date)
519 519
 	{
520 520
 		$Marine = new Marine($this->db);
521 521
 		date_default_timezone_set('UTC');
522 522
 
523 523
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
524
-                $query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
525
-                $date = date('c',$date);
524
+				$query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
525
+				$date = date('c',$date);
526 526
 		$spotter_array = $Marine->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
527 527
 
528 528
 		return $spotter_array;
529 529
 	}
530 530
 
531 531
 
532
-        /**
533
-	* Gets all the spotter information based on a particular id
534
-	*
535
-	* @return Array the spotter information
536
-	*
537
-	*/
532
+		/**
533
+		 * Gets all the spotter information based on a particular id
534
+		 *
535
+		 * @return Array the spotter information
536
+		 *
537
+		 */
538 538
 	public function getAllLiveMarineDataById($id,$liveinterval = false)
539 539
 	{
540 540
 		global $globalDBdriver, $globalLiveInterval;
@@ -562,18 +562,18 @@  discard block
 block discarded – undo
562 562
 		return $spotter_array;
563 563
 	}
564 564
 
565
-        /**
566
-	* Gets all the spotter information based on a particular ident
567
-	*
568
-	* @return Array the spotter information
569
-	*
570
-	*/
565
+		/**
566
+		 * Gets all the spotter information based on a particular ident
567
+		 *
568
+		 * @return Array the spotter information
569
+		 *
570
+		 */
571 571
 	public function getAllLiveMarineDataByIdent($ident)
572 572
 	{
573 573
 		date_default_timezone_set('UTC');
574 574
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
575 575
 		$query  = self::$global_query.' WHERE marine_live.ident = :ident';
576
-    		try {
576
+			try {
577 577
 			
578 578
 			$sth = $this->db->prepare($query);
579 579
 			$sth->execute(array(':ident' => $ident));
@@ -587,23 +587,23 @@  discard block
 block discarded – undo
587 587
 
588 588
 
589 589
 	/**
590
-	* Deletes all info in the table
591
-	*
592
-	* @return String success or false
593
-	*
594
-	*/
590
+	 * Deletes all info in the table
591
+	 *
592
+	 * @return String success or false
593
+	 *
594
+	 */
595 595
 	public function deleteLiveMarineData()
596 596
 	{
597 597
 		global $globalDBdriver;
598 598
 		if ($globalDBdriver == 'mysql') {
599 599
 			//$query  = "DELETE FROM marine_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= marine_live.date";
600 600
 			$query  = 'DELETE FROM marine_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= marine_live.date';
601
-            		//$query  = "DELETE FROM marine_live WHERE marine_live.id IN (SELECT marine_live.id FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= marine_live.date)";
601
+					//$query  = "DELETE FROM marine_live WHERE marine_live.id IN (SELECT marine_live.id FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= marine_live.date)";
602 602
 		} else {
603 603
 			$query  = "DELETE FROM marine_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= marine_live.date";
604 604
 		}
605 605
         
606
-    		try {
606
+			try {
607 607
 			
608 608
 			$sth = $this->db->prepare($query);
609 609
 			$sth->execute();
@@ -615,18 +615,18 @@  discard block
 block discarded – undo
615 615
 	}
616 616
 
617 617
 	/**
618
-	* Deletes all info in the table for aircraft not seen since 2 HOUR
619
-	*
620
-	* @return String success or false
621
-	*
622
-	*/
618
+	 * Deletes all info in the table for aircraft not seen since 2 HOUR
619
+	 *
620
+	 * @return String success or false
621
+	 *
622
+	 */
623 623
 	public function deleteLiveMarineDataNotUpdated()
624 624
 	{
625 625
 		global $globalDBdriver, $globalDebug;
626 626
 		if ($globalDBdriver == 'mysql') {
627 627
 			//$query = 'SELECT fammarine_id FROM marine_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) >= marine_live.date AND marine_live.fammarine_id NOT IN (SELECT fammarine_id FROM marine_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) < marine_live.date) LIMIT 800 OFFSET 0';
628
-    			$query = "SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0";
629
-    			try {
628
+				$query = "SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0";
629
+				try {
630 630
 				
631 631
 				$sth = $this->db->prepare($query);
632 632
 				$sth->execute();
@@ -634,8 +634,8 @@  discard block
 block discarded – undo
634 634
 				return "error";
635 635
 			}
636 636
 			$query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN (';
637
-                        $i = 0;
638
-                        $j =0;
637
+						$i = 0;
638
+						$j =0;
639 639
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
640 640
 			foreach($all as $row)
641 641
 			{
@@ -643,20 +643,20 @@  discard block
 block discarded – undo
643 643
 				$j++;
644 644
 				if ($j == 30) {
645 645
 					if ($globalDebug) echo ".";
646
-				    	try {
646
+						try {
647 647
 						
648 648
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
649 649
 						$sth->execute();
650 650
 					} catch(PDOException $e) {
651 651
 						return "error";
652 652
 					}
653
-                                	$query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN (';
654
-                                	$j = 0;
653
+									$query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN (';
654
+									$j = 0;
655 655
 				}
656 656
 				$query_delete .= "'".$row['fammarine_id']."',";
657 657
 			}
658 658
 			if ($i > 0) {
659
-    				try {
659
+					try {
660 660
 					
661 661
 					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
662 662
 					$sth->execute();
@@ -667,9 +667,9 @@  discard block
 block discarded – undo
667 667
 			return "success";
668 668
 		} elseif ($globalDBdriver == 'pgsql') {
669 669
 			//$query = "SELECT fammarine_id FROM marine_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= marine_live.date AND marine_live.fammarine_id NOT IN (SELECT fammarine_id FROM marine_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' < marine_live.date) LIMIT 800 OFFSET 0";
670
-    			//$query = "SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0";
671
-    			$query = "DELETE FROM marine_live WHERE fammarine_id IN (SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)";
672
-    			try {
670
+				//$query = "SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0";
671
+				$query = "DELETE FROM marine_live WHERE fammarine_id IN (SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)";
672
+				try {
673 673
 				
674 674
 				$sth = $this->db->prepare($query);
675 675
 				$sth->execute();
@@ -713,17 +713,17 @@  discard block
 block discarded – undo
713 713
 	}
714 714
 
715 715
 	/**
716
-	* Deletes all info in the table for an ident
717
-	*
718
-	* @return String success or false
719
-	*
720
-	*/
716
+	 * Deletes all info in the table for an ident
717
+	 *
718
+	 * @return String success or false
719
+	 *
720
+	 */
721 721
 	public function deleteLiveMarineDataByIdent($ident)
722 722
 	{
723 723
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
724 724
 		$query  = 'DELETE FROM marine_live WHERE ident = :ident';
725 725
         
726
-    		try {
726
+			try {
727 727
 			
728 728
 			$sth = $this->db->prepare($query);
729 729
 			$sth->execute(array(':ident' => $ident));
@@ -735,17 +735,17 @@  discard block
 block discarded – undo
735 735
 	}
736 736
 
737 737
 	/**
738
-	* Deletes all info in the table for an id
739
-	*
740
-	* @return String success or false
741
-	*
742
-	*/
738
+	 * Deletes all info in the table for an id
739
+	 *
740
+	 * @return String success or false
741
+	 *
742
+	 */
743 743
 	public function deleteLiveMarineDataById($id)
744 744
 	{
745 745
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
746 746
 		$query  = 'DELETE FROM marine_live WHERE fammarine_id = :id';
747 747
         
748
-    		try {
748
+			try {
749 749
 			
750 750
 			$sth = $this->db->prepare($query);
751 751
 			$sth->execute(array(':id' => $id));
@@ -758,11 +758,11 @@  discard block
 block discarded – undo
758 758
 
759 759
 
760 760
 	/**
761
-	* Gets the aircraft ident within the last hour
762
-	*
763
-	* @return String the ident
764
-	*
765
-	*/
761
+	 * Gets the aircraft ident within the last hour
762
+	 *
763
+	 * @return String the ident
764
+	 *
765
+	 */
766 766
 	public function getIdentFromLastHour($ident)
767 767
 	{
768 768
 		global $globalDBdriver, $globalTimezone;
@@ -788,14 +788,14 @@  discard block
 block discarded – undo
788 788
 			$ident_result = $row['ident'];
789 789
 		}
790 790
 		return $ident_result;
791
-        }
791
+		}
792 792
 
793 793
 	/**
794
-	* Check recent aircraft
795
-	*
796
-	* @return String the ident
797
-	*
798
-	*/
794
+	 * Check recent aircraft
795
+	 *
796
+	 * @return String the ident
797
+	 *
798
+	 */
799 799
 	public function checkIdentRecent($ident)
800 800
 	{
801 801
 		global $globalDBdriver, $globalTimezone;
@@ -821,14 +821,14 @@  discard block
 block discarded – undo
821 821
 			$ident_result = $row['fammarine_id'];
822 822
 		}
823 823
 		return $ident_result;
824
-        }
824
+		}
825 825
 
826 826
 	/**
827
-	* Check recent aircraft by id
828
-	*
829
-	* @return String the ident
830
-	*
831
-	*/
827
+	 * Check recent aircraft by id
828
+	 *
829
+	 * @return String the ident
830
+	 *
831
+	 */
832 832
 	public function checkIdRecent($id)
833 833
 	{
834 834
 		global $globalDBdriver, $globalTimezone;
@@ -854,14 +854,14 @@  discard block
 block discarded – undo
854 854
 			$ident_result = $row['fammarine_id'];
855 855
 		}
856 856
 		return $ident_result;
857
-        }
857
+		}
858 858
 
859 859
 	/**
860
-	* Check recent aircraft by mmsi
861
-	*
862
-	* @return String the ident
863
-	*
864
-	*/
860
+	 * Check recent aircraft by mmsi
861
+	 *
862
+	 * @return String the ident
863
+	 *
864
+	 */
865 865
 	public function checkMMSIRecent($mmsi)
866 866
 	{
867 867
 		global $globalDBdriver, $globalTimezone;
@@ -887,19 +887,19 @@  discard block
 block discarded – undo
887 887
 			$ident_result = $row['fammarine_id'];
888 888
 		}
889 889
 		return $ident_result;
890
-        }
890
+		}
891 891
 
892 892
 	/**
893
-	* Adds a new spotter data
894
-	*
895
-	* @param String $fammarine_id the ID from flightaware
896
-	* @param String $ident the flight ident
897
-	* @param String $aircraft_icao the aircraft type
898
-	* @param String $departure_airport_icao the departure airport
899
-	* @param String $arrival_airport_icao the arrival airport
900
-	* @return String success or false
901
-	*
902
-	*/
893
+	 * Adds a new spotter data
894
+	 *
895
+	 * @param String $fammarine_id the ID from flightaware
896
+	 * @param String $ident the flight ident
897
+	 * @param String $aircraft_icao the aircraft type
898
+	 * @param String $departure_airport_icao the departure airport
899
+	 * @param String $arrival_airport_icao the arrival airport
900
+	 * @return String success or false
901
+	 *
902
+	 */
903 903
 	public function addLiveMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $mmsi = '',$type = '',$typeid = '',$imo = '', $callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '')
904 904
 	{
905 905
 		global $globalURL, $globalArchive, $globalDebug;
@@ -973,10 +973,10 @@  discard block
 block discarded – undo
973 973
 		if ($typeid == '') $typeid = NULL;
974 974
 		if ($statusid == '') $statusid = NULL;
975 975
 
976
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
977
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
978
-            	if ($arrival_date == '') $arrival_date = NULL;
979
-            	$query = '';
976
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
977
+				if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
978
+				if ($arrival_date == '') $arrival_date = NULL;
979
+				$query = '';
980 980
 		if ($globalArchive) {
981 981
 			if ($globalDebug) echo '-- Delete previous data -- ';
982 982
 			$query .= 'DELETE FROM marine_live WHERE fammarine_id = :fammarine_id;';
Please login to merge, or discard this patch.
aircraft-statistics-airline-country.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -21,18 +21,18 @@  discard block
 block discarded – undo
21 21
 	print '<div class="select-item">';
22 22
 	print '<form action="'.$globalURL.'/aircraft" method="get">';
23 23
 	print '<select name="aircraft_type" class="selectpicker" data-live-search="true">';
24
-    	print '<option></option>';
25
-    	$Stats = new Stats();
26
-    	$aircraft_types = $Stats->getAllAircraftTypes();
27
-    	if (empty($aircraft_types)) $aircraft_types = $Spotter->getAllAircraftTypes();
28
-    	foreach($aircraft_types as $aircrafttype)
29
-    	{
30
-    		if($aircraft_type == $aircrafttype['aircraft_icao'])
31
-    		{
32
-    			print '<option value="'.$aircrafttype['aircraft_icao'].'" selected="selected">'.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>';
33
-    		} else {
34
-    			print '<option value="'.$aircrafttype['aircraft_icao'].'">'.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>';
35
-    		}
24
+		print '<option></option>';
25
+		$Stats = new Stats();
26
+		$aircraft_types = $Stats->getAllAircraftTypes();
27
+		if (empty($aircraft_types)) $aircraft_types = $Spotter->getAllAircraftTypes();
28
+		foreach($aircraft_types as $aircrafttype)
29
+		{
30
+			if($aircraft_type == $aircrafttype['aircraft_icao'])
31
+			{
32
+				print '<option value="'.$aircrafttype['aircraft_icao'].'" selected="selected">'.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>';
33
+			} else {
34
+				print '<option value="'.$aircrafttype['aircraft_icao'].'">'.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>';
35
+			}
36 36
 	}
37 37
 	print '</select>';
38 38
 	print '<button type="submit"><i class="fa fa-angle-double-right"></i></button>';
@@ -61,18 +61,18 @@  discard block
 block discarded – undo
61 61
 	print '<script type="text/javascript" src="'.$globalURL.'/js/datamaps.world.min.js"></script>';
62 62
 	print '<div id="chartCountry" class="chart" width="100%"></div><script>';
63 63
 	print 'var series = [';
64
-        $country_data = '';
64
+		$country_data = '';
65 65
 	foreach($airline_array as $airline_item)
66 66
 	{
67 67
 		$country_data .= '[ "'.$airline_item['airline_country_iso3'].'",'.$airline_item['airline_country_count'].'],';
68 68
 	}
69
-        $country_data = substr($country_data, 0, -1);
70
-        print $country_data;
71
-        print '];';
72
-        print 'var dataset = {};var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);';
73
-        print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#EFEFFF","#001830"]);';
74
-        print 'series.forEach(function(item){var iso = item[0], value = item[1]; dataset[iso] = { numberOfThings: value, fillColor: paletteScale(value) };});';
75
-        print 'new Datamap({
69
+		$country_data = substr($country_data, 0, -1);
70
+		print $country_data;
71
+		print '];';
72
+		print 'var dataset = {};var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);';
73
+		print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#EFEFFF","#001830"]);';
74
+		print 'series.forEach(function(item){var iso = item[0], value = item[1]; dataset[iso] = { numberOfThings: value, fillColor: paletteScale(value) };});';
75
+		print 'new Datamap({
76 76
 	    element: document.getElementById("chartCountry"),
77 77
 	    projection: "mercator", // big world map
78 78
 	    fills: { defaultFill: "#F5F5F5" },
Please login to merge, or discard this patch.
marine-type-detailed.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -62,12 +62,12 @@
 block discarded – undo
62 62
 	*/
63 63
 		//if ($aircraft_type != "NA")
64 64
 		//{
65
-	    		print '<div class="info column">';
66
-	      		print '<h1>'.$spotter_array[0]['type'].'</h1>';
67
-	      		//print '<div><span class="label">'._("Name").'</span>'.$spotter_array[0]['aircraft_name'].'</div>';
68
-	      		//print '<div><span class="label">'._("ICAO").'</span>'.$spotter_array[0]['aircraft_type'].'</div>'; 
69
-	      		//if (isset($spotter_array[0]['aircraft_manufacturer'])) print '<div><span class="label">'._("Manufacturer").'</span><a href="'.$globalURL.'/manufacturer/'.strtolower(str_replace(" ", "-", $spotter_array[0]['aircraft_manufacturer'])).'">'.$spotter_array[0]['aircraft_manufacturer'].'</a></div>';
70
-	    		print '</div>';
65
+				print '<div class="info column">';
66
+		  		print '<h1>'.$spotter_array[0]['type'].'</h1>';
67
+		  		//print '<div><span class="label">'._("Name").'</span>'.$spotter_array[0]['aircraft_name'].'</div>';
68
+		  		//print '<div><span class="label">'._("ICAO").'</span>'.$spotter_array[0]['aircraft_type'].'</div>'; 
69
+		  		//if (isset($spotter_array[0]['aircraft_manufacturer'])) print '<div><span class="label">'._("Manufacturer").'</span><a href="'.$globalURL.'/manufacturer/'.strtolower(str_replace(" ", "-", $spotter_array[0]['aircraft_manufacturer'])).'">'.$spotter_array[0]['aircraft_manufacturer'].'</a></div>';
70
+				print '</div>';
71 71
 		//} else {
72 72
 		//	print '<div class="alert alert-warning">'._("This special aircraft profile shows all flights in where the aircraft type is unknown.").'</div>';
73 73
 		//}
Please login to merge, or discard this patch.
require/class.Marine.php 1 patch
Indentation   +227 added lines, -227 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@  discard block
 block discarded – undo
12 12
 	}
13 13
 
14 14
 	/**
15
-	* Get SQL query part for filter used
16
-	* @param Array $filter the filter
17
-	* @return Array the SQL part
18
-	*/
15
+	 * Get SQL query part for filter used
16
+	 * @param Array $filter the filter
17
+	 * @return Array the SQL part
18
+	 */
19 19
 	
20 20
 	public function getFilter($filter = array(),$where = false,$and = false) {
21 21
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
@@ -82,14 +82,14 @@  discard block
 block discarded – undo
82 82
 	}
83 83
 
84 84
 	/**
85
-	* Executes the SQL statements to get the spotter information
86
-	*
87
-	* @param String $query the SQL query
88
-	* @param Array $params parameter of the query
89
-	* @param String $limitQuery the limit query
90
-	* @return Array the spotter information
91
-	*
92
-	*/
85
+	 * Executes the SQL statements to get the spotter information
86
+	 *
87
+	 * @param String $query the SQL query
88
+	 * @param Array $params parameter of the query
89
+	 * @param String $limitQuery the limit query
90
+	 * @return Array the spotter information
91
+	 *
92
+	 */
93 93
 	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
94 94
 	{
95 95
 		date_default_timezone_set('UTC');
@@ -220,11 +220,11 @@  discard block
 block discarded – undo
220 220
 	
221 221
 	
222 222
 	/**
223
-	* Gets all the spotter information based on the latest data entry
224
-	*
225
-	* @return Array the spotter information
226
-	*
227
-	*/
223
+	 * Gets all the spotter information based on the latest data entry
224
+	 *
225
+	 * @return Array the spotter information
226
+	 *
227
+	 */
228 228
 	public function getLatestMarineData($limit = '', $sort = '', $filter = array())
229 229
 	{
230 230
 		global $global_query;
@@ -273,11 +273,11 @@  discard block
 block discarded – undo
273 273
 	}
274 274
 
275 275
 	/**
276
-	* Gets all the spotter information based on the callsign
277
-	*
278
-	* @return Array the spotter information
279
-	*
280
-	*/
276
+	 * Gets all the spotter information based on the callsign
277
+	 *
278
+	 * @return Array the spotter information
279
+	 *
280
+	 */
281 281
 	public function getMarineDataByIdent($ident = '', $limit = '', $sort = '', $filter = array())
282 282
 	{
283 283
 		global $global_query;
@@ -329,11 +329,11 @@  discard block
 block discarded – undo
329 329
 	}
330 330
 
331 331
 	/**
332
-	* Gets all the marine information based on the type
333
-	*
334
-	* @return Array the marine information
335
-	*
336
-	*/
332
+	 * Gets all the marine information based on the type
333
+	 *
334
+	 * @return Array the marine information
335
+	 *
336
+	 */
337 337
 	public function getMarineDataByType($type = '', $limit = '', $sort = '', $filter = array())
338 338
 	{
339 339
 		global $global_query;
@@ -441,12 +441,12 @@  discard block
 block discarded – undo
441 441
 
442 442
 
443 443
 	/**
444
-	* Gets all source name
445
-	*
446
-	* @param String type format of source
447
-	* @return Array list of source name
448
-	*
449
-	*/
444
+	 * Gets all source name
445
+	 *
446
+	 * @param String type format of source
447
+	 * @return Array list of source name
448
+	 *
449
+	 */
450 450
 	public function getAllSourceName($type = '',$filters = array())
451 451
 	{
452 452
 		$filter_query = $this->getFilter($filters,true,true);
@@ -476,11 +476,11 @@  discard block
 block discarded – undo
476 476
 
477 477
 
478 478
 	/**
479
-	* Gets a list of all idents/callsigns
480
-	*
481
-	* @return Array list of ident/callsign names
482
-	*
483
-	*/
479
+	 * Gets a list of all idents/callsigns
480
+	 *
481
+	 * @return Array list of ident/callsign names
482
+	 *
483
+	 */
484 484
 	public function getAllIdents($filters = array())
485 485
 	{
486 486
 		$filter_query = $this->getFilter($filters,true,true);
@@ -504,11 +504,11 @@  discard block
 block discarded – undo
504 504
 	}
505 505
 
506 506
 	/**
507
-	* Gets all info from a mmsi
508
-	*
509
-	* @return Array ident
510
-	*
511
-	*/
507
+	 * Gets all info from a mmsi
508
+	 *
509
+	 * @return Array ident
510
+	 *
511
+	 */
512 512
 	public function getIdentity($mmsi)
513 513
 	{
514 514
 		$mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT);
@@ -521,9 +521,9 @@  discard block
 block discarded – undo
521 521
 	}
522 522
 
523 523
 	/**
524
-	* Add identity
525
-	*
526
-	*/
524
+	 * Add identity
525
+	 *
526
+	 */
527 527
 	public function addIdentity($mmsi,$imo,$ident,$callsign,$type)
528 528
 	{
529 529
 		$mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT);
@@ -589,13 +589,13 @@  discard block
 block discarded – undo
589 589
 	}
590 590
 
591 591
 	/**
592
-	* Update ident tracker data
593
-	*
594
-	* @param String $fammarine_id the ID
595
-	* @param String $ident the marine ident
596
-	* @return String success or false
597
-	*
598
-	*/
592
+	 * Update ident tracker data
593
+	 *
594
+	 * @param String $fammarine_id the ID
595
+	 * @param String $ident the marine ident
596
+	 * @return String success or false
597
+	 *
598
+	 */
599 599
 	public function updateIdentMarineData($fammarine_id = '', $ident = '',$fromsource = NULL)
600 600
 	{
601 601
 		$query = 'UPDATE marine_output SET ident = :ident WHERE fammarine_id = :fammarine_id';
@@ -610,13 +610,13 @@  discard block
 block discarded – undo
610 610
 	}
611 611
 
612 612
 	/**
613
-	* Update arrival marine data
614
-	*
615
-	* @param String $fammarine_id the ID
616
-	* @param String $arrival_code the marine ident
617
-	* @return String success or false
618
-	*
619
-	*/
613
+	 * Update arrival marine data
614
+	 *
615
+	 * @param String $fammarine_id the ID
616
+	 * @param String $arrival_code the marine ident
617
+	 * @return String success or false
618
+	 *
619
+	 */
620 620
 	public function updateArrivalPortNameMarineData($fammarine_id = '', $arrival_code = '',$fromsource = NULL)
621 621
 	{
622 622
 		$query = 'UPDATE marine_output SET arrival_port_name = :arrival_code WHERE fammarine_id = :fammarine_id';
@@ -631,19 +631,19 @@  discard block
 block discarded – undo
631 631
 	}
632 632
 
633 633
 	/**
634
-	* Update Status data
635
-	*
636
-	* @param String $fammarine_id the ID
637
-	* @param String $status_id the marine status id
638
-	* @param String $status the marine status
639
-	* @return String success or false
640
-	*
641
-	*/
634
+	 * Update Status data
635
+	 *
636
+	 * @param String $fammarine_id the ID
637
+	 * @param String $status_id the marine status id
638
+	 * @param String $status the marine status
639
+	 * @return String success or false
640
+	 *
641
+	 */
642 642
 	public function updateStatusMarineData($fammarine_id = '', $status_id = '',$status = '')
643 643
 	{
644 644
 
645 645
 		$query = 'UPDATE marine_output SET status = :status, status_id = :status_id WHERE fammarine_id = :fammarine_id';
646
-                $query_values = array(':fammarine_id' => $fammarine_id,':status' => $status,':status_id' => $status_id);
646
+				$query_values = array(':fammarine_id' => $fammarine_id,':status' => $status,':status_id' => $status_id);
647 647
 
648 648
 		try {
649 649
 			$sth = $this->db->prepare($query);
@@ -656,17 +656,17 @@  discard block
 block discarded – undo
656 656
 
657 657
 	}
658 658
 	/**
659
-	* Update latest marine data
660
-	*
661
-	* @param String $fammarine_id the ID
662
-	* @param String $ident the marine ident
663
-	* @return String success or false
664
-	*
665
-	*/	
659
+	 * Update latest marine data
660
+	 *
661
+	 * @param String $fammarine_id the ID
662
+	 * @param String $ident the marine ident
663
+	 * @return String success or false
664
+	 *
665
+	 */	
666 666
 	public function updateLatestMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $groundspeed = NULL, $date = '')
667 667
 	{
668 668
 		$query = 'UPDATE marine_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_seen = :last_seen, last_ground_speed = :last_ground_speed WHERE fammarine_id = :fammarine_id';
669
-                $query_values = array(':fammarine_id' => $fammarine_id,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident);
669
+				$query_values = array(':fammarine_id' => $fammarine_id,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident);
670 670
 
671 671
 		try {
672 672
 			$sth = $this->db->prepare($query);
@@ -680,30 +680,30 @@  discard block
 block discarded – undo
680 680
 	}
681 681
 
682 682
 	/**
683
-	* Adds a new spotter data
684
-	*
685
-	* @param String $fammarine_id the ID
686
-	* @param String $ident the marine ident
687
-	* @param String $departure_airport_icao the departure airport
688
-	* @param String $arrival_airport_icao the arrival airport
689
-	* @param String $latitude latitude of flight
690
-	* @param String $longitude latitude of flight
691
-	* @param String $waypoints waypoints of flight
692
-	* @param String $heading heading of flight
693
-	* @param String $groundspeed speed of flight
694
-	* @param String $date date of flight
695
-	* @param String $departure_airport_time departure time of flight
696
-	* @param String $arrival_airport_time arrival time of flight
697
-	* @param String $squawk squawk code of flight
698
-	* @param String $route_stop route stop of flight
699
-	* @param String $highlight highlight or not
700
-	* @param String $ModeS ModesS code of flight
701
-	* @param String $registration registration code of flight
702
-	* @param String $pilot_id pilot id of flight (for virtual airlines)
703
-	* @param String $pilot_name pilot name of flight (for virtual airlines)
704
-	* @param String $verticalrate vertival rate of flight
705
-	* @return String success or false
706
-	*/
683
+	 * Adds a new spotter data
684
+	 *
685
+	 * @param String $fammarine_id the ID
686
+	 * @param String $ident the marine ident
687
+	 * @param String $departure_airport_icao the departure airport
688
+	 * @param String $arrival_airport_icao the arrival airport
689
+	 * @param String $latitude latitude of flight
690
+	 * @param String $longitude latitude of flight
691
+	 * @param String $waypoints waypoints of flight
692
+	 * @param String $heading heading of flight
693
+	 * @param String $groundspeed speed of flight
694
+	 * @param String $date date of flight
695
+	 * @param String $departure_airport_time departure time of flight
696
+	 * @param String $arrival_airport_time arrival time of flight
697
+	 * @param String $squawk squawk code of flight
698
+	 * @param String $route_stop route stop of flight
699
+	 * @param String $highlight highlight or not
700
+	 * @param String $ModeS ModesS code of flight
701
+	 * @param String $registration registration code of flight
702
+	 * @param String $pilot_id pilot id of flight (for virtual airlines)
703
+	 * @param String $pilot_name pilot name of flight (for virtual airlines)
704
+	 * @param String $verticalrate vertival rate of flight
705
+	 * @return String success or false
706
+	 */
707 707
 	public function addMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $mmsi = '',$type = '',$typeid = '',$imo = '',$callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$format_source = '', $source_name = '')
708 708
 	{
709 709
 		global $globalURL, $globalMarineImageFetch;
@@ -818,7 +818,7 @@  discard block
 block discarded – undo
818 818
 			$sth->execute($query_values);
819 819
 			$this->db = null;
820 820
 		} catch (PDOException $e) {
821
-		    return "error : ".$e->getMessage();
821
+			return "error : ".$e->getMessage();
822 822
 		}
823 823
 		
824 824
 		return "success";
@@ -827,11 +827,11 @@  discard block
 block discarded – undo
827 827
 	
828 828
   
829 829
 	/**
830
-	* Gets the aircraft ident within the last hour
831
-	*
832
-	* @return String the ident
833
-	*
834
-	*/
830
+	 * Gets the aircraft ident within the last hour
831
+	 *
832
+	 * @return String the ident
833
+	 *
834
+	 */
835 835
 	public function getIdentFromLastHour($ident)
836 836
 	{
837 837
 		global $globalDBdriver, $globalTimezone;
@@ -847,11 +847,11 @@  discard block
 block discarded – undo
847 847
 								AND marine_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
848 848
 								AND marine_output.date < now() AT TIME ZONE 'UTC'";
849 849
 			$query_data = array(':ident' => $ident);
850
-    		}
850
+			}
851 851
 		
852 852
 		$sth = $this->db->prepare($query);
853 853
 		$sth->execute($query_data);
854
-    		$ident_result='';
854
+			$ident_result='';
855 855
 		while($row = $sth->fetch(PDO::FETCH_ASSOC))
856 856
 		{
857 857
 			$ident_result = $row['ident'];
@@ -862,11 +862,11 @@  discard block
 block discarded – undo
862 862
 	
863 863
 	
864 864
 	/**
865
-	* Gets the aircraft data from the last 20 seconds
866
-	*
867
-	* @return Array the spotter data
868
-	*
869
-	*/
865
+	 * Gets the aircraft data from the last 20 seconds
866
+	 *
867
+	 * @return Array the spotter data
868
+	 *
869
+	 */
870 870
 	public function getRealTimeData($q = '')
871 871
 	{
872 872
 		global $globalDBdriver;
@@ -904,11 +904,11 @@  discard block
 block discarded – undo
904 904
 	
905 905
 
906 906
 	/**
907
-	* Gets all number of flight over countries
908
-	*
909
-	* @return Array the airline country list
910
-	*
911
-	*/
907
+	 * Gets all number of flight over countries
908
+	 *
909
+	 * @return Array the airline country list
910
+	 *
911
+	 */
912 912
 
913 913
 	public function countAllMarineOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
914 914
 	{
@@ -981,11 +981,11 @@  discard block
 block discarded – undo
981 981
 	
982 982
 	
983 983
 	/**
984
-	* Gets all callsigns that have flown over
985
-	*
986
-	* @return Array the callsign list
987
-	*
988
-	*/
984
+	 * Gets all callsigns that have flown over
985
+	 *
986
+	 * @return Array the callsign list
987
+	 *
988
+	 */
989 989
 	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
990 990
 	{
991 991
 		global $globalDBdriver;
@@ -1052,11 +1052,11 @@  discard block
 block discarded – undo
1052 1052
 
1053 1053
 
1054 1054
 	/**
1055
-	* Counts all dates
1056
-	*
1057
-	* @return Array the date list
1058
-	*
1059
-	*/
1055
+	 * Counts all dates
1056
+	 *
1057
+	 * @return Array the date list
1058
+	 *
1059
+	 */
1060 1060
 	public function countAllDates($filters = array())
1061 1061
 	{
1062 1062
 		global $globalTimezone, $globalDBdriver;
@@ -1102,11 +1102,11 @@  discard block
 block discarded – undo
1102 1102
 	
1103 1103
 	
1104 1104
 	/**
1105
-	* Counts all dates during the last 7 days
1106
-	*
1107
-	* @return Array the date list
1108
-	*
1109
-	*/
1105
+	 * Counts all dates during the last 7 days
1106
+	 *
1107
+	 * @return Array the date list
1108
+	 *
1109
+	 */
1110 1110
 	public function countAllDatesLast7Days($filters = array())
1111 1111
 	{
1112 1112
 		global $globalTimezone, $globalDBdriver;
@@ -1128,7 +1128,7 @@  discard block
 block discarded – undo
1128 1128
 			$query .= " GROUP BY date_name 
1129 1129
 								ORDER BY date_name ASC";
1130 1130
 			$query_data = array(':offset' => $offset);
1131
-    		}
1131
+			}
1132 1132
 		
1133 1133
 		$sth = $this->db->prepare($query);
1134 1134
 		$sth->execute($query_data);
@@ -1148,11 +1148,11 @@  discard block
 block discarded – undo
1148 1148
 	}
1149 1149
 
1150 1150
 	/**
1151
-	* Counts all dates during the last month
1152
-	*
1153
-	* @return Array the date list
1154
-	*
1155
-	*/
1151
+	 * Counts all dates during the last month
1152
+	 *
1153
+	 * @return Array the date list
1154
+	 *
1155
+	 */
1156 1156
 	public function countAllDatesLastMonth($filters = array())
1157 1157
 	{
1158 1158
 		global $globalTimezone, $globalDBdriver;
@@ -1174,7 +1174,7 @@  discard block
 block discarded – undo
1174 1174
 			$query .= " GROUP BY date_name 
1175 1175
 								ORDER BY date_name ASC";
1176 1176
 			$query_data = array(':offset' => $offset);
1177
-    		}
1177
+			}
1178 1178
 		
1179 1179
 		$sth = $this->db->prepare($query);
1180 1180
 		$sth->execute($query_data);
@@ -1196,11 +1196,11 @@  discard block
 block discarded – undo
1196 1196
 
1197 1197
 
1198 1198
 	/**
1199
-	* Counts all month
1200
-	*
1201
-	* @return Array the month list
1202
-	*
1203
-	*/
1199
+	 * Counts all month
1200
+	 *
1201
+	 * @return Array the month list
1202
+	 *
1203
+	 */
1204 1204
 	public function countAllMonths($filters = array())
1205 1205
 	{
1206 1206
 		global $globalTimezone, $globalDBdriver;
@@ -1245,11 +1245,11 @@  discard block
 block discarded – undo
1245 1245
 	
1246 1246
 
1247 1247
 	/**
1248
-	* Counts all dates during the last year
1249
-	*
1250
-	* @return Array the date list
1251
-	*
1252
-	*/
1248
+	 * Counts all dates during the last year
1249
+	 *
1250
+	 * @return Array the date list
1251
+	 *
1252
+	 */
1253 1253
 	public function countAllMonthsLastYear($filters)
1254 1254
 	{
1255 1255
 		global $globalTimezone, $globalDBdriver;
@@ -1271,7 +1271,7 @@  discard block
 block discarded – undo
1271 1271
 			$query .= " GROUP BY year_name, month_name
1272 1272
 								ORDER BY year_name, month_name ASC";
1273 1273
 			$query_data = array(':offset' => $offset);
1274
-    		}
1274
+			}
1275 1275
 		
1276 1276
 		$sth = $this->db->prepare($query);
1277 1277
 		$sth->execute($query_data);
@@ -1294,11 +1294,11 @@  discard block
 block discarded – undo
1294 1294
 	
1295 1295
 	
1296 1296
 	/**
1297
-	* Counts all hours
1298
-	*
1299
-	* @return Array the hour list
1300
-	*
1301
-	*/
1297
+	 * Counts all hours
1298
+	 *
1299
+	 * @return Array the hour list
1300
+	 *
1301
+	 */
1302 1302
 	public function countAllHours($orderby,$filters = array())
1303 1303
 	{
1304 1304
 		global $globalTimezone, $globalDBdriver;
@@ -1361,11 +1361,11 @@  discard block
 block discarded – undo
1361 1361
 	
1362 1362
 	
1363 1363
 	/**
1364
-	* Counts all hours by date
1365
-	*
1366
-	* @return Array the hour list
1367
-	*
1368
-	*/
1364
+	 * Counts all hours by date
1365
+	 *
1366
+	 * @return Array the hour list
1367
+	 *
1368
+	 */
1369 1369
 	public function countAllHoursByDate($date, $filters = array())
1370 1370
 	{
1371 1371
 		global $globalTimezone, $globalDBdriver;
@@ -1409,11 +1409,11 @@  discard block
 block discarded – undo
1409 1409
 	
1410 1410
 	
1411 1411
 	/**
1412
-	* Counts all hours by a ident/callsign
1413
-	*
1414
-	* @return Array the hour list
1415
-	*
1416
-	*/
1412
+	 * Counts all hours by a ident/callsign
1413
+	 *
1414
+	 * @return Array the hour list
1415
+	 *
1416
+	 */
1417 1417
 	public function countAllHoursByIdent($ident, $filters = array())
1418 1418
 	{
1419 1419
 		global $globalTimezone, $globalDBdriver;
@@ -1458,11 +1458,11 @@  discard block
 block discarded – undo
1458 1458
 	
1459 1459
 	
1460 1460
 	/**
1461
-	* Counts all vessels
1462
-	*
1463
-	* @return Integer the number of vessels
1464
-	*
1465
-	*/
1461
+	 * Counts all vessels
1462
+	 *
1463
+	 * @return Integer the number of vessels
1464
+	 *
1465
+	 */
1466 1466
 	public function countOverallMarine($filters = array(),$year = '',$month = '')
1467 1467
 	{
1468 1468
 		global $globalDBdriver;
@@ -1497,11 +1497,11 @@  discard block
 block discarded – undo
1497 1497
 	}
1498 1498
 	
1499 1499
 	/**
1500
-	* Counts all vessel type
1501
-	*
1502
-	* @return Integer the number of vessels
1503
-	*
1504
-	*/
1500
+	 * Counts all vessel type
1501
+	 *
1502
+	 * @return Integer the number of vessels
1503
+	 *
1504
+	 */
1505 1505
 	public function countOverallMarineTypes($filters = array(),$year = '',$month = '')
1506 1506
 	{
1507 1507
 		global $globalDBdriver;
@@ -1536,11 +1536,11 @@  discard block
 block discarded – undo
1536 1536
 	
1537 1537
   
1538 1538
 	/**
1539
-	* Counts all hours of today
1540
-	*
1541
-	* @return Array the hour list
1542
-	*
1543
-	*/
1539
+	 * Counts all hours of today
1540
+	 *
1541
+	 * @return Array the hour list
1542
+	 *
1543
+	 */
1544 1544
 	public function countAllHoursFromToday($filters = array())
1545 1545
 	{
1546 1546
 		global $globalTimezone, $globalDBdriver;
@@ -1580,12 +1580,12 @@  discard block
 block discarded – undo
1580 1580
 	}
1581 1581
     
1582 1582
     
1583
-     /**
1584
-	* Gets the Barrie Spotter ID based on the FlightAware ID
1585
-	*
1586
-	* @return Integer the Barrie Spotter ID
1583
+	 /**
1584
+	  * Gets the Barrie Spotter ID based on the FlightAware ID
1585
+	  *
1586
+	  * @return Integer the Barrie Spotter ID
1587 1587
 q	*
1588
-	*/
1588
+	  */
1589 1589
 	public function getMarineIDBasedOnFamMarineID($fammarine_id)
1590 1590
 	{
1591 1591
 		$fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING);
@@ -1606,13 +1606,13 @@  discard block
 block discarded – undo
1606 1606
   
1607 1607
  
1608 1608
 	/**
1609
-	* Parses a date string
1610
-	*
1611
-	* @param String $dateString the date string
1612
-	* @param String $timezone the timezone of a user
1613
-	* @return Array the time information
1614
-	*
1615
-	*/
1609
+	 * Parses a date string
1610
+	 *
1611
+	 * @param String $dateString the date string
1612
+	 * @param String $timezone the timezone of a user
1613
+	 * @return Array the time information
1614
+	 *
1615
+	 */
1616 1616
 	public function parseDateString($dateString, $timezone = '')
1617 1617
 	{
1618 1618
 		$time_array = array();
@@ -1645,12 +1645,12 @@  discard block
 block discarded – undo
1645 1645
 	}
1646 1646
 	
1647 1647
 	/**
1648
-	* Parses the direction degrees to working
1649
-	*
1650
-	* @param Float $direction the direction in degrees
1651
-	* @return Array the direction information
1652
-	*
1653
-	*/
1648
+	 * Parses the direction degrees to working
1649
+	 *
1650
+	 * @param Float $direction the direction in degrees
1651
+	 * @return Array the direction information
1652
+	 *
1653
+	 */
1654 1654
 	public function parseDirection($direction = 0)
1655 1655
 	{
1656 1656
 		if ($direction == '') $direction = 0;
@@ -1729,12 +1729,12 @@  discard block
 block discarded – undo
1729 1729
 	
1730 1730
 	
1731 1731
 	/**
1732
-	* Gets Country from latitude/longitude
1733
-	*
1734
-	* @param Float $latitude latitute of the flight
1735
-	* @param Float $longitude longitute of the flight
1736
-	* @return String the countrie
1737
-	*/
1732
+	 * Gets Country from latitude/longitude
1733
+	 *
1734
+	 * @param Float $latitude latitute of the flight
1735
+	 * @param Float $longitude longitute of the flight
1736
+	 * @return String the countrie
1737
+	 */
1738 1738
 	public function getCountryFromLatitudeLongitude($latitude,$longitude)
1739 1739
 	{
1740 1740
 		global $globalDBdriver, $globalDebug;
@@ -1771,11 +1771,11 @@  discard block
 block discarded – undo
1771 1771
 	}
1772 1772
 
1773 1773
 	/**
1774
-	* Gets Country from iso2
1775
-	*
1776
-	* @param String $iso2 ISO2 country code
1777
-	* @return String the countrie
1778
-	*/
1774
+	 * Gets Country from iso2
1775
+	 *
1776
+	 * @param String $iso2 ISO2 country code
1777
+	 * @return String the countrie
1778
+	 */
1779 1779
 	public function getCountryFromISO2($iso2)
1780 1780
 	{
1781 1781
 		global $globalDBdriver, $globalDebug;
@@ -1804,12 +1804,12 @@  discard block
 block discarded – undo
1804 1804
 
1805 1805
 	
1806 1806
 	/**
1807
-	* Gets the short url from bit.ly
1808
-	*
1809
-	* @param String $url the full url
1810
-	* @return String the bit.ly url
1811
-	*
1812
-	*/
1807
+	 * Gets the short url from bit.ly
1808
+	 *
1809
+	 * @param String $url the full url
1810
+	 * @return String the bit.ly url
1811
+	 *
1812
+	 */
1813 1813
 	public function getBitlyURL($url)
1814 1814
 	{
1815 1815
 		global $globalBitlyAccessToken;
@@ -1836,11 +1836,11 @@  discard block
 block discarded – undo
1836 1836
 
1837 1837
 	
1838 1838
 	/**
1839
-	* Gets all vessels types that have flown over
1840
-	*
1841
-	* @return Array the vessel type list
1842
-	*
1843
-	*/
1839
+	 * Gets all vessels types that have flown over
1840
+	 *
1841
+	 * @return Array the vessel type list
1842
+	 *
1843
+	 */
1844 1844
 	public function countAllMarineTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
1845 1845
 	{
1846 1846
 		global $globalDBdriver;
@@ -1906,11 +1906,11 @@  discard block
 block discarded – undo
1906 1906
 	}
1907 1907
 
1908 1908
 	/**
1909
-	* Gets all the tracker information
1910
-	*
1911
-	* @return Array the tracker information
1912
-	*
1913
-	*/
1909
+	 * Gets all the tracker information
1910
+	 *
1911
+	 * @return Array the tracker information
1912
+	 *
1913
+	 */
1914 1914
 	public function searchMarineData($q = '', $callsign = '',$mmsi = '', $imo = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array())
1915 1915
 	{
1916 1916
 		global $globalTimezone, $globalDBdriver;
Please login to merge, or discard this patch.