Completed
Push — master ( 83aaff...7b298e )
by Yannick
32:28
created
header.php 1 patch
Indentation   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 // When button "Remove all filters" is clicked
29 29
 if (isset($_POST['removefilters'])) {
30 30
 	$allfilters = array_filter(array_keys($_COOKIE),function($key) {
31
-	    return strpos($key,'filter_') === 0;
31
+		return strpos($key,'filter_') === 0;
32 32
 	});
33 33
 	foreach ($allfilters as $filt) {
34 34
 		unset($_COOKIE[$filt]);
@@ -167,17 +167,17 @@  discard block
 block discarded – undo
167 167
 	}
168 168
 ?>
169 169
 <?php 
170
-    if (isset($_POST['archive'])) {
170
+	if (isset($_POST['archive'])) {
171 171
 ?>
172 172
 <script src="<?php print $globalURL; ?>/js/map.common.js"></script>
173 173
 <?php 
174
-	    if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
174
+		if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
175 175
 ?>
176 176
 
177 177
 <script src="<?php print $globalURL; ?>/js/map.js.php?<?php print time(); ?>&archive&begindate=<?php print strtotime($_POST['start_date']); ?>&enddate=<?php print strtotime($_POST['end_date']); ?>&archivespeed=<?php print $_POST['archivespeed']; ?>"></script>
178 178
 <?php    
179
-	    }
180
-    } else {
179
+		}
180
+	} else {
181 181
 ?>
182 182
 <?php
183 183
 /*	if (isset($globalBeta) && $globalBeta) {
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 */
190 190
 ?>
191 191
 <?php 
192
-	    if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
192
+		if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
193 193
 ?>
194 194
 <?php
195 195
 //		if (isset($globalBeta) && $globalBeta) {
@@ -216,13 +216,13 @@  discard block
 block discarded – undo
216 216
 <script src="<?php print $globalURL; ?>/js/map-marine.2d.js.php?<?php print time(); ?>"></script>
217 217
 <?php
218 218
 		}
219
-	    }
219
+		}
220 220
 ?>
221 221
 <?php
222 222
 //	}
223 223
 ?>
224 224
 <?php
225
-    }
225
+	}
226 226
 }
227 227
 ?>
228 228
 <?php
@@ -391,24 +391,24 @@  discard block
 block discarded – undo
391 391
       <ul class="nav navbar-nav">
392 392
 
393 393
 <?php 
394
-    $sub = false;
395
-    if (((!isset($globalAircraft) || (isset($globalAircraft) && $globalAircraft === TRUE)) && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalTracker) && $globalTracker === TRUE))) || (isset($globalMarine) && $globalMarine === TRUE && isset($globalTracker) && $globalTracker === TRUE)) {
394
+	$sub = false;
395
+	if (((!isset($globalAircraft) || (isset($globalAircraft) && $globalAircraft === TRUE)) && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalTracker) && $globalTracker === TRUE))) || (isset($globalMarine) && $globalMarine === TRUE && isset($globalTracker) && $globalTracker === TRUE)) {
396 396
 	$sub = true;
397
-    }
397
+	}
398 398
 ?>
399 399
 <?php
400
-    if (!isset($globalAircraft) || $globalAircraft === TRUE) {
400
+	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
401 401
 ?>
402 402
     <li class="dropdown">
403 403
 <?php
404
-    if ($sub) {
404
+	if ($sub) {
405 405
 ?>
406 406
       	<li class="dropdown">
407 407
           <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Aircrafts"); ?> <b class="caret"></b></a>
408 408
 	<ul class="dropdown-menu multi-level">
409 409
       	<li class="dropdown-submenu">
410 410
 <?php
411
-    }
411
+	}
412 412
 ?>
413 413
           <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
414 414
           <ul class="dropdown-menu">
@@ -416,15 +416,15 @@  discard block
 block discarded – undo
416 416
 			<li><a href="<?php print $globalURL; ?>/airline"><?php echo _("Airlines"); ?></a></li>
417 417
 			<li><a href="<?php print $globalURL; ?>/airport"><?php echo _("Airports"); ?></a></li>
418 418
 <?php
419
-    if ((!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) {
419
+	if ((!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) {
420 420
 ?>
421 421
 			<li><a href="<?php print $globalURL; ?>/owner"><?php echo _("Owners"); ?></a></li>
422 422
 <?php
423
-    } else {
423
+	} else {
424 424
 ?>
425 425
 			<li><a href="<?php print $globalURL; ?>/pilot"><?php echo _("Pilots"); ?></a></li>
426 426
 <?php
427
-    }
427
+	}
428 428
 ?>
429 429
 			<li><hr /></li>
430 430
             <li><a href="<?php print $globalURL; ?>/currently"><?php echo _("Current Activity"); ?></a></li>
@@ -432,34 +432,34 @@  discard block
 block discarded – undo
432 432
             <li><a href="<?php print $globalURL; ?>/date/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Activity"); ?></a></li>
433 433
             <li><a href="<?php print $globalURL; ?>/newest"><?php echo _("Newest by Category"); ?></a></li>
434 434
             <?php
435
-        	if ($globalACARS) {
436
-        	    if (isset($globalDemo) && $globalDemo) {
437
-    	    ?>
435
+			if ($globalACARS) {
436
+				if (isset($globalDemo) && $globalDemo) {
437
+			?>
438 438
             <li><hr /></li>
439 439
             <li><i><?php echo _('ACARS data not available publicly'); ?></i></li>
440 440
             <li><a href=""><?php echo _('Latest ACARS messages'); ?></a></li>
441 441
             <li><a href=""><?php echo _('Archive ACARS messages'); ?></a></li>
442 442
             <?php
443
-        	    } else {
444
-    	    ?>
443
+				} else {
444
+			?>
445 445
             <li><hr /></li>
446 446
             <li><a href="<?php print $globalURL; ?>/acars-latest"><?php echo _("Latest ACARS messages"); ?></a></li>
447 447
             <li><a href="<?php print $globalURL; ?>/acars-archive"><?php echo _("Archive ACARS messages"); ?></a></li>
448 448
             <?php
449
-        	    }
450
-        	}
451
-    	    ?>
449
+				}
450
+			}
451
+			?>
452 452
     	    <?php
453
-    	        if (isset($globalAccidents) && $globalAccidents) {
454
-    	    ?>
453
+				if (isset($globalAccidents) && $globalAccidents) {
454
+			?>
455 455
             <li><hr /></li>
456 456
             <li><a href="<?php print $globalURL; ?>/accident-latest"><?php echo _("Latest accident"); ?></a></li>
457 457
             <li><a href="<?php print $globalURL; ?>/accident/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Accident"); ?></a></li>
458 458
             <li><a href="<?php print $globalURL; ?>/incident-latest"><?php echo _("Latest incident"); ?></a></li>
459 459
             <li><a href="<?php print $globalURL; ?>/incident/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Incident"); ?></a></li>
460 460
             <?php
461
-        	}
462
-    	    ?>
461
+			}
462
+			?>
463 463
             <li><hr /></li>
464 464
             <li><a href="<?php print $globalURL; ?>/highlights/table"><?php echo _("Special Highlights"); ?></a></li>
465 465
             <li><a href="<?php print $globalURL; ?>/upcoming"><?php echo _("Upcoming Flights"); ?></a></li>
@@ -482,14 +482,14 @@  discard block
 block discarded – undo
482 482
     </ul>
483 483
 <?php
484 484
 	}
485
-    }
485
+	}
486 486
 ?>
487 487
 <?php
488
-    if (isset($globalMarine) && $globalMarine) {
488
+	if (isset($globalMarine) && $globalMarine) {
489 489
 ?>
490 490
     <li class="dropdown">
491 491
 <?php
492
-        if ($sub) {
492
+		if ($sub) {
493 493
 ?>
494 494
     <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Vessels"); ?> <b class="caret"></b></a>
495 495
 	<ul class="dropdown-menu multi-level">
@@ -513,14 +513,14 @@  discard block
 block discarded – undo
513 513
 	}
514 514
 ?>
515 515
 <?php
516
-    }
516
+	}
517 517
 ?>
518 518
 <?php
519
-    if (isset($globalTracker) && $globalTracker) {
519
+	if (isset($globalTracker) && $globalTracker) {
520 520
 ?>
521 521
     <li class="dropdown">
522 522
 <?php
523
-        if ($sub) {
523
+		if ($sub) {
524 524
 ?>
525 525
     <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Trackers"); ?> <b class="caret"></b></a>
526 526
 	<ul class="dropdown-menu multi-level">
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
 	}
545 545
 ?>
546 546
 <?php
547
-    }
547
+	}
548 548
 ?>
549 549
 
550 550
         <li class="dropdown">
@@ -553,12 +553,12 @@  discard block
 block discarded – undo
553 553
           	<li><a href="<?php print $globalURL; ?>/about"><?php echo _("About The Project"); ?></a></li>
554 554
           	<li><a href="<?php print $globalURL; ?>/about/export"><?php echo _("Exporting Data"); ?></a></li>
555 555
 <?php
556
-    if (!isset($globalAircraft) || $globalAircraft === TRUE) {
556
+	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
557 557
 ?>
558 558
 		<li><hr /></li>
559 559
 		<li><a href="<?php print $globalURL; ?>/about/tv"><?php echo _("Spotter TV"); ?></a></li>
560 560
 <?php
561
-    }
561
+	}
562 562
 ?>
563 563
 	    <?php if (isset($globalContribute) && $globalContribute) { ?>
564 564
                 <li><hr /></li>
@@ -579,14 +579,14 @@  discard block
 block discarded – undo
579 579
   	    <form>
580 580
   		<select class="selectpicker" data-width="120px" onchange="language(this);">
581 581
   		    <?php
582
-  		        $Language = new Language();
583
-  		        $alllang = $Language->getLanguages();
584
-  		        foreach ($alllang as $key => $lang) {
585
-  		            print '<option value="'.$key.'"';
586
-  		            if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected ';
587
-  		            print '>'.$lang[0].'</option>';
588
-  		        }
589
-  		    ?>
582
+  				$Language = new Language();
583
+  				$alllang = $Language->getLanguages();
584
+  				foreach ($alllang as $key => $lang) {
585
+  					print '<option value="'.$key.'"';
586
+  					if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected ';
587
+  					print '>'.$lang[0].'</option>';
588
+  				}
589
+  			?>
590 590
   		</select>
591 591
   	    </form>
592 592
   	</div>
@@ -617,18 +617,18 @@  discard block
 block discarded – undo
617 617
 ?>
618 618
     <div class="top-header clear" role="main">
619 619
 <?php
620
-    if (isset($longitude) && isset($latitude) && $longitude != 0 && $latitude != 0) {
620
+	if (isset($longitude) && isset($latitude) && $longitude != 0 && $latitude != 0) {
621 621
 ?>
622 622
     <div id="archive-map"></div>
623 623
 <?php
624
-    }
624
+	}
625 625
 ?>
626 626
     </div>
627 627
 <?php
628 628
 }
629 629
 if ((strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) || (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false))
630 630
 {
631
-    ?>
631
+	?>
632 632
     <div class="top-header clear" role="main">
633 633
         <div id="map"></div>
634 634
 	<link rel="stylesheet" href="<?php print $globalURL; ?>/css/leaflet.css" />
@@ -639,15 +639,15 @@  discard block
 block discarded – undo
639 639
         var zoom = 13;
640 640
 //create the map
641 641
 <?php
642
-    if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) {
642
+	if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) {
643 643
 ?>
644 644
   map = L.map('map', { zoomControl:true }).setView([<?php print $airport_array[0]['latitude']; ?>,<?php print $airport_array[0]['longitude']; ?>], zoom);
645 645
 <?php
646
-    } elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) {
646
+	} elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) {
647 647
 ?>
648 648
   map = L.map('map', { zoomControl:true });
649 649
 <?php
650
-    } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) {
650
+	} elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) {
651 651
 ?>
652 652
   map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['departure_airport_latitude']; ?>,<?php print $spotter_array[0]['arrival_airport_longitude']; ?>]);
653 653
     var line = L.polyline([[<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>],[<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>]]).addTo(map);
@@ -655,22 +655,22 @@  discard block
 block discarded – undo
655 655
     var departure_airport = L.marker([<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/departure_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map);
656 656
     var arrival_airport = L.marker([<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/arrival_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map);
657 657
 <?php
658
-    } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude'])) {
658
+	} elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude'])) {
659 659
 ?>
660 660
   map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['latitude']; ?>,<?php print $spotter_array[0]['longitude']; ?>]);
661 661
 <?php
662
-    } elseif (!isset($spotter_array[0]['latitude']) && !isset($spotter_array[0]['longitude'])) {
662
+	} elseif (!isset($spotter_array[0]['latitude']) && !isset($spotter_array[0]['longitude'])) {
663 663
 ?>
664 664
   map = L.map('map', { zoomControl:true });
665 665
 <?php
666
-    }
666
+	}
667 667
 ?>
668 668
   //initialize the layer group for the aircrft markers
669 669
   var layer_data = L.layerGroup();
670 670
 
671 671
   //a few title layers
672 672
 <?php
673
-    if ($globalMapProvider == 'Mapbox') {
673
+	if ($globalMapProvider == 'Mapbox') {
674 674
 ?>
675 675
   L.tileLayer('https://{s}.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={token}', {
676 676
     maxZoom: 18,
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
     token : '<?php print $globalMapboxToken; ?>'
682 682
   }).addTo(map);
683 683
 <?php
684
-    } elseif ($globalMapProvider == 'OpenStreetMap') {
684
+	} elseif ($globalMapProvider == 'OpenStreetMap') {
685 685
 ?>
686 686
   L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
687 687
     maxZoom: 18,
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
       '<a href="http://www.openstreetmap.org/copyright">Open Database Licence</a>'
690 690
   }).addTo(map);
691 691
 <?php
692
-    } elseif ($globalMapProvider == 'MapQuest-OSM') {
692
+	} elseif ($globalMapProvider == 'MapQuest-OSM') {
693 693
 ?>
694 694
   L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.png', {
695 695
     maxZoom: 18,
@@ -698,7 +698,7 @@  discard block
 block discarded – undo
698 698
       'Tiles Courtesy of <a href="http://www.mapquest.com">MapQuest</a>'
699 699
   }).addTo(map);
700 700
 <?php
701
-    } elseif ($globalMapProvider == 'MapQuest-Aerial') {
701
+	} elseif ($globalMapProvider == 'MapQuest-Aerial') {
702 702
 ?>
703 703
   L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.png', {
704 704
     maxZoom: 18,
@@ -707,27 +707,27 @@  discard block
 block discarded – undo
707 707
       'Tiles Courtesy of <a href="http://www.mapquest.com">MapQuest</a>, Portions Courtesy NASA/JPL-Caltech and U.S. Depart. of Agriculture, Farm Service Agency"'
708 708
   }).addTo(map);
709 709
 <?php
710
-    } elseif ($globalMapProvider == 'Google-Roadmap') {
710
+	} elseif ($globalMapProvider == 'Google-Roadmap') {
711 711
 ?>
712 712
     var googleLayer = new L.Google('ROADMAP');
713 713
     map.addLayer(googleLayer);
714 714
 <?php
715
-    } elseif ($globalMapProvider == 'Google-Satellite') {
715
+	} elseif ($globalMapProvider == 'Google-Satellite') {
716 716
 ?>
717 717
     var googleLayer = new L.Google('SATELLITE');
718 718
     map.addLayer(googleLayer);
719 719
 <?php
720
-    } elseif ($globalMapProvider == 'Google-Hybrid') {
720
+	} elseif ($globalMapProvider == 'Google-Hybrid') {
721 721
 ?>
722 722
     var googleLayer = new L.Google('HYBRID');
723 723
     map.addLayer(googleLayer);
724 724
 <?php
725
-    } elseif ($globalMapProvider == 'Google-Terrain') {
725
+	} elseif ($globalMapProvider == 'Google-Terrain') {
726 726
 ?>
727 727
     var googleLayer = new L.Google('Terrain');
728 728
     map.addLayer(googleLayer);
729 729
 <?php
730
-    }
730
+	}
731 731
 ?>
732 732
         </script>
733 733
     </div>
Please login to merge, or discard this patch.
live-geojson.php 1 patch
Indentation   +35 added lines, -35 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
 
@@ -497,17 +497,17 @@  discard block
 block discarded – undo
497 497
 				if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history'];
498 498
 				
499 499
 				if (
500
-				    (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') 
501
-				    || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory)
500
+					(isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') 
501
+					|| ((isset($globalMapHistory) && $globalMapHistory) || $allhistory)
502 502
 				//    || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id']))
503 503
 				//    || (isset($history) && $history != '' && $history != 'NA' && $history == $spotter_item['ident'])
504
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
505
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])
506
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id']))
507
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id'])
508
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid']))
509
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid'])
510
-				    ) {
504
+					|| (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
505
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])
506
+					|| (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id']))
507
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id'])
508
+					|| (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid']))
509
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid'])
510
+					) {
511 511
 					if ($tracker) {
512 512
 						if ($from_archive || $globalArchive) {
513 513
 							$spotter_history_array = $TrackerArchive->getAllArchiveTrackerDataById($spotter_item['famtrackid']);
@@ -596,26 +596,26 @@  discard block
 block discarded – undo
596 596
 				}
597 597
 				
598 598
 				if (isset($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))))) {
599
-				    $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
600
-				    if (isset($spotter_item['departure_airport_latitude'])) {
599
+					$output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
600
+					if (isset($spotter_item['departure_airport_latitude'])) {
601 601
 					$output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],';
602
-				    } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') {
602
+					} elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') {
603 603
 					$dairport = $Spotter->getAllAirportInfo($spotter_item['departure_airport']);
604 604
 					if (isset($dairport[0]['latitude'])) {
605
-					    $output_air .= '['.$dairport[0]['longitude'].','.$dairport[0]['latitude'].'],';
605
+						$output_air .= '['.$dairport[0]['longitude'].','.$dairport[0]['latitude'].'],';
606 606
 					}
607
-				    }
608
-				    if (isset($spotter_item['arrival_airport_latitude'])) {
607
+					}
608
+					if (isset($spotter_item['arrival_airport_latitude'])) {
609 609
 					$output_air .= '['.$spotter_item['arrival_airport_longitude'].','.$spotter_item['arrival_airport_latitude'].']';
610
-				    } elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
610
+					} elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
611 611
 					$aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']);
612 612
 					if (isset($aairport[0]['latitude'])) {
613
-					    $output_air .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].']';
613
+						$output_air .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].']';
614 614
 					}
615
-				    }
616
-				    $output_air .= ']}},';
617
-				    $output .= $output_air;
618
-				    unset($output_air);
615
+					}
616
+					$output_air .= ']}},';
617
+					$output .= $output_air;
618
+					unset($output_air);
619 619
 				}
620 620
 			}
621 621
 			$output  = substr($output, 0, -1);
Please login to merge, or discard this patch.
require/class.TrackerLive.php 1 patch
Indentation   +199 added lines, -199 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@  discard block
 block discarded – undo
12 12
 
13 13
 
14 14
 	/**
15
-	* Get SQL query part for filter used
16
-	* @param Array $filter the filter
17
-	* @return Array the SQL part
18
-	*/
15
+	 * Get SQL query part for filter used
16
+	 * @param Array $filter the filter
17
+	 * @return Array the SQL part
18
+	 */
19 19
 	public function getFilter($filter = array(),$where = false,$and = false) {
20 20
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
21 21
 		$filters = array();
@@ -86,11 +86,11 @@  discard block
 block discarded – undo
86 86
 	}
87 87
 
88 88
 	/**
89
-	* Gets all the spotter information based on the latest data entry
90
-	*
91
-	* @return Array the spotter information
92
-	*
93
-	*/
89
+	 * Gets all the spotter information based on the latest data entry
90
+	 *
91
+	 * @return Array the spotter information
92
+	 *
93
+	 */
94 94
 	public function getLiveTrackerData($limit = '', $sort = '', $filter = array())
95 95
 	{
96 96
 		global $globalDBdriver, $globalLiveInterval;
@@ -132,11 +132,11 @@  discard block
 block discarded – undo
132 132
 	}
133 133
 
134 134
 	/**
135
-	* Gets Minimal Live Spotter data
136
-	*
137
-	* @return Array the spotter information
138
-	*
139
-	*/
135
+	 * Gets Minimal Live Spotter data
136
+	 *
137
+	 * @return Array the spotter information
138
+	 *
139
+	 */
140 140
 	public function getMinLiveTrackerData($filter = array())
141 141
 	{
142 142
 		global $globalDBdriver, $globalLiveInterval;
@@ -170,11 +170,11 @@  discard block
 block discarded – undo
170 170
 	}
171 171
 
172 172
 	/**
173
-	* Gets Minimal Live Spotter data since xx seconds
174
-	*
175
-	* @return Array the spotter information
176
-	*
177
-	*/
173
+	 * Gets Minimal Live Spotter data since xx seconds
174
+	 *
175
+	 * @return Array the spotter information
176
+	 *
177
+	 */
178 178
 	public function getMinLastLiveTrackerData($filter = array())
179 179
 	{
180 180
 		global $globalDBdriver, $globalLiveInterval;
@@ -187,13 +187,13 @@  discard block
 block discarded – undo
187 187
 			$query  = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
188 188
 			FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' 
189 189
 			ORDER BY tracker_live.famtrackid, tracker_live.date";
190
-                } else {
190
+				} else {
191 191
 			$query  = "SELECT tracker_live.ident, tracker_live.famtrackid, tracker_live.type,tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
192 192
 			FROM tracker_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= tracker_live.date AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' 
193 193
 			ORDER BY tracker_live.famtrackid, tracker_live.date";
194 194
 		}
195 195
 
196
-    		try {
196
+			try {
197 197
 			$sth = $this->db->prepare($query);
198 198
 			$sth->execute();
199 199
 		} catch(PDOException $e) {
@@ -205,11 +205,11 @@  discard block
 block discarded – undo
205 205
 	}
206 206
 
207 207
 	/**
208
-	* Gets number of latest data entry
209
-	*
210
-	* @return String number of entry
211
-	*
212
-	*/
208
+	 * Gets number of latest data entry
209
+	 *
210
+	 * @return String number of entry
211
+	 *
212
+	 */
213 213
 	public function getLiveTrackerCount($filter = array())
214 214
 	{
215 215
 		global $globalDBdriver, $globalLiveInterval;
@@ -234,11 +234,11 @@  discard block
 block discarded – undo
234 234
 	}
235 235
 
236 236
 	/**
237
-	* Gets all the spotter information based on the latest data entry and coord
238
-	*
239
-	* @return Array the spotter information
240
-	*
241
-	*/
237
+	 * Gets all the spotter information based on the latest data entry and coord
238
+	 *
239
+	 * @return Array the spotter information
240
+	 *
241
+	 */
242 242
 	public function getLiveTrackerDatabyCoord($coord, $filter = array())
243 243
 	{
244 244
 		global $globalDBdriver, $globalLiveInterval;
@@ -262,11 +262,11 @@  discard block
 block discarded – undo
262 262
 	}
263 263
 
264 264
 	/**
265
-	* Gets all the spotter information based on the latest data entry and coord
266
-	*
267
-	* @return Array the spotter information
268
-	*
269
-	*/
265
+	 * Gets all the spotter information based on the latest data entry and coord
266
+	 *
267
+	 * @return Array the spotter information
268
+	 *
269
+	 */
270 270
 	public function getMinLiveTrackerDatabyCoord($coord, $filter = array())
271 271
 	{
272 272
 		global $globalDBdriver, $globalLiveInterval;
@@ -293,11 +293,11 @@  discard block
 block discarded – undo
293 293
 	}
294 294
 
295 295
 	/**
296
-	* Gets all the spotter information based on a user's latitude and longitude
297
-	*
298
-	* @return Array the spotter information
299
-	*
300
-	*/
296
+	 * Gets all the spotter information based on a user's latitude and longitude
297
+	 *
298
+	 * @return Array the spotter information
299
+	 *
300
+	 */
301 301
 	public function getLatestTrackerForLayar($lat, $lng, $radius, $interval)
302 302
 	{
303 303
 		$Tracker = new Tracker($this->db);
@@ -310,142 +310,142 @@  discard block
 block discarded – undo
310 310
 		if ($lng != '')
311 311
 		{
312 312
 			if (!is_numeric($lng))
313
-                        {
314
-                                return false;
315
-                        }
316
-                }
317
-
318
-                if ($radius != '')
319
-                {
320
-                        if (!is_numeric($radius))
321
-                        {
322
-                                return false;
323
-                        }
324
-                }
313
+						{
314
+								return false;
315
+						}
316
+				}
317
+
318
+				if ($radius != '')
319
+				{
320
+						if (!is_numeric($radius))
321
+						{
322
+								return false;
323
+						}
324
+				}
325 325
 		$additional_query = '';
326 326
 		if ($interval != '')
327
-                {
328
-                        if (!is_string($interval))
329
-                        {
330
-                                //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';
331
-			        return false;
332
-                        } else {
333
-                if ($interval == '1m')
334
-                {
335
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';
336
-                } else if ($interval == '15m'){
337
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= tracker_live.date ';
338
-                } 
339
-            }
340
-                } else {
341
-         $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';   
342
-        }
343
-
344
-                $query  = "SELECT tracker_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM tracker_live 
327
+				{
328
+						if (!is_string($interval))
329
+						{
330
+								//$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';
331
+					return false;
332
+						} else {
333
+				if ($interval == '1m')
334
+				{
335
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';
336
+				} else if ($interval == '15m'){
337
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= tracker_live.date ';
338
+				} 
339
+			}
340
+				} else {
341
+		 $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';   
342
+		}
343
+
344
+				$query  = "SELECT tracker_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM tracker_live 
345 345
                    WHERE tracker_live.latitude <> '' 
346 346
                                    AND tracker_live.longitude <> '' 
347 347
                    ".$additional_query."
348 348
                    HAVING distance < :radius  
349 349
                                    ORDER BY distance";
350 350
 
351
-                $spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
351
+				$spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
352 352
 
353
-                return $spotter_array;
354
-        }
353
+				return $spotter_array;
354
+		}
355 355
 
356 356
     
357
-        /**
358
-	* Gets all the spotter information based on a particular callsign
359
-	*
360
-	* @return Array the spotter information
361
-	*
362
-	*/
357
+		/**
358
+		 * Gets all the spotter information based on a particular callsign
359
+		 *
360
+		 * @return Array the spotter information
361
+		 *
362
+		 */
363 363
 	public function getLastLiveTrackerDataByIdent($ident)
364 364
 	{
365 365
 		$Tracker = new Tracker($this->db);
366 366
 		date_default_timezone_set('UTC');
367 367
 
368 368
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
369
-                $query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
369
+				$query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
370 370
 
371 371
 		$spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident),'',true);
372 372
 
373 373
 		return $spotter_array;
374 374
 	}
375 375
 
376
-        /**
377
-	* Gets all the spotter information based on a particular callsign
378
-	*
379
-	* @return Array the spotter information
380
-	*
381
-	*/
376
+		/**
377
+		 * Gets all the spotter information based on a particular callsign
378
+		 *
379
+		 * @return Array the spotter information
380
+		 *
381
+		 */
382 382
 	public function getDateLiveTrackerDataByIdent($ident,$date)
383 383
 	{
384 384
 		$Tracker = new Tracker($this->db);
385 385
 		date_default_timezone_set('UTC');
386 386
 
387 387
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
388
-                $query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
388
+				$query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
389 389
 
390
-                $date = date('c',$date);
390
+				$date = date('c',$date);
391 391
 		$spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
392 392
 
393 393
 		return $spotter_array;
394 394
 	}
395 395
 
396
-        /**
397
-	* Gets last spotter information based on a particular callsign
398
-	*
399
-	* @return Array the spotter information
400
-	*
401
-	*/
396
+		/**
397
+		 * Gets last spotter information based on a particular callsign
398
+		 *
399
+		 * @return Array the spotter information
400
+		 *
401
+		 */
402 402
 	public function getLastLiveTrackerDataById($id)
403 403
 	{
404 404
 		$Tracker = new Tracker($this->db);
405 405
 		date_default_timezone_set('UTC');
406 406
 
407 407
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
408
-                $query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
408
+				$query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
409 409
 
410 410
 		$spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id),'',true);
411 411
 
412 412
 		return $spotter_array;
413 413
 	}
414 414
 
415
-        /**
416
-	* Gets last spotter information based on a particular callsign
417
-	*
418
-	* @return Array the spotter information
419
-	*
420
-	*/
415
+		/**
416
+		 * Gets last spotter information based on a particular callsign
417
+		 *
418
+		 * @return Array the spotter information
419
+		 *
420
+		 */
421 421
 	public function getDateLiveTrackerDataById($id,$date)
422 422
 	{
423 423
 		$Tracker = new Tracker($this->db);
424 424
 		date_default_timezone_set('UTC');
425 425
 
426 426
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
427
-                $query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
428
-                $date = date('c',$date);
427
+				$query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
428
+				$date = date('c',$date);
429 429
 		$spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
430 430
 
431 431
 		return $spotter_array;
432 432
 	}
433 433
 
434
-        /**
435
-	* Gets altitude information based on a particular callsign
436
-	*
437
-	* @return Array the spotter information
438
-	*
439
-	*/
434
+		/**
435
+		 * Gets altitude information based on a particular callsign
436
+		 *
437
+		 * @return Array the spotter information
438
+		 *
439
+		 */
440 440
 	public function getAltitudeLiveTrackerDataByIdent($ident)
441 441
 	{
442 442
 
443 443
 		date_default_timezone_set('UTC');
444 444
 
445 445
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
446
-                $query  = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident';
446
+				$query  = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident';
447 447
 
448
-    		try {
448
+			try {
449 449
 			
450 450
 			$sth = $this->db->prepare($query);
451 451
 			$sth->execute(array(':ident' => $ident));
@@ -458,12 +458,12 @@  discard block
 block discarded – undo
458 458
 		return $spotter_array;
459 459
 	}
460 460
 
461
-        /**
462
-	* Gets all the spotter information based on a particular id
463
-	*
464
-	* @return Array the spotter information
465
-	*
466
-	*/
461
+		/**
462
+		 * Gets all the spotter information based on a particular id
463
+		 *
464
+		 * @return Array the spotter information
465
+		 *
466
+		 */
467 467
 	public function getAllLiveTrackerDataById($id,$liveinterval = false)
468 468
 	{
469 469
 		global $globalDBdriver, $globalLiveInterval;
@@ -491,18 +491,18 @@  discard block
 block discarded – undo
491 491
 		return $spotter_array;
492 492
 	}
493 493
 
494
-        /**
495
-	* Gets all the spotter information based on a particular ident
496
-	*
497
-	* @return Array the spotter information
498
-	*
499
-	*/
494
+		/**
495
+		 * Gets all the spotter information based on a particular ident
496
+		 *
497
+		 * @return Array the spotter information
498
+		 *
499
+		 */
500 500
 	public function getAllLiveTrackerDataByIdent($ident)
501 501
 	{
502 502
 		date_default_timezone_set('UTC');
503 503
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
504 504
 		$query  = self::$global_query.' WHERE tracker_live.ident = :ident';
505
-    		try {
505
+			try {
506 506
 			
507 507
 			$sth = $this->db->prepare($query);
508 508
 			$sth->execute(array(':ident' => $ident));
@@ -516,23 +516,23 @@  discard block
 block discarded – undo
516 516
 
517 517
 
518 518
 	/**
519
-	* Deletes all info in the table
520
-	*
521
-	* @return String success or false
522
-	*
523
-	*/
519
+	 * Deletes all info in the table
520
+	 *
521
+	 * @return String success or false
522
+	 *
523
+	 */
524 524
 	public function deleteLiveTrackerData()
525 525
 	{
526 526
 		global $globalDBdriver;
527 527
 		if ($globalDBdriver == 'mysql') {
528 528
 			//$query  = "DELETE FROM tracker_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= tracker_live.date";
529 529
 			$query  = 'DELETE FROM tracker_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= tracker_live.date';
530
-            		//$query  = "DELETE FROM tracker_live WHERE tracker_live.id IN (SELECT tracker_live.id FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= tracker_live.date)";
530
+					//$query  = "DELETE FROM tracker_live WHERE tracker_live.id IN (SELECT tracker_live.id FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= tracker_live.date)";
531 531
 		} else {
532 532
 			$query  = "DELETE FROM tracker_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= tracker_live.date";
533 533
 		}
534 534
         
535
-    		try {
535
+			try {
536 536
 			
537 537
 			$sth = $this->db->prepare($query);
538 538
 			$sth->execute();
@@ -544,18 +544,18 @@  discard block
 block discarded – undo
544 544
 	}
545 545
 
546 546
 	/**
547
-	* Deletes all info in the table for aircraft not seen since 2 HOUR
548
-	*
549
-	* @return String success or false
550
-	*
551
-	*/
547
+	 * Deletes all info in the table for aircraft not seen since 2 HOUR
548
+	 *
549
+	 * @return String success or false
550
+	 *
551
+	 */
552 552
 	public function deleteLiveTrackerDataNotUpdated()
553 553
 	{
554 554
 		global $globalDBdriver, $globalDebug;
555 555
 		if ($globalDBdriver == 'mysql') {
556 556
 			//$query = 'SELECT famtrackid FROM tracker_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) >= tracker_live.date AND tracker_live.famtrackid NOT IN (SELECT famtrackid FROM tracker_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) < tracker_live.date) LIMIT 800 OFFSET 0';
557
-    			$query = "SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0";
558
-    			try {
557
+				$query = "SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0";
558
+				try {
559 559
 				
560 560
 				$sth = $this->db->prepare($query);
561 561
 				$sth->execute();
@@ -563,8 +563,8 @@  discard block
 block discarded – undo
563 563
 				return "error";
564 564
 			}
565 565
 			$query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN (';
566
-                        $i = 0;
567
-                        $j =0;
566
+						$i = 0;
567
+						$j =0;
568 568
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
569 569
 			foreach($all as $row)
570 570
 			{
@@ -572,20 +572,20 @@  discard block
 block discarded – undo
572 572
 				$j++;
573 573
 				if ($j == 30) {
574 574
 					if ($globalDebug) echo ".";
575
-				    	try {
575
+						try {
576 576
 						
577 577
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
578 578
 						$sth->execute();
579 579
 					} catch(PDOException $e) {
580 580
 						return "error";
581 581
 					}
582
-                                	$query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN (';
583
-                                	$j = 0;
582
+									$query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN (';
583
+									$j = 0;
584 584
 				}
585 585
 				$query_delete .= "'".$row['famtrackid']."',";
586 586
 			}
587 587
 			if ($i > 0) {
588
-    				try {
588
+					try {
589 589
 					
590 590
 					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
591 591
 					$sth->execute();
@@ -596,9 +596,9 @@  discard block
 block discarded – undo
596 596
 			return "success";
597 597
 		} elseif ($globalDBdriver == 'pgsql') {
598 598
 			//$query = "SELECT famtrackid FROM tracker_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= tracker_live.date AND tracker_live.famtrackid NOT IN (SELECT famtrackid FROM tracker_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' < tracker_live.date) LIMIT 800 OFFSET 0";
599
-    			//$query = "SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0";
600
-    			$query = "DELETE FROM tracker_live WHERE famtrackid IN (SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)";
601
-    			try {
599
+				//$query = "SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0";
600
+				$query = "DELETE FROM tracker_live WHERE famtrackid IN (SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)";
601
+				try {
602 602
 				
603 603
 				$sth = $this->db->prepare($query);
604 604
 				$sth->execute();
@@ -642,17 +642,17 @@  discard block
 block discarded – undo
642 642
 	}
643 643
 
644 644
 	/**
645
-	* Deletes all info in the table for an ident
646
-	*
647
-	* @return String success or false
648
-	*
649
-	*/
645
+	 * Deletes all info in the table for an ident
646
+	 *
647
+	 * @return String success or false
648
+	 *
649
+	 */
650 650
 	public function deleteLiveTrackerDataByIdent($ident)
651 651
 	{
652 652
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
653 653
 		$query  = 'DELETE FROM tracker_live WHERE ident = :ident';
654 654
         
655
-    		try {
655
+			try {
656 656
 			
657 657
 			$sth = $this->db->prepare($query);
658 658
 			$sth->execute(array(':ident' => $ident));
@@ -664,17 +664,17 @@  discard block
 block discarded – undo
664 664
 	}
665 665
 
666 666
 	/**
667
-	* Deletes all info in the table for an id
668
-	*
669
-	* @return String success or false
670
-	*
671
-	*/
667
+	 * Deletes all info in the table for an id
668
+	 *
669
+	 * @return String success or false
670
+	 *
671
+	 */
672 672
 	public function deleteLiveTrackerDataById($id)
673 673
 	{
674 674
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
675 675
 		$query  = 'DELETE FROM tracker_live WHERE famtrackid = :id';
676 676
         
677
-    		try {
677
+			try {
678 678
 			
679 679
 			$sth = $this->db->prepare($query);
680 680
 			$sth->execute(array(':id' => $id));
@@ -687,11 +687,11 @@  discard block
 block discarded – undo
687 687
 
688 688
 
689 689
 	/**
690
-	* Gets the aircraft ident within the last hour
691
-	*
692
-	* @return String the ident
693
-	*
694
-	*/
690
+	 * Gets the aircraft ident within the last hour
691
+	 *
692
+	 * @return String the ident
693
+	 *
694
+	 */
695 695
 	public function getIdentFromLastHour($ident)
696 696
 	{
697 697
 		global $globalDBdriver, $globalTimezone;
@@ -717,14 +717,14 @@  discard block
 block discarded – undo
717 717
 			$ident_result = $row['ident'];
718 718
 		}
719 719
 		return $ident_result;
720
-        }
720
+		}
721 721
 
722 722
 	/**
723
-	* Check recent aircraft
724
-	*
725
-	* @return String the ident
726
-	*
727
-	*/
723
+	 * Check recent aircraft
724
+	 *
725
+	 * @return String the ident
726
+	 *
727
+	 */
728 728
 	public function checkIdentRecent($ident)
729 729
 	{
730 730
 		global $globalDBdriver, $globalTimezone;
@@ -750,14 +750,14 @@  discard block
 block discarded – undo
750 750
 			$ident_result = $row['famtrackid'];
751 751
 		}
752 752
 		return $ident_result;
753
-        }
753
+		}
754 754
 
755 755
 	/**
756
-	* Check recent aircraft by id
757
-	*
758
-	* @return String the ident
759
-	*
760
-	*/
756
+	 * Check recent aircraft by id
757
+	 *
758
+	 * @return String the ident
759
+	 *
760
+	 */
761 761
 	public function checkIdRecent($id)
762 762
 	{
763 763
 		global $globalDBdriver, $globalTimezone;
@@ -783,19 +783,19 @@  discard block
 block discarded – undo
783 783
 			$ident_result = $row['famtrackid'];
784 784
 		}
785 785
 		return $ident_result;
786
-        }
786
+		}
787 787
 
788 788
 	/**
789
-	* Adds a new spotter data
790
-	*
791
-	* @param String $famtrackid the ID from flightaware
792
-	* @param String $ident the flight ident
793
-	* @param String $aircraft_icao the aircraft type
794
-	* @param String $departure_airport_icao the departure airport
795
-	* @param String $arrival_airport_icao the arrival airport
796
-	* @return String success or false
797
-	*
798
-	*/
789
+	 * Adds a new spotter data
790
+	 *
791
+	 * @param String $famtrackid the ID from flightaware
792
+	 * @param String $ident the flight ident
793
+	 * @param String $aircraft_icao the aircraft type
794
+	 * @param String $departure_airport_icao the departure airport
795
+	 * @param String $arrival_airport_icao the arrival airport
796
+	 * @return String success or false
797
+	 *
798
+	 */
799 799
 	public function addLiveTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '')
800 800
 	{
801 801
 		global $globalURL, $globalArchive, $globalDebug;
@@ -868,8 +868,8 @@  discard block
 block discarded – undo
868 868
 		$comment = filter_var($comment,FILTER_SANITIZE_STRING);
869 869
 		$type = filter_var($type,FILTER_SANITIZE_STRING);
870 870
 
871
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
872
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
871
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
872
+				if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
873 873
             	
874 874
 		$query = '';
875 875
 		if ($globalArchive) {
@@ -884,16 +884,16 @@  discard block
 block discarded – undo
884 884
 			
885 885
 			$sth = $this->db->prepare($query);
886 886
 			$sth->execute($query_values);
887
-                } catch(PDOException $e) {
888
-                	return "error : ".$e->getMessage();
889
-                }
890
-                echo 'putinarchive : '.$putinarchive."\n";
891
-                echo 'noarchive : '.$noarchive."\n";
887
+				} catch(PDOException $e) {
888
+					return "error : ".$e->getMessage();
889
+				}
890
+				echo 'putinarchive : '.$putinarchive."\n";
891
+				echo 'noarchive : '.$noarchive."\n";
892 892
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
893
-		    if ($globalDebug) echo '(Add to SBS archive : ';
894
-		    $TrackerArchive = new TrackerArchive($this->db);
895
-		    $result =  $TrackerArchive->addTrackerArchiveData($famtrackid, $ident,$latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type,$noarchive,$format_source, $source_name, $over_country);
896
-		    if ($globalDebug) echo $result.')';
893
+			if ($globalDebug) echo '(Add to SBS archive : ';
894
+			$TrackerArchive = new TrackerArchive($this->db);
895
+			$result =  $TrackerArchive->addTrackerArchiveData($famtrackid, $ident,$latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type,$noarchive,$format_source, $source_name, $over_country);
896
+			if ($globalDebug) echo $result.')';
897 897
 		}
898 898
 
899 899
 		return "success";
Please login to merge, or discard this patch.
footer.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,12 +2,12 @@
 block discarded – undo
2 2
 
3 3
 <footer class="container">
4 4
 	<?php
5
-	    if (isset($sql_time)) {
5
+		if (isset($sql_time)) {
6 6
 	?>
7 7
 	<i><?php echo _("Page generated in").' '.round($sql_time+$page_time,2); ?>s (<?php print round($page_time,2); ?>ms PHP - <?php print round($sql_time,2); ?>ms SQL)</i>
8 8
 	<br />
9 9
 	<?php
10
-	    }
10
+		}
11 11
 	?>
12 12
 	<span>Developed in Barrie by <a href="http://mtru.nz/" target="_blank">Mario Trunz</a> & at <a href="http://www.zugaina.com" target="_blank">Zugaina</a> by Ycarus</span> - <span><a href="<?php if (isset($globalURL)) print $globalURL; ?>/about#source">Source &amp; Credits</a></span> - <span><a href="https://www.flightairmap.fr/" target="_blank">Get source code</a></span>
13 13
 </footer>
Please login to merge, or discard this patch.
require/class.Tracker.php 1 patch
Indentation   +195 added lines, -195 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
 	
21 21
 	public function getFilter($filter = array(),$where = false,$and = false) {
22 22
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
@@ -80,14 +80,14 @@  discard block
 block discarded – undo
80 80
 	}
81 81
 
82 82
 	/**
83
-	* Executes the SQL statements to get the spotter information
84
-	*
85
-	* @param String $query the SQL query
86
-	* @param Array $params parameter of the query
87
-	* @param String $limitQuery the limit query
88
-	* @return Array the spotter information
89
-	*
90
-	*/
83
+	 * Executes the SQL statements to get the spotter information
84
+	 *
85
+	 * @param String $query the SQL query
86
+	 * @param Array $params parameter of the query
87
+	 * @param String $limitQuery the limit query
88
+	 * @return Array the spotter information
89
+	 *
90
+	 */
91 91
 	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
92 92
 	{
93 93
 		date_default_timezone_set('UTC');
@@ -200,11 +200,11 @@  discard block
 block discarded – undo
200 200
 	
201 201
 	
202 202
 	/**
203
-	* Gets all the spotter information based on the latest data entry
204
-	*
205
-	* @return Array the spotter information
206
-	*
207
-	*/
203
+	 * Gets all the spotter information based on the latest data entry
204
+	 *
205
+	 * @return Array the spotter information
206
+	 *
207
+	 */
208 208
 	public function getLatestTrackerData($limit = '', $sort = '', $filter = array())
209 209
 	{
210 210
 		global $global_query;
@@ -262,11 +262,11 @@  discard block
 block discarded – undo
262 262
 	}
263 263
 
264 264
 	/**
265
-	* Gets all the spotter information based on the callsign
266
-	*
267
-	* @return Array the spotter information
268
-	*
269
-	*/
265
+	 * Gets all the spotter information based on the callsign
266
+	 *
267
+	 * @return Array the spotter information
268
+	 *
269
+	 */
270 270
 	public function getTrackerDataByIdent($ident = '', $limit = '', $sort = '', $filter = array())
271 271
 	{
272 272
 		global $global_query;
@@ -377,12 +377,12 @@  discard block
 block discarded – undo
377 377
 
378 378
 
379 379
 	/**
380
-	* Gets all source name
381
-	*
382
-	* @param String type format of source
383
-	* @return Array list of source name
384
-	*
385
-	*/
380
+	 * Gets all source name
381
+	 *
382
+	 * @param String type format of source
383
+	 * @return Array list of source name
384
+	 *
385
+	 */
386 386
 	public function getAllSourceName($type = '',$filters = array())
387 387
 	{
388 388
 		$filter_query = $this->getFilter($filters,true,true);
@@ -412,11 +412,11 @@  discard block
 block discarded – undo
412 412
 
413 413
 
414 414
 	/**
415
-	* Gets a list of all idents/callsigns
416
-	*
417
-	* @return Array list of ident/callsign names
418
-	*
419
-	*/
415
+	 * Gets a list of all idents/callsigns
416
+	 *
417
+	 * @return Array list of ident/callsign names
418
+	 *
419
+	 */
420 420
 	public function getAllIdents($filters = array())
421 421
 	{
422 422
 		$filter_query = $this->getFilter($filters,true,true);
@@ -484,18 +484,18 @@  discard block
 block discarded – undo
484 484
 	
485 485
 	
486 486
 	/**
487
-	* Update ident spotter data
488
-	*
489
-	* @param String $flightaware_id the ID from flightaware
490
-	* @param String $ident the flight ident
491
-	* @return String success or false
492
-	*
493
-	*/	
487
+	 * Update ident spotter data
488
+	 *
489
+	 * @param String $flightaware_id the ID from flightaware
490
+	 * @param String $ident the flight ident
491
+	 * @return String success or false
492
+	 *
493
+	 */	
494 494
 	public function updateIdentTrackerData($famtrackid = '', $ident = '',$fromsource = NULL)
495 495
 	{
496 496
 
497 497
 		$query = 'UPDATE tracker_output SET ident = :ident WHERE famtrackid = :famtrackid';
498
-                $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident);
498
+				$query_values = array(':famtrackid' => $famtrackid,':ident' => $ident);
499 499
 
500 500
 		try {
501 501
 			$sth = $this->db->prepare($query);
@@ -508,18 +508,18 @@  discard block
 block discarded – undo
508 508
 
509 509
 	}
510 510
 	/**
511
-	* Update latest spotter data
512
-	*
513
-	* @param String $flightaware_id the ID from flightaware
514
-	* @param String $ident the flight ident
515
-	* @param String $arrival_airport_icao the arrival airport
516
-	* @return String success or false
517
-	*
518
-	*/	
511
+	 * Update latest spotter data
512
+	 *
513
+	 * @param String $flightaware_id the ID from flightaware
514
+	 * @param String $ident the flight ident
515
+	 * @param String $arrival_airport_icao the arrival airport
516
+	 * @return String success or false
517
+	 *
518
+	 */	
519 519
 	public function updateLatestTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $groundspeed = NULL, $date = '')
520 520
 	{
521 521
 		$query = 'UPDATE tracker_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_seen = :last_seen, last_ground_speed = :last_ground_speed WHERE famtrackid = :famtrackid';
522
-                $query_values = array(':famtrackid' => $famtrackid,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident);
522
+				$query_values = array(':famtrackid' => $famtrackid,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident);
523 523
 
524 524
 		try {
525 525
 			$sth = $this->db->prepare($query);
@@ -533,32 +533,32 @@  discard block
 block discarded – undo
533 533
 	}
534 534
 
535 535
 	/**
536
-	* Adds a new spotter data
537
-	*
538
-	* @param String $flightaware_id the ID from flightaware
539
-	* @param String $ident the flight ident
540
-	* @param String $aircraft_icao the aircraft type
541
-	* @param String $departure_airport_icao the departure airport
542
-	* @param String $arrival_airport_icao the arrival airport
543
-	* @param String $latitude latitude of flight
544
-	* @param String $longitude latitude of flight
545
-	* @param String $waypoints waypoints of flight
546
-	* @param String $altitude altitude of flight
547
-	* @param String $heading heading of flight
548
-	* @param String $groundspeed speed of flight
549
-	* @param String $date date of flight
550
-	* @param String $departure_airport_time departure time of flight
551
-	* @param String $arrival_airport_time arrival time of flight
552
-	* @param String $squawk squawk code of flight
553
-	* @param String $route_stop route stop of flight
554
-	* @param String $highlight highlight or not
555
-	* @param String $ModeS ModesS code of flight
556
-	* @param String $registration registration code of flight
557
-	* @param String $pilot_id pilot id of flight (for virtual airlines)
558
-	* @param String $pilot_name pilot name of flight (for virtual airlines)
559
-	* @param String $verticalrate vertival rate of flight
560
-	* @return String success or false
561
-	*/
536
+	 * Adds a new spotter data
537
+	 *
538
+	 * @param String $flightaware_id the ID from flightaware
539
+	 * @param String $ident the flight ident
540
+	 * @param String $aircraft_icao the aircraft type
541
+	 * @param String $departure_airport_icao the departure airport
542
+	 * @param String $arrival_airport_icao the arrival airport
543
+	 * @param String $latitude latitude of flight
544
+	 * @param String $longitude latitude of flight
545
+	 * @param String $waypoints waypoints of flight
546
+	 * @param String $altitude altitude of flight
547
+	 * @param String $heading heading of flight
548
+	 * @param String $groundspeed speed of flight
549
+	 * @param String $date date of flight
550
+	 * @param String $departure_airport_time departure time of flight
551
+	 * @param String $arrival_airport_time arrival time of flight
552
+	 * @param String $squawk squawk code of flight
553
+	 * @param String $route_stop route stop of flight
554
+	 * @param String $highlight highlight or not
555
+	 * @param String $ModeS ModesS code of flight
556
+	 * @param String $registration registration code of flight
557
+	 * @param String $pilot_id pilot id of flight (for virtual airlines)
558
+	 * @param String $pilot_name pilot name of flight (for virtual airlines)
559
+	 * @param String $verticalrate vertival rate of flight
560
+	 * @return String success or false
561
+	 */
562 562
 	public function addTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $comment = '', $type = '',$format_source = '', $source_name = '')
563 563
 	{
564 564
 		global $globalURL;
@@ -643,16 +643,16 @@  discard block
 block discarded – undo
643 643
 		$comment = filter_var($comment,FILTER_SANITIZE_STRING);
644 644
 		$type = filter_var($type,FILTER_SANITIZE_STRING);
645 645
 	
646
-                if ($latitude == '' && $longitude == '') {
647
-            		$latitude = 0;
648
-            		$longitude = 0;
649
-            	}
650
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
651
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
652
-                $query  = "INSERT INTO tracker_output (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, comment, type) 
646
+				if ($latitude == '' && $longitude == '') {
647
+					$latitude = 0;
648
+					$longitude = 0;
649
+				}
650
+				if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
651
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
652
+				$query  = "INSERT INTO tracker_output (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, comment, type) 
653 653
                 VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:speed,:date,:format_source, :source_name,:comment,:type)";
654 654
 
655
-                $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':altitude' => $altitude,':heading' => $heading,':speed' => $groundspeed,':date' => $date,':format_source' => $format_source, ':source_name' => $source_name,':comment' => $comment,':type' => $type);
655
+				$query_values = array(':famtrackid' => $famtrackid,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':altitude' => $altitude,':heading' => $heading,':speed' => $groundspeed,':date' => $date,':format_source' => $format_source, ':source_name' => $source_name,':comment' => $comment,':type' => $type);
656 656
 
657 657
 		try {
658 658
 		        
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
 			$sth->execute($query_values);
661 661
 			$this->db = null;
662 662
 		} catch (PDOException $e) {
663
-		    return "error : ".$e->getMessage();
663
+			return "error : ".$e->getMessage();
664 664
 		}
665 665
 		
666 666
 		return "success";
@@ -669,11 +669,11 @@  discard block
 block discarded – undo
669 669
 	
670 670
   
671 671
 	/**
672
-	* Gets the aircraft ident within the last hour
673
-	*
674
-	* @return String the ident
675
-	*
676
-	*/
672
+	 * Gets the aircraft ident within the last hour
673
+	 *
674
+	 * @return String the ident
675
+	 *
676
+	 */
677 677
 	public function getIdentFromLastHour($ident)
678 678
 	{
679 679
 		global $globalDBdriver, $globalTimezone;
@@ -689,11 +689,11 @@  discard block
 block discarded – undo
689 689
 								AND tracker_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
690 690
 								AND tracker_output.date < now() AT TIME ZONE 'UTC'";
691 691
 			$query_data = array(':ident' => $ident);
692
-    		}
692
+			}
693 693
 		
694 694
 		$sth = $this->db->prepare($query);
695 695
 		$sth->execute($query_data);
696
-    		$ident_result='';
696
+			$ident_result='';
697 697
 		while($row = $sth->fetch(PDO::FETCH_ASSOC))
698 698
 		{
699 699
 			$ident_result = $row['ident'];
@@ -704,11 +704,11 @@  discard block
 block discarded – undo
704 704
 	
705 705
 	
706 706
 	/**
707
-	* Gets the aircraft data from the last 20 seconds
708
-	*
709
-	* @return Array the spotter data
710
-	*
711
-	*/
707
+	 * Gets the aircraft data from the last 20 seconds
708
+	 *
709
+	 * @return Array the spotter data
710
+	 *
711
+	 */
712 712
 	public function getRealTimeData($q = '')
713 713
 	{
714 714
 		global $globalDBdriver;
@@ -746,11 +746,11 @@  discard block
 block discarded – undo
746 746
 	
747 747
 
748 748
 	/**
749
-	* Gets all number of flight over countries
750
-	*
751
-	* @return Array the airline country list
752
-	*
753
-	*/
749
+	 * Gets all number of flight over countries
750
+	 *
751
+	 * @return Array the airline country list
752
+	 *
753
+	 */
754 754
 
755 755
 	public function countAllTrackerOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
756 756
 	{
@@ -821,11 +821,11 @@  discard block
 block discarded – undo
821 821
 	}
822 822
 	
823 823
 	/**
824
-	* Gets all callsigns that have flown over
825
-	*
826
-	* @return Array the callsign list
827
-	*
828
-	*/
824
+	 * Gets all callsigns that have flown over
825
+	 *
826
+	 * @return Array the callsign list
827
+	 *
828
+	 */
829 829
 	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
830 830
 	{
831 831
 		global $globalDBdriver;
@@ -892,11 +892,11 @@  discard block
 block discarded – undo
892 892
 
893 893
 
894 894
 	/**
895
-	* Counts all dates
896
-	*
897
-	* @return Array the date list
898
-	*
899
-	*/
895
+	 * Counts all dates
896
+	 *
897
+	 * @return Array the date list
898
+	 *
899
+	 */
900 900
 	public function countAllDates($filters = array())
901 901
 	{
902 902
 		global $globalTimezone, $globalDBdriver;
@@ -942,11 +942,11 @@  discard block
 block discarded – undo
942 942
 	
943 943
 	
944 944
 	/**
945
-	* Counts all dates during the last 7 days
946
-	*
947
-	* @return Array the date list
948
-	*
949
-	*/
945
+	 * Counts all dates during the last 7 days
946
+	 *
947
+	 * @return Array the date list
948
+	 *
949
+	 */
950 950
 	public function countAllDatesLast7Days($filters = array())
951 951
 	{
952 952
 		global $globalTimezone, $globalDBdriver;
@@ -968,7 +968,7 @@  discard block
 block discarded – undo
968 968
 			$query .= " GROUP BY date_name 
969 969
 								ORDER BY date_name ASC";
970 970
 			$query_data = array(':offset' => $offset);
971
-    		}
971
+			}
972 972
 		
973 973
 		$sth = $this->db->prepare($query);
974 974
 		$sth->execute($query_data);
@@ -988,11 +988,11 @@  discard block
 block discarded – undo
988 988
 	}
989 989
 
990 990
 	/**
991
-	* Counts all dates during the last month
992
-	*
993
-	* @return Array the date list
994
-	*
995
-	*/
991
+	 * Counts all dates during the last month
992
+	 *
993
+	 * @return Array the date list
994
+	 *
995
+	 */
996 996
 	public function countAllDatesLastMonth($filters = array())
997 997
 	{
998 998
 		global $globalTimezone, $globalDBdriver;
@@ -1014,7 +1014,7 @@  discard block
 block discarded – undo
1014 1014
 			$query .= " GROUP BY date_name 
1015 1015
 								ORDER BY date_name ASC";
1016 1016
 			$query_data = array(':offset' => $offset);
1017
-    		}
1017
+			}
1018 1018
 		
1019 1019
 		$sth = $this->db->prepare($query);
1020 1020
 		$sth->execute($query_data);
@@ -1036,11 +1036,11 @@  discard block
 block discarded – undo
1036 1036
 
1037 1037
 
1038 1038
 	/**
1039
-	* Counts all month
1040
-	*
1041
-	* @return Array the month list
1042
-	*
1043
-	*/
1039
+	 * Counts all month
1040
+	 *
1041
+	 * @return Array the month list
1042
+	 *
1043
+	 */
1044 1044
 	public function countAllMonths($filters = array())
1045 1045
 	{
1046 1046
 		global $globalTimezone, $globalDBdriver;
@@ -1085,11 +1085,11 @@  discard block
 block discarded – undo
1085 1085
 	
1086 1086
 
1087 1087
 	/**
1088
-	* Counts all dates during the last year
1089
-	*
1090
-	* @return Array the date list
1091
-	*
1092
-	*/
1088
+	 * Counts all dates during the last year
1089
+	 *
1090
+	 * @return Array the date list
1091
+	 *
1092
+	 */
1093 1093
 	public function countAllMonthsLastYear($filters)
1094 1094
 	{
1095 1095
 		global $globalTimezone, $globalDBdriver;
@@ -1111,7 +1111,7 @@  discard block
 block discarded – undo
1111 1111
 			$query .= " GROUP BY year_name, month_name
1112 1112
 								ORDER BY year_name, month_name ASC";
1113 1113
 			$query_data = array(':offset' => $offset);
1114
-    		}
1114
+			}
1115 1115
 		
1116 1116
 		$sth = $this->db->prepare($query);
1117 1117
 		$sth->execute($query_data);
@@ -1134,11 +1134,11 @@  discard block
 block discarded – undo
1134 1134
 	
1135 1135
 	
1136 1136
 	/**
1137
-	* Counts all hours
1138
-	*
1139
-	* @return Array the hour list
1140
-	*
1141
-	*/
1137
+	 * Counts all hours
1138
+	 *
1139
+	 * @return Array the hour list
1140
+	 *
1141
+	 */
1142 1142
 	public function countAllHours($orderby,$filters = array())
1143 1143
 	{
1144 1144
 		global $globalTimezone, $globalDBdriver;
@@ -1201,11 +1201,11 @@  discard block
 block discarded – undo
1201 1201
 	
1202 1202
 	
1203 1203
 	/**
1204
-	* Counts all hours by date
1205
-	*
1206
-	* @return Array the hour list
1207
-	*
1208
-	*/
1204
+	 * Counts all hours by date
1205
+	 *
1206
+	 * @return Array the hour list
1207
+	 *
1208
+	 */
1209 1209
 	public function countAllHoursByDate($date, $filters = array())
1210 1210
 	{
1211 1211
 		global $globalTimezone, $globalDBdriver;
@@ -1249,11 +1249,11 @@  discard block
 block discarded – undo
1249 1249
 	
1250 1250
 	
1251 1251
 	/**
1252
-	* Counts all hours by a ident/callsign
1253
-	*
1254
-	* @return Array the hour list
1255
-	*
1256
-	*/
1252
+	 * Counts all hours by a ident/callsign
1253
+	 *
1254
+	 * @return Array the hour list
1255
+	 *
1256
+	 */
1257 1257
 	public function countAllHoursByIdent($ident, $filters = array())
1258 1258
 	{
1259 1259
 		global $globalTimezone, $globalDBdriver;
@@ -1298,11 +1298,11 @@  discard block
 block discarded – undo
1298 1298
 	
1299 1299
 	
1300 1300
 	/**
1301
-	* Counts all flights that have flown over
1302
-	*
1303
-	* @return Integer the number of flights
1304
-	*
1305
-	*/
1301
+	 * Counts all flights that have flown over
1302
+	 *
1303
+	 * @return Integer the number of flights
1304
+	 *
1305
+	 */
1306 1306
 	public function countOverallTracker($filters = array(),$year = '',$month = '')
1307 1307
 	{
1308 1308
 		global $globalDBdriver;
@@ -1338,11 +1338,11 @@  discard block
 block discarded – undo
1338 1338
 	
1339 1339
   
1340 1340
 	/**
1341
-	* Counts all hours of today
1342
-	*
1343
-	* @return Array the hour list
1344
-	*
1345
-	*/
1341
+	 * Counts all hours of today
1342
+	 *
1343
+	 * @return Array the hour list
1344
+	 *
1345
+	 */
1346 1346
 	public function countAllHoursFromToday($filters = array())
1347 1347
 	{
1348 1348
 		global $globalTimezone, $globalDBdriver;
@@ -1382,12 +1382,12 @@  discard block
 block discarded – undo
1382 1382
 	}
1383 1383
     
1384 1384
     
1385
-     /**
1386
-	* Gets the Barrie Spotter ID based on the FlightAware ID
1387
-	*
1388
-	* @return Integer the Barrie Spotter ID
1385
+	 /**
1386
+	  * Gets the Barrie Spotter ID based on the FlightAware ID
1387
+	  *
1388
+	  * @return Integer the Barrie Spotter ID
1389 1389
 q	*
1390
-	*/
1390
+	  */
1391 1391
 	public function getTrackerIDBasedOnFamTrackID($famtrackid)
1392 1392
 	{
1393 1393
 		$famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING);
@@ -1408,13 +1408,13 @@  discard block
 block discarded – undo
1408 1408
   
1409 1409
  
1410 1410
 	/**
1411
-	* Parses a date string
1412
-	*
1413
-	* @param String $dateString the date string
1414
-	* @param String $timezone the timezone of a user
1415
-	* @return Array the time information
1416
-	*
1417
-	*/
1411
+	 * Parses a date string
1412
+	 *
1413
+	 * @param String $dateString the date string
1414
+	 * @param String $timezone the timezone of a user
1415
+	 * @return Array the time information
1416
+	 *
1417
+	 */
1418 1418
 	public function parseDateString($dateString, $timezone = '')
1419 1419
 	{
1420 1420
 		$time_array = array();
@@ -1447,12 +1447,12 @@  discard block
 block discarded – undo
1447 1447
 	}
1448 1448
 	
1449 1449
 	/**
1450
-	* Parses the direction degrees to working
1451
-	*
1452
-	* @param Float $direction the direction in degrees
1453
-	* @return Array the direction information
1454
-	*
1455
-	*/
1450
+	 * Parses the direction degrees to working
1451
+	 *
1452
+	 * @param Float $direction the direction in degrees
1453
+	 * @return Array the direction information
1454
+	 *
1455
+	 */
1456 1456
 	public function parseDirection($direction = 0)
1457 1457
 	{
1458 1458
 		if ($direction == '') $direction = 0;
@@ -1531,12 +1531,12 @@  discard block
 block discarded – undo
1531 1531
 	
1532 1532
 	
1533 1533
 	/**
1534
-	* Gets Country from latitude/longitude
1535
-	*
1536
-	* @param Float $latitude latitute of the flight
1537
-	* @param Float $longitude longitute of the flight
1538
-	* @return String the countrie
1539
-	*/
1534
+	 * Gets Country from latitude/longitude
1535
+	 *
1536
+	 * @param Float $latitude latitute of the flight
1537
+	 * @param Float $longitude longitute of the flight
1538
+	 * @return String the countrie
1539
+	 */
1540 1540
 	public function getCountryFromLatitudeLongitude($latitude,$longitude)
1541 1541
 	{
1542 1542
 		global $globalDBdriver, $globalDebug;
@@ -1573,11 +1573,11 @@  discard block
 block discarded – undo
1573 1573
 	}
1574 1574
 
1575 1575
 	/**
1576
-	* Gets Country from iso2
1577
-	*
1578
-	* @param String $iso2 ISO2 country code
1579
-	* @return String the countrie
1580
-	*/
1576
+	 * Gets Country from iso2
1577
+	 *
1578
+	 * @param String $iso2 ISO2 country code
1579
+	 * @return String the countrie
1580
+	 */
1581 1581
 	public function getCountryFromISO2($iso2)
1582 1582
 	{
1583 1583
 		global $globalDBdriver, $globalDebug;
@@ -1606,12 +1606,12 @@  discard block
 block discarded – undo
1606 1606
 
1607 1607
 	
1608 1608
 	/**
1609
-	* Gets the short url from bit.ly
1610
-	*
1611
-	* @param String $url the full url
1612
-	* @return String the bit.ly url
1613
-	*
1614
-	*/
1609
+	 * Gets the short url from bit.ly
1610
+	 *
1611
+	 * @param String $url the full url
1612
+	 * @return String the bit.ly url
1613
+	 *
1614
+	 */
1615 1615
 	public function getBitlyURL($url)
1616 1616
 	{
1617 1617
 		global $globalBitlyAccessToken;
Please login to merge, or discard this patch.
require/class.TrackerImport.php 1 patch
Indentation   +140 added lines, -140 removed lines patch added patch discarded remove patch
@@ -7,16 +7,16 @@  discard block
 block discarded – undo
7 7
 require_once(dirname(__FILE__).'/class.Source.php');
8 8
 
9 9
 class TrackerImport {
10
-    private $all_tracked = array();
11
-    private $last_delete_hourly = 0;
12
-    private $last_delete = 0;
13
-    private $stats = array();
14
-    private $tmd = 0;
15
-    private $source_location = array();
16
-    public $db = null;
17
-    public $nb = 0;
10
+	private $all_tracked = array();
11
+	private $last_delete_hourly = 0;
12
+	private $last_delete = 0;
13
+	private $stats = array();
14
+	private $tmd = 0;
15
+	private $source_location = array();
16
+	public $db = null;
17
+	public $nb = 0;
18 18
 
19
-    public function __construct($dbc = null) {
19
+	public function __construct($dbc = null) {
20 20
 	global $globalBeta;
21 21
 	$Connection = new Connection($dbc);
22 22
 	$this->db = $Connection->db();
@@ -38,50 +38,50 @@  discard block
 block discarded – undo
38 38
 	    }
39 39
 	}
40 40
 	*/
41
-    }
41
+	}
42 42
 
43
-    public function checkAll() {
43
+	public function checkAll() {
44 44
 	global $globalDebug;
45 45
 	if ($globalDebug) echo "Update last seen tracked data...\n";
46 46
 	foreach ($this->all_tracked as $key => $flight) {
47
-	    if (isset($this->all_tracked[$key]['id'])) {
47
+		if (isset($this->all_tracked[$key]['id'])) {
48 48
 		//echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].'  '.$this->all_tracked[$key]['longitude']."\n";
49
-    		$Tracker = new Tracker($this->db);
50
-        	$Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']);
51
-            }
49
+			$Tracker = new Tracker($this->db);
50
+			$Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']);
51
+			}
52
+	}
52 53
 	}
53
-    }
54 54
 
55
-    public function del() {
55
+	public function del() {
56 56
 	global $globalDebug;
57 57
 	// Delete old infos
58 58
 	if ($globalDebug) echo 'Delete old values and update latest data...'."\n";
59 59
 	foreach ($this->all_tracked as $key => $flight) {
60
-    	    if (isset($flight['lastupdate'])) {
61
-        	if ($flight['lastupdate'] < (time()-3000)) {
62
-            	    if (isset($this->all_tracked[$key]['id'])) {
63
-            		if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n";
60
+			if (isset($flight['lastupdate'])) {
61
+			if ($flight['lastupdate'] < (time()-3000)) {
62
+					if (isset($this->all_tracked[$key]['id'])) {
63
+					if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n";
64 64
 			/*
65 65
 			$TrackerLive = new TrackerLive();
66 66
             		$TrackerLive->deleteLiveTrackerDataById($this->all_tracked[$key]['id']);
67 67
 			$TrackerLive->db = null;
68 68
 			*/
69
-            		//$real_arrival = $this->arrival($key);
70
-            		$Tracker = new Tracker($this->db);
71
-            		if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') {
69
+					//$real_arrival = $this->arrival($key);
70
+					$Tracker = new Tracker($this->db);
71
+					if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') {
72 72
 				$result = $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed']);
73 73
 				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
74 74
 			}
75 75
 			// Put in archive
76 76
 //			$Tracker->db = null;
77
-            	    }
78
-            	    unset($this->all_tracked[$key]);
79
-    	        }
80
-	    }
81
-        }
82
-    }
77
+					}
78
+					unset($this->all_tracked[$key]);
79
+				}
80
+		}
81
+		}
82
+	}
83 83
 
84
-    public function add($line) {
84
+	public function add($line) {
85 85
 	global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked;
86 86
 	if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02';
87 87
 	date_default_timezone_set('UTC');
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
 	
91 91
 	// SBS format is CSV format
92 92
 	if(is_array($line) && isset($line['ident'])) {
93
-	    //print_r($line);
94
-  	    if (isset($line['ident'])) {
93
+		//print_r($line);
94
+  		if (isset($line['ident'])) {
95 95
 
96 96
 		/*
97 97
 		// Increment message number
@@ -107,29 +107,29 @@  discard block
 block discarded – undo
107 107
 		*/
108 108
 		
109 109
 		$Common = new Common();
110
-	        if (!isset($line['id'])) $id = trim($line['ident']);
111
-	        else $id = trim($line['id']);
110
+			if (!isset($line['id'])) $id = trim($line['ident']);
111
+			else $id = trim($line['id']);
112 112
 		
113 113
 		if (!isset($this->all_tracked[$id])) {
114
-		    $this->all_tracked[$id] = array();
115
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedTracker' => 0));
116
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','noarchive' => false,'putinarchive' => true,'over_country' => ''));
117
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time()));
118
-		    if (!isset($line['id'])) {
114
+			$this->all_tracked[$id] = array();
115
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedTracker' => 0));
116
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','noarchive' => false,'putinarchive' => true,'over_country' => ''));
117
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time()));
118
+			if (!isset($line['id'])) {
119 119
 			if (!isset($globalDaemon)) $globalDaemon = TRUE;
120 120
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi')));
121
-		     } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id']));
122
-		    if ($globalAllTracked !== FALSE) $dataFound = true;
121
+			 } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id']));
122
+			if ($globalAllTracked !== FALSE) $dataFound = true;
123 123
 		}
124 124
 		
125 125
 		if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) {
126
-		    if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_tracked[$id]['datetime'])) {
126
+			if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_tracked[$id]['datetime'])) {
127 127
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime']));
128
-		    } else {
128
+			} else {
129 129
 				if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n";
130 130
 				elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n";
131 131
 				return '';
132
-		    }
132
+			}
133 133
 		} elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) {
134 134
 			if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!";
135 135
 			return '';
@@ -146,38 +146,38 @@  discard block
 block discarded – undo
146 146
 		
147 147
 		//if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9-]+$/', $line['ident'])) {
148 148
 		if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident']))) {
149
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident'])));
150
-		    if ($this->all_tracked[$id]['addedTracker'] == 1) {
149
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident'])));
150
+			if ($this->all_tracked[$id]['addedTracker'] == 1) {
151 151
 			$timeelapsed = microtime(true);
152
-            		$Tracker = new Tracker($this->db);
153
-            		$fromsource = NULL;
154
-            		$result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource);
152
+					$Tracker = new Tracker($this->db);
153
+					$fromsource = NULL;
154
+					$result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource);
155 155
 			if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
156 156
 			$Tracker->db = null;
157 157
 			if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
158
-		    }
159
-		    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident']));
158
+			}
159
+			if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident']));
160 160
 		}
161 161
 
162 162
 		if (isset($line['speed']) && $line['speed'] != '') {
163
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed'])));
164
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true));
163
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed'])));
164
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true));
165 165
 		} else if (!isset($this->all_tracked[$id]['speed_fromsrc']) && isset($this->all_tracked[$id]['time_last_coord']) && $this->all_tracked[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) {
166
-		    $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m');
167
-		    if ($distance > 100 && $distance < 10000) {
166
+			$distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m');
167
+			if ($distance > 100 && $distance < 10000) {
168 168
 			$speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']);
169 169
 			$speed = $speed*3.6;
170 170
 			if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed)));
171 171
   			if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['ident']." : ".$speed." - distance : ".$distance."\n";
172
-		    }
172
+			}
173 173
 		}
174 174
 
175
-	        if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) {
176
-	    	    if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']);
177
-	    	    else unset($timediff);
178
-	    	    if ($this->tmd > 5 || !isset($timediff) || $timediff > 100 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) {
175
+			if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) {
176
+				if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']);
177
+				else unset($timediff);
178
+				if ($this->tmd > 5 || !isset($timediff) || $timediff > 100 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) {
179 179
 			if (isset($this->all_tracked[$id]['archive_latitude']) && isset($this->all_tracked[$id]['archive_longitude']) && isset($this->all_tracked[$id]['livedb_latitude']) && isset($this->all_tracked[$id]['livedb_longitude'])) {
180
-			    if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) {
180
+				if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) {
181 181
 				$this->all_tracked[$id]['archive_latitude'] = $line['latitude'];
182 182
 				$this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
183 183
 				$this->all_tracked[$id]['putinarchive'] = true;
@@ -191,120 +191,120 @@  discard block
 block discarded – undo
191 191
 				if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
192 192
 				$this->tmd = 0;
193 193
 				if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n";
194
-			    }
194
+				}
195 195
 			}
196 196
 
197 197
 			if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) {
198 198
 				if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude'];
199 199
 				if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') {
200
-				    $this->all_tracked[$id]['livedb_latitude'] = $line['latitude'];
201
-				    $dataFound = true;
202
-				    $this->all_tracked[$id]['time_last_coord'] = time();
200
+					$this->all_tracked[$id]['livedb_latitude'] = $line['latitude'];
201
+					$dataFound = true;
202
+					$this->all_tracked[$id]['time_last_coord'] = time();
203 203
 				}
204 204
 				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude']));
205 205
 			}
206 206
 			if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) {
207
-			    if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
207
+				if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
208 208
 				if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
209 209
 				if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') {
210
-				    $this->all_tracked[$id]['livedb_longitude'] = $line['longitude'];
211
-				    $dataFound = true;
212
-				    $this->all_tracked[$id]['time_last_coord'] = time();
210
+					$this->all_tracked[$id]['livedb_longitude'] = $line['longitude'];
211
+					$dataFound = true;
212
+					$this->all_tracked[$id]['time_last_coord'] = time();
213 213
 				}
214 214
 				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('longitude' => $line['longitude']));
215 215
 			}
216 216
 
217
-		    } else if ($globalDebug && $timediff > 20) {
217
+			} else if ($globalDebug && $timediff > 20) {
218 218
 			$this->tmd = $this->tmd + 1;
219 219
 			echo '!!! Too much distance in short time... for '.$this->all_tracked[$id]['ident']."\n";
220 220
 			echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')."m -";
221 221
 			echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')/$timediff)*3.6)." km/h - ";
222 222
 			echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_tracked[$id]['latitude'].' - prev long : '.$this->all_tracked[$id]['longitude']." \n";
223
-		    }
223
+			}
224 224
 		}
225 225
 		if (isset($line['last_update']) && $line['last_update'] != '') {
226
-		    if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true;
227
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update']));
226
+			if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true;
227
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update']));
228 228
 		}
229 229
 		if (isset($line['format_source']) && $line['format_source'] != '') {
230
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source']));
230
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source']));
231 231
 		}
232 232
 		if (isset($line['source_name']) && $line['source_name'] != '') {
233
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name']));
233
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name']));
234 234
 		}
235 235
 		if (isset($line['comment']) && $line['comment'] != '') {
236
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('comment' => $line['comment']));
237
-		    //$dataFound = true;
236
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('comment' => $line['comment']));
237
+			//$dataFound = true;
238 238
 		}
239 239
 		if (isset($line['type']) && $line['type'] != '') {
240
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type']));
241
-		    //$dataFound = true;
240
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type']));
241
+			//$dataFound = true;
242 242
 		}
243 243
 
244 244
 		if (isset($line['altitude']) && $line['altitude'] != '') {
245
-		    //if (!isset($this->all_tracked[$id]['altitude']) || $this->all_tracked[$id]['altitude'] == '' || ($this->all_tracked[$id]['altitude'] > 0 && $line['altitude'] != 0)) {
245
+			//if (!isset($this->all_tracked[$id]['altitude']) || $this->all_tracked[$id]['altitude'] == '' || ($this->all_tracked[$id]['altitude'] > 0 && $line['altitude'] != 0)) {
246 246
 			if (is_int($this->all_tracked[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_tracked[$id]['altitude']) > 3) $this->all_tracked[$id]['putinarchive'] = true;
247 247
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude' => round($line['altitude']/100)));
248 248
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude_real' => $line['altitude']));
249 249
 			//$dataFound = true;
250
-		    //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n";
250
+			//} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n";
251 251
   		}
252 252
 
253 253
 		if (isset($line['noarchive']) && $line['noarchive'] === true) {
254
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true));
254
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true));
255 255
 		}
256 256
 		
257 257
 		if (isset($line['heading']) && $line['heading'] != '') {
258
-		    if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true;
259
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading'])));
260
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true));
261
-		    //$dataFound = true;
258
+			if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true;
259
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading'])));
260
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true));
261
+			//$dataFound = true;
262 262
   		} elseif (!isset($this->all_tracked[$id]['heading_fromsrc']) && isset($this->all_tracked[$id]['archive_latitude']) && $this->all_tracked[$id]['archive_latitude'] != $this->all_tracked[$id]['latitude'] && isset($this->all_tracked[$id]['archive_longitude']) && $this->all_tracked[$id]['archive_longitude'] != $this->all_tracked[$id]['longitude']) {
263
-  		    $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']);
264
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading)));
265
-		    if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true;
266
-  		    if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n";
263
+  			$heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']);
264
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading)));
265
+			if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true;
266
+  			if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n";
267 267
   		}
268 268
 		//if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false;
269 269
 
270 270
 		if ($dataFound === true && isset($this->all_tracked[$id]['ident'])) {
271
-		    $this->all_tracked[$id]['lastupdate'] = time();
272
-		    if ($this->all_tracked[$id]['addedTracker'] == 0) {
273
-		        if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == ''  || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
274
-			    if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) {
271
+			$this->all_tracked[$id]['lastupdate'] = time();
272
+			if ($this->all_tracked[$id]['addedTracker'] == 0) {
273
+				if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == ''  || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
274
+				if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) {
275 275
 				if ($globalDebug) echo "Check if aircraft is already in DB...";
276 276
 				$timeelapsed = microtime(true);
277 277
 				$TrackerLive = new TrackerLive($this->db);
278 278
 				if (isset($line['id'])) {
279
-				    $recent_ident = $TrackerLive->checkIdRecent($line['id']);
280
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
279
+					$recent_ident = $TrackerLive->checkIdRecent($line['id']);
280
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
281 281
 				} elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') {
282
-				    $recent_ident = $TrackerLive->checkIdentRecent($this->all_tracked[$id]['ident']);
283
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
282
+					$recent_ident = $TrackerLive->checkIdentRecent($this->all_tracked[$id]['ident']);
283
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
284 284
 				} else $recent_ident = '';
285 285
 				$TrackerLive->db=null;
286 286
 
287 287
 				if ($globalDebug && $recent_ident == '') echo " Not in DB.\n";
288 288
 				elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n";
289
-			    } else {
289
+				} else {
290 290
 				$recent_ident = '';
291 291
 				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0));
292
-			    }
293
-			    //if there was no aircraft with the same callsign within the last hour and go post it into the archive
294
-			    if($recent_ident == "")
295
-			    {
292
+				}
293
+				//if there was no aircraft with the same callsign within the last hour and go post it into the archive
294
+				if($recent_ident == "")
295
+				{
296 296
 				if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : ";
297 297
 				//adds the spotter data for the archive
298
-				    $highlight = '';
299
-				    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi')));
300
-				    $timeelapsed = microtime(true);
301
-				    $Tracker = new Tracker($this->db);
302
-				    $result = $Tracker->addTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']);
303
-				    $Tracker->db = null;
304
-				    if ($globalDebug && isset($result)) echo $result."\n";
305
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
298
+					$highlight = '';
299
+					if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi')));
300
+					$timeelapsed = microtime(true);
301
+					$Tracker = new Tracker($this->db);
302
+					$result = $Tracker->addTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']);
303
+					$Tracker->db = null;
304
+					if ($globalDebug && isset($result)) echo $result."\n";
305
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
306 306
 				    
307
-				    /*
307
+					/*
308 308
 				    // Add source stat in DB
309 309
 				    $Stats = new Stats($this->db);
310 310
 				    if (!empty($this->stats)) {
@@ -331,20 +331,20 @@  discard block
 block discarded – undo
331 331
 				    }
332 332
 				    $Stats->db = null;
333 333
 				    */
334
-				    $this->del();
334
+					$this->del();
335 335
 				//$ignoreImport = false;
336 336
 				$this->all_tracked[$id]['addedTracker'] = 1;
337 337
 				//print_r($this->all_tracked[$id]);
338 338
 				if ($this->last_delete == 0 || time() - $this->last_delete > 1800) {
339
-				    if ($globalDebug) echo "---- Deleting Live Tracker data older than 9 hours...";
340
-				    //TrackerLive->deleteLiveTrackerDataNotUpdated();
341
-				    $TrackerLive = new TrackerLive($this->db);
342
-				    $TrackerLive->deleteLiveTrackerData();
343
-				    $TrackerLive->db=null;
344
-				    if ($globalDebug) echo " Done\n";
345
-				    $this->last_delete = time();
339
+					if ($globalDebug) echo "---- Deleting Live Tracker data older than 9 hours...";
340
+					//TrackerLive->deleteLiveTrackerDataNotUpdated();
341
+					$TrackerLive = new TrackerLive($this->db);
342
+					$TrackerLive->deleteLiveTrackerData();
343
+					$TrackerLive->db=null;
344
+					if ($globalDebug) echo " Done\n";
345
+					$this->last_delete = time();
346 346
 				}
347
-			    } else {
347
+				} else {
348 348
 				$this->all_tracked[$id]['id'] = $recent_ident;
349 349
 				$this->all_tracked[$id]['addedTracker'] = 1;
350 350
 				if (isset($globalDaemon) && !$globalDaemon) {
@@ -353,16 +353,16 @@  discard block
 block discarded – undo
353 353
 					$Tracker->db = null;
354 354
 				}
355 355
 				
356
-			    }
356
+				}
357
+			}
357 358
 			}
358
-		    }
359
-		    //adds the spotter LIVE data
360
-		    if ($globalDebug) {
359
+			//adds the spotter LIVE data
360
+			if ($globalDebug) {
361 361
 			echo 'DATA : ident : '.$this->all_tracked[$id]['ident'].' - type : '.$this->all_tracked[$id]['type'].' - Latitude : '.$this->all_tracked[$id]['latitude'].' - Longitude : '.$this->all_tracked[$id]['longitude'].' - Altitude : '.$this->all_tracked[$id]['altitude'].' - Heading : '.$this->all_tracked[$id]['heading'].' - Speed : '.$this->all_tracked[$id]['speed']."\n";
362
-		    }
363
-		    $ignoreImport = false;
362
+			}
363
+			$ignoreImport = false;
364 364
 
365
-		    if (!$ignoreImport) {
365
+			if (!$ignoreImport) {
366 366
 			if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
367 367
 				if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : ";
368 368
 				$timeelapsed = microtime(true);
@@ -434,22 +434,22 @@  discard block
 block discarded – undo
434 434
 			
435 435
 			
436 436
 			if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) {
437
-			    if ($globalDebug) echo "---- Deleting Live Tracker data Not updated since 2 hour...";
438
-			    $TrackerLive = new TrackerLive($this->db);
439
-			    $TrackerLive->deleteLiveTrackerDataNotUpdated();
440
-			    $TrackerLive->db = null;
441
-			    //TrackerLive->deleteLiveTrackerData();
442
-			    if ($globalDebug) echo " Done\n";
443
-			    $this->last_delete_hourly = time();
437
+				if ($globalDebug) echo "---- Deleting Live Tracker data Not updated since 2 hour...";
438
+				$TrackerLive = new TrackerLive($this->db);
439
+				$TrackerLive->deleteLiveTrackerDataNotUpdated();
440
+				$TrackerLive->db = null;
441
+				//TrackerLive->deleteLiveTrackerData();
442
+				if ($globalDebug) echo " Done\n";
443
+				$this->last_delete_hourly = time();
444 444
 			}
445 445
 			
446
-		    }
447
-		    //$ignoreImport = false;
446
+			}
447
+			//$ignoreImport = false;
448 448
 		}
449 449
 		//if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN);
450 450
 		if ($send) return $this->all_tracked[$id];
451
-	    }
451
+		}
452
+	}
452 453
 	}
453
-    }
454 454
 }
455 455
 ?>
Please login to merge, or discard this patch.
require/class.APRS.php 1 patch
Indentation   +144 added lines, -144 removed lines patch added patch discarded remove patch
@@ -2,10 +2,10 @@  discard block
 block discarded – undo
2 2
 require_once(dirname(__FILE__).'/settings.php');
3 3
 require_once(dirname(__FILE__).'/class.Common.php');
4 4
 class aprs {
5
-    private $socket;
6
-    private $connected = false;
5
+	private $socket;
6
+	private $connected = false;
7 7
 
8
-    protected $symbols = array('!' => 'Police',
8
+	protected $symbols = array('!' => 'Police',
9 9
 	'#' => 'DIGI',
10 10
 	'$' => 'Phone',
11 11
 	'%' => 'DX Cluster',
@@ -89,13 +89,13 @@  discard block
 block discarded – undo
89 89
 	'y' => 'Yagi At QTH');
90 90
 	
91 91
 
92
-    private function urshift($n, $s) {
92
+	private function urshift($n, $s) {
93 93
 	return ($n >= 0) ? ($n >> $s) :
94
-	    (($n & 0x7fffffff) >> $s) | 
94
+		(($n & 0x7fffffff) >> $s) | 
95 95
 		(0x40000000 >> ($s - 1));
96
-    }
96
+	}
97 97
 
98
-    public function parse($input) {
98
+	public function parse($input) {
99 99
 	global $globalDebug;
100 100
 	$debug = false;
101 101
 	$result = array();
@@ -107,8 +107,8 @@  discard block
 block discarded – undo
107 107
 	
108 108
 	/* Check that end was found and body has at least one byte. */
109 109
 	if ($splitpos == 0 || $splitpos + 1 == $input_len || $splitpos === FALSE) {
110
-	    if ($globalDebug) echo '!!! APRS invalid : '.$input."\n";
111
-	    return false;
110
+		if ($globalDebug) echo '!!! APRS invalid : '.$input."\n";
111
+		return false;
112 112
 	}
113 113
 	
114 114
 	if ($debug) echo 'input : '.$input."\n";
@@ -122,31 +122,31 @@  discard block
 block discarded – undo
122 122
 	/* Parse source, target and path. */
123 123
 	//FLRDF0A52>APRS,qAS,LSTB
124 124
 	if (preg_match('/^([A-Z0-9\\-]{1,9})>(.*)$/',$header,$matches)) {
125
-	    $ident = $matches[1];
126
-	    $all_elements = $matches[2];
127
-	    if ($ident == 'AIRCRAFT') {
125
+		$ident = $matches[1];
126
+		$all_elements = $matches[2];
127
+		if ($ident == 'AIRCRAFT') {
128 128
 		$result['format_source'] = 'famaprs';
129 129
 		$result['source_type'] = 'modes';
130
-	    } elseif ($ident == 'MARINE') {
130
+		} elseif ($ident == 'MARINE') {
131 131
 		$result['format_source'] = 'famaprs';
132 132
 		$result['source_type'] = 'ais';
133
-	    } else {
133
+		} else {
134 134
 		if ($debug) echo 'ident : '.$ident."\n";
135 135
 		$result['ident'] = $ident;
136
-	    }
136
+		}
137 137
 	} else return false;
138 138
 	$elements = explode(',',$all_elements);
139 139
 	$source = end($elements);
140 140
 	$result['source'] = $source;
141 141
 	foreach ($elements as $element) {
142
-	    if (preg_match('/^([a-zA-Z0-9-]{1,9})([*]?)$/',$element)) {
143
-	        //echo "ok";
144
-	        //if ($element == 'TCPIP*') return false;
145
-	    } elseif (!preg_match('/^([0-9A-F]{32})$/',$element)) {
142
+		if (preg_match('/^([a-zA-Z0-9-]{1,9})([*]?)$/',$element)) {
143
+			//echo "ok";
144
+			//if ($element == 'TCPIP*') return false;
145
+		} elseif (!preg_match('/^([0-9A-F]{32})$/',$element)) {
146 146
 		if ($debug) echo 'element : '.$element."\n";
147 147
 		return false;
148
-	    }
149
-	    /*
148
+		}
149
+		/*
150 150
 	    } elseif (preg_match('/^([0-9A-F]{32})$/',$element)) {
151 151
 		//echo "ok";
152 152
 	    } else {
@@ -173,49 +173,49 @@  discard block
 block discarded – undo
173 173
 	$body_parse = substr($body,1);
174 174
 	//echo 'Body : '.$body."\n";
175 175
 	if (preg_match('/^;(.){9}\*/',$body,$matches)) {
176
-	    $body_parse = substr($body_parse,10);
177
-	    $find = true;
178
-	    //echo $body_parse."\n";
176
+		$body_parse = substr($body_parse,10);
177
+		$find = true;
178
+		//echo $body_parse."\n";
179 179
 	}
180 180
 	if (preg_match('/^`(.*)\//',$body,$matches)) {
181
-	    $body_parse = substr($body_parse,strlen($matches[1])-1);
182
-	    $find = true;
183
-	    //echo $body_parse."\n";
181
+		$body_parse = substr($body_parse,strlen($matches[1])-1);
182
+		$find = true;
183
+		//echo $body_parse."\n";
184 184
 	}
185 185
 	if (preg_match("/^'(.*)\//",$body,$matches)) {
186
-	    $body_parse = substr($body_parse,strlen($matches[1])-1);
187
-	    $find = true;
188
-	    //echo $body_parse."\n";
186
+		$body_parse = substr($body_parse,strlen($matches[1])-1);
187
+		$find = true;
188
+		//echo $body_parse."\n";
189 189
 	}
190 190
 	if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([zh\\/])/',$body_parse,$matches)) {
191
-	    $find = true;
192
-	    //print_r($matches);
193
-	    $timestamp = $matches[0];
194
-	    if ($matches[4] == 'h') {
191
+		$find = true;
192
+		//print_r($matches);
193
+		$timestamp = $matches[0];
194
+		if ($matches[4] == 'h') {
195 195
 		$timestamp = strtotime(date('Ymd').' '.$matches[1].':'.$matches[2].':'.$matches[3]);
196 196
 		//echo 'timestamp : '.$timestamp.' - now : '.time()."\n";
197 197
 		/*
198 198
 		if (time() + 3900 < $timestamp) $timestamp -= 86400;
199 199
 		elseif (time() - 82500 > $timestamp) $timestamp += 86400;
200 200
 		*/
201
-	    } elseif ($matches[4] == 'z' || $matches[4] == '/') {
201
+		} elseif ($matches[4] == 'z' || $matches[4] == '/') {
202 202
 		// This work or not ?
203 203
 		$timestamp = strtotime(date('Ym').$matches[1].' '.$matches[2].':'.$matches[3]);
204
-	    }
205
-	    $body_parse = substr($body_parse,7);
206
-	    $result['timestamp'] = $timestamp;
207
-	    //echo date('Ymd H:i:s',$timestamp);
204
+		}
205
+		$body_parse = substr($body_parse,7);
206
+		$result['timestamp'] = $timestamp;
207
+		//echo date('Ymd H:i:s',$timestamp);
208 208
 	}
209 209
 	if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})/',$body_parse,$matches)) {
210
-	    $find = true;
211
-	    $timestamp = strtotime(date('Y').$matches[1].$matches[2].' '.$matches[3].':'.$matches[4]);
212
-	    $body_parse = substr($body_parse,8);
213
-	    $result['timestamp'] = $timestamp;
214
-	    //echo date('Ymd H:i:s',$timestamp);
210
+		$find = true;
211
+		$timestamp = strtotime(date('Y').$matches[1].$matches[2].' '.$matches[3].':'.$matches[4]);
212
+		$body_parse = substr($body_parse,8);
213
+		$result['timestamp'] = $timestamp;
214
+		//echo date('Ymd H:i:s',$timestamp);
215 215
 	}
216 216
 	//if (strlen($body_parse) > 19) {
217
-	    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)) {
218
-	    $find = true;
217
+		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)) {
218
+		$find = true;
219 219
 		// 4658.70N/00707.78Ez
220 220
 		//print_r(str_split($body_parse));
221 221
 		
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 		$lon = intval($lon_deg);
233 233
 		if ($lat > 89 || $lon > 179) return false;
234 234
 	    
235
-	    /*
235
+		/*
236 236
 	    $tmp_5b = str_replace('.','',$lat_min);
237 237
 	    if (preg_match('/^([0-9]{0,4})( {0,4})$/',$tmp_5b,$matches)) {
238 238
 	        print_r($matches);
@@ -246,9 +246,9 @@  discard block
 block discarded – undo
246 246
 		$result['longitude'] = $longitude;
247 247
 		$body_parse = substr($body_parse,18);
248 248
 		$body_parse_len = strlen($body_parse);
249
-	    }
250
-	    $body_parse_len = strlen($body_parse);
251
-	    if ($body_parse_len > 0) {
249
+		}
250
+		$body_parse_len = strlen($body_parse);
251
+		if ($body_parse_len > 0) {
252 252
 		/*
253 253
 		if (!isset($result['timestamp']) && !isset($result['latitude'])) {
254 254
 			$body_split = str_split($body);
@@ -278,95 +278,95 @@  discard block
 block discarded – undo
278 278
 			if (isset($this->symbols[$symbol_code])) $result['symbol'] = $this->symbols[$symbol_code];
279 279
 			if ($symbol_code != '_') {
280 280
 			}
281
-		    //$body_parse = substr($body_parse,1);
282
-		    //$body_parse = trim($body_parse);
283
-		    //$body_parse_len = strlen($body_parse);
284
-		    if ($body_parse_len >= 7) {
281
+			//$body_parse = substr($body_parse,1);
282
+			//$body_parse = trim($body_parse);
283
+			//$body_parse_len = strlen($body_parse);
284
+			if ($body_parse_len >= 7) {
285 285
 			
286
-		        if (preg_match('/^([0-9\\. ]{3})\\/([0-9\\. ]{3})/',$body_parse)) {
287
-		    	    $course = substr($body_parse,0,3);
288
-		    	    $tmp_s = intval($course);
289
-		    	    if ($tmp_s >= 1 && $tmp_s <= 360) $result['heading'] = intval($course);
290
-		    	    $speed = substr($body_parse,4,3);
291
-		    	    if ($speed != '...') {
292
-		    		//$result['speed'] = round($speed*1.852);
293
-		    		$result['speed'] = intval($speed);
294
-		    	    }
295
-		    	    $body_parse = substr($body_parse,7);
296
-		        }
297
-		        // Check PHGR, PHG, RNG
298
-		    } 
299
-		    /*
286
+				if (preg_match('/^([0-9\\. ]{3})\\/([0-9\\. ]{3})/',$body_parse)) {
287
+					$course = substr($body_parse,0,3);
288
+					$tmp_s = intval($course);
289
+					if ($tmp_s >= 1 && $tmp_s <= 360) $result['heading'] = intval($course);
290
+					$speed = substr($body_parse,4,3);
291
+					if ($speed != '...') {
292
+					//$result['speed'] = round($speed*1.852);
293
+					$result['speed'] = intval($speed);
294
+					}
295
+					$body_parse = substr($body_parse,7);
296
+				}
297
+				// Check PHGR, PHG, RNG
298
+			} 
299
+			/*
300 300
 		    else if ($body_parse_len > 0) {
301 301
 			$rest = $body_parse;
302 302
 		    }
303 303
 		    */
304
-		    if (strlen($body_parse) > 0) {
305
-		        if (preg_match('/\\/A=(-[0-9]{5}|[0-9]{6})/',$body_parse,$matches)) {
306
-		            $altitude = intval($matches[1]);
307
-		            //$result['altitude'] = round($altitude*0.3048);
308
-		            $result['altitude'] = $altitude;
309
-		            //$body_parse = trim(substr($body_parse,strlen($matches[0])));
310
-		            $body_parse = trim(preg_replace('/\\/A=(-[0-9]{5}|[0-9]{6})/','',$body_parse));
311
-		        }
312
-		    }
304
+			if (strlen($body_parse) > 0) {
305
+				if (preg_match('/\\/A=(-[0-9]{5}|[0-9]{6})/',$body_parse,$matches)) {
306
+					$altitude = intval($matches[1]);
307
+					//$result['altitude'] = round($altitude*0.3048);
308
+					$result['altitude'] = $altitude;
309
+					//$body_parse = trim(substr($body_parse,strlen($matches[0])));
310
+					$body_parse = trim(preg_replace('/\\/A=(-[0-9]{5}|[0-9]{6})/','',$body_parse));
311
+				}
312
+			}
313 313
 		    
314
-		    // Telemetry
315
-		    /*
314
+			// Telemetry
315
+			/*
316 316
 		    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)) {
317 317
 		        // Nothing yet...
318 318
 		    }
319 319
 		    */
320
-		    // DAO
320
+			// DAO
321 321
 		    
322
-		    if (preg_match('/^!([0-9A-Z]{3})/',$body_parse,$matches)) {
322
+			if (preg_match('/^!([0-9A-Z]{3})/',$body_parse,$matches)) {
323 323
 			    
324
-			    $dao = $matches[1];
325
-			    if (preg_match('/^([A-Z])([0-9]{2})/',$dao)) {
324
+				$dao = $matches[1];
325
+				if (preg_match('/^([A-Z])([0-9]{2})/',$dao)) {
326 326
 				$dao_split = str_split($dao);
327
-			        $lat_off = (($dao_split[1])-48.0)*0.001/60.0;
328
-			        $lon_off = (($dao_split[2])-48.0)*0.001/60.0;
327
+					$lat_off = (($dao_split[1])-48.0)*0.001/60.0;
328
+					$lon_off = (($dao_split[2])-48.0)*0.001/60.0;
329 329
 			    
330 330
 				if ($result['latitude'] < 0) $result['latitude'] -= $lat_off;
331 331
 				else $result['latitude'] += $lat_off;
332 332
 				if ($result['longitude'] < 0) $result['longitude'] -= $lon_off;
333 333
 				else $result['longitude'] += $lon_off;
334
-			    }
334
+				}
335 335
 			    
336
-		            $body_parse = substr($body_parse,6);
337
-		    }
336
+					$body_parse = substr($body_parse,6);
337
+			}
338 338
 		    
339
-		    if (preg_match('/CS=([0-9A-Z_]*)/',$body_parse,$matches)) {
339
+			if (preg_match('/CS=([0-9A-Z_]*)/',$body_parse,$matches)) {
340 340
 			$result['ident'] = str_replace('_',' ',$matches[1]);
341
-		    }
342
-		    if (preg_match('/SQ=([0-9]{4})/',$body_parse,$matches)) {
341
+			}
342
+			if (preg_match('/SQ=([0-9]{4})/',$body_parse,$matches)) {
343 343
 			$result['squawk'] = $matches[1];
344
-		    }
345
-		    if (preg_match('/AI=([0-9A-Z]{4})/',$body_parse,$matches)) {
344
+			}
345
+			if (preg_match('/AI=([0-9A-Z]{4})/',$body_parse,$matches)) {
346 346
 			$result['aircraft_icao'] = $matches[1];
347
-		    }
348
-		    if (preg_match('/VR=([0-9]*)/',$body_parse,$matches)) {
347
+			}
348
+			if (preg_match('/VR=([0-9]*)/',$body_parse,$matches)) {
349 349
 			$result['verticalrate'] = $matches[1];
350
-		    }
351
-		    if (preg_match('/TI=([0-9]*)/',$body_parse,$matches)) {
350
+			}
351
+			if (preg_match('/TI=([0-9]*)/',$body_parse,$matches)) {
352 352
 			$result['typeid'] = $matches[1];
353
-		    }
354
-		    if (preg_match('/SI=([0-9]*)/',$body_parse,$matches)) {
353
+			}
354
+			if (preg_match('/SI=([0-9]*)/',$body_parse,$matches)) {
355 355
 			$result['statusid'] = $matches[1];
356
-		    }
357
-		    if (preg_match('/IMO=([0-9]{7})/',$body_parse,$matches)) {
356
+			}
357
+			if (preg_match('/IMO=([0-9]{7})/',$body_parse,$matches)) {
358 358
 			$result['imo'] = $matches[1];
359
-		    }
360
-		    if (preg_match('/AD=([0-9]*)/',$body_parse,$matches)) {
359
+			}
360
+			if (preg_match('/AD=([0-9]*)/',$body_parse,$matches)) {
361 361
 			$result['arrival_date'] = $matches[1];
362
-		    }
363
-		    if (preg_match('/AC=([0-9A-Z_]*)/',$body_parse,$matches)) {
362
+			}
363
+			if (preg_match('/AC=([0-9A-Z_]*)/',$body_parse,$matches)) {
364 364
 			$result['arrival_code'] = str_replace('_',' ',$matches[1]);
365
-		    }
366
-		    // OGN comment
365
+			}
366
+			// OGN comment
367 367
 		   // echo "Before OGN : ".$body_parse."\n";
368
-		    //if (preg_match('/^id([0-9A-F]{8}) ([+-])([0-9]{3,4})fpm ([+-])([0-9.]{3,4})rot (.*)$/',$body_parse,$matches)) {
369
-		    if (preg_match('/^id([0-9A-F]{8})/',$body_parse,$matches)) {
368
+			//if (preg_match('/^id([0-9A-F]{8}) ([+-])([0-9]{3,4})fpm ([+-])([0-9.]{3,4})rot (.*)$/',$body_parse,$matches)) {
369
+			if (preg_match('/^id([0-9A-F]{8})/',$body_parse,$matches)) {
370 370
 			$id = $matches[1];
371 371
 			//$mode = substr($id,0,2);
372 372
 			$address = substr($id,2);
@@ -396,53 +396,53 @@  discard block
 block discarded – undo
396 396
 			$stealth = (intval(substr($id,0,2), 16) & 0b10000000) != 0;
397 397
 			$result['stealth'] = $stealth;
398 398
 			$result['address'] = $address;
399
-		    }
399
+			}
400 400
 		    
401
-		    //Comment
402
-		    $result['comment'] = trim($body_parse);
401
+			//Comment
402
+			$result['comment'] = trim($body_parse);
403 403
 		} else {
404
-		    // parse weather
405
-		    //$body_parse = substr($body_parse,1);
406
-		    //$body_parse_len = strlen($body_parse);
404
+			// parse weather
405
+			//$body_parse = substr($body_parse,1);
406
+			//$body_parse_len = strlen($body_parse);
407 407
 
408
-		    if (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
409
-			    $result['wind_dir'] = intval($matches[1]);
410
-			    $result['wind_speed'] = round(intval($matches[2])*1.60934,1);
411
-			    $result['wind_gust'] = round(intval($matches[3])*1.60934,1);
412
-			    $result['temp'] = round(5/9*((intval($matches[4]))-32),1);
413
-		    	    $body_parse = substr($body_parse,strlen($matches[0])+1);
414
-		    } elseif (preg_match('/^_{0,1}c([0-9 \\.\\-]{3})s([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
408
+			if (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
409
+				$result['wind_dir'] = intval($matches[1]);
410
+				$result['wind_speed'] = round(intval($matches[2])*1.60934,1);
411
+				$result['wind_gust'] = round(intval($matches[3])*1.60934,1);
412
+				$result['temp'] = round(5/9*((intval($matches[4]))-32),1);
413
+					$body_parse = substr($body_parse,strlen($matches[0])+1);
414
+			} elseif (preg_match('/^_{0,1}c([0-9 \\.\\-]{3})s([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
415 415
 			$result['wind_dir'] = intval($matches[1]);
416 416
 			$result['wind_speed'] = round($matches[2]*1.60934,1);
417 417
 			$result['wind_gust'] = round($matches[3]*1.60934,1);
418 418
 			$result['temp'] = round(5/9*(($matches[4])-32),1);
419
-		        $body_parse = substr($body_parse,strlen($matches[0])+1);
420
-		    } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
419
+				$body_parse = substr($body_parse,strlen($matches[0])+1);
420
+			} elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
421 421
 			$result['wind_dir'] = intval($matches[1]);
422 422
 			$result['wind_speed'] = round($matches[2]*1.60934,1);
423 423
 			$result['wind_gust'] = round($matches[3]*1.60934,1);
424
-		        $body_parse = substr($body_parse,strlen($matches[0])+1);
425
-		    } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)/',$body_parse,$matches)) {
424
+				$body_parse = substr($body_parse,strlen($matches[0])+1);
425
+			} elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)/',$body_parse,$matches)) {
426 426
 			$result['wind_dir'] = intval($matches[1]);
427 427
 			$result['wind_speed'] = round($matches[2]*1.60934,1);
428 428
 			$result['wind_gust'] = round($matches[3]*1.60934,1);
429
-		        $body_parse = substr($body_parse,strlen($matches[0])+1);
430
-		    }
431
-		    if (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9]+)t(-?[0-9 \\.]{1,3})/',$body_parse,$matches)) {
429
+				$body_parse = substr($body_parse,strlen($matches[0])+1);
430
+			}
431
+			if (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9]+)t(-?[0-9 \\.]{1,3})/',$body_parse,$matches)) {
432 432
 			$result['temp'] = round(5/9*(($matches[1])-32),1);
433
-		    }
433
+			}
434 434
 		}
435 435
 		} else $result['comment'] = trim($body_parse);
436 436
 
437
-	    }
437
+		}
438 438
 	//}
439 439
 	if (isset($result['latitude'])) $result['latitude'] = round($result['latitude'],4);
440 440
 	if (isset($result['longitude'])) $result['longitude'] = round($result['longitude'],4);
441 441
 	if ($debug) print_r($result);
442 442
 	return $result;
443
-    }
443
+	}
444 444
     
445
-    public function connect() {
445
+	public function connect() {
446 446
 	global $globalAPRSversion, $globalServerAPRSssid, $globalServerAPRSpass,$globalName, $globalServerAPRShost, $globalServerAPRSport;
447 447
 	$aprs_connect = 0;
448 448
 	$aprs_keep = 120;
@@ -465,32 +465,32 @@  discard block
 block discarded – undo
465 465
 		$send = socket_send( $this->socket  , $aprs_login , strlen($aprs_login) , 0 );
466 466
 		while ($msgin = socket_read($this->socket, 1000,PHP_NORMAL_READ)) {
467 467
 			if (strpos($msgin, "$aprs_ssid verified") !== FALSE) {
468
-			    echo 'APRS user verified !'."\n";
469
-			    $this->connected = true;
470
-			    return true;
471
-			    break;
468
+				echo 'APRS user verified !'."\n";
469
+				$this->connected = true;
470
+				return true;
471
+				break;
472 472
 			}
473 473
 			if (time()-$authstart > 5) {
474
-			    echo 'APRS timeout'."\n";
475
-			    break;
474
+				echo 'APRS timeout'."\n";
475
+				break;
476 476
 			}
477 477
 		}
478 478
 		socket_set_option($this->socket,SOL_SOCKET,SO_KEEPALIVE);
479 479
 	}
480
-    }
480
+	}
481 481
 
482
-    public function disconnect() {
482
+	public function disconnect() {
483 483
 	socket_close($this->socket);
484
-    }
484
+	}
485 485
     
486
-    public function send($data) {
486
+	public function send($data) {
487 487
 	if ($this->connected === false) $this->connect();
488 488
 	$send = socket_send( $this->socket  , $data , strlen($data),0);
489 489
 	if ($send === FALSE) {
490 490
 		socket_close($this->socket);
491 491
 		$this->connect();
492 492
 	}
493
-    }
493
+	}
494 494
 }
495 495
 
496 496
 class APRSSpotter extends APRS {
Please login to merge, or discard this patch.
require/class.SBS.php 1 patch
Indentation   +130 added lines, -130 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 class SBS {
3
-    static $latlon = array();
3
+	static $latlon = array();
4 4
     
5
-    public function parse($buffer) {
5
+	public function parse($buffer) {
6 6
 	// Not yet finished, no CRC checks
7 7
 	//echo $buffer."\n";
8 8
 	$data = array();
@@ -13,47 +13,47 @@  discard block
 block discarded – undo
13 13
 	$bin = gmp_strval( gmp_init($hex,16), 2);
14 14
 	//if (strlen($hex) == 28 && $this->parityCheck($hex,$bin)) {
15 15
 	if (strlen($hex) == 28) {
16
-	    $df = intval(substr($bin,0,5),2);
17
-	    //$ca = intval(substr($bin,5,3),2);
18
-	    // Only support DF17 for now
19
-	    //if ($df == 17 || ($df == 18 && ($ca == 0 || $ca == 1 || $ca == 6))) {
20
-	    if (($df == 17 || $df == 18) && ($this->parityCheck($hex,$bin) || $typehex == '@')) {
16
+		$df = intval(substr($bin,0,5),2);
17
+		//$ca = intval(substr($bin,5,3),2);
18
+		// Only support DF17 for now
19
+		//if ($df == 17 || ($df == 18 && ($ca == 0 || $ca == 1 || $ca == 6))) {
20
+		if (($df == 17 || $df == 18) && ($this->parityCheck($hex,$bin) || $typehex == '@')) {
21 21
 		$icao = substr($hex,2,6);
22 22
 		$data['hex'] = $icao;
23 23
 		$tc = intval(substr($bin,32,5),2);
24 24
 		if ($tc >= 1 && $tc <= 4) {
25
-		    //callsign
26
-		    $csbin = substr($bin,40,56);
27
-		    $charset = str_split('#ABCDEFGHIJKLMNOPQRSTUVWXYZ#####_###############0123456789######');
28
-		    $cs = '';
29
-		    $cs .= $charset[intval(substr($csbin,0,6),2)];
30
-		    $cs .= $charset[intval(substr($csbin,6,6),2)];
31
-		    $cs .= $charset[intval(substr($csbin,12,6),2)];
32
-		    $cs .= $charset[intval(substr($csbin,18,6),2)];
33
-		    $cs .= $charset[intval(substr($csbin,24,6),2)];
34
-		    $cs .= $charset[intval(substr($csbin,30,6),2)];
35
-		    $cs .= $charset[intval(substr($csbin,36,6),2)];
36
-		    $cs .= $charset[intval(substr($csbin,42,6),2)];
37
-		    $cs = str_replace('_','',$cs);
38
-		    $cs = str_replace('#','',$cs);
39
-		    $callsign = $cs;
40
-		    $data['ident'] = $callsign;
25
+			//callsign
26
+			$csbin = substr($bin,40,56);
27
+			$charset = str_split('#ABCDEFGHIJKLMNOPQRSTUVWXYZ#####_###############0123456789######');
28
+			$cs = '';
29
+			$cs .= $charset[intval(substr($csbin,0,6),2)];
30
+			$cs .= $charset[intval(substr($csbin,6,6),2)];
31
+			$cs .= $charset[intval(substr($csbin,12,6),2)];
32
+			$cs .= $charset[intval(substr($csbin,18,6),2)];
33
+			$cs .= $charset[intval(substr($csbin,24,6),2)];
34
+			$cs .= $charset[intval(substr($csbin,30,6),2)];
35
+			$cs .= $charset[intval(substr($csbin,36,6),2)];
36
+			$cs .= $charset[intval(substr($csbin,42,6),2)];
37
+			$cs = str_replace('_','',$cs);
38
+			$cs = str_replace('#','',$cs);
39
+			$callsign = $cs;
40
+			$data['ident'] = $callsign;
41 41
 		} elseif ($tc >= 9 && $tc <= 18) {
42
-		    // Check Q-bit
43
-		    $q = substr($bin,47,1);
44
-		    if ($q) {
42
+			// Check Q-bit
43
+			$q = substr($bin,47,1);
44
+			if ($q) {
45 45
 			$n = intval(substr($bin,40,7).substr($bin,48,4),2);
46 46
 			$alt = $n*25-1000;
47 47
 			$data['altitude'] = $alt;
48
-		    }
49
-		    // Check odd/even flag
50
-		    $oe = substr($bin,53,1);
51
-		    //if ($oe) => odd else even
52
-		    //  131072 is 2^17 since CPR latitude and longitude are encoded in 17 bits.
53
-		    $cprlat = intval(substr($bin,54,17),2)/131072.0;
54
-		    $cprlon = intval(substr($bin,71,17),2)/131072.0;
55
-		    if ($oe == 0) $this::$latlon[$icao] = array('latitude' => $cprlat,'longitude' => $cprlon,'created' => time());
56
-		    elseif (isset($this::$latlon[$icao]) && (time() - $this::$latlon[$icao]['created']) < 10) {
48
+			}
49
+			// Check odd/even flag
50
+			$oe = substr($bin,53,1);
51
+			//if ($oe) => odd else even
52
+			//  131072 is 2^17 since CPR latitude and longitude are encoded in 17 bits.
53
+			$cprlat = intval(substr($bin,54,17),2)/131072.0;
54
+			$cprlon = intval(substr($bin,71,17),2)/131072.0;
55
+			if ($oe == 0) $this::$latlon[$icao] = array('latitude' => $cprlat,'longitude' => $cprlon,'created' => time());
56
+			elseif (isset($this::$latlon[$icao]) && (time() - $this::$latlon[$icao]['created']) < 10) {
57 57
 			$cprlat_odd = $cprlat;
58 58
 			$cprlon_odd = $cprlon;
59 59
 			$cprlat_even = $this::$latlon[$icao]['latitude'];
@@ -66,53 +66,53 @@  discard block
 block discarded – undo
66 66
 			if ($lat_odd >= 270) $lat_odd = $lat_odd - 360;
67 67
 			// check latitude zone
68 68
 			if ($this->cprNL($lat_even) == $this->cprNL($lat_odd)) {
69
-			    if ($this::$latlon[$icao]['created'] > time()) {
69
+				if ($this::$latlon[$icao]['created'] > time()) {
70 70
 				$ni = $this->cprN($lat_even,0);
71 71
 				$m = floor($cprlon_even*($this->cprNL($lat_even)-1) - $cprlon_odd * $this->cprNL($lat_even)+0.5);
72 72
 				$lon = (360.0/$ni)*($m%$ni+$cprlon_even);
73 73
 				$lat = $lat_even;
74 74
 				if ($lon > 180) $lon = $lon -360;
75 75
 				if ($lat > -91 && $lat < 91 && $lon > -181 && $lon < 181) {
76
-				    //if ($globalDebug) echo 'cs : '.$cs.' - hex : '.$hex.' - lat : '.$lat.' - lon : '.$lon;
77
-				    $data['latitude'] = $lat;
78
-				    $data['longitude'] = $lon;
76
+					//if ($globalDebug) echo 'cs : '.$cs.' - hex : '.$hex.' - lat : '.$lat.' - lon : '.$lon;
77
+					$data['latitude'] = $lat;
78
+					$data['longitude'] = $lon;
79 79
 				}
80
-			    } else {
80
+				} else {
81 81
 				$ni = $this->cprN($lat_odd,1);
82 82
 				$m = floor($cprlon_even*($this->cprNL($lat_odd)-1) - $cprlon_odd * $this->cprNL($lat_odd)+0.5);
83 83
 				$lon = (360.0/$ni)*($m%$ni+$cprlon_odd);
84 84
 				$lat = $lat_odd;
85 85
 				if ($lon > 180) $lon = $lon -360;
86 86
 				if ($lat > -91 && $lat < 91 && $lon > -181 && $lon < 181) {
87
-				    //if ($globalDebug) echo 'icao : '.$icao.' - hex : '.$hex.' - lat : '.$lat.' - lon : '.$lon.' second'."\n";
88
-				    $data['latitude'] = $lat;
89
-				    $data['longitude'] = $lon;
87
+					//if ($globalDebug) echo 'icao : '.$icao.' - hex : '.$hex.' - lat : '.$lat.' - lon : '.$lon.' second'."\n";
88
+					$data['latitude'] = $lat;
89
+					$data['longitude'] = $lon;
90
+				}
90 91
 				}
91
-			    }
92 92
 			} else echo "Not cprNL";
93 93
 			unset($this::$latlon[$icao]);
94
-		    }
94
+			}
95 95
 		} elseif ($tc == 19) {
96
-		    // speed & heading
97
-		    $v_ew_dir = intval(substr($bin,45,1));
98
-		    $v_ew = intval(substr($bin,46,10),2);
99
-		    $v_ns_dir = intval(substr($bin,56,1));
100
-		    $v_ns = intval(substr($bin,57,10),2);
101
-		    if ($v_ew_dir) $v_ew = -1*$v_ew;
102
-		    if ($v_ns_dir) $v_ns = -1*$v_ns;
103
-		    $speed = sqrt($v_ns*$v_ns+$v_ew*$v_ew);
104
-		    $heading = atan2($v_ew,$v_ns)*360.0/(2*pi());
105
-		    if ($heading <0) $heading = $heading+360;
106
-		    $data['speed'] = $speed;
107
-		    $data['heading'] = $heading;
96
+			// speed & heading
97
+			$v_ew_dir = intval(substr($bin,45,1));
98
+			$v_ew = intval(substr($bin,46,10),2);
99
+			$v_ns_dir = intval(substr($bin,56,1));
100
+			$v_ns = intval(substr($bin,57,10),2);
101
+			if ($v_ew_dir) $v_ew = -1*$v_ew;
102
+			if ($v_ns_dir) $v_ns = -1*$v_ns;
103
+			$speed = sqrt($v_ns*$v_ns+$v_ew*$v_ew);
104
+			$heading = atan2($v_ew,$v_ns)*360.0/(2*pi());
105
+			if ($heading <0) $heading = $heading+360;
106
+			$data['speed'] = $speed;
107
+			$data['heading'] = $heading;
108
+		}
108 109
 		}
109
-	    }
110
-	    if (isset($data)) {
110
+		if (isset($data)) {
111 111
 		//print_r($data);
112 112
 		return $data;
113
-	    }
114
-        }
115
-    }
113
+		}
114
+		}
115
+	}
116 116
 
117 117
 
118 118
 	public function cprNL($lat) {
@@ -177,16 +177,16 @@  discard block
 block discarded – undo
177 177
 	if ($lat < 86.53536998) return 3;
178 178
 	if ($lat < 87.00000000) return 2;
179 179
 	return 1;
180
-    }
180
+	}
181 181
     
182
-    public function cprN($lat,$isodd) {
182
+	public function cprN($lat,$isodd) {
183 183
 	$nl = $this->cprNL($lat) - $isodd;
184 184
 	if ($nl > 1) return $nl;
185 185
 	else return 1;
186
-    }
186
+	}
187 187
 
188 188
 
189
-    function parityCheck($msg, $bin) {
189
+	function parityCheck($msg, $bin) {
190 190
 $modes_checksum_table = array(
191 191
 0x3935ea, 0x1c9af5, 0xf1b77e, 0x78dbbf, 0xc397db, 0x9e31e9, 0xb0e2f0, 0x587178,
192 192
 0x2c38bc, 0x161c5e, 0x0b0e2f, 0xfa7d13, 0x82c48d, 0xbe9842, 0x5f4c21, 0xd05c14,
@@ -208,75 +208,75 @@  discard block
 block discarded – undo
208 208
 	$checksum = intval(substr($msg,22,6),16);
209 209
 
210 210
 	for ($j = 0; $j < strlen($bin); $j++) {
211
-	    if ($bin[$j]) $crc = $crc^intval($modes_checksum_table[$j],0);
211
+		if ($bin[$j]) $crc = $crc^intval($modes_checksum_table[$j],0);
212 212
 	}
213 213
 	if ($crc == $checksum) return true;
214 214
 	else {
215
-	    //echo "**** CRC ERROR ****\n";
216
-	    return false;
215
+		//echo "**** CRC ERROR ****\n";
216
+		return false;
217
+	}
217 218
 	}
218
-    }
219 219
     
220
-    public function famaprs_to_basestation($data) {
220
+	public function famaprs_to_basestation($data) {
221 221
 	$result = array();
222
-        if (isset($data['ident']) && $data['ident'] != '') {
223
-	    $msg = array();
224
-	    $msg['msg_type'] = 'MSG';
225
-	    $msg['transmission_type'] = 1;
226
-	    $msg['session_id'] = 5;
227
-	    $msg['aircraftid'] = hexdec($data['address']);
228
-	    $msg['hex'] = $data['address'];
229
-	    $msg['flightid'] = hexdec($data['address']);
230
-	    $msg['date_gen'] = date('Y/m/d',$data['timestamp']);
231
-	    $msg['time_gen'] = date('H:i:s',$data['timestamp']).'.180';
232
-	    $msg['date_log'] = date('Y/m/d',$data['timestamp']);
233
-	    $msg['time_log'] = date('H:i:s',$data['timestamp']).'.180';
234
-	    $msg['callsign'] = $data['ident'];
235
-	    $msg['altitude'] = '';
236
-	    $msg['speed'] = '';
237
-	    $msg['track'] = '';
238
-	    $msg['latitude'] = '';
239
-	    $msg['longitude'] = '';
240
-	    $msg['verticalrate'] = '';
241
-	    $msg['squawk'] = '';
242
-	    $msg['alert'] = '';
243
-	    $msg['emergency'] = '';
244
-	    $msg['SPI'] = '';
245
-	    $msg['ground'] = '';
246
-    	    $result[] = implode(',',$msg);
247
-    	}
248
-    	if (isset($data['latitude']) && $data['latitude'] != 0) {
249
-	    $msg = array();
250
-	    $msg['msg_type'] = 'MSG';
251
-	    $msg['transmission_type'] = 2;
252
-	    $msg['session_id'] = 5;
253
-	    $msg['aircraftid'] = hexdec($data['address']);
254
-	    $msg['hex'] = $data['address'];
255
-	    $msg['flightid'] = hexdec($data['address']);
256
-	    $msg['date_gen'] = date('Y/m/d',$data['timestamp']);
257
-	    $msg['time_gen'] = date('H:i:s',$data['timestamp']).'.180';
258
-	    $msg['date_log'] = date('Y/m/d',$data['timestamp']);
259
-	    $msg['time_log'] = date('H:i:s',$data['timestamp']).'.180';
260
-	    $msg['callsign'] = '';
261
-	    if (isset($data['altitude'])) $msg['altitude'] = $data['altitude'];
262
-	    else $msg['altitude'] = '';
263
-	    $msg['speed'] = $data['speed'];
264
-	    if (isset($data['heading'])) $msg['track'] = $data['heading'];
265
-	    else $msg['track'] = '';
266
-	    $msg['latitude'] = $data['latitude'];
267
-	    $msg['longitude'] = $data['longitude'];
268
-	    if (isset($data['verticalrate'])) $msg['verticalrate'] = $data['verticalrate'];
269
-	    else $msg['verticalrate'] = '';
270
-	    if (isset($data['squawk'])) $msg['squawk'] = $data['squawk'];
271
-	    else $msg['squawk'] = 0;
272
-	    $msg['alert'] = 0;
273
-	    $msg['emergency'] = 0;
274
-	    $msg['SPI'] = 0;
275
-	    if (isset($data['ground'])) $msg['ground'] = 1;
276
-	    else $msg['ground'] = 0;
277
-    	    $result[] = implode(',',$msg);
278
-        }
279
-        return $result;
280
-    }
222
+		if (isset($data['ident']) && $data['ident'] != '') {
223
+		$msg = array();
224
+		$msg['msg_type'] = 'MSG';
225
+		$msg['transmission_type'] = 1;
226
+		$msg['session_id'] = 5;
227
+		$msg['aircraftid'] = hexdec($data['address']);
228
+		$msg['hex'] = $data['address'];
229
+		$msg['flightid'] = hexdec($data['address']);
230
+		$msg['date_gen'] = date('Y/m/d',$data['timestamp']);
231
+		$msg['time_gen'] = date('H:i:s',$data['timestamp']).'.180';
232
+		$msg['date_log'] = date('Y/m/d',$data['timestamp']);
233
+		$msg['time_log'] = date('H:i:s',$data['timestamp']).'.180';
234
+		$msg['callsign'] = $data['ident'];
235
+		$msg['altitude'] = '';
236
+		$msg['speed'] = '';
237
+		$msg['track'] = '';
238
+		$msg['latitude'] = '';
239
+		$msg['longitude'] = '';
240
+		$msg['verticalrate'] = '';
241
+		$msg['squawk'] = '';
242
+		$msg['alert'] = '';
243
+		$msg['emergency'] = '';
244
+		$msg['SPI'] = '';
245
+		$msg['ground'] = '';
246
+			$result[] = implode(',',$msg);
247
+		}
248
+		if (isset($data['latitude']) && $data['latitude'] != 0) {
249
+		$msg = array();
250
+		$msg['msg_type'] = 'MSG';
251
+		$msg['transmission_type'] = 2;
252
+		$msg['session_id'] = 5;
253
+		$msg['aircraftid'] = hexdec($data['address']);
254
+		$msg['hex'] = $data['address'];
255
+		$msg['flightid'] = hexdec($data['address']);
256
+		$msg['date_gen'] = date('Y/m/d',$data['timestamp']);
257
+		$msg['time_gen'] = date('H:i:s',$data['timestamp']).'.180';
258
+		$msg['date_log'] = date('Y/m/d',$data['timestamp']);
259
+		$msg['time_log'] = date('H:i:s',$data['timestamp']).'.180';
260
+		$msg['callsign'] = '';
261
+		if (isset($data['altitude'])) $msg['altitude'] = $data['altitude'];
262
+		else $msg['altitude'] = '';
263
+		$msg['speed'] = $data['speed'];
264
+		if (isset($data['heading'])) $msg['track'] = $data['heading'];
265
+		else $msg['track'] = '';
266
+		$msg['latitude'] = $data['latitude'];
267
+		$msg['longitude'] = $data['longitude'];
268
+		if (isset($data['verticalrate'])) $msg['verticalrate'] = $data['verticalrate'];
269
+		else $msg['verticalrate'] = '';
270
+		if (isset($data['squawk'])) $msg['squawk'] = $data['squawk'];
271
+		else $msg['squawk'] = 0;
272
+		$msg['alert'] = 0;
273
+		$msg['emergency'] = 0;
274
+		$msg['SPI'] = 0;
275
+		if (isset($data['ground'])) $msg['ground'] = 1;
276
+		else $msg['ground'] = 0;
277
+			$result[] = implode(',',$msg);
278
+		}
279
+		return $result;
280
+	}
281 281
 }
282 282
 ?>
Please login to merge, or discard this patch.
index.php 1 patch
Indentation   +89 added lines, -89 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     <?php }; if (isset($globalTracker) && $globalTracker) { ?><td><div id="ibxtracker"><h4><?php echo _("Trackers Detected"); ?></h4><br /><i class="fa fa-spinner fa-pulse fa-fw"></i></div></td><?php } ?>
41 41
 </tr></table></div>
42 42
 <?php
43
-    if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
43
+	if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
44 44
 
45 45
 ?>
46 46
 <script src="<?php echo $globalURL; ?>/js/map.3d.js.php"></script>
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 <script src="<?php echo $globalURL; ?>/js/map-marine.3d.js.php"></script>
61 61
 <?php
62 62
 	}
63
-    }
63
+	}
64 64
 ?>
65 65
 <div id="dialog" title="<?php echo _("Session has timed-out"); ?>">
66 66
   <p><?php echo _("In order to save data consumption web page times out after 30 minutes. Close this dialog to continue."); ?></p>
@@ -74,34 +74,34 @@  discard block
 block discarded – undo
74 74
 	<li><a href="#" onclick="getUserLocation(); return false;" title="<?php echo _("Plot your Location"); ?>"><i class="fa fa-map-marker"></i></a></li>
75 75
 	<li><a href="#" onclick="getCompassDirection(); return false;" title="<?php echo _("Compass Mode"); ?>"><i class="fa fa-compass"></i></a></li>
76 76
 <?php
77
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
77
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
78 78
 	if (isset($globalArchive) && $globalArchive == TRUE) {
79 79
 ?>
80 80
 	<li><a href="#archive" role="tab" title="<?php echo _("Archive"); ?>"><i class="fa fa-archive"></i></a></li>
81 81
 <?php
82 82
 	}
83
-    }
83
+	}
84 84
 ?>
85 85
 	<li><a href="#home" role="tab" title="<?php echo _("Layers"); ?>"><i class="fa fa-map"></i></a></li>
86 86
 	<li><a href="#filters" role="tab" title="<?php echo _("Filters"); ?>"><i class="fa fa-filter"></i></a></li>
87 87
 	<li><a href="#settings" role="tab" title="<?php echo _("Settings"); ?>"><i class="fa fa-gears"></i></a></li>
88 88
 <?php
89
-    if (isset($globalMap3D) && $globalMap3D) {
89
+	if (isset($globalMap3D) && $globalMap3D) {
90 90
 	if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
91 91
 ?>
92 92
 	<li><a href="#" onclick="show3D(); return false;" role="tab" title="3D"><b>3D</b></a></li>
93 93
 <?php
94
-        } else {
95
-    	    if (isset($globalMapSatellites) && $globalMapSatellites) {
94
+		} else {
95
+			if (isset($globalMapSatellites) && $globalMapSatellites) {
96 96
 ?>
97 97
 	<li><a href="#satellites" role="tab" title="<?php echo _("Satellites"); ?>"><i class="satellite"></i></a></li>
98 98
 <?php
99
-	    }
99
+		}
100 100
 ?>
101 101
 	<li><a href="#" onclick="show2D(); return false;" role="tab" title="2D"><b>2D</b></a></li>
102 102
 <?php
103 103
 	}
104
-    }
104
+	}
105 105
 ?>
106 106
     </ul>
107 107
 
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 ?>
176 176
         </div>
177 177
 <?php
178
-    if (isset($globalArchive) && $globalArchive == TRUE) {
178
+	if (isset($globalArchive) && $globalArchive == TRUE) {
179 179
 ?>
180 180
         <div class="sidebar-pane" id="archive">
181 181
 	    <h1 class="sidebar-header"><?php echo _("Playback"); ?> <i>Bêta</i><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 	    </form>
236 236
 	</div>
237 237
 <?php
238
-    }
238
+	}
239 239
 ?>
240 240
         <div class="sidebar-pane" id="settings">
241 241
 	    <h1 class="sidebar-header"><?php echo _("Settings"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
@@ -246,56 +246,56 @@  discard block
 block discarded – undo
246 246
 			    <?php
247 247
 				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider;
248 248
 				else $MapType = $_COOKIE['MapType'];
249
-			    ?>
249
+				?>
250 250
 			    <?php
251 251
 				if (isset($globalBingMapKey) && $globalBingMapKey != '') {
252
-			    ?>
252
+				?>
253 253
 			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option>
254 254
 			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option>
255 255
 			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option>
256 256
 			    <?php
257 257
 				}
258
-			    ?>
258
+				?>
259 259
 			    <?php
260
-			        if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
261
-			    ?>
260
+					if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
261
+				?>
262 262
 			    <?php
263
-				    if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
264
-			    ?>
263
+					if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
264
+				?>
265 265
 			    <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option>
266 266
 			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option>
267 267
 			    <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option>
268 268
 			    <?php
269
-				    }
270
-			    ?>
269
+					}
270
+				?>
271 271
 			    <?php
272
-				    if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
273
-			    ?>
272
+					if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
273
+				?>
274 274
 			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option>
275 275
 			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option>
276 276
 			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option>
277 277
 			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option>
278 278
 			    <?php
279
-				    }
280
-			    ?>
279
+					}
280
+				?>
281 281
 			    <?php
282
-				    if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
283
-			    ?>
282
+					if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
283
+				?>
284 284
 			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option>
285 285
 			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option>
286 286
 			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option>
287 287
 			    <?php
288
-				    }
289
-			    ?>
288
+					}
289
+				?>
290 290
 			    <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option>
291 291
 			    <?php
292 292
 				}
293
-			    ?>
293
+				?>
294 294
 			    <?php
295
-				    if (isset($globalMapboxToken) && $globalMapboxToken != '') {
295
+					if (isset($globalMapboxToken) && $globalMapboxToken != '') {
296 296
 					if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default';
297 297
 					else $MapBoxId = $_COOKIE['MapTypeId'];
298
-			    ?>
298
+				?>
299 299
 			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option>
300 300
 			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option>
301 301
 			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option>
@@ -309,13 +309,13 @@  discard block
 block discarded – undo
309 309
 			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option>
310 310
 			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option>
311 311
 			    <?php
312
-				    }
313
-			    ?>
312
+					}
313
+				?>
314 314
 			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option>
315 315
 			</select>
316 316
 		    </li>
317 317
 <?php
318
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
318
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
319 319
 ?>
320 320
 		    <li><?php echo _("Type of Terrain:"); ?>
321 321
 			<select  class="selectpicker" onchange="terrainType(this);">
@@ -325,10 +325,10 @@  discard block
 block discarded – undo
325 325
 			</select>
326 326
 		    </li>
327 327
 <?php
328
-    }
328
+	}
329 329
 ?>
330 330
 <?php
331
-    if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
331
+	if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
332 332
 ?>
333 333
 		    
334 334
 		    <li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') print 'checked'; ?> ><?php echo _("Display flight info as popup"); ?></label></div></li>
@@ -336,75 +336,75 @@  discard block
 block discarded – undo
336 336
 		    <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || !isset($_COOKIE['MapRoute'])) print 'checked'; ?> ><?php echo _("Display flight route on click"); ?></label></div></li>
337 337
 		    <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Planes animate between updates"); ?></label></div></li>
338 338
 <?php
339
-    }
339
+	}
340 340
 ?>
341 341
 		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true') print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li>
342 342
 <?php
343
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
343
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
344 344
 ?>
345 345
 		    <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>
346 346
 <?php
347
-    }
348
-    if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
347
+	}
348
+	if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
349 349
 ?>
350 350
 		    <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>
351 351
 <?php
352
-    }
352
+	}
353 353
 ?>
354 354
 
355 355
 		    <?php
356 356
 			if (function_exists('array_column')) {
357
-			    if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
358
-		    ?>
357
+				if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
358
+			?>
359 359
 		    <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>
360 360
 		    <?php
361
-			    }
361
+				}
362 362
 			} elseif (isset($globalSources)) {
363
-			    $dispolar = false;
364
-			    foreach ($globalSources as $testsource) {
365
-			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
366
-			    }
367
-			    if ($dispolar) {
368
-		    ?>
363
+				$dispolar = false;
364
+				foreach ($globalSources as $testsource) {
365
+					if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
366
+				}
367
+				if ($dispolar) {
368
+			?>
369 369
 		    <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>
370 370
 		    <?php
371
-			    }
372
-		        }
373
-		    ?>
371
+				}
372
+				}
373
+			?>
374 374
 <?php
375
-    if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
375
+	if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
376 376
 ?>
377 377
 
378 378
 		    <?php
379 379
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
380
-		    	    if (extension_loaded('gd') && function_exists('gd_info')) {
381
-		    ?>
380
+					if (extension_loaded('gd') && function_exists('gd_info')) {
381
+			?>
382 382
 		    <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>
383 383
 		    <?php 
384 384
 				if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') {
385
-		    ?>
385
+			?>
386 386
 		    <li><?php echo _("Aircraft icon color:"); ?>
387 387
 			<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'; ?>">
388 388
 		    </li>
389 389
 		    <?php
390 390
 				}
391
-			    }
392
-		        }
393
-		    ?>
391
+				}
392
+				}
393
+			?>
394 394
 		    <?php
395 395
 			if (isset($globalMarine) && $globalMarine === TRUE) {
396
-			    if (extension_loaded('gd') && function_exists('gd_info')) {
397
-		    ?>
396
+				if (extension_loaded('gd') && function_exists('gd_info')) {
397
+			?>
398 398
 		    <li><?php echo _("Marine icon color:"); ?>
399 399
 			<input type="color" name="marinecolor" id="html5colorpicker" onchange="iconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print '1a3151'; ?>">
400 400
 		    </li>
401 401
 		    <?php
402
-			    }
403
-		        }
404
-		    ?>
402
+				}
403
+				}
404
+			?>
405 405
 		    <?php
406 406
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
407
-		    ?>
407
+			?>
408 408
 		    <li><?php echo _("Show airport icon at zoom level:"); ?>
409 409
 			<div class="range">
410 410
 			    <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'; ?>">
@@ -413,9 +413,9 @@  discard block
 block discarded – undo
413 413
 		    </li>
414 414
 		    <?php
415 415
 			}
416
-		    ?>
416
+			?>
417 417
 <?php
418
-    } elseif (isset($_COOKIE['MapFormat']) || $_COOKIE['MapFOrmat'] == '3d') {
418
+	} elseif (isset($_COOKIE['MapFormat']) || $_COOKIE['MapFOrmat'] == '3d') {
419 419
 ?>
420 420
 <?php
421 421
 	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
 		    </li>
437 437
 <?php
438 438
 	}
439
-    }
439
+	}
440 440
 ?>
441 441
 		    <li><?php echo _("Distance unit:"); ?>
442 442
 			<select class="selectpicker" onchange="unitdistance(this);">
@@ -469,19 +469,19 @@  discard block
 block discarded – undo
469 469
 		    <ul>
470 470
 		    <?php
471 471
 			if (!isset($globalAircraft) || $globalAircraft) {
472
-		    ?>
472
+			?>
473 473
 		    <?php
474 474
 			if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) {
475
-		    ?>
475
+			?>
476 476
 			<?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 } ?>
477 477
 			<?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 } ?>
478 478
 			<?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 } ?>
479 479
 		    <?php
480 480
 			}
481
-		    ?>
481
+			?>
482 482
 		    <?php
483 483
 			if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) {
484
-		    ?>
484
+			?>
485 485
 			<?php if (isset($globalSBS1) && $globalSBS1) { ?>
486 486
 			    <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>
487 487
 			<?php } ?>
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
 			<?php } ?>
491 491
 		    <?php
492 492
 			}
493
-		    ?>
493
+			?>
494 494
 		    <li><?php echo _("Display airlines:"); ?>
495 495
 		    <br/>
496 496
 			<select class="selectpicker" multiple onchange="airlines(this);" id="display_airlines">
@@ -510,14 +510,14 @@  discard block
 block discarded – undo
510 510
 						echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>';
511 511
 					}
512 512
 				}
513
-			    ?>
513
+				?>
514 514
 			</select>
515 515
 		    </li>
516 516
 		    <?php
517 517
 			$Spotter = new Spotter();
518 518
 			$allalliancenames = $Spotter->getAllAllianceNames();
519 519
 			if (!empty($allalliancenames)) {
520
-		    ?>
520
+			?>
521 521
 		    <li><?php echo _("Display alliance:"); ?>
522 522
 		    <br/>
523 523
 			<select class="selectpicker" onchange="alliance(this);" id="display_alliance">
@@ -531,18 +531,18 @@  discard block
 block discarded – undo
531 531
 						echo '<option value="'.$alliance_name.'">'.$alliance_name.'</option>';
532 532
 					}
533 533
 				}
534
-			    ?>
534
+				?>
535 535
 			</select>
536 536
 		    </li>
537 537
 		    <?php
538 538
 			}
539
-		    ?>
539
+			?>
540 540
 		    <?php
541 541
 			}
542
-		    ?>
542
+			?>
543 543
 		    <?php
544 544
 			if (isset($globalAPRS) && $globalAPRS) {
545
-		    ?>
545
+			?>
546 546
 		    <li><?php echo _("Display APRS sources name:"); ?>
547 547
 			<select class="selectpicker" multiple onchange="sources(this);">
548 548
 			    <?php
@@ -554,18 +554,18 @@  discard block
 block discarded – undo
554 554
 						echo '<option value="'.$source['source_name'].'">'.$source['source_name'].'</option>';
555 555
 					}
556 556
 				}
557
-			    ?>
557
+				?>
558 558
 			</select>
559 559
 		    </li>
560 560
 		    <?php
561 561
 			}
562
-		    ?>
562
+			?>
563 563
 		    <?php
564 564
 			if (!isset($globalAircraft) && $globalAircraft) {
565
-		    ?>
565
+			?>
566 566
 		    <?php
567 567
 			if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS)) {
568
-		    ?>
568
+			?>
569 569
 		    <li><?php echo _("Display airlines of type:"); ?><br/>
570 570
 			<select class="selectpicker" onchange="airlinestype(this);">
571 571
 			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
@@ -576,14 +576,14 @@  discard block
 block discarded – undo
576 576
 		    </li>
577 577
 		    <?php
578 578
 			}
579
-		    ?>
579
+			?>
580 580
 		    <li>
581 581
 			<?php echo _("Display flight with ident:"); ?>
582 582
 			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" />
583 583
 		    </li>
584 584
 		    <?php
585 585
 			}
586
-		    ?>
586
+			?>
587 587
 		</ul>
588 588
 	    </form>
589 589
 	    <form method="post">
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
 	    </form>
593 593
     	</div>
594 594
 <?php
595
-    if (isset($globalMapSatellites) && $globalMapSatellites && isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
595
+	if (isset($globalMapSatellites) && $globalMapSatellites && isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
596 596
 ?>
597 597
         <div class="sidebar-pane" id="satellites">
598 598
 	    <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
@@ -632,14 +632,14 @@  discard block
 block discarded – undo
632 632
 						print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>';
633 633
 					}
634 634
 				}
635
-			    ?>
635
+				?>
636 636
 			</select>
637 637
 		    </li>
638 638
 		</ul>
639 639
 	    </form>
640 640
 	</div>
641 641
 <?php
642
-    }
642
+	}
643 643
 ?>
644 644
     </div>
645 645
 </div>
Please login to merge, or discard this patch.