Completed
Push — master ( e6c083...dab432 )
by Yannick
31:25
created
country.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@
 block discarded – undo
4 4
 
5 5
 if (isset($_POST['country']) && $_POST['country'] != "")
6 6
 {
7
-	$country = filter_input(INPUT_POST,'country',FILTER_SANITIZE_STRING);
7
+	$country = filter_input(INPUT_POST, 'country', FILTER_SANITIZE_STRING);
8 8
 	header('Location: '.$globalURL.'/country/'.$country);
9 9
 } else {
10 10
 	if ($globalURL == '') {
Please login to merge, or discard this patch.
header.php 3 patches
Indentation   +79 added lines, -79 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]);
@@ -160,17 +160,17 @@  discard block
 block discarded – undo
160 160
 	}
161 161
 ?>
162 162
 <?php 
163
-    if (isset($_POST['archive'])) {
163
+	if (isset($_POST['archive'])) {
164 164
 ?>
165 165
 <script src="<?php print $globalURL; ?>/js/map.common.js"></script>
166 166
 <?php 
167
-	    if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
167
+		if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
168 168
 ?>
169 169
 
170 170
 <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>
171 171
 <?php    
172
-	    }
173
-    } else {
172
+		}
173
+	} else {
174 174
 ?>
175 175
 <?php
176 176
 /*	if (isset($globalBeta) && $globalBeta) {
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 */
183 183
 ?>
184 184
 <?php 
185
-	    if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
185
+		if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
186 186
 ?>
187 187
 <?php
188 188
 //		if (isset($globalBeta) && $globalBeta) {
@@ -213,13 +213,13 @@  discard block
 block discarded – undo
213 213
 <script src="<?php print $globalURL; ?>/js/map-satellite.2d.js.php?<?php print time(); ?>"></script>
214 214
 <?php
215 215
 		}
216
-	    }
216
+		}
217 217
 ?>
218 218
 <?php
219 219
 //	}
220 220
 ?>
221 221
 <?php
222
-    }
222
+	}
223 223
 }
224 224
 ?>
225 225
 <?php
@@ -397,61 +397,61 @@  discard block
 block discarded – undo
397 397
       <ul class="nav navbar-nav">
398 398
 
399 399
 <?php 
400
-    $sub = false;
401
-    if (
400
+	$sub = false;
401
+	if (
402 402
 	(
403
-	    (!isset($globalAircraft) || (isset($globalAircraft) && $globalAircraft === TRUE)) && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalTracker) && $globalTracker === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE))
403
+		(!isset($globalAircraft) || (isset($globalAircraft) && $globalAircraft === TRUE)) && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalTracker) && $globalTracker === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE))
404 404
 	) || 
405 405
 	(
406
-	    isset($globalMarine) && $globalMarine === TRUE && ((isset($globalTracker) && $globalTracker === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE))
406
+		isset($globalMarine) && $globalMarine === TRUE && ((isset($globalTracker) && $globalTracker === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE))
407 407
 	) || 
408 408
 	(
409
-	    isset($globalTracker) && $globalTracker === TRUE && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE))
409
+		isset($globalTracker) && $globalTracker === TRUE && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE))
410 410
 	) || 
411 411
 	(
412
-	    isset($globalSatellite) && $globalSatellite === TRUE && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalTracker) && $globalTracker === TRUE))
412
+		isset($globalSatellite) && $globalSatellite === TRUE && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalTracker) && $globalTracker === TRUE))
413 413
 	)
414
-    ) {
414
+	) {
415 415
 	$sub = true;
416
-    }
416
+	}
417 417
 ?>
418 418
 <?php
419
-    if (!isset($globalAircraft) || $globalAircraft === TRUE) {
419
+	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
420 420
 ?>
421 421
     <li class="dropdown">
422 422
 <?php
423
-    if ($sub) {
423
+	if ($sub) {
424 424
 ?>
425 425
       	<li class="dropdown">
426 426
           <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Aircrafts"); ?> <b class="caret"></b></a>
427 427
 	<ul class="dropdown-menu multi-level">
428 428
       	<li class="dropdown-submenu">
429 429
 <?php
430
-    }
430
+	}
431 431
 ?>
432 432
           <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
433 433
           <ul class="dropdown-menu">
434 434
           	<li><a href="<?php print $globalURL; ?>/aircraft"><?php echo _("Aircrafts Types"); ?></a></li>
435 435
 <?php
436
-    if (!isset($globalNoAirlines) || $globalNoAirlines === FALSE) {
436
+	if (!isset($globalNoAirlines) || $globalNoAirlines === FALSE) {
437 437
 ?>
438 438
 			<li><a href="<?php print $globalURL; ?>/airline"><?php echo _("Airlines"); ?></a></li>
439 439
 <?php
440
-    }
440
+	}
441 441
 ?>
442 442
 			<li><a href="<?php print $globalURL; ?>/airport"><?php echo _("Airports"); ?></a></li>
443 443
 <?php
444
-    if ((isset($globalUseOwner) && $globalUseOwner) || (!isset($globalUseOwner) && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM))) {
444
+	if ((isset($globalUseOwner) && $globalUseOwner) || (!isset($globalUseOwner) && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM))) {
445 445
 ?>
446 446
 			<li><a href="<?php print $globalURL; ?>/owner"><?php echo _("Owners"); ?></a></li>
447 447
 <?php
448
-    } 
449
-    if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) {
448
+	} 
449
+	if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) {
450 450
 
451 451
 ?>
452 452
 			<li><a href="<?php print $globalURL; ?>/pilot"><?php echo _("Pilots"); ?></a></li>
453 453
 <?php
454
-    }
454
+	}
455 455
 ?>
456 456
 			<li><hr /></li>
457 457
             <li><a href="<?php print $globalURL; ?>/currently"><?php echo _("Current Activity"); ?></a></li>
@@ -459,43 +459,43 @@  discard block
 block discarded – undo
459 459
             <li><a href="<?php print $globalURL; ?>/date/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Activity"); ?></a></li>
460 460
             <li><a href="<?php print $globalURL; ?>/newest"><?php echo _("Newest by Category"); ?></a></li>
461 461
             <?php
462
-        	if ($globalACARS) {
463
-        	    if (isset($globalDemo) && $globalDemo) {
464
-    	    ?>
462
+			if ($globalACARS) {
463
+				if (isset($globalDemo) && $globalDemo) {
464
+			?>
465 465
             <li><hr /></li>
466 466
             <li><i><?php echo _('ACARS data not available publicly'); ?></i></li>
467 467
             <li><a href=""><?php echo _('Latest ACARS messages'); ?></a></li>
468 468
             <li><a href=""><?php echo _('Archive ACARS messages'); ?></a></li>
469 469
             <?php
470
-        	    } else {
471
-    	    ?>
470
+				} else {
471
+			?>
472 472
             <li><hr /></li>
473 473
             <li><a href="<?php print $globalURL; ?>/acars-latest"><?php echo _("Latest ACARS messages"); ?></a></li>
474 474
             <li><a href="<?php print $globalURL; ?>/acars-archive"><?php echo _("Archive ACARS messages"); ?></a></li>
475 475
             <?php
476
-        	    }
477
-        	}
478
-    	    ?>
476
+				}
477
+			}
478
+			?>
479 479
     	    <?php
480
-    	        if (isset($globalAccidents) && $globalAccidents) {
481
-    	    ?>
480
+				if (isset($globalAccidents) && $globalAccidents) {
481
+			?>
482 482
             <li><hr /></li>
483 483
             <li><a href="<?php print $globalURL; ?>/accident-latest"><?php echo _("Latest accident"); ?></a></li>
484 484
             <li><a href="<?php print $globalURL; ?>/accident/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Accident"); ?></a></li>
485 485
             <li><a href="<?php print $globalURL; ?>/incident-latest"><?php echo _("Latest incident"); ?></a></li>
486 486
             <li><a href="<?php print $globalURL; ?>/incident/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Incident"); ?></a></li>
487 487
             <?php
488
-        	}
489
-    	    ?>
488
+			}
489
+			?>
490 490
             <li><hr /></li>
491 491
             <li><a href="<?php print $globalURL; ?>/highlights/table"><?php echo _("Special Highlights"); ?></a></li>
492 492
             <?php
493 493
 		if (!isset($globalNoUpcoming) || $globalNoUpcoming === FALSE) {
494
-	    ?>
494
+		?>
495 495
             <li><a href="<?php print $globalURL; ?>/upcoming"><?php echo _("Upcoming Flights"); ?></a></li>
496 496
 	    <?php
497 497
 		}
498
-	    ?>
498
+		?>
499 499
           </ul>
500 500
         </li>
501 501
       	<li><a href="<?php print $globalURL; ?>/search"><?php echo _("Search"); ?></a></li>
@@ -522,14 +522,14 @@  discard block
 block discarded – undo
522 522
     </ul>
523 523
 <?php
524 524
 	}
525
-    }
525
+	}
526 526
 ?>
527 527
 <?php
528
-    if (isset($globalMarine) && $globalMarine) {
528
+	if (isset($globalMarine) && $globalMarine) {
529 529
 ?>
530 530
     <li class="dropdown">
531 531
 <?php
532
-        if ($sub) {
532
+		if ($sub) {
533 533
 ?>
534 534
     <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Vessels"); ?> <b class="caret"></b></a>
535 535
 	<ul class="dropdown-menu multi-level">
@@ -555,14 +555,14 @@  discard block
 block discarded – undo
555 555
 	}
556 556
 ?>
557 557
 <?php
558
-    }
558
+	}
559 559
 ?>
560 560
 <?php
561
-    if (isset($globalTracker) && $globalTracker) {
561
+	if (isset($globalTracker) && $globalTracker) {
562 562
 ?>
563 563
     <li class="dropdown">
564 564
 <?php
565
-        if ($sub) {
565
+		if ($sub) {
566 566
 ?>
567 567
     <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Trackers"); ?> <b class="caret"></b></a>
568 568
 	<ul class="dropdown-menu multi-level">
@@ -588,14 +588,14 @@  discard block
 block discarded – undo
588 588
 	}
589 589
 ?>
590 590
 <?php
591
-    }
591
+	}
592 592
 ?>
593 593
 <?php
594
-    if (isset($globalSatellite) && $globalSatellite) {
594
+	if (isset($globalSatellite) && $globalSatellite) {
595 595
 ?>
596 596
     <li class="dropdown">
597 597
 <?php
598
-        if ($sub) {
598
+		if ($sub) {
599 599
 ?>
600 600
     <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Satellite"); ?> <b class="caret"></b></a>
601 601
 	<ul class="dropdown-menu multi-level">
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
 	}
623 623
 ?>
624 624
 <?php
625
-    }
625
+	}
626 626
 ?>
627 627
 
628 628
         <li class="dropdown">
@@ -631,12 +631,12 @@  discard block
 block discarded – undo
631 631
           	<li><a href="<?php print $globalURL; ?>/about"><?php echo _("About The Project"); ?></a></li>
632 632
           	<li><a href="<?php print $globalURL; ?>/about/export"><?php echo _("Exporting Data"); ?></a></li>
633 633
 <?php
634
-    if (!isset($globalAircraft) || $globalAircraft === TRUE) {
634
+	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
635 635
 ?>
636 636
 		<li><hr /></li>
637 637
 		<li><a href="<?php print $globalURL; ?>/about/tv"><?php echo _("Spotter TV"); ?></a></li>
638 638
 <?php
639
-    }
639
+	}
640 640
 ?>
641 641
 	    <?php if (isset($globalContribute) && $globalContribute) { ?>
642 642
                 <li><hr /></li>
@@ -657,14 +657,14 @@  discard block
 block discarded – undo
657 657
   	    <form>
658 658
   		<select class="selectpicker" data-width="120px" onchange="language(this);">
659 659
   		    <?php
660
-  		        $Language = new Language();
661
-  		        $alllang = $Language->getLanguages();
662
-  		        foreach ($alllang as $key => $lang) {
663
-  		            print '<option value="'.$key.'"';
664
-  		            if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected ';
665
-  		            print '>'.$lang[0].'</option>';
666
-  		        }
667
-  		    ?>
660
+  				$Language = new Language();
661
+  				$alllang = $Language->getLanguages();
662
+  				foreach ($alllang as $key => $lang) {
663
+  					print '<option value="'.$key.'"';
664
+  					if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected ';
665
+  					print '>'.$lang[0].'</option>';
666
+  				}
667
+  			?>
668 668
   		</select>
669 669
   	    </form>
670 670
   	</div>
@@ -695,18 +695,18 @@  discard block
 block discarded – undo
695 695
 ?>
696 696
     <div class="top-header clear" role="main">
697 697
 <?php
698
-    if (isset($longitude) && isset($latitude) && $longitude != 0 && $latitude != 0) {
698
+	if (isset($longitude) && isset($latitude) && $longitude != 0 && $latitude != 0) {
699 699
 ?>
700 700
     <div id="archive-map"></div>
701 701
 <?php
702
-    }
702
+	}
703 703
 ?>
704 704
     </div>
705 705
 <?php
706 706
 }
707 707
 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))
708 708
 {
709
-    ?>
709
+	?>
710 710
     <div class="top-header clear" role="main">
711 711
         <div id="map"></div>
712 712
 	<link rel="stylesheet" href="<?php print $globalURL; ?>/css/leaflet.css" />
@@ -717,15 +717,15 @@  discard block
 block discarded – undo
717 717
         var zoom = 13;
718 718
 //create the map
719 719
 <?php
720
-    if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) {
720
+	if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) {
721 721
 ?>
722 722
   map = L.map('map', { zoomControl:true }).setView([<?php print $airport_array[0]['latitude']; ?>,<?php print $airport_array[0]['longitude']; ?>], zoom);
723 723
 <?php
724
-    } elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) {
724
+	} elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) {
725 725
 ?>
726 726
   map = L.map('map', { zoomControl:true });
727 727
 <?php
728
-    } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) {
728
+	} elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) {
729 729
 ?>
730 730
   map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['departure_airport_latitude']; ?>,<?php print $spotter_array[0]['arrival_airport_longitude']; ?>]);
731 731
     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);
@@ -733,22 +733,22 @@  discard block
 block discarded – undo
733 733
     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);
734 734
     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);
735 735
 <?php
736
-    } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude']) && isset($spotter_array[0]['latitude'])) {
736
+	} elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude']) && isset($spotter_array[0]['latitude'])) {
737 737
 ?>
738 738
   map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['latitude']; ?>,<?php print $spotter_array[0]['longitude']; ?>]);
739 739
 <?php
740
-    } elseif (!isset($spotter_array[0]['latitude']) && !isset($spotter_array[0]['longitude'])) {
740
+	} elseif (!isset($spotter_array[0]['latitude']) && !isset($spotter_array[0]['longitude'])) {
741 741
 ?>
742 742
   map = L.map('map', { zoomControl:true });
743 743
 <?php
744
-    }
744
+	}
745 745
 ?>
746 746
   //initialize the layer group for the aircrft markers
747 747
   var layer_data = L.layerGroup();
748 748
 
749 749
   //a few title layers
750 750
 <?php
751
-    if ($globalMapProvider == 'Mapbox') {
751
+	if ($globalMapProvider == 'Mapbox') {
752 752
 ?>
753 753
   L.tileLayer('https://{s}.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={token}', {
754 754
     maxZoom: 18,
@@ -759,7 +759,7 @@  discard block
 block discarded – undo
759 759
     token : '<?php print $globalMapboxToken; ?>'
760 760
   }).addTo(map);
761 761
 <?php
762
-    } elseif ($globalMapProvider == 'MapQuest-OSM') {
762
+	} elseif ($globalMapProvider == 'MapQuest-OSM') {
763 763
 ?>
764 764
   L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.png', {
765 765
     maxZoom: 18,
@@ -768,7 +768,7 @@  discard block
 block discarded – undo
768 768
       'Tiles Courtesy of <a href="http://www.mapquest.com">MapQuest</a>'
769 769
   }).addTo(map);
770 770
 <?php
771
-    } elseif ($globalMapProvider == 'MapQuest-Aerial') {
771
+	} elseif ($globalMapProvider == 'MapQuest-Aerial') {
772 772
 ?>
773 773
   L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.png', {
774 774
     maxZoom: 18,
@@ -777,27 +777,27 @@  discard block
 block discarded – undo
777 777
       '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"'
778 778
   }).addTo(map);
779 779
 <?php
780
-    } elseif ($globalMapProvider == 'Google-Roadmap') {
780
+	} elseif ($globalMapProvider == 'Google-Roadmap') {
781 781
 ?>
782 782
     var googleLayer = new L.Google('ROADMAP');
783 783
     map.addLayer(googleLayer);
784 784
 <?php
785
-    } elseif ($globalMapProvider == 'Google-Satellite') {
785
+	} elseif ($globalMapProvider == 'Google-Satellite') {
786 786
 ?>
787 787
     var googleLayer = new L.Google('SATELLITE');
788 788
     map.addLayer(googleLayer);
789 789
 <?php
790
-    } elseif ($globalMapProvider == 'Google-Hybrid') {
790
+	} elseif ($globalMapProvider == 'Google-Hybrid') {
791 791
 ?>
792 792
     var googleLayer = new L.Google('HYBRID');
793 793
     map.addLayer(googleLayer);
794 794
 <?php
795
-    } elseif ($globalMapProvider == 'Google-Terrain') {
795
+	} elseif ($globalMapProvider == 'Google-Terrain') {
796 796
 ?>
797 797
     var googleLayer = new L.Google('Terrain');
798 798
     map.addLayer(googleLayer);
799 799
 <?php
800
-    } elseif (isset($globalMapCustomLayer[$globalMapProvider])) {
800
+	} elseif (isset($globalMapCustomLayer[$globalMapProvider])) {
801 801
 	$customid = $globalMapProvider;
802 802
 ?>
803 803
     L.tileLayer('<?php print $globalMapCustomLayer[$customid]['url']; ?>/{z}/{x}/{y}.png', {
@@ -807,8 +807,8 @@  discard block
 block discarded – undo
807 807
         attribution: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>'
808 808
     }).addTo(map);
809 809
 <?php
810
-    //} elseif ($globalMapProvider == 'OpenStreetMap') {
811
-    } else {
810
+	//} elseif ($globalMapProvider == 'OpenStreetMap') {
811
+	} else {
812 812
 ?>
813 813
   L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
814 814
     maxZoom: 18,
@@ -817,7 +817,7 @@  discard block
 block discarded – undo
817 817
   }).addTo(map);
818 818
 
819 819
 <?php
820
-    }
820
+	}
821 821
 ?>
822 822
         </script>
823 823
     </div>
Please login to merge, or discard this patch.
Braces   +77 added lines, -17 removed lines patch added patch discarded remove patch
@@ -6,10 +6,15 @@  discard block
 block discarded – undo
6 6
 //gets the page file and stores it in a variable
7 7
 $file_path = pathinfo($_SERVER['SCRIPT_NAME']);
8 8
 $current_page = $file_path['filename'];
9
-if ($globalTimezone == '') $globalTimezone = 'UTC';
9
+if ($globalTimezone == '') {
10
+	$globalTimezone = 'UTC';
11
+}
10 12
 date_default_timezone_set($globalTimezone);
11
-if (isset($_COOKIE['MapType']) && $_COOKIE['MapType'] != '') $MapType = $_COOKIE['MapType'];
12
-else $MapType = $globalMapProvider;
13
+if (isset($_COOKIE['MapType']) && $_COOKIE['MapType'] != '') {
14
+	$MapType = $_COOKIE['MapType'];
15
+} else {
16
+	$MapType = $globalMapProvider;
17
+}
13 18
 
14 19
 
15 20
 if (isset($_GET['3d'])) {
@@ -241,7 +246,13 @@  discard block
 block discarded – undo
241 246
 <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script>
242 247
 <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script>
243 248
 <script src="<?php print $globalURL; ?>/js/map.common.js"></script>
244
-<script src="<?php print $globalURL; ?>/js/map.2d.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script>
249
+<script src="<?php print $globalURL; ?>/js/map.2d.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) {
250
+	print '&latitude='.$latitude;
251
+}
252
+?><?php if(isset($longitude)) {
253
+	print '&longitude='.$longitude;
254
+}
255
+?>&<?php print time(); ?>"></script>
245 256
 <?php
246 257
 		if (!isset($type) || $type == 'aircraft') {
247 258
 ?>
@@ -314,7 +325,13 @@  discard block
 block discarded – undo
314 325
 <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script>
315 326
 <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script>
316 327
 <script src="<?php print $globalURL; ?>/js/map.common.js"></script>
317
-<script src="<?php print $globalURL; ?>/js/map.2d.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script>
328
+<script src="<?php print $globalURL; ?>/js/map.2d.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if(isset($latitude)) {
329
+	print '&latitude='.$latitude;
330
+}
331
+?><?php if(isset($longitude)) {
332
+	print '&longitude='.$longitude;
333
+}
334
+?>&<?php print time(); ?>"></script>
318 335
 <script src="<?php print $globalURL; ?>/js/map-aircraft.2d.js.php?flightaware_id=<?php print $flightaware_id; ?>&<?php print time(); ?>"></script>
319 336
 <?php
320 337
 		if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '' && ($MapType == 'Google-Roadmap' || $MapType == 'Google-Satellite' || $MapType == 'Google-Hybrid' || $MapType == 'Google-Terrain')) {
@@ -395,7 +412,12 @@  discard block
 block discarded – undo
395 412
         <span class="icon-bar"></span>
396 413
       </button>
397 414
       <a href="<?php print $globalURL; ?>/search" class="navbar-toggle navbar-toggle-search"><i class="fa fa-search"></i></a>
398
-      <a class="navbar-brand" href="<?php if ($globalURL == '') print '/'; else print $globalURL; ?>"><img src="<?php print $globalURL.$logoURL; ?>" height="30px" /></a>
415
+      <a class="navbar-brand" href="<?php if ($globalURL == '') {
416
+	print '/';
417
+} else {
418
+	print $globalURL;
419
+}
420
+?>"><img src="<?php print $globalURL.$logoURL; ?>" height="30px" /></a>
399 421
     </div>
400 422
     <div class="collapse navbar-collapse">
401 423
 
@@ -434,7 +456,10 @@  discard block
 block discarded – undo
434 456
 <?php
435 457
     }
436 458
 ?>
437
-          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
459
+          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) {
460
+	echo 'right-';
461
+}
462
+?>caret"></b></a>
438 463
           <ul class="dropdown-menu">
439 464
           	<li><a href="<?php print $globalURL; ?>/aircraft"><?php echo _("Aircrafts Types"); ?></a></li>
440 465
 <?php
@@ -505,8 +530,14 @@  discard block
 block discarded – undo
505 530
         </li>
506 531
       	<li><a href="<?php print $globalURL; ?>/search"><?php echo _("Search"); ?></a></li>
507 532
       	<li><a href="<?php print $globalURL; ?>/statistics"><?php echo _("Statistics"); ?></a></li>
508
-        <li class="dropdown<?php if ($sub) echo '-submenu'; ?>">
509
-          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Tools"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
533
+        <li class="dropdown<?php if ($sub) {
534
+	echo '-submenu';
535
+}
536
+?>">
537
+          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Tools"); ?> <b class="<?php if ($sub) {
538
+	echo 'right-';
539
+}
540
+?>caret"></b></a>
510 541
           <ul class="dropdown-menu">
511 542
           	<li><a href="<?php print $globalURL; ?>/tools/acars"><?php echo _("ACARS translator"); ?></a></li>
512 543
           	<li><a href="<?php print $globalURL; ?>/tools/metar"><?php echo _("METAR translator"); ?></a></li>
@@ -542,7 +573,10 @@  discard block
 block discarded – undo
542 573
 <?php
543 574
 	}
544 575
 ?>
545
-		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
576
+		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) {
577
+	echo 'right-';
578
+}
579
+?>caret"></b></a>
546 580
 		<ul class="dropdown-menu">
547 581
 		    <li><a href="<?php print $globalURL; ?>/marine/currently"><?php echo _("Current Activity"); ?></a></li>
548 582
 		    <li><a href="<?php print $globalURL; ?>/marine/latest"><?php echo _("Latest Activity"); ?></a></li>
@@ -575,7 +609,10 @@  discard block
 block discarded – undo
575 609
 <?php
576 610
 	}
577 611
 ?>
578
-		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
612
+		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) {
613
+	echo 'right-';
614
+}
615
+?>caret"></b></a>
579 616
 		<ul class="dropdown-menu">
580 617
 		    <li><a href="<?php print $globalURL; ?>/tracker/currently"><?php echo _("Current Activity"); ?></a></li>
581 618
 		    <li><a href="<?php print $globalURL; ?>/tracker/latest"><?php echo _("Latest Activity"); ?></a></li>
@@ -609,7 +646,10 @@  discard block
 block discarded – undo
609 646
 	}
610 647
 ?>
611 648
 <!--
612
-		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
649
+		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) {
650
+	echo 'right-';
651
+}
652
+?>caret"></b></a>
613 653
 		<ul class="dropdown-menu">
614 654
 		    <li><a href="<?php print $globalURL; ?>/satellite/currently"><?php echo _("Current Activity"); ?></a></li>
615 655
 		    <li><a href="<?php print $globalURL; ?>/satellite/latest"><?php echo _("Latest Activity"); ?></a></li>
@@ -666,7 +706,9 @@  discard block
 block discarded – undo
666 706
   		        $alllang = $Language->getLanguages();
667 707
   		        foreach ($alllang as $key => $lang) {
668 708
   		            print '<option value="'.$key.'"';
669
-  		            if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected ';
709
+  		            if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) {
710
+  		            	print ' selected ';
711
+  		            }
670 712
   		            print '>'.$lang[0].'</option>';
671 713
   		        }
672 714
   		    ?>
@@ -806,9 +848,24 @@  discard block
 block discarded – undo
806 848
 	$customid = $globalMapProvider;
807 849
 ?>
808 850
     L.tileLayer('<?php print $globalMapCustomLayer[$customid]['url']; ?>/{z}/{x}/{y}.png', {
809
-        maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) print $globalMapCustomLayer[$customid]['maxZoom']; else print '18'; ?>,
810
-        minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) print $globalMapCustomLayer[$customid]['minZoom']; else print '0'; ?>,
811
-        noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
851
+        maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) {
852
+	print $globalMapCustomLayer[$customid]['maxZoom'];
853
+} else {
854
+	print '18';
855
+}
856
+?>,
857
+        minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) {
858
+	print $globalMapCustomLayer[$customid]['minZoom'];
859
+} else {
860
+	print '0';
861
+}
862
+?>,
863
+        noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
864
+	print 'false';
865
+} else {
866
+	print 'true';
867
+}
868
+?>,
812 869
         attribution: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>'
813 870
     }).addTo(map);
814 871
 <?php
@@ -831,4 +888,7 @@  discard block
 block discarded – undo
831 888
 
832 889
 ?>
833 890
 
834
-<section class="container main-content <?php if (strtolower($current_page) == 'index') print 'index '; ?>clear">
891
+<section class="container main-content <?php if (strtolower($current_page) == 'index') {
892
+	print 'index ';
893
+}
894
+?>clear">
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -13,31 +13,31 @@  discard block
 block discarded – undo
13 13
 
14 14
 
15 15
 if (isset($_GET['3d'])) {
16
-	setcookie('MapFormat','3d');
16
+	setcookie('MapFormat', '3d');
17 17
 } else if (isset($_GET['2d'])) {
18
-	setcookie('MapFormat','2d');
18
+	setcookie('MapFormat', '2d');
19 19
 }
20 20
 
21 21
 if (isset($_POST['archive'])) {
22
-	setcookie('archive','true');
23
-	setcookie('archive_begin',strtotime($_POST['start_date']));
24
-	setcookie('archive_end',strtotime($_POST['end_date']));
25
-	setcookie('archive_speed',$_POST['archivespeed']);
22
+	setcookie('archive', 'true');
23
+	setcookie('archive_begin', strtotime($_POST['start_date']));
24
+	setcookie('archive_end', strtotime($_POST['end_date']));
25
+	setcookie('archive_speed', $_POST['archivespeed']);
26 26
 }
27 27
 if (isset($_POST['noarchive'])) {
28
-	setcookie('archive','false',-1);
29
-	setcookie('archive_begin','',-1);
30
-	setcookie('archive_end','',-1);
31
-	setcookie('archive_speed','',-1);
28
+	setcookie('archive', 'false', -1);
29
+	setcookie('archive_begin', '', -1);
30
+	setcookie('archive_end', '', -1);
31
+	setcookie('archive_speed', '', -1);
32 32
 }
33 33
 // When button "Remove all filters" is clicked
34 34
 if (isset($_POST['removefilters'])) {
35
-	$allfilters = array_filter(array_keys($_COOKIE),function($key) {
36
-	    return strpos($key,'filter_') === 0;
35
+	$allfilters = array_filter(array_keys($_COOKIE), function($key) {
36
+	    return strpos($key, 'filter_') === 0;
37 37
 	});
38 38
 	foreach ($allfilters as $filt) {
39 39
 		unset($_COOKIE[$filt]);
40
-		setcookie($filt,null,-1);
40
+		setcookie($filt, null, -1);
41 41
 	}
42 42
 }
43 43
 ?>
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script>
242 242
 <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script>
243 243
 <script src="<?php print $globalURL; ?>/js/map.common.js"></script>
244
-<script src="<?php print $globalURL; ?>/js/map.2d.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script>
244
+<script src="<?php print $globalURL; ?>/js/map.2d.js.php?ident=<?php print $ident; ?><?php if (isset($latitude)) print '&latitude='.$latitude; ?><?php if (isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script>
245 245
 <?php
246 246
 		if (!isset($type) || $type == 'aircraft') {
247 247
 ?>
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script>
315 315
 <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script>
316 316
 <script src="<?php print $globalURL; ?>/js/map.common.js"></script>
317
-<script src="<?php print $globalURL; ?>/js/map.2d.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script>
317
+<script src="<?php print $globalURL; ?>/js/map.2d.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if (isset($latitude)) print '&latitude='.$latitude; ?><?php if (isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script>
318 318
 <script src="<?php print $globalURL; ?>/js/map-aircraft.2d.js.php?flightaware_id=<?php print $flightaware_id; ?>&<?php print time(); ?>"></script>
319 319
 <?php
320 320
 		if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '' && ($MapType == 'Google-Roadmap' || $MapType == 'Google-Satellite' || $MapType == 'Google-Hybrid' || $MapType == 'Google-Terrain')) {
@@ -678,8 +678,8 @@  discard block
 block discarded – undo
678 678
 ?>
679 679
       <div class="search">
680 680
       <form action="<?php print $globalURL; ?>/search" method="get">
681
-		<!--<input type="text" name="q" value="<?php if (isset($GET['q'])) { if ($_GET['q'] != ""){ print $_GET['q']; } else { print _("Search"); } } else { print _("Search"); } ?>" onfocus="if (this.value=='search'){this.value='';}" /><button type="submit"><i class="fa fa-search"></i></button>-->
682
-		<input type="text" name="callsign" value="<?php if (isset($GET['callsign'])) { if ($_GET['callsign'] != ""){ print $_GET['callsign']; } else { print _("Search"); } } else { print _("Search"); } ?>" onfocus="if (this.value=='search'){this.value='';}" /><button type="submit"><i class="fa fa-search"></i></button>
681
+		<!--<input type="text" name="q" value="<?php if (isset($GET['q'])) { if ($_GET['q'] != "") { print $_GET['q']; } else { print _("Search"); } } else { print _("Search"); } ?>" onfocus="if (this.value=='search'){this.value='';}" /><button type="submit"><i class="fa fa-search"></i></button>-->
682
+		<input type="text" name="callsign" value="<?php if (isset($GET['callsign'])) { if ($_GET['callsign'] != "") { print $_GET['callsign']; } else { print _("Search"); } } else { print _("Search"); } ?>" onfocus="if (this.value=='search'){this.value='';}" /><button type="submit"><i class="fa fa-search"></i></button>
683 683
 	</form>
684 684
 	</div>
685 685
   	<div class="social">
@@ -697,7 +697,7 @@  discard block
 block discarded – undo
697 697
 	print '</div>';
698 698
 }
699 699
 
700
-if (strtolower($current_page) =='ident-detailed' || strtolower($current_page) == 'flightid-overview') {
700
+if (strtolower($current_page) == 'ident-detailed' || strtolower($current_page) == 'flightid-overview') {
701 701
 ?>
702 702
     <div class="top-header clear" role="main">
703 703
 <?php
@@ -710,7 +710,7 @@  discard block
 block discarded – undo
710 710
     </div>
711 711
 <?php
712 712
 }
713
-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))
713
+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))
714 714
 {
715 715
     ?>
716 716
     <div class="top-header clear" role="main">
@@ -723,15 +723,15 @@  discard block
 block discarded – undo
723 723
         var zoom = 13;
724 724
 //create the map
725 725
 <?php
726
-    if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) {
726
+    if (strpos(strtolower($current_page), 'airport-') !== false && strpos(strtolower($current_page), 'statistics-') === false && isset($airport_array[0]['latitude'])) {
727 727
 ?>
728 728
   map = L.map('map', { zoomControl:true }).setView([<?php print $airport_array[0]['latitude']; ?>,<?php print $airport_array[0]['longitude']; ?>], zoom);
729 729
 <?php
730
-    } elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) {
730
+    } elseif (strpos(strtolower($current_page), 'airport-') !== false && strpos(strtolower($current_page), 'statistics-') === false) {
731 731
 ?>
732 732
   map = L.map('map', { zoomControl:true });
733 733
 <?php
734
-    } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) {
734
+    } elseif (strpos(strtolower($current_page), 'route-') !== false && strpos(strtolower($current_page), 'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) {
735 735
 ?>
736 736
   map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['departure_airport_latitude']; ?>,<?php print $spotter_array[0]['arrival_airport_longitude']; ?>]);
737 737
     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);
@@ -739,7 +739,7 @@  discard block
 block discarded – undo
739 739
     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);
740 740
     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);
741 741
 <?php
742
-    } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude']) && isset($spotter_array[0]['latitude'])) {
742
+    } elseif (strpos(strtolower($current_page), 'route-') !== false && strpos(strtolower($current_page), 'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude']) && isset($spotter_array[0]['latitude'])) {
743 743
 ?>
744 744
   map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['latitude']; ?>,<?php print $spotter_array[0]['longitude']; ?>]);
745 745
 <?php
Please login to merge, or discard this patch.
pilot-detailed.php 2 patches
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -5,13 +5,13 @@  discard block
 block discarded – undo
5 5
 require_once('require/class.Language.php');
6 6
 require_once('require/class.SpotterArchive.php');
7 7
 
8
-if (!isset($_GET['pilot'])){
8
+if (!isset($_GET['pilot'])) {
9 9
 	header('Location: '.$globalURL.'/');
10 10
 } else {
11 11
 	$Spotter = new Spotter();
12 12
 	$SpotterArchive = new SpotterArchive();
13 13
 	//calculuation for the pagination
14
-	if(!isset($_GET['limit']))
14
+	if (!isset($_GET['limit']))
15 15
 	{
16 16
 		$limit_start = 0;
17 17
 		$limit_end = 25;
@@ -32,29 +32,29 @@  discard block
 block discarded – undo
32 32
 	
33 33
 	$page_url = $globalURL.'/pilot/'.$_GET['pilot'];
34 34
 	
35
-	$pilot = filter_input(INPUT_GET,'pilot',FILTER_SANITIZE_STRING);
36
-	$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
37
-	$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
38
-	$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
35
+	$pilot = filter_input(INPUT_GET, 'pilot', FILTER_SANITIZE_STRING);
36
+	$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
37
+	$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT);
38
+	$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT);
39 39
 	$filter = array();
40
-	if ($year != '') $filter = array_merge($filter,array('year' => $year));
41
-	if ($month != '') $filter = array_merge($filter,array('month' => $month));
40
+	if ($year != '') $filter = array_merge($filter, array('year' => $year));
41
+	if ($month != '') $filter = array_merge($filter, array('month' => $month));
42 42
 	if ($sort != '') 
43 43
 	{
44
-		$spotter_array = $Spotter->getSpotterDataByPilot($pilot,$limit_start.",".$absolute_difference, $sort,$filter);
44
+		$spotter_array = $Spotter->getSpotterDataByPilot($pilot, $limit_start.",".$absolute_difference, $sort, $filter);
45 45
 		if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) {
46
-			$spotter_array = $SpotterArchive->getSpotterDataByPilot($pilot,$limit_start.",".$absolute_difference, $sort,$filter);
46
+			$spotter_array = $SpotterArchive->getSpotterDataByPilot($pilot, $limit_start.",".$absolute_difference, $sort, $filter);
47 47
 		}
48 48
 	} else {
49
-		$spotter_array = $Spotter->getSpotterDataByPilot($pilot,$limit_start.",".$absolute_difference,'',$filter);
49
+		$spotter_array = $Spotter->getSpotterDataByPilot($pilot, $limit_start.",".$absolute_difference, '', $filter);
50 50
 		if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) {
51
-			$spotter_array = $SpotterArchive->getSpotterDataByPilot($pilot,$limit_start.",".$absolute_difference,'',$filter);
51
+			$spotter_array = $SpotterArchive->getSpotterDataByPilot($pilot, $limit_start.",".$absolute_difference, '', $filter);
52 52
 		}
53 53
 	}
54 54
 
55 55
 	if (!empty($spotter_array))
56 56
 	{
57
-		$title = sprintf(_("Detailed View for %s"),$spotter_array[0]['pilot_name']);
57
+		$title = sprintf(_("Detailed View for %s"), $spotter_array[0]['pilot_name']);
58 58
 		$ident = $spotter_array[0]['ident'];
59 59
 		if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude'];
60 60
 		if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude'];
@@ -115,23 +115,23 @@  discard block
 block discarded – undo
115 115
 			$Stats = new Stats();
116 116
 			$flights = $Stats->getStatsPilot($pilot);
117 117
 		} else $flights = 0;
118
-		if ($flights == 0) $flights = $Spotter->countFlightsByPilot($pilot,$filter);
118
+		if ($flights == 0) $flights = $Spotter->countFlightsByPilot($pilot, $filter);
119 119
 		print '<div><span class="label">'._("Flights").'</span>'.$flights.'</div>';
120
-		$aircraft_type = count($Spotter->countAllAircraftTypesByPilot($pilot,$filter));
120
+		$aircraft_type = count($Spotter->countAllAircraftTypesByPilot($pilot, $filter));
121 121
 		print '<div><span class="label">'._("Aircrafts type").'</span>'.$aircraft_type.'</div>';
122
-		$aircraft_registration = count($Spotter->countAllAircraftRegistrationByPilot($pilot,$filter));
122
+		$aircraft_registration = count($Spotter->countAllAircraftRegistrationByPilot($pilot, $filter));
123 123
 		print '<div><span class="label">'._("Aircrafts").'</span>'.$aircraft_registration.'</div>';
124
-		$aircraft_manufacturer = count($Spotter->countAllAircraftManufacturerByPilot($pilot,$filter));
124
+		$aircraft_manufacturer = count($Spotter->countAllAircraftManufacturerByPilot($pilot, $filter));
125 125
 		print '<div><span class="label">'._("Manufacturers").'</span>'.$aircraft_manufacturer.'</div>';
126
-		$airlines = count($Spotter->countAllAirlinesByPilot($pilot,$filter));
126
+		$airlines = count($Spotter->countAllAirlinesByPilot($pilot, $filter));
127 127
 		print '<div><span class="label">'._("Airlines").'</span>'.$airlines.'</div>';
128
-		$duration = $Spotter->getFlightDurationByPilot($pilot,$filter);
128
+		$duration = $Spotter->getFlightDurationByPilot($pilot, $filter);
129 129
 		if ($duration != '0') print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>';
130 130
 		print '</div>';
131 131
 	
132 132
 		include('pilot-sub-menu.php');
133 133
 		print '<div class="table column">';
134
-		print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the pilot <strong>%s</strong>."),$spotter_array[0]['pilot_name']).'</p>';
134
+		print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the pilot <strong>%s</strong>."), $spotter_array[0]['pilot_name']).'</p>';
135 135
 
136 136
 		include('table-output.php'); 
137 137
 		print '<div class="pagination">';
Please login to merge, or discard this patch.
Braces   +24 added lines, -8 removed lines patch added patch discarded remove patch
@@ -37,8 +37,12 @@  discard block
 block discarded – undo
37 37
 	$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
38 38
 	$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
39 39
 	$filter = array();
40
-	if ($year != '') $filter = array_merge($filter,array('year' => $year));
41
-	if ($month != '') $filter = array_merge($filter,array('month' => $month));
40
+	if ($year != '') {
41
+		$filter = array_merge($filter,array('year' => $year));
42
+	}
43
+	if ($month != '') {
44
+		$filter = array_merge($filter,array('month' => $month));
45
+	}
42 46
 	if ($sort != '') 
43 47
 	{
44 48
 		$spotter_array = $Spotter->getSpotterDataByPilot($pilot,$limit_start.",".$absolute_difference, $sort,$filter);
@@ -56,8 +60,12 @@  discard block
 block discarded – undo
56 60
 	{
57 61
 		$title = sprintf(_("Detailed View for %s"),$spotter_array[0]['pilot_name']);
58 62
 		$ident = $spotter_array[0]['ident'];
59
-		if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude'];
60
-		if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude'];
63
+		if (isset($spotter_array[0]['latitude'])) {
64
+			$latitude = $spotter_array[0]['latitude'];
65
+		}
66
+		if (isset($spotter_array[0]['longitude'])) {
67
+			$longitude = $spotter_array[0]['longitude'];
68
+		}
61 69
 		require_once('header.php');
62 70
 		/*
63 71
 		if (isset($globalArchive) && $globalArchive) {
@@ -110,12 +118,18 @@  discard block
 block discarded – undo
110 118
 		*/
111 119
 		print '<div class="info column">';
112 120
 		print '<h1>'.$spotter_array[0]['pilot_name'].'</h1>';
113
-		if (isset($spotter_array[0]['pilot_id']) && $spotter_array[0]['pilot_id'] != '') print '<div><span class="label">'._("Pilot ID").'</span>'.$spotter_array[0]['pilot_id'].'</div>';
121
+		if (isset($spotter_array[0]['pilot_id']) && $spotter_array[0]['pilot_id'] != '') {
122
+			print '<div><span class="label">'._("Pilot ID").'</span>'.$spotter_array[0]['pilot_id'].'</div>';
123
+		}
114 124
 		if ($year == '' && $month == '') {
115 125
 			$Stats = new Stats();
116 126
 			$flights = $Stats->getStatsPilot($pilot);
117
-		} else $flights = 0;
118
-		if ($flights == 0) $flights = $Spotter->countFlightsByPilot($pilot,$filter);
127
+		} else {
128
+			$flights = 0;
129
+		}
130
+		if ($flights == 0) {
131
+			$flights = $Spotter->countFlightsByPilot($pilot,$filter);
132
+		}
119 133
 		print '<div><span class="label">'._("Flights").'</span>'.$flights.'</div>';
120 134
 		$aircraft_type = count($Spotter->countAllAircraftTypesByPilot($pilot,$filter));
121 135
 		print '<div><span class="label">'._("Aircrafts type").'</span>'.$aircraft_type.'</div>';
@@ -126,7 +140,9 @@  discard block
 block discarded – undo
126 140
 		$airlines = count($Spotter->countAllAirlinesByPilot($pilot,$filter));
127 141
 		print '<div><span class="label">'._("Airlines").'</span>'.$airlines.'</div>';
128 142
 		$duration = $Spotter->getFlightDurationByPilot($pilot,$filter);
129
-		if ($duration != '0') print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>';
143
+		if ($duration != '0') {
144
+			print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>';
145
+		}
130 146
 		print '</div>';
131 147
 	
132 148
 		include('pilot-sub-menu.php');
Please login to merge, or discard this patch.
route.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -5,8 +5,8 @@
 block discarded – undo
5 5
 
6 6
 if (isset($_POST['departure_airport']) && $_POST['departure_airport'] != '')
7 7
 {
8
-	$departure_airport = filter_input(INPUT_POST,'departure_airport',FILTER_SANITIZE_STRING);
9
-	$arrival_airport = filter_input(INPUT_POST,'arrival_airport',FILTER_SANITIZE_STRING);
8
+	$departure_airport = filter_input(INPUT_POST, 'departure_airport', FILTER_SANITIZE_STRING);
9
+	$arrival_airport = filter_input(INPUT_POST, 'arrival_airport', FILTER_SANITIZE_STRING);
10 10
 	header('Location: '.$globalURL.'/route/'.$departure_airport.'/'.$arrival_airport);
11 11
 } else {
12 12
 	if ($globalURL == '') {
Please login to merge, or discard this patch.
country-detailed.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -3,17 +3,17 @@  discard block
 block discarded – undo
3 3
 require_once('require/class.Spotter.php');
4 4
 require_once('require/class.Language.php');
5 5
 
6
-if (!isset($_GET['country'])){
6
+if (!isset($_GET['country'])) {
7 7
 	header('Location: '.$globalURL.'');
8 8
 } else {
9 9
 	$Spotter = new Spotter();
10 10
 	//calculuation for the pagination
11
-	if(!isset($_GET['limit']))
11
+	if (!isset($_GET['limit']))
12 12
 	{
13 13
 		$limit_start = 0;
14 14
 		$limit_end = 25;
15 15
 		$absolute_difference = 25;
16
-	}  else {
16
+	} else {
17 17
 		$limit_explode = explode(",", $_GET['limit']);
18 18
 		if (isset($limit_explode[1])) {
19 19
 			$limit_start = $limit_explode[0];
@@ -32,10 +32,10 @@  discard block
 block discarded – undo
32 32
 	$limit_previous_1 = $limit_start - $absolute_difference;
33 33
 	$limit_previous_2 = $limit_end - $absolute_difference;
34 34
 	
35
-	$country = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET,'country',FILTER_SANITIZE_STRING))));
35
+	$country = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET, 'country', FILTER_SANITIZE_STRING))));
36 36
 	
37 37
 	$page_url = $globalURL.'/country/'.$_GET['country'];
38
-	$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
38
+	$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
39 39
 	if ($country == 'Na') {
40 40
 		$spotter_array = array();
41 41
 	} else {
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 
49 49
 	if (!empty($spotter_array))
50 50
 	{
51
-		$title = sprintf(_("Detailed View for Airports &amp; Airlines from %s"),$country);
51
+		$title = sprintf(_("Detailed View for Airports &amp; Airlines from %s"), $country);
52 52
 
53 53
 		require_once('header.php');
54 54
 		print '<div class="select-item">';
@@ -56,9 +56,9 @@  discard block
 block discarded – undo
56 56
 		print '<select name="country" class="selectpicker" data-live-search="true">';
57 57
 		print '<option></option>';
58 58
 		$all_countries = $Spotter->getAllCountries();
59
-		foreach($all_countries as $all_country)
59
+		foreach ($all_countries as $all_country)
60 60
 		{
61
-			if($country == $all_country['country'])
61
+			if ($country == $all_country['country'])
62 62
 			{
63 63
 				print '<option value="'.strtolower(str_replace(" ", "-", $all_country['country'])).'" selected="selected">'.$all_country['country'].'</option>';
64 64
 			} else {
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 		if ($_GET['country'] != "NA")
74 74
 		{
75 75
 			print '<div class="info column">';
76
-			print '<h1>'.sprintf(_("Airports &amp; Airlines from %s"),$country).'</h1>';
76
+			print '<h1>'.sprintf(_("Airports &amp; Airlines from %s"), $country).'</h1>';
77 77
 			print '</div>';
78 78
 		} else {
79 79
 			print '<div class="alert alert-warning">'._("This special country profile shows all flights that do <u>not</u> have a country of a airline or departure/arrival airport associated with them.").'</div>';
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 
82 82
 		include('country-sub-menu.php');
83 83
 		print '<div class="table column">';
84
-		print '<p>'.sprintf(_("The table below shows the detailed information of all flights of airports (both departure &amp; arrival) OR airlines from <strong>%s</strong>."),$country).'</p>';
84
+		print '<p>'.sprintf(_("The table below shows the detailed information of all flights of airports (both departure &amp; arrival) OR airlines from <strong>%s</strong>."), $country).'</p>';
85 85
 
86 86
 		include('table-output.php');
87 87
 		print '<div class="pagination">';
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
 		$limit_start = 0;
14 14
 		$limit_end = 25;
15 15
 		$absolute_difference = 25;
16
-	}  else {
16
+	} else {
17 17
 		$limit_explode = explode(",", $_GET['limit']);
18 18
 		if (isset($limit_explode[1])) {
19 19
 			$limit_start = $limit_explode[0];
Please login to merge, or discard this patch.
search-kml.php 2 patches
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -5,14 +5,14 @@  discard block
 block discarded – undo
5 5
 $Spotter = new Spotter();
6 6
 if (isset($_GET['start_date'])) {
7 7
 	//for the date manipulation into the query
8
-	if($_GET['start_date'] != "" && $_GET['end_date'] != ""){
8
+	if ($_GET['start_date'] != "" && $_GET['end_date'] != "") {
9 9
 		$start_date = $_GET['start_date'].":00";
10 10
 		$end_date = $_GET['end_date'].":00";
11 11
 		$sql_date = $start_date.",".$end_date;
12
-	} else if($_GET['start_date'] != ""){
12
+	} else if ($_GET['start_date'] != "") {
13 13
 		$start_date = $_GET['start_date'].":00";
14 14
 		$sql_date = $start_date;
15
-	} else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){
15
+	} else if ($_GET['start_date'] == "" && $_GET['end_date'] != "") {
16 16
 		$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00";
17 17
 		$sql_date = $end_date;
18 18
 	} else $sql_date = '';
@@ -20,38 +20,38 @@  discard block
 block discarded – undo
20 20
 
21 21
 if (isset($_GET['highest_altitude'])) {
22 22
 	//for altitude manipulation
23
-	if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){
24
-		$end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT);
25
-		$start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT);
23
+	if ($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != "") {
24
+		$end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT);
25
+		$start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT);
26 26
 		$sql_altitude = $start_altitude.",".$end_altitude;
27
-	} else if($_GET['highest_altitude'] != ""){
28
-		$end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT);
27
+	} else if ($_GET['highest_altitude'] != "") {
28
+		$end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT);
29 29
 		$sql_altitude = $end_altitude;
30
-	} else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){
31
-		$start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000";
30
+	} else if ($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != "") {
31
+		$start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT).",60000";
32 32
 		$sql_altitude = $start_altitude;
33 33
 	} else $sql_altitude = '';
34 34
 } else $sql_altitude = '';
35 35
 
36 36
 //calculuation for the pagination
37
-if(!isset($_GET['limit']))
37
+if (!isset($_GET['limit']))
38 38
 {
39 39
 	if (!isset($_GET['number_results'])) {
40 40
 		$limit_start = 0;
41 41
 		$limit_end = 25;
42 42
 		$absolute_difference = 25;
43 43
 	} else {
44
-		if ($_GET['number_results'] > 1000){
44
+		if ($_GET['number_results'] > 1000) {
45 45
 			$_GET['number_results'] = 1000;
46 46
 		}
47 47
 		$limit_start = 0;
48
-		$limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
49
-		$absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
48
+		$limit_end = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT);
49
+		$absolute_difference = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT);
50 50
 	}
51
-}  else {
51
+} else {
52 52
 	$limit_explode = explode(",", $_GET['limit']);
53
-	$limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT);
54
-	$limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT);
53
+	$limit_start = filter_var($limit_explode[0], FILTER_SANITIZE_NUMBER_INT);
54
+	$limit_end = filter_var($limit_explode[1], FILTER_SANITIZE_NUMBER_INT);
55 55
 }
56 56
 
57 57
 $absolute_difference = abs($limit_start - $limit_end);
@@ -68,23 +68,23 @@  discard block
 block discarded – undo
68 68
 
69 69
 if (isset($_GET['sort'])) $sort = $_GET['sort'];
70 70
 else $sort = '';
71
-$q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING);
72
-$registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING);
73
-$aircraft = filter_input(INPUT_GET,'aircraft',FILTER_SANITIZE_STRING);
74
-$manufacturer = filter_input(INPUT_GET,'manufacturer',FILTER_SANITIZE_STRING);
75
-$highlights = filter_input(INPUT_GET,'highlights',FILTER_SANITIZE_STRING);
76
-$airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
77
-$airline_country = filter_input(INPUT_GET,'airline_country',FILTER_SANITIZE_STRING);
78
-$airline_type = filter_input(INPUT_GET,'airline_type',FILTER_SANITIZE_STRING);
79
-$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING);
80
-$airport_country = filter_input(INPUT_GET,'airport_country',FILTER_SANITIZE_STRING);
81
-$callsign = filter_input(INPUT_GET,'callsign',FILTER_SANITIZE_STRING);
82
-$owner = filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING);
83
-$pilot_id = filter_input(INPUT_GET,'pilot_id',FILTER_SANITIZE_STRING);
84
-$pilot_name = filter_input(INPUT_GET,'pilot_name',FILTER_SANITIZE_STRING);
85
-$departure_airport_route = filter_input(INPUT_GET,'departure_airport_route',FILTER_SANITIZE_STRING);
86
-$arrival_airport_route = filter_input(INPUT_GET,'arrival_airport_route',FILTER_SANITIZE_STRING);
87
-$spotter_array = $Spotter->searchSpotterData($q,$registration,$aircraft,strtolower(str_replace("-", " ", $manufacturer)),$highlights,$airline,$airline_country,$airline_type,$airport,$airport_country,$callsign,$departure_airport_route,$arrival_airport_route,$owner,$pilot_id,$pilot_name,$sql_altitude,$sql_date,$limit_start.",".$absolute_difference,$sort,'');
71
+$q = filter_input(INPUT_GET, 'q', FILTER_SANITIZE_STRING);
72
+$registration = filter_input(INPUT_GET, 'registratrion', FILTER_SANITIZE_STRING);
73
+$aircraft = filter_input(INPUT_GET, 'aircraft', FILTER_SANITIZE_STRING);
74
+$manufacturer = filter_input(INPUT_GET, 'manufacturer', FILTER_SANITIZE_STRING);
75
+$highlights = filter_input(INPUT_GET, 'highlights', FILTER_SANITIZE_STRING);
76
+$airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
77
+$airline_country = filter_input(INPUT_GET, 'airline_country', FILTER_SANITIZE_STRING);
78
+$airline_type = filter_input(INPUT_GET, 'airline_type', FILTER_SANITIZE_STRING);
79
+$airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING);
80
+$airport_country = filter_input(INPUT_GET, 'airport_country', FILTER_SANITIZE_STRING);
81
+$callsign = filter_input(INPUT_GET, 'callsign', FILTER_SANITIZE_STRING);
82
+$owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING);
83
+$pilot_id = filter_input(INPUT_GET, 'pilot_id', FILTER_SANITIZE_STRING);
84
+$pilot_name = filter_input(INPUT_GET, 'pilot_name', FILTER_SANITIZE_STRING);
85
+$departure_airport_route = filter_input(INPUT_GET, 'departure_airport_route', FILTER_SANITIZE_STRING);
86
+$arrival_airport_route = filter_input(INPUT_GET, 'arrival_airport_route', FILTER_SANITIZE_STRING);
87
+$spotter_array = $Spotter->searchSpotterData($q, $registration, $aircraft, strtolower(str_replace("-", " ", $manufacturer)), $highlights, $airline, $airline_country, $airline_type, $airport, $airport_country, $callsign, $departure_airport_route, $arrival_airport_route, $owner, $pilot_id, $pilot_name, $sql_altitude, $sql_date, $limit_start.",".$absolute_difference, $sort, '');
88 88
 
89 89
 $output = '<?xml version="1.0" encoding="UTF-8"?>';
90 90
 $output .= '<kml xmlns="http://www.opengis.net/kml/2.2">';
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 $output .= '</Style>';
113 113
 
114 114
 if (!empty($spotter_array)) {
115
-	foreach($spotter_array as $spotter_item) {
115
+	foreach ($spotter_array as $spotter_item) {
116 116
 		$altitude = $spotter_item['altitude'].'00';
117 117
 		if ($spotter_item['waypoints'] != '') {
118 118
 			//waypoint plotting
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 			$waypoint_pieces = explode(' ', $spotter_item['waypoints']);
124 124
 			$waypoint_pieces = array_chunk($waypoint_pieces, 2);
125 125
 			foreach ($waypoint_pieces as $waypoint_coordinate) {
126
-				if (isset($waypoint_coordinate[1])) $output .=  $waypoint_coordinate[1].','.$waypoint_coordinate[0].','.$altitude.' ';
126
+				if (isset($waypoint_coordinate[1])) $output .= $waypoint_coordinate[1].','.$waypoint_coordinate[0].','.$altitude.' ';
127 127
 			}
128 128
 			$output .= '</coordinates>';
129 129
 			$output .= '<altitudeMode>absolute</altitudeMode>';
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 		$output .= ' ]]></description>';
168 168
 		$output .= '<styleUrl>#departureAirport</styleUrl>';
169 169
 		$output .= '<Point>';
170
-		$output .=  '<coordinates>'.$spotter_item['departure_airport_longitude'].', '.$spotter_item['departure_airport_latitude'].', '.$spotter_item['departure_airport_altitude'].'</coordinates>';
170
+		$output .= '<coordinates>'.$spotter_item['departure_airport_longitude'].', '.$spotter_item['departure_airport_latitude'].', '.$spotter_item['departure_airport_altitude'].'</coordinates>';
171 171
 		$output .= '<altitudeMode>absolute</altitudeMode>';
172 172
 		$output .= '</Point>';
173 173
 		$output .= '</Placemark>'; 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 		$output .= ' ]]></description>';
209 209
 		$output .= '<styleUrl>#arrivalAirport</styleUrl>';
210 210
 		$output .= '<Point>';
211
-		$output .=  '<coordinates>'.$spotter_item['arrival_airport_longitude'].', '.$spotter_item['arrival_airport_latitude'].', '.$spotter_item['arrival_airport_altitude'].'</coordinates>';
211
+		$output .= '<coordinates>'.$spotter_item['arrival_airport_longitude'].', '.$spotter_item['arrival_airport_latitude'].', '.$spotter_item['arrival_airport_altitude'].'</coordinates>';
212 212
 		$output .= '<altitudeMode>absolute</altitudeMode>';
213 213
 		$output .= '</Point>';
214 214
 		$output .= '</Placemark>'; 
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 		$output .= ' ]]></description>';
253 253
 		$output .= '<styleUrl>#aircraft_'.$spotter_item['spotter_id'].'</styleUrl>';
254 254
 		$output .= '<Point>';
255
-		$output .=  '<coordinates>'.$spotter_item['longitude'].', '.$spotter_item['latitude'].', '.$altitude.'</coordinates>';
255
+		$output .= '<coordinates>'.$spotter_item['longitude'].', '.$spotter_item['latitude'].', '.$altitude.'</coordinates>';
256 256
 		$output .= '<altitudeMode>absolute</altitudeMode>';
257 257
 		$output .= '</Point>';
258 258
 		$output .= '</Placemark>'; 
Please login to merge, or discard this patch.
Braces   +21 added lines, -8 removed lines patch added patch discarded remove patch
@@ -15,8 +15,12 @@  discard block
 block discarded – undo
15 15
 	} else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){
16 16
 		$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00";
17 17
 		$sql_date = $end_date;
18
-	} else $sql_date = '';
19
-} else $sql_date = '';
18
+	} else {
19
+		$sql_date = '';
20
+	}
21
+	} else {
22
+	$sql_date = '';
23
+}
20 24
 
21 25
 if (isset($_GET['highest_altitude'])) {
22 26
 	//for altitude manipulation
@@ -30,8 +34,12 @@  discard block
 block discarded – undo
30 34
 	} else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){
31 35
 		$start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000";
32 36
 		$sql_altitude = $start_altitude;
33
-	} else $sql_altitude = '';
34
-} else $sql_altitude = '';
37
+	} else {
38
+		$sql_altitude = '';
39
+	}
40
+	} else {
41
+	$sql_altitude = '';
42
+}
35 43
 
36 44
 //calculuation for the pagination
37 45
 if(!isset($_GET['limit']))
@@ -48,7 +56,7 @@  discard block
 block discarded – undo
48 56
 		$limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
49 57
 		$absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
50 58
 	}
51
-}  else {
59
+} else {
52 60
 	$limit_explode = explode(",", $_GET['limit']);
53 61
 	$limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT);
54 62
 	$limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT);
@@ -66,8 +74,11 @@  discard block
 block discarded – undo
66 74
 
67 75
 header('Content-Type: text/xml');
68 76
 
69
-if (isset($_GET['sort'])) $sort = $_GET['sort'];
70
-else $sort = '';
77
+if (isset($_GET['sort'])) {
78
+	$sort = $_GET['sort'];
79
+} else {
80
+	$sort = '';
81
+}
71 82
 $q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING);
72 83
 $registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING);
73 84
 $aircraft = filter_input(INPUT_GET,'aircraft',FILTER_SANITIZE_STRING);
@@ -123,7 +134,9 @@  discard block
 block discarded – undo
123 134
 			$waypoint_pieces = explode(' ', $spotter_item['waypoints']);
124 135
 			$waypoint_pieces = array_chunk($waypoint_pieces, 2);
125 136
 			foreach ($waypoint_pieces as $waypoint_coordinate) {
126
-				if (isset($waypoint_coordinate[1])) $output .=  $waypoint_coordinate[1].','.$waypoint_coordinate[0].','.$altitude.' ';
137
+				if (isset($waypoint_coordinate[1])) {
138
+					$output .=  $waypoint_coordinate[1].','.$waypoint_coordinate[0].','.$altitude.' ';
139
+				}
127 140
 			}
128 141
 			$output .= '</coordinates>';
129 142
 			$output .= '<altitudeMode>absolute</altitudeMode>';
Please login to merge, or discard this patch.
live-czml.php 3 patches
Braces   +119 added lines, -43 removed lines patch added patch discarded remove patch
@@ -8,8 +8,12 @@  discard block
 block discarded – undo
8 8
 }
9 9
 $tracker = false;
10 10
 $marine = false;
11
-if (isset($_GET['tracker'])) $tracker = true;
12
-if (isset($_GET['marine'])) $marine = true;
11
+if (isset($_GET['tracker'])) {
12
+	$tracker = true;
13
+}
14
+if (isset($_GET['marine'])) {
15
+	$marine = true;
16
+}
13 17
 if ($tracker) {
14 18
 	require_once('require/class.Tracker.php');
15 19
 	require_once('require/class.TrackerLive.php');
@@ -66,24 +70,49 @@  discard block
 block discarded – undo
66 70
 }
67 71
 header('Content-Type: text/javascript');
68 72
 
69
-if (!isset($globalJsonCompress)) $compress = true;
70
-else $compress = $globalJsonCompress;
73
+if (!isset($globalJsonCompress)) {
74
+	$compress = true;
75
+} else {
76
+	$compress = $globalJsonCompress;
77
+}
71 78
 
72 79
 $from_archive = false;
73 80
 $min = false;
74 81
 $allhistory = false;
75 82
 $filter['source'] = array();
76
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
77
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
78
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
79
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
80
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
81
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
82
-if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
83
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
84
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
85
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
86
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
83
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') {
84
+	$filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
85
+}
86
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') {
87
+	$filter['source'] = array_merge($filter['source'],array('whazzup'));
88
+}
89
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') {
90
+	$filter['source'] = array_merge($filter['source'],array('phpvmacars'));
91
+}
92
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') {
93
+	$filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
94
+}
95
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') {
96
+	$filter['source'] = array_merge($filter['source'],array('aprs'));
97
+}
98
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') {
99
+	$filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
100
+}
101
+if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') {
102
+	$filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
103
+}
104
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') {
105
+	$filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
106
+}
107
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') {
108
+	$filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
109
+}
110
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') {
111
+	$filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
112
+}
113
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') {
114
+	$filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
115
+}
87 116
 /*
88 117
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
89 118
 	$min = true;
@@ -180,8 +209,12 @@  discard block
 block discarded – undo
180 209
 	} else {
181 210
 		$flightcnt = $SpotterLive->getLiveSpotterCount($filter);
182 211
 	}
183
-	if ($flightcnt == '') $flightcnt = 0;
184
-} else $flightcnt = 0;
212
+	if ($flightcnt == '') {
213
+		$flightcnt = 0;
214
+	}
215
+	} else {
216
+	$flightcnt = 0;
217
+}
185 218
 
186 219
 $sqltime = round(microtime(true)-$begintime,2);
187 220
 $minitime = time();
@@ -217,7 +250,9 @@  discard block
 block discarded – undo
217 250
 $prev_flightaware_id = '';
218 251
 $speed = 1;
219 252
 $gltf2 = false;
220
-if (isset($archivespeed)) $speed = $archivespeed;
253
+if (isset($archivespeed)) {
254
+	$speed = $archivespeed;
255
+}
221 256
 $output = '[';
222 257
 if ($tracker) {
223 258
 	$output .= '{"id" : "document", "name" : "tracker","version" : "1.0"';
@@ -253,9 +288,13 @@  discard block
 block discarded – undo
253 288
 			$image = "images/placeholder_thumb.png";
254 289
 		}
255 290
 
256
-                if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id'];
257
-                elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid'];
258
-                elseif (isset($spotter_item['fammarine_id'])) $id = $spotter_item['fammarine_id'];
291
+                if (isset($spotter_item['flightaware_id'])) {
292
+                	$id = $spotter_item['flightaware_id'];
293
+                } elseif (isset($spotter_item['famtrackid'])) {
294
+                	$id = $spotter_item['famtrackid'];
295
+                } elseif (isset($spotter_item['fammarine_id'])) {
296
+                	$id = $spotter_item['fammarine_id'];
297
+                }
259 298
                 if ($prev_flightaware_id != $id) {
260 299
 			if ($prev_flightaware_id != '') {
261 300
 				/*
@@ -303,7 +342,9 @@  discard block
 block discarded – undo
303 342
 							}
304 343
 						}
305 344
 					}
306
-					if ($ident != '') $output.= '"ident": "'.$ident.'",';
345
+					if ($ident != '') {
346
+						$output.= '"ident": "'.$ident.'",';
347
+					}
307 348
 				}
308 349
 				$output.= '"gltf2": %gltf2%,';
309 350
 				$output.= '"type": "flight"';
@@ -335,7 +376,9 @@  discard block
 block discarded – undo
335 376
 							$spotter_item['engine_type'] = $aircraft_info[0]['engine_type'];
336 377
 							$spotter_item['wake_category'] = $aircraft_info[0]['wake_category'];
337 378
 							$spotter_item['engine_count'] = $aircraft_info[0]['engine_count'];
338
-						} else $aircraft_shadow = '';
379
+						} else {
380
+							$aircraft_shadow = '';
381
+						}
339 382
 	    					$output .= ' "billboard" : {"image" : "'.$globalURL.'/images/aircrafts/new/'.$aircraft_shadow.'","scale" : 0.5';
340 383
 						if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true' && isset($_COOKIE['IconColor'])) {
341 384
 							$rgb = $Common->hex2rgb($_COOKIE['IconColor']);
@@ -343,7 +386,9 @@  discard block
 block discarded – undo
343 386
 						}
344 387
 						$output .= '},';
345 388
 					}
346
-				} else $output .= ' "billboard" : {"image" : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAfCAYAAACVgY94AAAACXBIWXMAAC4jAAAuIwF4pT92AAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAA7VJREFUeNrEl2uIlWUQx39nXUu0m2uQbZYrbabdLKMs/VBkmHQjioqFIhBS+hKEQpQRgVAf2u5RQkGBRUllRH4I2e5ZUBJlEZVt5i0tTfHStrZ6fn35L70d9n7Obg88vOedmWfmf2bmmZkXlRrtq9V16mZ1iVqqhd5agXvQf1c5zw/V8dXqrqO6dQKwBrgdWApsCb0VqAc2AnOrMVANwIsD4BLgTOBPYB2wHJgEzAG+ANqAu4ZsZYiuX5QwfqI2hvaNulA9J7zLQn8o76vUuuHOwXHqSzH4aIF+TWjnBkSH+nCBf716SP1KPWO4AJ6ltgfIjRW8p9U/1KPz/ry6RT2mIDNF3Zjz19Ya4G1R/J16dgWvQd2pPlXhMdVZPUTgxfCW1wJgXUJpQlvfg8zs8K8r0Caom9QHetG7NGfa1ElDBThRXRtFd/Qh16puKIS3e7+clBjdy7kL1b3q4fzJQQGck5z6Nb97kxujblWf64HXov7Vl/E4YXWccP9AAd6dAx+ox/WTArNzY1t64B0f8K0DyLXuUvRGZfcpCo1VX4tg6wB76WMB0dALf526foAX8cqUot2pGP8B2Kz+krBeNYjS8636dh/8Beo2deoA9TWp76pd6g0q9cDNwKvAD8A84EfglLRBe2g+JWAfcEF68bPABOCoAl/gIPA5MA64FVgGnNhP292W3r0SeB1YVlJXAjcBP8XwyQUj9AKwAzg2+/fQSsBhoJxBAaALaIzenZGnD911wA7gEDAD2FFSpwOzgDHZ5T7+ZSlGd2d6AXgi5+qAn+O5U0PbBVwKtAD3AHuB8f3YGBUdncCGoQ4LE9XtGRqK9LnduVPRIu2BPqwD65IYbS7Qpql7Ql9YoJcy9bwzkgPrfOCj5G33+h54E/g0PAr5thq4ApgyEgNrc27aWwVaPTA1QJ4BjgTGFvhteV40EgPrgvTP7qlmZqFnl9WD+b2posN83E/NrEkOjlI/U1fkfUYa/pe5IE3qZPW8jFOqiyN7p3pAPX04c7AxYSoDDcAjKT2LgLXA6IR2M3Bviv59wDTgQGTPH84Qd8+HXfHcoUws2zM0HMjuUPep+xP2PWpnwtw0GJsldbBpewQwE/gbeDyt7H1gcW53O7AC+A3Yn6+/W+Ld9SnWA15DAVhc8xK2TuA9YHrCuhV4EngFuBx4YagG6qv8cF+T52kB2Zy+e1I8taUacNV+uBdXO7ABmJwJpwx8XQvF9TUCWM64tiQhbq/oMv+7BwFWpQzNT8vbVQul/wwAGzzdmXU1xuUAAAAASUVORK5CYII=","scale" : 0.5},';
389
+				} else {
390
+					$output .= ' "billboard" : {"image" : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAfCAYAAACVgY94AAAACXBIWXMAAC4jAAAuIwF4pT92AAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAA7VJREFUeNrEl2uIlWUQx39nXUu0m2uQbZYrbabdLKMs/VBkmHQjioqFIhBS+hKEQpQRgVAf2u5RQkGBRUllRH4I2e5ZUBJlEZVt5i0tTfHStrZ6fn35L70d9n7Obg88vOedmWfmf2bmmZkXlRrtq9V16mZ1iVqqhd5agXvQf1c5zw/V8dXqrqO6dQKwBrgdWApsCb0VqAc2AnOrMVANwIsD4BLgTOBPYB2wHJgEzAG+ANqAu4ZsZYiuX5QwfqI2hvaNulA9J7zLQn8o76vUuuHOwXHqSzH4aIF+TWjnBkSH+nCBf716SP1KPWO4AJ6ltgfIjRW8p9U/1KPz/ry6RT2mIDNF3Zjz19Ya4G1R/J16dgWvQd2pPlXhMdVZPUTgxfCW1wJgXUJpQlvfg8zs8K8r0Caom9QHetG7NGfa1ElDBThRXRtFd/Qh16puKIS3e7+clBjdy7kL1b3q4fzJQQGck5z6Nb97kxujblWf64HXov7Vl/E4YXWccP9AAd6dAx+ox/WTArNzY1t64B0f8K0DyLXuUvRGZfcpCo1VX4tg6wB76WMB0dALf526foAX8cqUot2pGP8B2Kz+krBeNYjS8636dh/8Beo2deoA9TWp76pd6g0q9cDNwKvAD8A84EfglLRBe2g+JWAfcEF68bPABOCoAl/gIPA5MA64FVgGnNhP292W3r0SeB1YVlJXAjcBP8XwyQUj9AKwAzg2+/fQSsBhoJxBAaALaIzenZGnD911wA7gEDAD2FFSpwOzgDHZ5T7+ZSlGd2d6AXgi5+qAn+O5U0PbBVwKtAD3AHuB8f3YGBUdncCGoQ4LE9XtGRqK9LnduVPRIu2BPqwD65IYbS7Qpql7Ql9YoJcy9bwzkgPrfOCj5G33+h54E/g0PAr5thq4ApgyEgNrc27aWwVaPTA1QJ4BjgTGFvhteV40EgPrgvTP7qlmZqFnl9WD+b2posN83E/NrEkOjlI/U1fkfUYa/pe5IE3qZPW8jFOqiyN7p3pAPX04c7AxYSoDDcAjKT2LgLXA6IR2M3Bviv59wDTgQGTPH84Qd8+HXfHcoUws2zM0HMjuUPep+xP2PWpnwtw0GJsldbBpewQwE/gbeDyt7H1gcW53O7AC+A3Yn6+/W+Ld9SnWA15DAVhc8xK2TuA9YHrCuhV4EngFuBx4YagG6qv8cF+T52kB2Zy+e1I8taUacNV+uBdXO7ABmJwJpwx8XQvF9TUCWM64tiQhbq/oMv+7BwFWpQzNT8vbVQul/wwAGzzdmXU1xuUAAAAASUVORK5CYII=","scale" : 0.5},';
391
+				}
347 392
 			} elseif ($one3dmodel) {
348 393
 				if (isset($globalMap3DForceModel) && $globalMap3DForceModel != '') {
349 394
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$globalMap3DForceModel.'","scale" : 1.0,"minimumPixelSize": 20';
@@ -383,7 +428,9 @@  discard block
 block discarded – undo
383 428
 							$spotter_item['engine_type'] = $aircraft_info[0]['engine_type'];
384 429
 							$spotter_item['wake_category'] = $aircraft_info[0]['wake_category'];
385 430
 							$spotter_item['engine_count'] = $aircraft_info[0]['engine_count'];
386
-						} else $aircraft_shadow = '';
431
+						} else {
432
+							$aircraft_shadow = '';
433
+						}
387 434
 						if ($aircraft_shadow != '') {
388 435
 							if (isset($modelsdb[$aircraft_shadow])) {
389 436
 								$output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$modelsdb[$aircraft_shadow].'","scale" : 1.0,"minimumPixelSize": 20';
@@ -520,7 +567,9 @@  discard block
 block discarded – undo
520 567
 								}
521 568
 								$output .= '},';
522 569
 								//if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
523
-								if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
570
+								if ($spotter_item['aircraft_icao'] != '') {
571
+									$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
572
+								}
524 573
 								$modelsdb[$aircraft_icao] = 'Cesium_Air.glb';
525 574
 							}
526 575
 						} elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') {
@@ -542,7 +591,9 @@  discard block
 block discarded – undo
542 591
 							}
543 592
 							$output .= '},';
544 593
 							//if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
545
-							if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
594
+							if ($spotter_item['aircraft_icao'] != '') {
595
+								$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
596
+							}
546 597
 							$modelsdb[$aircraft_icao] = 'Cesium_Air.glb';
547 598
 						}
548 599
 					} else {
@@ -555,7 +606,9 @@  discard block
 block discarded – undo
555 606
 						}
556 607
 						$output .= '},';
557 608
 						//if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
558
-						if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
609
+						if ($spotter_item['aircraft_icao'] != '') {
610
+							$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
611
+						}
559 612
 						$modelsdb[$aircraft_icao] = 'Cesium_Air.glb';
560 613
 					}
561 614
 				} elseif ($tracker && isset($spotter_item['type'])) {
@@ -659,8 +712,11 @@  discard block
 block discarded – undo
659 712
 					$output .= '},';
660 713
 				}
661 714
 			}
662
-			if (isset($onground) && $onground) $output = str_replace('%onground%','true',$output);
663
-			else $output = str_replace('%onground%','false',$output);
715
+			if (isset($onground) && $onground) {
716
+				$output = str_replace('%onground%','true',$output);
717
+			} else {
718
+				$output = str_replace('%onground%','false',$output);
719
+			}
664 720
 
665 721
 	//		$output .= '"heightReference": "CLAMP_TO_GROUND",';
666 722
 			//$output .= '"heightReference": "'.$heightrelative.'",';
@@ -673,8 +729,12 @@  discard block
 block discarded – undo
673 729
 	//		$output .= '"interpolationDegree" : 5,';
674 730
 	//		$output .= '"epoch" : "'.date("c",strtotime($spotter_item['date'])).'", ';
675 731
 			$output .= '"cartographicDegrees": [';
676
-			if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']);
677
-			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
732
+			if ($minitime > strtotime($spotter_item['date'])) {
733
+				$minitime = strtotime($spotter_item['date']);
734
+			}
735
+			if ($maxitime < strtotime($spotter_item['date'])) {
736
+				$maxitime = strtotime($spotter_item['date']);
737
+			}
678 738
 			$output .= '"'.date("c",strtotime($spotter_item['date'])).'", ';
679 739
 			$output .= $spotter_item['longitude'].', ';
680 740
 			$output .= $spotter_item['latitude'];
@@ -697,7 +757,9 @@  discard block
 block discarded – undo
697 757
 					$output .= ', '.round($spotter_item['altitude']*30.48);
698 758
 					$prevalt = round($spotter_item['altitude']*30.48);
699 759
 				}
700
-			} else $output .= ', 0';
760
+			} else {
761
+				$output .= ', 0';
762
+			}
701 763
 			//$orientation = '"orientation" : { ';
702 764
 			//$orientation .= '"unitQuaternion": [';
703 765
 			//$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0));
@@ -705,13 +767,18 @@  discard block
 block discarded – undo
705 767
 		} else {
706 768
 			$nblatlong = $nblatlong+1;
707 769
 			$output .= ',"'.date("c",strtotime($spotter_item['date'])).'", ';
708
-			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
770
+			if ($maxitime < strtotime($spotter_item['date'])) {
771
+				$maxitime = strtotime($spotter_item['date']);
772
+			}
709 773
 			if ($spotter_item['ground_speed'] == 0) {
710 774
 				$output .= $prevlong.', ';
711 775
 				$output .= $prevlat;
712 776
 				//if (!$marine && (!isset($onground) || !$onground)) $output .= ', '.$prevalt;
713
-				if (!$marine) $output .= ', '.$prevalt;
714
-				else $output .= ', 0';
777
+				if (!$marine) {
778
+					$output .= ', '.$prevalt;
779
+				} else {
780
+					$output .= ', 0';
781
+				}
715 782
 			} else {
716 783
 				$output .= $spotter_item['longitude'].', ';
717 784
 				$output .= $spotter_item['latitude'];
@@ -724,14 +791,17 @@  discard block
 block discarded – undo
724 791
 							$output .= ', 0';
725 792
 						}
726 793
 					} else {
727
-						if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') $output .= ', '.round($spotter_item['real_altitude']*0.3048);
728
-						elseif ($tracker) {
794
+						if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') {
795
+							$output .= ', '.round($spotter_item['real_altitude']*0.3048);
796
+						} elseif ($tracker) {
729 797
 							$output .= ', '.round($spotter_item['altitude']*0.3048);
730 798
 						} else {
731 799
 							$output .= ', '.round($spotter_item['altitude']*30.48);
732 800
 						}
733 801
 					}
734
-				} else $output .= ', 0';
802
+				} else {
803
+					$output .= ', 0';
804
+				}
735 805
 			}
736 806
 			//$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0));
737 807
 			//$orientation .= ',"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w'];
@@ -750,11 +820,17 @@  discard block
 block discarded – undo
750 820
 		} else {
751 821
 			$output = str_replace('%minitime%',date("c",time()-$globalLiveInterval),$output);
752 822
 		}
823
+	} else {
824
+		$output = str_replace('%minitime%',date("c",$minitime),$output);
753 825
 	}
754
-	else $output = str_replace('%minitime%',date("c",$minitime),$output);
755
-} else $output = str_replace('%minitime%',date("c",$minitime),$output);
826
+	} else {
827
+	$output = str_replace('%minitime%',date("c",$minitime),$output);
828
+}
756 829
 $output = str_replace('%maxitime%',date("c",$maxitime),$output);
757
-if ($gltf2) $output = str_replace('%gltf2%','true',$output);
758
-else $output = str_replace('%gltf2%','false',$output);
830
+if ($gltf2) {
831
+	$output = str_replace('%gltf2%','true',$output);
832
+} else {
833
+	$output = str_replace('%gltf2%','false',$output);
834
+}
759 835
 print $output;
760 836
 ?>
Please login to merge, or discard this patch.
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -39,30 +39,30 @@  discard block
 block discarded – undo
39 39
 
40 40
 
41 41
 function quaternionrotate($heading, $attitude = 0, $bank = 0) {
42
-    // Assuming the angles are in radians.
43
-    $c1 = cos($heading/2);
44
-    $s1 = sin($heading/2);
45
-    $c2 = cos($attitude/2);
46
-    $s2 = sin($attitude/2);
47
-    $c3 = cos($bank/2);
48
-    $s3 = sin($bank/2);
49
-    $c1c2 = $c1*$c2;
50
-    $s1s2 = $s1*$s2;
51
-    $w =$c1c2*$c3 - $s1s2*$s3;
52
-    $x =$c1c2*$s3 + $s1s2*$c3;
53
-    $y =$s1*$c2*$c3 + $c1*$s2*$s3;
54
-    $z =$c1*$s2*$c3 - $s1*$c2*$s3;
55
-    return array('x' => $x,'y' => $y,'z' => $z,'w' => $w);
42
+	// Assuming the angles are in radians.
43
+	$c1 = cos($heading/2);
44
+	$s1 = sin($heading/2);
45
+	$c2 = cos($attitude/2);
46
+	$s2 = sin($attitude/2);
47
+	$c3 = cos($bank/2);
48
+	$s3 = sin($bank/2);
49
+	$c1c2 = $c1*$c2;
50
+	$s1s2 = $s1*$s2;
51
+	$w =$c1c2*$c3 - $s1s2*$s3;
52
+	$x =$c1c2*$s3 + $s1s2*$c3;
53
+	$y =$s1*$c2*$c3 + $c1*$s2*$s3;
54
+	$z =$c1*$s2*$c3 - $s1*$c2*$s3;
55
+	return array('x' => $x,'y' => $y,'z' => $z,'w' => $w);
56 56
 //    return array('x' => '0.0','y' => '-0.931','z' => '0.0','w' => '0.365');
57 57
 
58 58
 }
59 59
 
60 60
 
61 61
 if (isset($_GET['download'])) {
62
-    if ($_GET['download'] == "true")
63
-    {
62
+	if ($_GET['download'] == "true")
63
+	{
64 64
 	header('Content-disposition: attachment; filename="flightairmap.json"');
65
-    }
65
+	}
66 66
 }
67 67
 header('Content-Type: text/javascript');
68 68
 
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 	if (isset($_GET['coord']) && $_GET['coord'] != '') {
156 156
 		$coord = explode(',',$_GET['coord']);
157 157
 		if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) 
158
-		    && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) {
158
+			&& $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) {
159 159
 			$coord = array();
160 160
 		}
161 161
 	}
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 	if (isset($_GET['coord']) && $_GET['coord'] != '') {
166 166
 		$coord = explode(',',$_GET['coord']);
167 167
 		if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) 
168
-		    && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) {
168
+			&& $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) {
169 169
 			$coord = array();
170 170
 		}
171 171
 	}
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 	if (isset($_GET['coord']) && $_GET['coord'] != '') {
176 176
 		$coord = explode(',',$_GET['coord']);
177 177
 		if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) 
178
-		    && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) {
178
+			&& $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) {
179 179
 			$coord = array();
180 180
 		}
181 181
 	}
@@ -265,10 +265,10 @@  discard block
 block discarded – undo
265 265
 			$image = "images/placeholder_thumb.png";
266 266
 		}
267 267
 
268
-                if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id'];
269
-                elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid'];
270
-                elseif (isset($spotter_item['fammarine_id'])) $id = $spotter_item['fammarine_id'];
271
-                if ($prev_flightaware_id != $id) {
268
+				if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id'];
269
+				elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid'];
270
+				elseif (isset($spotter_item['fammarine_id'])) $id = $spotter_item['fammarine_id'];
271
+				if ($prev_flightaware_id != $id) {
272 272
 			if ($prev_flightaware_id != '') {
273 273
 				/*
274 274
 				if ($nblatlong == 1) {
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 							$spotter_item['wake_category'] = $aircraft_info[0]['wake_category'];
349 349
 							$spotter_item['engine_count'] = $aircraft_info[0]['engine_count'];
350 350
 						} else $aircraft_shadow = '';
351
-	    					$output .= ' "billboard" : {"image" : "'.$globalURL.'/images/aircrafts/new/'.$aircraft_shadow.'","scale" : 0.5';
351
+							$output .= ' "billboard" : {"image" : "'.$globalURL.'/images/aircrafts/new/'.$aircraft_shadow.'","scale" : 0.5';
352 352
 						if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true' && isset($_COOKIE['IconColor'])) {
353 353
 							$rgb = $Common->hex2rgb($_COOKIE['IconColor']);
354 354
 							$output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}';
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
 							$rgb = $Common->hex2rgb($_COOKIE['IconColor']);
380 380
 							$output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}';
381 381
 						}
382
-    						$output .= '},';
382
+							$output .= '},';
383 383
 					} elseif (isset($modelsdb[$aircraft_icao]) && $aircraft_icao != '') {
384 384
 						$output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$modelsdb[$aircraft_icao].'","scale" : 1.0,"minimumPixelSize": 20';
385 385
 						$output .= ',"heightReference": "'.$heightrelative.'"';
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 							$rgb = $Common->hex2rgb($_COOKIE['IconColor']);
388 388
 							$output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}';
389 389
 						}
390
-    						$output .= '},';
390
+							$output .= '},';
391 391
 					} elseif ($aircraft_icao != '') {
392 392
 						$aircraft_info = $Spotter->getAllAircraftInfo($aircraft_icao);
393 393
 						if (isset($aircraft_info[0]['engine_type'])) {
Please login to merge, or discard this patch.
Spacing   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -48,11 +48,11 @@  discard block
 block discarded – undo
48 48
     $s3 = sin($bank/2);
49 49
     $c1c2 = $c1*$c2;
50 50
     $s1s2 = $s1*$s2;
51
-    $w =$c1c2*$c3 - $s1s2*$s3;
52
-    $x =$c1c2*$s3 + $s1s2*$c3;
53
-    $y =$s1*$c2*$c3 + $c1*$s2*$s3;
54
-    $z =$c1*$s2*$c3 - $s1*$c2*$s3;
55
-    return array('x' => $x,'y' => $y,'z' => $z,'w' => $w);
51
+    $w = $c1c2*$c3 - $s1s2*$s3;
52
+    $x = $c1c2*$s3 + $s1s2*$c3;
53
+    $y = $s1*$c2*$c3 + $c1*$s2*$s3;
54
+    $z = $c1*$s2*$c3 - $s1*$c2*$s3;
55
+    return array('x' => $x, 'y' => $y, 'z' => $z, 'w' => $w);
56 56
 //    return array('x' => '0.0','y' => '-0.931','z' => '0.0','w' => '0.365');
57 57
 
58 58
 }
@@ -73,17 +73,17 @@  discard block
 block discarded – undo
73 73
 $min = false;
74 74
 $allhistory = false;
75 75
 $filter['source'] = array();
76
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
77
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
78
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
79
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
80
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
81
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
82
-if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
83
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
84
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
85
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
86
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
76
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt'));
77
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup'));
78
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars'));
79
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs'));
80
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs'));
81
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING);
82
+if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'], FILTER_SANITIZE_STRING);
83
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING);
84
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING);
85
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING);
86
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING);
87 87
 /*
88 88
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
89 89
 	$min = true;
@@ -130,12 +130,12 @@  discard block
 block discarded – undo
130 130
 	$from_archive = true;
131 131
 //	$begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
132 132
 //	$enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
133
-	$begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT);
134
-	$enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT);
135
-	$archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT);
136
-	$begindate = date('Y-m-d H:i:s',$begindate);
137
-	$enddate = date('Y-m-d H:i:s',$enddate);
138
-	$spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter);
133
+	$begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT);
134
+	$enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT);
135
+	$archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT);
136
+	$begindate = date('Y-m-d H:i:s', $begindate);
137
+	$enddate = date('Y-m-d H:i:s', $enddate);
138
+	$spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate, $enddate, $filter);
139 139
 } elseif (isset($_COOKIE['archive']) && isset($_COOKIE['archive_begin']) && isset($_COOKIE['archive_end']) && isset($_COOKIE['archive_speed'])) {
140 140
 	$from_archive = true;
141 141
 //	$begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
@@ -145,46 +145,46 @@  discard block
 block discarded – undo
145 145
 	$begindate = $_COOKIE['archive_begin'];
146 146
 	$enddate = $_COOKIE['archive_end'];
147 147
 
148
-	$archivespeed = filter_var($_COOKIE['archive_speed'],FILTER_SANITIZE_NUMBER_INT);
149
-	$begindate = date('Y-m-d H:i:s',$begindate);
150
-	$enddate = date('Y-m-d H:i:s',$enddate);
148
+	$archivespeed = filter_var($_COOKIE['archive_speed'], FILTER_SANITIZE_NUMBER_INT);
149
+	$begindate = date('Y-m-d H:i:s', $begindate);
150
+	$enddate = date('Y-m-d H:i:s', $enddate);
151 151
 //	echo 'Begin : '.$begindate.' - End : '.$enddate."\n";
152
-	$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter);
152
+	$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter);
153 153
 } elseif ($tracker) {
154 154
 	$coord = array();
155 155
 	if (isset($_GET['coord']) && $_GET['coord'] != '') {
156
-		$coord = explode(',',$_GET['coord']);
157
-		if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) 
156
+		$coord = explode(',', $_GET['coord']);
157
+		if (!(filter_var($coord[0], FILTER_VALIDATE_FLOAT) && filter_var($coord[1], FILTER_VALIDATE_FLOAT) && filter_var($coord[2], FILTER_VALIDATE_FLOAT) && filter_var($coord[3], FILTER_VALIDATE_FLOAT) 
158 158
 		    && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) {
159 159
 			$coord = array();
160 160
 		}
161 161
 	}
162
-	$spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord,$filter,true);
162
+	$spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord, $filter, true);
163 163
 } elseif ($marine) {
164 164
 	$coord = array();
165 165
 	if (isset($_GET['coord']) && $_GET['coord'] != '') {
166
-		$coord = explode(',',$_GET['coord']);
167
-		if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) 
166
+		$coord = explode(',', $_GET['coord']);
167
+		if (!(filter_var($coord[0], FILTER_VALIDATE_FLOAT) && filter_var($coord[1], FILTER_VALIDATE_FLOAT) && filter_var($coord[2], FILTER_VALIDATE_FLOAT) && filter_var($coord[3], FILTER_VALIDATE_FLOAT) 
168 168
 		    && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) {
169 169
 			$coord = array();
170 170
 		}
171 171
 	}
172
-	$spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,true);
172
+	$spotter_array = $MarineLive->getMinLastLiveMarineData($coord, $filter, true);
173 173
 } else {
174 174
 	$coord = array();
175 175
 	if (isset($_GET['coord']) && $_GET['coord'] != '') {
176
-		$coord = explode(',',$_GET['coord']);
177
-		if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) 
176
+		$coord = explode(',', $_GET['coord']);
177
+		if (!(filter_var($coord[0], FILTER_VALIDATE_FLOAT) && filter_var($coord[1], FILTER_VALIDATE_FLOAT) && filter_var($coord[2], FILTER_VALIDATE_FLOAT) && filter_var($coord[3], FILTER_VALIDATE_FLOAT) 
178 178
 		    && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) {
179 179
 			$coord = array();
180 180
 		}
181 181
 	}
182
-	$spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,true);
182
+	$spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord, $filter, true);
183 183
 }
184 184
 //print_r($spotter_array);
185 185
 if (!empty($spotter_array) && isset($coord)) {
186 186
 	if (isset($_GET['archive'])) {
187
-		$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter);
187
+		$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter);
188 188
 	} elseif ($tracker) {
189 189
 		$flightcnt = $TrackerLive->getLiveTrackerCount($filter);
190 190
 	} elseif ($marine) {
@@ -195,15 +195,15 @@  discard block
 block discarded – undo
195 195
 	if ($flightcnt == '') $flightcnt = 0;
196 196
 } else $flightcnt = 0;
197 197
 
198
-$sqltime = round(microtime(true)-$begintime,2);
198
+$sqltime = round(microtime(true) - $begintime, 2);
199 199
 $minitime = time();
200 200
 $maxitime = 0;
201
-$lastupdate = filter_input(INPUT_GET,'update',FILTER_SANITIZE_NUMBER_INT);
201
+$lastupdate = filter_input(INPUT_GET, 'update', FILTER_SANITIZE_NUMBER_INT);
202 202
 $modelsdb = array();
203 203
 if (file_exists(dirname(__FILE__).'/models/modelsdb')) {
204
-	if (($handle = fopen(dirname(__FILE__).'/models/modelsdb','r')) !== FALSE) {
205
-		while (($row = fgetcsv($handle,1000)) !== FALSE) {
206
-			if (isset($row[1]) ){
204
+	if (($handle = fopen(dirname(__FILE__).'/models/modelsdb', 'r')) !== FALSE) {
205
+		while (($row = fgetcsv($handle, 1000)) !== FALSE) {
206
+			if (isset($row[1])) {
207 207
 				$model = $row[0];
208 208
 				$modelsdb[$model] = $row[1];
209 209
 			}
@@ -213,9 +213,9 @@  discard block
 block discarded – undo
213 213
 }
214 214
 $modelsdb2 = array();
215 215
 if (file_exists(dirname(__FILE__).'/models/gltf2/modelsdb')) {
216
-	if (($handle = fopen(dirname(__FILE__).'/models/gltf2/modelsdb','r')) !== FALSE) {
217
-		while (($row = fgetcsv($handle,1000)) !== FALSE) {
218
-			if (isset($row[1]) ){
216
+	if (($handle = fopen(dirname(__FILE__).'/models/gltf2/modelsdb', 'r')) !== FALSE) {
217
+		while (($row = fgetcsv($handle, 1000)) !== FALSE) {
218
+			if (isset($row[1])) {
219 219
 				$model = $row[0];
220 220
 				$modelsdb2[$model] = $row[1];
221 221
 			}
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 if (!empty($spotter_array) && is_array($spotter_array))
254 254
 {
255 255
 	$nblatlong = 0;
256
-	foreach($spotter_array as $spotter_item)
256
+	foreach ($spotter_array as $spotter_item)
257 257
 	{
258 258
 		$j++;
259 259
 		//if (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'airwhere') $heightrelative = 'RELATIVE_TO_GROUND';
@@ -295,9 +295,9 @@  discard block
 block discarded – undo
295 295
 			$output .= '"lastupdate": "'.$lastupdate.'",';
296 296
 			$output .= '"format": "'.$spotter_item['format_source'].'",';
297 297
 			if ($tracker) {
298
-				$output.= '"type": "tracker"';
298
+				$output .= '"type": "tracker"';
299 299
 			} elseif ($marine) {
300
-				$output.= '"type": "marine"';
300
+				$output .= '"type": "marine"';
301 301
 			} else {
302 302
 				if (isset($globalMap3DLiveries) && $globalMap3DLiveries) {
303 303
 					$aircraft_icao = $spotter_item['aircraft_icao'];
@@ -311,14 +311,14 @@  discard block
 block discarded – undo
311 311
 						if (isset($airline_icao)) {
312 312
 							$imagefile = $aircraft_icao.'-'.$airline_icao.'.png';
313 313
 							if (file_exists(dirname(__FILE__).'/models/gltf2/liveries/'.$imagefile)) {
314
-								$output.= '"liveries": "'.$globalURL.'/models/gltf2/liveries/'.$imagefile.'",';
314
+								$output .= '"liveries": "'.$globalURL.'/models/gltf2/liveries/'.$imagefile.'",';
315 315
 							}
316 316
 						}
317 317
 					}
318
-					if ($ident != '') $output.= '"ident": "'.$ident.'",';
318
+					if ($ident != '') $output .= '"ident": "'.$ident.'",';
319 319
 				}
320
-				$output.= '"gltf2": %gltf2%,';
321
-				$output.= '"type": "flight"';
320
+				$output .= '"gltf2": %gltf2%,';
321
+				$output .= '"type": "flight"';
322 322
 			}
323 323
 			$output .= '},';
324 324
 
@@ -671,8 +671,8 @@  discard block
 block discarded – undo
671 671
 					$output .= '},';
672 672
 				}
673 673
 			}
674
-			if (isset($onground) && $onground) $output = str_replace('%onground%','true',$output);
675
-			else $output = str_replace('%onground%','false',$output);
674
+			if (isset($onground) && $onground) $output = str_replace('%onground%', 'true', $output);
675
+			else $output = str_replace('%onground%', 'false', $output);
676 676
 
677 677
 	//		$output .= '"heightReference": "CLAMP_TO_GROUND",';
678 678
 			//$output .= '"heightReference": "'.$heightrelative.'",';
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
 			$output .= '"cartographicDegrees": [';
688 688
 			if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']);
689 689
 			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
690
-			$output .= '"'.date("c",strtotime($spotter_item['date'])).'", ';
690
+			$output .= '"'.date("c", strtotime($spotter_item['date'])).'", ';
691 691
 			$output .= $spotter_item['longitude'].', ';
692 692
 			$output .= $spotter_item['latitude'];
693 693
 			$prevlong = $spotter_item['longitude'];
@@ -715,8 +715,8 @@  discard block
 block discarded – undo
715 715
 			//$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0));
716 716
 			//$orientation .= '"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w'];
717 717
 		} else {
718
-			$nblatlong = $nblatlong+1;
719
-			$output .= ',"'.date("c",strtotime($spotter_item['date'])).'", ';
718
+			$nblatlong = $nblatlong + 1;
719
+			$output .= ',"'.date("c", strtotime($spotter_item['date'])).'", ';
720 720
 			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
721 721
 			if ($spotter_item['ground_speed'] == 0) {
722 722
 				$output .= $prevlong.', ';
@@ -756,17 +756,17 @@  discard block
 block discarded – undo
756 756
 }
757 757
 $output .= ']';
758 758
 if (isset($globalArchive) && $globalArchive === TRUE) {
759
-	if ((time()-$globalLiveInterval) > $minitime) {
760
-		if (time()-$globalLiveInterval > $maxitime) {
761
-			$output = str_replace('%minitime%',date("c",$maxitime),$output);
759
+	if ((time() - $globalLiveInterval) > $minitime) {
760
+		if (time() - $globalLiveInterval > $maxitime) {
761
+			$output = str_replace('%minitime%', date("c", $maxitime), $output);
762 762
 		} else {
763
-			$output = str_replace('%minitime%',date("c",time()-$globalLiveInterval),$output);
763
+			$output = str_replace('%minitime%', date("c", time() - $globalLiveInterval), $output);
764 764
 		}
765 765
 	}
766
-	else $output = str_replace('%minitime%',date("c",$minitime),$output);
767
-} else $output = str_replace('%minitime%',date("c",$minitime),$output);
768
-$output = str_replace('%maxitime%',date("c",$maxitime),$output);
769
-if ($gltf2) $output = str_replace('%gltf2%','true',$output);
770
-else $output = str_replace('%gltf2%','false',$output);
766
+	else $output = str_replace('%minitime%', date("c", $minitime), $output);
767
+} else $output = str_replace('%minitime%', date("c", $minitime), $output);
768
+$output = str_replace('%maxitime%', date("c", $maxitime), $output);
769
+if ($gltf2) $output = str_replace('%gltf2%', 'true', $output);
770
+else $output = str_replace('%gltf2%', 'false', $output);
771 771
 print $output;
772 772
 ?>
Please login to merge, or discard this patch.
require/class.Marine.php 4 patches
Doc Comments   +8 added lines, -21 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 	/**
15 15
 	* Get SQL query part for filter used
16 16
 	* @param Array $filter the filter
17
-	* @return Array the SQL part
17
+	* @return string the SQL part
18 18
 	*/
19 19
 	
20 20
 	public function getFilter($filter = array(),$where = false,$and = false) {
@@ -467,6 +467,11 @@  discard block
 block discarded – undo
467 467
 	/**
468 468
 	* Add identity
469 469
 	*
470
+	* @param string $mmsi
471
+	* @param string $imo
472
+	* @param string $ident
473
+	* @param string $callsign
474
+	* @param string $type
470 475
 	*/
471 476
 	public function addIdentity($mmsi,$imo,$ident,$callsign,$type)
472 477
 	{
@@ -600,25 +605,6 @@  discard block
 block discarded – undo
600 605
 	*
601 606
 	* @param String $fammarine_id the ID
602 607
 	* @param String $ident the marine ident
603
-	* @param String $departure_airport_icao the departure airport
604
-	* @param String $arrival_airport_icao the arrival airport
605
-	* @param String $latitude latitude of flight
606
-	* @param String $longitude latitude of flight
607
-	* @param String $waypoints waypoints of flight
608
-	* @param String $heading heading of flight
609
-	* @param String $groundspeed speed of flight
610
-	* @param String $date date of flight
611
-	* @param String $departure_airport_time departure time of flight
612
-	* @param String $arrival_airport_time arrival time of flight
613
-	* @param String $squawk squawk code of flight
614
-	* @param String $route_stop route stop of flight
615
-	* @param String $highlight highlight or not
616
-	* @param String $ModeS ModesS code of flight
617
-	* @param String $registration registration code of flight
618
-	* @param String $pilot_id pilot id of flight (for virtual airlines)
619
-	* @param String $pilot_name pilot name of flight (for virtual airlines)
620
-	* @param String $verticalrate vertival rate of flight
621
-	* @return String success or false
622 608
 	*/
623 609
 	public function addMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $mmsi = '',$type = '',$typeid = '',$imo = '',$callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$format_source = '', $source_name = '')
624 610
 	{
@@ -1211,6 +1197,7 @@  discard block
 block discarded – undo
1211 1197
 	/**
1212 1198
 	* Counts all hours
1213 1199
 	*
1200
+	* @param string $orderby
1214 1201
 	* @return Array the hour list
1215 1202
 	*
1216 1203
 	*/
@@ -1562,7 +1549,7 @@  discard block
 block discarded – undo
1562 1549
 	/**
1563 1550
 	* Parses the direction degrees to working
1564 1551
 	*
1565
-	* @param Float $direction the direction in degrees
1552
+	* @param integer $direction the direction in degrees
1566 1553
 	* @return Array the direction information
1567 1554
 	*
1568 1555
 	*/
Please login to merge, or discard this patch.
Indentation   +227 added lines, -227 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@  discard block
 block discarded – undo
12 12
 	}
13 13
 
14 14
 	/**
15
-	* Get SQL query part for filter used
16
-	* @param Array $filter the filter
17
-	* @return Array the SQL part
18
-	*/
15
+	 * Get SQL query part for filter used
16
+	 * @param Array $filter the filter
17
+	 * @return Array the SQL part
18
+	 */
19 19
 	
20 20
 	public function getFilter($filter = array(),$where = false,$and = false) {
21 21
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
@@ -82,14 +82,14 @@  discard block
 block discarded – undo
82 82
 	}
83 83
 
84 84
 	/**
85
-	* Executes the SQL statements to get the spotter information
86
-	*
87
-	* @param String $query the SQL query
88
-	* @param Array $params parameter of the query
89
-	* @param String $limitQuery the limit query
90
-	* @return Array the spotter information
91
-	*
92
-	*/
85
+	 * Executes the SQL statements to get the spotter information
86
+	 *
87
+	 * @param String $query the SQL query
88
+	 * @param Array $params parameter of the query
89
+	 * @param String $limitQuery the limit query
90
+	 * @return Array the spotter information
91
+	 *
92
+	 */
93 93
 	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
94 94
 	{
95 95
 		date_default_timezone_set('UTC');
@@ -220,11 +220,11 @@  discard block
 block discarded – undo
220 220
 	
221 221
 	
222 222
 	/**
223
-	* Gets all the spotter information based on the latest data entry
224
-	*
225
-	* @return Array the spotter information
226
-	*
227
-	*/
223
+	 * Gets all the spotter information based on the latest data entry
224
+	 *
225
+	 * @return Array the spotter information
226
+	 *
227
+	 */
228 228
 	public function getLatestMarineData($limit = '', $sort = '', $filter = array())
229 229
 	{
230 230
 		global $global_query;
@@ -273,11 +273,11 @@  discard block
 block discarded – undo
273 273
 	}
274 274
 
275 275
 	/**
276
-	* Gets all the spotter information based on the callsign
277
-	*
278
-	* @return Array the spotter information
279
-	*
280
-	*/
276
+	 * Gets all the spotter information based on the callsign
277
+	 *
278
+	 * @return Array the spotter information
279
+	 *
280
+	 */
281 281
 	public function getMarineDataByIdent($ident = '', $limit = '', $sort = '', $filter = array())
282 282
 	{
283 283
 		global $global_query;
@@ -329,11 +329,11 @@  discard block
 block discarded – undo
329 329
 	}
330 330
 
331 331
 	/**
332
-	* Gets all the marine information based on the type
333
-	*
334
-	* @return Array the marine information
335
-	*
336
-	*/
332
+	 * Gets all the marine information based on the type
333
+	 *
334
+	 * @return Array the marine information
335
+	 *
336
+	 */
337 337
 	public function getMarineDataByType($type = '', $limit = '', $sort = '', $filter = array())
338 338
 	{
339 339
 		global $global_query;
@@ -441,12 +441,12 @@  discard block
 block discarded – undo
441 441
 
442 442
 
443 443
 	/**
444
-	* Gets all source name
445
-	*
446
-	* @param String type format of source
447
-	* @return Array list of source name
448
-	*
449
-	*/
444
+	 * Gets all source name
445
+	 *
446
+	 * @param String type format of source
447
+	 * @return Array list of source name
448
+	 *
449
+	 */
450 450
 	public function getAllSourceName($type = '',$filters = array())
451 451
 	{
452 452
 		$filter_query = $this->getFilter($filters,true,true);
@@ -476,11 +476,11 @@  discard block
 block discarded – undo
476 476
 
477 477
 
478 478
 	/**
479
-	* Gets a list of all idents/callsigns
480
-	*
481
-	* @return Array list of ident/callsign names
482
-	*
483
-	*/
479
+	 * Gets a list of all idents/callsigns
480
+	 *
481
+	 * @return Array list of ident/callsign names
482
+	 *
483
+	 */
484 484
 	public function getAllIdents($filters = array())
485 485
 	{
486 486
 		$filter_query = $this->getFilter($filters,true,true);
@@ -504,11 +504,11 @@  discard block
 block discarded – undo
504 504
 	}
505 505
 
506 506
 	/**
507
-	* Gets all info from a mmsi
508
-	*
509
-	* @return Array ident
510
-	*
511
-	*/
507
+	 * Gets all info from a mmsi
508
+	 *
509
+	 * @return Array ident
510
+	 *
511
+	 */
512 512
 	public function getIdentity($mmsi)
513 513
 	{
514 514
 		$mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT);
@@ -521,9 +521,9 @@  discard block
 block discarded – undo
521 521
 	}
522 522
 
523 523
 	/**
524
-	* Add identity
525
-	*
526
-	*/
524
+	 * Add identity
525
+	 *
526
+	 */
527 527
 	public function addIdentity($mmsi,$imo,$ident,$callsign,$type)
528 528
 	{
529 529
 		$mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT);
@@ -589,13 +589,13 @@  discard block
 block discarded – undo
589 589
 	}
590 590
 
591 591
 	/**
592
-	* Update ident tracker data
593
-	*
594
-	* @param String $fammarine_id the ID
595
-	* @param String $ident the marine ident
596
-	* @return String success or false
597
-	*
598
-	*/
592
+	 * Update ident tracker data
593
+	 *
594
+	 * @param String $fammarine_id the ID
595
+	 * @param String $ident the marine ident
596
+	 * @return String success or false
597
+	 *
598
+	 */
599 599
 	public function updateIdentMarineData($fammarine_id = '', $ident = '',$fromsource = NULL)
600 600
 	{
601 601
 		$query = 'UPDATE marine_output SET ident = :ident WHERE fammarine_id = :fammarine_id';
@@ -610,13 +610,13 @@  discard block
 block discarded – undo
610 610
 	}
611 611
 
612 612
 	/**
613
-	* Update arrival marine data
614
-	*
615
-	* @param String $fammarine_id the ID
616
-	* @param String $arrival_code the marine ident
617
-	* @return String success or false
618
-	*
619
-	*/
613
+	 * Update arrival marine data
614
+	 *
615
+	 * @param String $fammarine_id the ID
616
+	 * @param String $arrival_code the marine ident
617
+	 * @return String success or false
618
+	 *
619
+	 */
620 620
 	public function updateArrivalPortNameMarineData($fammarine_id = '', $arrival_code = '',$fromsource = NULL)
621 621
 	{
622 622
 		$query = 'UPDATE marine_output SET arrival_port_name = :arrival_code WHERE fammarine_id = :fammarine_id';
@@ -631,19 +631,19 @@  discard block
 block discarded – undo
631 631
 	}
632 632
 
633 633
 	/**
634
-	* Update Status data
635
-	*
636
-	* @param String $fammarine_id the ID
637
-	* @param String $status_id the marine status id
638
-	* @param String $status the marine status
639
-	* @return String success or false
640
-	*
641
-	*/
634
+	 * Update Status data
635
+	 *
636
+	 * @param String $fammarine_id the ID
637
+	 * @param String $status_id the marine status id
638
+	 * @param String $status the marine status
639
+	 * @return String success or false
640
+	 *
641
+	 */
642 642
 	public function updateStatusMarineData($fammarine_id = '', $status_id = '',$status = '')
643 643
 	{
644 644
 
645 645
 		$query = 'UPDATE marine_output SET status = :status, status_id = :status_id WHERE fammarine_id = :fammarine_id';
646
-                $query_values = array(':fammarine_id' => $fammarine_id,':status' => $status,':status_id' => $status_id);
646
+				$query_values = array(':fammarine_id' => $fammarine_id,':status' => $status,':status_id' => $status_id);
647 647
 
648 648
 		try {
649 649
 			$sth = $this->db->prepare($query);
@@ -656,17 +656,17 @@  discard block
 block discarded – undo
656 656
 
657 657
 	}
658 658
 	/**
659
-	* Update latest marine data
660
-	*
661
-	* @param String $fammarine_id the ID
662
-	* @param String $ident the marine ident
663
-	* @return String success or false
664
-	*
665
-	*/	
659
+	 * Update latest marine data
660
+	 *
661
+	 * @param String $fammarine_id the ID
662
+	 * @param String $ident the marine ident
663
+	 * @return String success or false
664
+	 *
665
+	 */	
666 666
 	public function updateLatestMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $groundspeed = NULL, $date = '')
667 667
 	{
668 668
 		$query = 'UPDATE marine_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_seen = :last_seen, last_ground_speed = :last_ground_speed WHERE fammarine_id = :fammarine_id';
669
-                $query_values = array(':fammarine_id' => $fammarine_id,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident);
669
+				$query_values = array(':fammarine_id' => $fammarine_id,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident);
670 670
 
671 671
 		try {
672 672
 			$sth = $this->db->prepare($query);
@@ -680,30 +680,30 @@  discard block
 block discarded – undo
680 680
 	}
681 681
 
682 682
 	/**
683
-	* Adds a new spotter data
684
-	*
685
-	* @param String $fammarine_id the ID
686
-	* @param String $ident the marine ident
687
-	* @param String $departure_airport_icao the departure airport
688
-	* @param String $arrival_airport_icao the arrival airport
689
-	* @param String $latitude latitude of flight
690
-	* @param String $longitude latitude of flight
691
-	* @param String $waypoints waypoints of flight
692
-	* @param String $heading heading of flight
693
-	* @param String $groundspeed speed of flight
694
-	* @param String $date date of flight
695
-	* @param String $departure_airport_time departure time of flight
696
-	* @param String $arrival_airport_time arrival time of flight
697
-	* @param String $squawk squawk code of flight
698
-	* @param String $route_stop route stop of flight
699
-	* @param String $highlight highlight or not
700
-	* @param String $ModeS ModesS code of flight
701
-	* @param String $registration registration code of flight
702
-	* @param String $pilot_id pilot id of flight (for virtual airlines)
703
-	* @param String $pilot_name pilot name of flight (for virtual airlines)
704
-	* @param String $verticalrate vertival rate of flight
705
-	* @return String success or false
706
-	*/
683
+	 * Adds a new spotter data
684
+	 *
685
+	 * @param String $fammarine_id the ID
686
+	 * @param String $ident the marine ident
687
+	 * @param String $departure_airport_icao the departure airport
688
+	 * @param String $arrival_airport_icao the arrival airport
689
+	 * @param String $latitude latitude of flight
690
+	 * @param String $longitude latitude of flight
691
+	 * @param String $waypoints waypoints of flight
692
+	 * @param String $heading heading of flight
693
+	 * @param String $groundspeed speed of flight
694
+	 * @param String $date date of flight
695
+	 * @param String $departure_airport_time departure time of flight
696
+	 * @param String $arrival_airport_time arrival time of flight
697
+	 * @param String $squawk squawk code of flight
698
+	 * @param String $route_stop route stop of flight
699
+	 * @param String $highlight highlight or not
700
+	 * @param String $ModeS ModesS code of flight
701
+	 * @param String $registration registration code of flight
702
+	 * @param String $pilot_id pilot id of flight (for virtual airlines)
703
+	 * @param String $pilot_name pilot name of flight (for virtual airlines)
704
+	 * @param String $verticalrate vertival rate of flight
705
+	 * @return String success or false
706
+	 */
707 707
 	public function addMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $mmsi = '',$type = '',$typeid = '',$imo = '',$callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$format_source = '', $source_name = '')
708 708
 	{
709 709
 		global $globalURL, $globalMarineImageFetch;
@@ -818,7 +818,7 @@  discard block
 block discarded – undo
818 818
 			$sth->execute($query_values);
819 819
 			$this->db = null;
820 820
 		} catch (PDOException $e) {
821
-		    return "error : ".$e->getMessage();
821
+			return "error : ".$e->getMessage();
822 822
 		}
823 823
 		
824 824
 		return "success";
@@ -827,11 +827,11 @@  discard block
 block discarded – undo
827 827
 	
828 828
   
829 829
 	/**
830
-	* Gets the aircraft ident within the last hour
831
-	*
832
-	* @return String the ident
833
-	*
834
-	*/
830
+	 * Gets the aircraft ident within the last hour
831
+	 *
832
+	 * @return String the ident
833
+	 *
834
+	 */
835 835
 	public function getIdentFromLastHour($ident)
836 836
 	{
837 837
 		global $globalDBdriver, $globalTimezone;
@@ -847,11 +847,11 @@  discard block
 block discarded – undo
847 847
 								AND marine_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
848 848
 								AND marine_output.date < now() AT TIME ZONE 'UTC'";
849 849
 			$query_data = array(':ident' => $ident);
850
-    		}
850
+			}
851 851
 		
852 852
 		$sth = $this->db->prepare($query);
853 853
 		$sth->execute($query_data);
854
-    		$ident_result='';
854
+			$ident_result='';
855 855
 		while($row = $sth->fetch(PDO::FETCH_ASSOC))
856 856
 		{
857 857
 			$ident_result = $row['ident'];
@@ -862,11 +862,11 @@  discard block
 block discarded – undo
862 862
 	
863 863
 	
864 864
 	/**
865
-	* Gets the aircraft data from the last 20 seconds
866
-	*
867
-	* @return Array the spotter data
868
-	*
869
-	*/
865
+	 * Gets the aircraft data from the last 20 seconds
866
+	 *
867
+	 * @return Array the spotter data
868
+	 *
869
+	 */
870 870
 	public function getRealTimeData($q = '')
871 871
 	{
872 872
 		global $globalDBdriver;
@@ -904,11 +904,11 @@  discard block
 block discarded – undo
904 904
 	
905 905
 
906 906
 	/**
907
-	* Gets all number of flight over countries
908
-	*
909
-	* @return Array the airline country list
910
-	*
911
-	*/
907
+	 * Gets all number of flight over countries
908
+	 *
909
+	 * @return Array the airline country list
910
+	 *
911
+	 */
912 912
 
913 913
 	public function countAllMarineOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
914 914
 	{
@@ -981,11 +981,11 @@  discard block
 block discarded – undo
981 981
 	
982 982
 	
983 983
 	/**
984
-	* Gets all callsigns that have flown over
985
-	*
986
-	* @return Array the callsign list
987
-	*
988
-	*/
984
+	 * Gets all callsigns that have flown over
985
+	 *
986
+	 * @return Array the callsign list
987
+	 *
988
+	 */
989 989
 	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
990 990
 	{
991 991
 		global $globalDBdriver;
@@ -1052,11 +1052,11 @@  discard block
 block discarded – undo
1052 1052
 
1053 1053
 
1054 1054
 	/**
1055
-	* Counts all dates
1056
-	*
1057
-	* @return Array the date list
1058
-	*
1059
-	*/
1055
+	 * Counts all dates
1056
+	 *
1057
+	 * @return Array the date list
1058
+	 *
1059
+	 */
1060 1060
 	public function countAllDates($filters = array())
1061 1061
 	{
1062 1062
 		global $globalTimezone, $globalDBdriver;
@@ -1102,11 +1102,11 @@  discard block
 block discarded – undo
1102 1102
 	
1103 1103
 	
1104 1104
 	/**
1105
-	* Counts all dates during the last 7 days
1106
-	*
1107
-	* @return Array the date list
1108
-	*
1109
-	*/
1105
+	 * Counts all dates during the last 7 days
1106
+	 *
1107
+	 * @return Array the date list
1108
+	 *
1109
+	 */
1110 1110
 	public function countAllDatesLast7Days($filters = array())
1111 1111
 	{
1112 1112
 		global $globalTimezone, $globalDBdriver;
@@ -1128,7 +1128,7 @@  discard block
 block discarded – undo
1128 1128
 			$query .= " GROUP BY date_name 
1129 1129
 								ORDER BY date_name ASC";
1130 1130
 			$query_data = array(':offset' => $offset);
1131
-    		}
1131
+			}
1132 1132
 		
1133 1133
 		$sth = $this->db->prepare($query);
1134 1134
 		$sth->execute($query_data);
@@ -1148,11 +1148,11 @@  discard block
 block discarded – undo
1148 1148
 	}
1149 1149
 
1150 1150
 	/**
1151
-	* Counts all dates during the last month
1152
-	*
1153
-	* @return Array the date list
1154
-	*
1155
-	*/
1151
+	 * Counts all dates during the last month
1152
+	 *
1153
+	 * @return Array the date list
1154
+	 *
1155
+	 */
1156 1156
 	public function countAllDatesLastMonth($filters = array())
1157 1157
 	{
1158 1158
 		global $globalTimezone, $globalDBdriver;
@@ -1174,7 +1174,7 @@  discard block
 block discarded – undo
1174 1174
 			$query .= " GROUP BY date_name 
1175 1175
 								ORDER BY date_name ASC";
1176 1176
 			$query_data = array(':offset' => $offset);
1177
-    		}
1177
+			}
1178 1178
 		
1179 1179
 		$sth = $this->db->prepare($query);
1180 1180
 		$sth->execute($query_data);
@@ -1196,11 +1196,11 @@  discard block
 block discarded – undo
1196 1196
 
1197 1197
 
1198 1198
 	/**
1199
-	* Counts all month
1200
-	*
1201
-	* @return Array the month list
1202
-	*
1203
-	*/
1199
+	 * Counts all month
1200
+	 *
1201
+	 * @return Array the month list
1202
+	 *
1203
+	 */
1204 1204
 	public function countAllMonths($filters = array())
1205 1205
 	{
1206 1206
 		global $globalTimezone, $globalDBdriver;
@@ -1245,11 +1245,11 @@  discard block
 block discarded – undo
1245 1245
 	
1246 1246
 
1247 1247
 	/**
1248
-	* Counts all dates during the last year
1249
-	*
1250
-	* @return Array the date list
1251
-	*
1252
-	*/
1248
+	 * Counts all dates during the last year
1249
+	 *
1250
+	 * @return Array the date list
1251
+	 *
1252
+	 */
1253 1253
 	public function countAllMonthsLastYear($filters)
1254 1254
 	{
1255 1255
 		global $globalTimezone, $globalDBdriver;
@@ -1271,7 +1271,7 @@  discard block
 block discarded – undo
1271 1271
 			$query .= " GROUP BY year_name, month_name
1272 1272
 								ORDER BY year_name, month_name ASC";
1273 1273
 			$query_data = array(':offset' => $offset);
1274
-    		}
1274
+			}
1275 1275
 		
1276 1276
 		$sth = $this->db->prepare($query);
1277 1277
 		$sth->execute($query_data);
@@ -1294,11 +1294,11 @@  discard block
 block discarded – undo
1294 1294
 	
1295 1295
 	
1296 1296
 	/**
1297
-	* Counts all hours
1298
-	*
1299
-	* @return Array the hour list
1300
-	*
1301
-	*/
1297
+	 * Counts all hours
1298
+	 *
1299
+	 * @return Array the hour list
1300
+	 *
1301
+	 */
1302 1302
 	public function countAllHours($orderby,$filters = array())
1303 1303
 	{
1304 1304
 		global $globalTimezone, $globalDBdriver;
@@ -1361,11 +1361,11 @@  discard block
 block discarded – undo
1361 1361
 	
1362 1362
 	
1363 1363
 	/**
1364
-	* Counts all hours by date
1365
-	*
1366
-	* @return Array the hour list
1367
-	*
1368
-	*/
1364
+	 * Counts all hours by date
1365
+	 *
1366
+	 * @return Array the hour list
1367
+	 *
1368
+	 */
1369 1369
 	public function countAllHoursByDate($date, $filters = array())
1370 1370
 	{
1371 1371
 		global $globalTimezone, $globalDBdriver;
@@ -1409,11 +1409,11 @@  discard block
 block discarded – undo
1409 1409
 	
1410 1410
 	
1411 1411
 	/**
1412
-	* Counts all hours by a ident/callsign
1413
-	*
1414
-	* @return Array the hour list
1415
-	*
1416
-	*/
1412
+	 * Counts all hours by a ident/callsign
1413
+	 *
1414
+	 * @return Array the hour list
1415
+	 *
1416
+	 */
1417 1417
 	public function countAllHoursByIdent($ident, $filters = array())
1418 1418
 	{
1419 1419
 		global $globalTimezone, $globalDBdriver;
@@ -1458,11 +1458,11 @@  discard block
 block discarded – undo
1458 1458
 	
1459 1459
 	
1460 1460
 	/**
1461
-	* Counts all vessels
1462
-	*
1463
-	* @return Integer the number of vessels
1464
-	*
1465
-	*/
1461
+	 * Counts all vessels
1462
+	 *
1463
+	 * @return Integer the number of vessels
1464
+	 *
1465
+	 */
1466 1466
 	public function countOverallMarine($filters = array(),$year = '',$month = '')
1467 1467
 	{
1468 1468
 		global $globalDBdriver;
@@ -1497,11 +1497,11 @@  discard block
 block discarded – undo
1497 1497
 	}
1498 1498
 	
1499 1499
 	/**
1500
-	* Counts all vessel type
1501
-	*
1502
-	* @return Integer the number of vessels
1503
-	*
1504
-	*/
1500
+	 * Counts all vessel type
1501
+	 *
1502
+	 * @return Integer the number of vessels
1503
+	 *
1504
+	 */
1505 1505
 	public function countOverallMarineTypes($filters = array(),$year = '',$month = '')
1506 1506
 	{
1507 1507
 		global $globalDBdriver;
@@ -1536,11 +1536,11 @@  discard block
 block discarded – undo
1536 1536
 	
1537 1537
   
1538 1538
 	/**
1539
-	* Counts all hours of today
1540
-	*
1541
-	* @return Array the hour list
1542
-	*
1543
-	*/
1539
+	 * Counts all hours of today
1540
+	 *
1541
+	 * @return Array the hour list
1542
+	 *
1543
+	 */
1544 1544
 	public function countAllHoursFromToday($filters = array())
1545 1545
 	{
1546 1546
 		global $globalTimezone, $globalDBdriver;
@@ -1580,12 +1580,12 @@  discard block
 block discarded – undo
1580 1580
 	}
1581 1581
     
1582 1582
     
1583
-     /**
1584
-	* Gets the Barrie Spotter ID based on the FlightAware ID
1585
-	*
1586
-	* @return Integer the Barrie Spotter ID
1583
+	 /**
1584
+	  * Gets the Barrie Spotter ID based on the FlightAware ID
1585
+	  *
1586
+	  * @return Integer the Barrie Spotter ID
1587 1587
 q	*
1588
-	*/
1588
+	  */
1589 1589
 	public function getMarineIDBasedOnFamMarineID($fammarine_id)
1590 1590
 	{
1591 1591
 		$fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING);
@@ -1606,13 +1606,13 @@  discard block
 block discarded – undo
1606 1606
   
1607 1607
  
1608 1608
 	/**
1609
-	* Parses a date string
1610
-	*
1611
-	* @param String $dateString the date string
1612
-	* @param String $timezone the timezone of a user
1613
-	* @return Array the time information
1614
-	*
1615
-	*/
1609
+	 * Parses a date string
1610
+	 *
1611
+	 * @param String $dateString the date string
1612
+	 * @param String $timezone the timezone of a user
1613
+	 * @return Array the time information
1614
+	 *
1615
+	 */
1616 1616
 	public function parseDateString($dateString, $timezone = '')
1617 1617
 	{
1618 1618
 		$time_array = array();
@@ -1645,12 +1645,12 @@  discard block
 block discarded – undo
1645 1645
 	}
1646 1646
 	
1647 1647
 	/**
1648
-	* Parses the direction degrees to working
1649
-	*
1650
-	* @param Float $direction the direction in degrees
1651
-	* @return Array the direction information
1652
-	*
1653
-	*/
1648
+	 * Parses the direction degrees to working
1649
+	 *
1650
+	 * @param Float $direction the direction in degrees
1651
+	 * @return Array the direction information
1652
+	 *
1653
+	 */
1654 1654
 	public function parseDirection($direction = 0)
1655 1655
 	{
1656 1656
 		if ($direction == '') $direction = 0;
@@ -1729,12 +1729,12 @@  discard block
 block discarded – undo
1729 1729
 	
1730 1730
 	
1731 1731
 	/**
1732
-	* Gets Country from latitude/longitude
1733
-	*
1734
-	* @param Float $latitude latitute of the flight
1735
-	* @param Float $longitude longitute of the flight
1736
-	* @return String the countrie
1737
-	*/
1732
+	 * Gets Country from latitude/longitude
1733
+	 *
1734
+	 * @param Float $latitude latitute of the flight
1735
+	 * @param Float $longitude longitute of the flight
1736
+	 * @return String the countrie
1737
+	 */
1738 1738
 	public function getCountryFromLatitudeLongitude($latitude,$longitude)
1739 1739
 	{
1740 1740
 		global $globalDBdriver, $globalDebug;
@@ -1771,11 +1771,11 @@  discard block
 block discarded – undo
1771 1771
 	}
1772 1772
 
1773 1773
 	/**
1774
-	* Gets Country from iso2
1775
-	*
1776
-	* @param String $iso2 ISO2 country code
1777
-	* @return String the countrie
1778
-	*/
1774
+	 * Gets Country from iso2
1775
+	 *
1776
+	 * @param String $iso2 ISO2 country code
1777
+	 * @return String the countrie
1778
+	 */
1779 1779
 	public function getCountryFromISO2($iso2)
1780 1780
 	{
1781 1781
 		global $globalDBdriver, $globalDebug;
@@ -1804,12 +1804,12 @@  discard block
 block discarded – undo
1804 1804
 
1805 1805
 	
1806 1806
 	/**
1807
-	* Gets the short url from bit.ly
1808
-	*
1809
-	* @param String $url the full url
1810
-	* @return String the bit.ly url
1811
-	*
1812
-	*/
1807
+	 * Gets the short url from bit.ly
1808
+	 *
1809
+	 * @param String $url the full url
1810
+	 * @return String the bit.ly url
1811
+	 *
1812
+	 */
1813 1813
 	public function getBitlyURL($url)
1814 1814
 	{
1815 1815
 		global $globalBitlyAccessToken;
@@ -1836,11 +1836,11 @@  discard block
 block discarded – undo
1836 1836
 
1837 1837
 	
1838 1838
 	/**
1839
-	* Gets all vessels types that have flown over
1840
-	*
1841
-	* @return Array the vessel type list
1842
-	*
1843
-	*/
1839
+	 * Gets all vessels types that have flown over
1840
+	 *
1841
+	 * @return Array the vessel type list
1842
+	 *
1843
+	 */
1844 1844
 	public function countAllMarineTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
1845 1845
 	{
1846 1846
 		global $globalDBdriver;
@@ -1906,11 +1906,11 @@  discard block
 block discarded – undo
1906 1906
 	}
1907 1907
 
1908 1908
 	/**
1909
-	* Gets all the tracker information
1910
-	*
1911
-	* @return Array the tracker information
1912
-	*
1913
-	*/
1909
+	 * Gets all the tracker information
1910
+	 *
1911
+	 * @return Array the tracker information
1912
+	 *
1913
+	 */
1914 1914
 	public function searchMarineData($q = '', $callsign = '',$mmsi = '', $imo = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array())
1915 1915
 	{
1916 1916
 		global $globalTimezone, $globalDBdriver;
Please login to merge, or discard this patch.
Spacing   +208 added lines, -208 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 require_once(dirname(__FILE__).'/class.Image.php');
3 3
 $global_query = "SELECT marine_output.* FROM marine_output";
4 4
 
5
-class Marine{
5
+class Marine {
6 6
 	public $db;
7 7
 	
8 8
 	public function __construct($dbc = null) {
@@ -17,33 +17,33 @@  discard block
 block discarded – undo
17 17
 	* @return Array the SQL part
18 18
 	*/
19 19
 	
20
-	public function getFilter($filter = array(),$where = false,$and = false) {
20
+	public function getFilter($filter = array(), $where = false, $and = false) {
21 21
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
22 22
 		$filters = array();
23 23
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
24 24
 			if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
25 25
 				$filters = $globalStatsFilters[$globalFilterName];
26 26
 			} else {
27
-				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
27
+				$filter = array_merge($filter, $globalStatsFilters[$globalFilterName]);
28 28
 			}
29 29
 		}
30 30
 		if (isset($filter[0]['source'])) {
31
-			$filters = array_merge($filters,$filter);
31
+			$filters = array_merge($filters, $filter);
32 32
 		}
33
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
33
+		if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
34 34
 		$filter_query_join = '';
35 35
 		$filter_query_where = '';
36
-		foreach($filters as $flt) {
36
+		foreach ($filters as $flt) {
37 37
 			if (isset($flt['idents']) && !empty($flt['idents'])) {
38 38
 				if (isset($flt['source'])) {
39
-					$filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spfi ON spfi.fammarine_id = marine_output.fammarine_id";
39
+					$filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spfi ON spfi.fammarine_id = marine_output.fammarine_id";
40 40
 				} else {
41
-					$filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','",$flt['idents'])."')) spfi ON spfi.fammarine_id = marine_output.fammarine_id";
41
+					$filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','", $flt['idents'])."')) spfi ON spfi.fammarine_id = marine_output.fammarine_id";
42 42
 				}
43 43
 			}
44 44
 		}
45 45
 		if (isset($filter['source']) && !empty($filter['source'])) {
46
-			$filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')";
46
+			$filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')";
47 47
 		}
48 48
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
49 49
 			$filter_query_where .= " AND ident = '".$filter['ident']."'";
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
76 76
 		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
77 77
 		if ($filter_query_where != '') {
78
-			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
78
+			$filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where);
79 79
 		}
80 80
 		$filter_query = $filter_query_join.$filter_query_where;
81 81
 		return $filter_query;
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	* @return Array the spotter information
91 91
 	*
92 92
 	*/
93
-	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
93
+	public function getDataFromDB($query, $params = array(), $limitQuery = '', $schedules = false)
94 94
 	{
95 95
 		date_default_timezone_set('UTC');
96 96
 		if (!is_string($query))
@@ -110,13 +110,13 @@  discard block
 block discarded – undo
110 110
 			$sth = $this->db->prepare($query.$limitQuery);
111 111
 			$sth->execute($params);
112 112
 		} catch (PDOException $e) {
113
-			printf("Invalid query : %s\nWhole query: %s\n",$e->getMessage(), $query.$limitQuery);
113
+			printf("Invalid query : %s\nWhole query: %s\n", $e->getMessage(), $query.$limitQuery);
114 114
 			exit();
115 115
 		}
116 116
 		
117 117
 		$num_rows = 0;
118 118
 		$spotter_array = array();
119
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
119
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
120 120
 		{
121 121
 			$num_rows++;
122 122
 			$temp_array = array();
@@ -151,10 +151,10 @@  discard block
 block discarded – undo
151 151
 			}
152 152
 			if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed'];
153 153
 
154
-			if(isset($temp_array['mmsi']) && $temp_array['mmsi'] != "")
154
+			if (isset($temp_array['mmsi']) && $temp_array['mmsi'] != "")
155 155
 			{
156 156
 				$Image = new Image($this->db);
157
-				if (isset($temp_array['ident']) && $temp_array['ident'] != '') $image_array = $Image->getMarineImage($temp_array['mmsi'],'',$temp_array['ident']);
157
+				if (isset($temp_array['ident']) && $temp_array['ident'] != '') $image_array = $Image->getMarineImage($temp_array['mmsi'], '', $temp_array['ident']);
158 158
 				else $image_array = $Image->getMarineImage($temp_array['mmsi']);
159 159
 				unset($Image);
160 160
 				if (count($image_array) > 0) {
@@ -190,17 +190,17 @@  discard block
 block discarded – undo
190 190
 				{
191 191
 					$temp_array['date'] = "about ".$dateArray['hours']." hours ago";
192 192
 				} else {
193
-					$temp_array['date'] = date("M j Y, g:i a",strtotime($row['date']." UTC"));
193
+					$temp_array['date'] = date("M j Y, g:i a", strtotime($row['date']." UTC"));
194 194
 				}
195 195
 				$temp_array['date_minutes_past'] = $dateArray['minutes'];
196
-				$temp_array['date_iso_8601'] = date("c",strtotime($row['date']." UTC"));
197
-				$temp_array['date_rfc_2822'] = date("r",strtotime($row['date']." UTC"));
196
+				$temp_array['date_iso_8601'] = date("c", strtotime($row['date']." UTC"));
197
+				$temp_array['date_rfc_2822'] = date("r", strtotime($row['date']." UTC"));
198 198
 				$temp_array['date_unix'] = strtotime($row['date']." UTC");
199 199
 				if (isset($row['last_seen']) && $row['last_seen'] != '') {
200 200
 					if (strtotime($row['last_seen']) > strtotime($row['date'])) {
201 201
 						$temp_array['duration'] = strtotime($row['last_seen']) - strtotime($row['date']);
202
-						$temp_array['last_seen_date_iso_8601'] = date("c",strtotime($row['last_seen']." UTC"));
203
-						$temp_array['last_seen_date_rfc_2822'] = date("r",strtotime($row['last_seen']." UTC"));
202
+						$temp_array['last_seen_date_iso_8601'] = date("c", strtotime($row['last_seen']." UTC"));
203
+						$temp_array['last_seen_date_rfc_2822'] = date("r", strtotime($row['last_seen']." UTC"));
204 204
 						$temp_array['last_seen_date_unix'] = strtotime($row['last_seen']." UTC");
205 205
 					}
206 206
 				}
@@ -233,8 +233,8 @@  discard block
 block discarded – undo
233 233
 		if ($limit != "")
234 234
 		{
235 235
 			$limit_array = explode(",", $limit);
236
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
237
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
236
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
237
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
238 238
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
239 239
 			{
240 240
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
@@ -248,8 +248,8 @@  discard block
 block discarded – undo
248 248
 		} else {
249 249
 			$orderby_query = " ORDER BY marine_output.date DESC";
250 250
 		}
251
-		$query  = $global_query.$filter_query." ".$orderby_query;
252
-		$spotter_array = $this->getDataFromDB($query, array(),$limit_query,true);
251
+		$query = $global_query.$filter_query." ".$orderby_query;
252
+		$spotter_array = $this->getDataFromDB($query, array(), $limit_query, true);
253 253
 		return $spotter_array;
254 254
 	}
255 255
     
@@ -267,8 +267,8 @@  discard block
 block discarded – undo
267 267
 		if ($id == '') return array();
268 268
 		$additional_query = "marine_output.fammarine_id = :id";
269 269
 		$query_values = array(':id' => $id);
270
-		$query  = $global_query." WHERE ".$additional_query." ";
271
-		$spotter_array = $this->getDataFromDB($query,$query_values);
270
+		$query = $global_query." WHERE ".$additional_query." ";
271
+		$spotter_array = $this->getDataFromDB($query, $query_values);
272 272
 		return $spotter_array;
273 273
 	}
274 274
 
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 		$query_values = array();
288 288
 		$limit_query = '';
289 289
 		$additional_query = '';
290
-		$filter_query = $this->getFilter($filter,true,true);
290
+		$filter_query = $this->getFilter($filter, true, true);
291 291
 		if ($ident != "")
292 292
 		{
293 293
 			if (!is_string($ident))
@@ -303,8 +303,8 @@  discard block
 block discarded – undo
303 303
 		{
304 304
 			$limit_array = explode(",", $limit);
305 305
 			
306
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
307
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
306
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
307
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
308 308
 			
309 309
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
310 310
 			{
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
 		$query_values = array();
344 344
 		$limit_query = '';
345 345
 		$additional_query = '';
346
-		$filter_query = $this->getFilter($filter,true,true);
346
+		$filter_query = $this->getFilter($filter, true, true);
347 347
 		if (!is_string($type))
348 348
 		{
349 349
 			return false;
@@ -356,8 +356,8 @@  discard block
 block discarded – undo
356 356
 		{
357 357
 			$limit_array = explode(",", $limit);
358 358
 			
359
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
360
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
359
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
360
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
361 361
 			
362 362
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
363 363
 			{
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
 		return $spotter_array;
382 382
 	}
383 383
 	
384
-	public function getMarineDataByDate($date = '', $limit = '', $sort = '',$filter = array())
384
+	public function getMarineDataByDate($date = '', $limit = '', $sort = '', $filter = array())
385 385
 	{
386 386
 		global $global_query, $globalTimezone, $globalDBdriver;
387 387
 		
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 		$limit_query = '';
390 390
 		$additional_query = '';
391 391
 
392
-		$filter_query = $this->getFilter($filter,true,true);
392
+		$filter_query = $this->getFilter($filter, true, true);
393 393
 		
394 394
 		if ($date != "")
395 395
 		{
@@ -415,8 +415,8 @@  discard block
 block discarded – undo
415 415
 		{
416 416
 			$limit_array = explode(",", $limit);
417 417
 			
418
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
419
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
418
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
419
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
420 420
 			
421 421
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
422 422
 			{
@@ -447,11 +447,11 @@  discard block
 block discarded – undo
447 447
 	* @return Array list of source name
448 448
 	*
449 449
 	*/
450
-	public function getAllSourceName($type = '',$filters = array())
450
+	public function getAllSourceName($type = '', $filters = array())
451 451
 	{
452
-		$filter_query = $this->getFilter($filters,true,true);
452
+		$filter_query = $this->getFilter($filters, true, true);
453 453
 		$query_values = array();
454
-		$query  = "SELECT DISTINCT marine_output.source_name 
454
+		$query = "SELECT DISTINCT marine_output.source_name 
455 455
 				FROM marine_output".$filter_query." marine_output.source_name <> ''";
456 456
 		if ($type != '') {
457 457
 			$query_values = array(':type' => $type);
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
 		$source_array = array();
467 467
 		$temp_array = array();
468 468
 		
469
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
469
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
470 470
 		{
471 471
 			$temp_array['source_name'] = $row['source_name'];
472 472
 			$source_array[] = $temp_array;
@@ -483,8 +483,8 @@  discard block
 block discarded – undo
483 483
 	*/
484 484
 	public function getAllIdents($filters = array())
485 485
 	{
486
-		$filter_query = $this->getFilter($filters,true,true);
487
-		$query  = "SELECT DISTINCT marine_output.ident
486
+		$filter_query = $this->getFilter($filters, true, true);
487
+		$query = "SELECT DISTINCT marine_output.ident
488 488
 								FROM marine_output".$filter_query." marine_output.ident <> '' 
489 489
 								ORDER BY marine_output.date ASC LIMIT 700 OFFSET 0";
490 490
 
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
 		$ident_array = array();
495 495
 		$temp_array = array();
496 496
 		
497
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
497
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
498 498
 		{
499 499
 			$temp_array['ident'] = $row['ident'];
500 500
 			$ident_array[] = $temp_array;
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
 	*/
512 512
 	public function getIdentity($mmsi)
513 513
 	{
514
-		$mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT);
514
+		$mmsi = filter_var($mmsi, FILTER_SANITIZE_NUMBER_INT);
515 515
 		$query  = "SELECT * FROM marine_identity WHERE mmsi = :mmsi LIMIT 1";
516 516
 		$sth = $this->db->prepare($query);
517 517
 		$sth->execute(array(':mmsi' => $mmsi));
@@ -524,23 +524,23 @@  discard block
 block discarded – undo
524 524
 	* Add identity
525 525
 	*
526 526
 	*/
527
-	public function addIdentity($mmsi,$imo,$ident,$callsign,$type)
527
+	public function addIdentity($mmsi, $imo, $ident, $callsign, $type)
528 528
 	{
529
-		$mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT);
529
+		$mmsi = filter_var($mmsi, FILTER_SANITIZE_NUMBER_INT);
530 530
 		if ($mmsi != '') {
531
-			$imo = filter_var($imo,FILTER_SANITIZE_NUMBER_INT);
532
-			$ident = filter_var($ident,FILTER_SANITIZE_STRING);
533
-			$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
534
-			$type = filter_var($type,FILTER_SANITIZE_STRING);
531
+			$imo = filter_var($imo, FILTER_SANITIZE_NUMBER_INT);
532
+			$ident = filter_var($ident, FILTER_SANITIZE_STRING);
533
+			$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
534
+			$type = filter_var($type, FILTER_SANITIZE_STRING);
535 535
 			$identinfo = $this->getIdentity($mmsi);
536 536
 			if (empty($identinfo)) {
537
-				$query  = "INSERT INTO marine_identity (mmsi,imo,call_sign,ship_name,type) VALUES (:mmsi,:imo,:call_sign,:ship_name,:type)";
537
+				$query = "INSERT INTO marine_identity (mmsi,imo,call_sign,ship_name,type) VALUES (:mmsi,:imo,:call_sign,:ship_name,:type)";
538 538
 				$sth = $this->db->prepare($query);
539
-				$sth->execute(array(':mmsi' => $mmsi,':imo' => $imo,':call_sign' => $callsign,':ship_name' => $ident,':type' => $type));
539
+				$sth->execute(array(':mmsi' => $mmsi, ':imo' => $imo, ':call_sign' => $callsign, ':ship_name' => $ident, ':type' => $type));
540 540
 			} elseif ($ident != '' && $identinfo['ship_name'] != $ident) {
541
-				$query  = "UPDATE marine_identity SET ship_name = :ship_name,type = :type WHERE mmsi = :mmsi";
541
+				$query = "UPDATE marine_identity SET ship_name = :ship_name,type = :type WHERE mmsi = :mmsi";
542 542
 				$sth = $this->db->prepare($query);
543
-				$sth->execute(array(':mmsi' => $mmsi,':ship_name' => $ident,':type' => $type));
543
+				$sth->execute(array(':mmsi' => $mmsi, ':ship_name' => $ident, ':type' => $type));
544 544
 			}
545 545
 		}
546 546
 	}
@@ -561,12 +561,12 @@  discard block
 block discarded – undo
561 561
 		} else $offset = '+00:00';
562 562
 
563 563
 		if ($globalDBdriver == 'mysql') {
564
-			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) as date
564
+			$query = "SELECT DISTINCT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) as date
565 565
 								FROM marine_output
566 566
 								WHERE marine_output.date <> '' 
567 567
 								ORDER BY marine_output.date ASC LIMIT 0,100";
568 568
 		} else {
569
-			$query  = "SELECT DISTINCT to_char(marine_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
569
+			$query = "SELECT DISTINCT to_char(marine_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
570 570
 								FROM marine_output
571 571
 								WHERE marine_output.date <> '' 
572 572
 								ORDER BY marine_output.date ASC LIMIT 0,100";
@@ -578,7 +578,7 @@  discard block
 block discarded – undo
578 578
 		$date_array = array();
579 579
 		$temp_array = array();
580 580
 		
581
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
581
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
582 582
 		{
583 583
 			$temp_array['date'] = $row['date'];
584 584
 
@@ -596,10 +596,10 @@  discard block
 block discarded – undo
596 596
 	* @return String success or false
597 597
 	*
598 598
 	*/
599
-	public function updateIdentMarineData($fammarine_id = '', $ident = '',$fromsource = NULL)
599
+	public function updateIdentMarineData($fammarine_id = '', $ident = '', $fromsource = NULL)
600 600
 	{
601 601
 		$query = 'UPDATE marine_output SET ident = :ident WHERE fammarine_id = :fammarine_id';
602
-		$query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident);
602
+		$query_values = array(':fammarine_id' => $fammarine_id, ':ident' => $ident);
603 603
 		try {
604 604
 			$sth = $this->db->prepare($query);
605 605
 			$sth->execute($query_values);
@@ -617,10 +617,10 @@  discard block
 block discarded – undo
617 617
 	* @return String success or false
618 618
 	*
619 619
 	*/
620
-	public function updateArrivalPortNameMarineData($fammarine_id = '', $arrival_code = '',$fromsource = NULL)
620
+	public function updateArrivalPortNameMarineData($fammarine_id = '', $arrival_code = '', $fromsource = NULL)
621 621
 	{
622 622
 		$query = 'UPDATE marine_output SET arrival_port_name = :arrival_code WHERE fammarine_id = :fammarine_id';
623
-		$query_values = array(':fammarine_id' => $fammarine_id,':arrival_code' => $arrival_code);
623
+		$query_values = array(':fammarine_id' => $fammarine_id, ':arrival_code' => $arrival_code);
624 624
 		try {
625 625
 			$sth = $this->db->prepare($query);
626 626
 			$sth->execute($query_values);
@@ -639,11 +639,11 @@  discard block
 block discarded – undo
639 639
 	* @return String success or false
640 640
 	*
641 641
 	*/
642
-	public function updateStatusMarineData($fammarine_id = '', $status_id = '',$status = '')
642
+	public function updateStatusMarineData($fammarine_id = '', $status_id = '', $status = '')
643 643
 	{
644 644
 
645 645
 		$query = 'UPDATE marine_output SET status = :status, status_id = :status_id WHERE fammarine_id = :fammarine_id';
646
-                $query_values = array(':fammarine_id' => $fammarine_id,':status' => $status,':status_id' => $status_id);
646
+                $query_values = array(':fammarine_id' => $fammarine_id, ':status' => $status, ':status_id' => $status_id);
647 647
 
648 648
 		try {
649 649
 			$sth = $this->db->prepare($query);
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
 	public function updateLatestMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $groundspeed = NULL, $date = '')
667 667
 	{
668 668
 		$query = 'UPDATE marine_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_seen = :last_seen, last_ground_speed = :last_ground_speed WHERE fammarine_id = :fammarine_id';
669
-                $query_values = array(':fammarine_id' => $fammarine_id,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident);
669
+                $query_values = array(':fammarine_id' => $fammarine_id, ':last_latitude' => $latitude, ':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed, ':last_seen' => $date, ':ident' => $ident);
670 670
 
671 671
 		try {
672 672
 			$sth = $this->db->prepare($query);
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
 	* @param String $verticalrate vertival rate of flight
705 705
 	* @return String success or false
706 706
 	*/
707
-	public function addMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $mmsi = '',$type = '',$typeid = '',$imo = '',$callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$format_source = '', $source_name = '')
707
+	public function addMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $mmsi = '', $type = '', $typeid = '', $imo = '', $callsign = '', $arrival_code = '', $arrival_date = '', $status = '', $statusid = '', $format_source = '', $source_name = '')
708 708
 	{
709 709
 		global $globalURL, $globalMarineImageFetch;
710 710
 		
@@ -771,32 +771,32 @@  discard block
 block discarded – undo
771 771
 		}
772 772
 
773 773
     
774
-		if ($date == "" || strtotime($date) < time()-20*60)
774
+		if ($date == "" || strtotime($date) < time() - 20*60)
775 775
 		{
776 776
 			$date = date("Y-m-d H:i:s", time());
777 777
 		}
778 778
 
779
-		$fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING);
780
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
781
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
782
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
783
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
784
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
785
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
786
-		$mmsi = filter_var($mmsi,FILTER_SANITIZE_STRING);
787
-		$type = filter_var($type,FILTER_SANITIZE_STRING);
788
-		$status = filter_var($status,FILTER_SANITIZE_STRING);
789
-		$type_id = filter_var($typeid,FILTER_SANITIZE_NUMBER_INT);
790
-		$status_id = filter_var($statusid,FILTER_SANITIZE_NUMBER_INT);
791
-		$imo = filter_var($imo,FILTER_SANITIZE_STRING);
792
-		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
793
-		$arrival_code = filter_var($arrival_code,FILTER_SANITIZE_STRING);
794
-		$arrival_date = filter_var($arrival_date,FILTER_SANITIZE_STRING);
779
+		$fammarine_id = filter_var($fammarine_id, FILTER_SANITIZE_STRING);
780
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
781
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
782
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
783
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
784
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
785
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
786
+		$mmsi = filter_var($mmsi, FILTER_SANITIZE_STRING);
787
+		$type = filter_var($type, FILTER_SANITIZE_STRING);
788
+		$status = filter_var($status, FILTER_SANITIZE_STRING);
789
+		$type_id = filter_var($typeid, FILTER_SANITIZE_NUMBER_INT);
790
+		$status_id = filter_var($statusid, FILTER_SANITIZE_NUMBER_INT);
791
+		$imo = filter_var($imo, FILTER_SANITIZE_STRING);
792
+		$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
793
+		$arrival_code = filter_var($arrival_code, FILTER_SANITIZE_STRING);
794
+		$arrival_date = filter_var($arrival_date, FILTER_SANITIZE_STRING);
795 795
 		if (isset($globalMarineImageFetch) && $globalMarineImageFetch === TRUE) {
796 796
 			$Image = new Image($this->db);
797
-			$image_array = $Image->getMarineImage($mmsi,$imo,$ident);
797
+			$image_array = $Image->getMarineImage($mmsi, $imo, $ident);
798 798
 			if (!isset($image_array[0]['mmsi'])) {
799
-				$Image->addMarineImage($mmsi,$imo,$ident);
799
+				$Image->addMarineImage($mmsi, $imo, $ident);
800 800
 			}
801 801
 			unset($Image);
802 802
 		}
@@ -809,10 +809,10 @@  discard block
 block discarded – undo
809 809
 		if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
810 810
 		if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
811 811
 		if ($arrival_date == '') $arrival_date = NULL;
812
-		$query  = "INSERT INTO marine_output (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, mmsi, type, type_id, status,status_id,imo,arrival_port_name,arrival_port_date) 
812
+		$query = "INSERT INTO marine_output (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, mmsi, type, type_id, status,status_id,imo,arrival_port_name,arrival_port_date) 
813 813
 		    VALUES (:fammarine_id,:ident,:latitude,:longitude,:heading,:speed,:date,:format_source, :source_name,:mmsi,:type,:type_id,:status,:status_id,:imo,:arrival_port_name,:arrival_port_date)";
814 814
 
815
-		$query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':heading' => $heading,':speed' => $groundspeed,':date' => $date,':format_source' => $format_source, ':source_name' => $source_name,':mmsi' => $mmsi,':type' => $type,':type_id' => $type_id,':status' => $status,':status_id' => $status_id,':imo' => $imo,':arrival_port_name' => $arrival_code,':arrival_port_date' => $arrival_date);
815
+		$query_values = array(':fammarine_id' => $fammarine_id, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':heading' => $heading, ':speed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':mmsi' => $mmsi, ':type' => $type, ':type_id' => $type_id, ':status' => $status, ':status_id' => $status_id, ':imo' => $imo, ':arrival_port_name' => $arrival_code, ':arrival_port_date' => $arrival_date);
816 816
 		try {
817 817
 			$sth = $this->db->prepare($query);
818 818
 			$sth->execute($query_values);
@@ -836,13 +836,13 @@  discard block
 block discarded – undo
836 836
 	{
837 837
 		global $globalDBdriver, $globalTimezone;
838 838
 		if ($globalDBdriver == 'mysql') {
839
-			$query  = "SELECT marine_output.ident FROM marine_output 
839
+			$query = "SELECT marine_output.ident FROM marine_output 
840 840
 								WHERE marine_output.ident = :ident 
841 841
 								AND marine_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
842 842
 								AND marine_output.date < UTC_TIMESTAMP()";
843 843
 			$query_data = array(':ident' => $ident);
844 844
 		} else {
845
-			$query  = "SELECT marine_output.ident FROM marine_output 
845
+			$query = "SELECT marine_output.ident FROM marine_output 
846 846
 								WHERE marine_output.ident = :ident 
847 847
 								AND marine_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
848 848
 								AND marine_output.date < now() AT TIME ZONE 'UTC'";
@@ -851,8 +851,8 @@  discard block
 block discarded – undo
851 851
 		
852 852
 		$sth = $this->db->prepare($query);
853 853
 		$sth->execute($query_data);
854
-    		$ident_result='';
855
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
854
+    		$ident_result = '';
855
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
856 856
 		{
857 857
 			$ident_result = $row['ident'];
858 858
 		}
@@ -878,8 +878,8 @@  discard block
 block discarded – undo
878 878
 				return false;
879 879
 			} else {
880 880
 				$q_array = explode(" ", $q);
881
-				foreach ($q_array as $q_item){
882
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
881
+				foreach ($q_array as $q_item) {
882
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
883 883
 					$additional_query .= " AND (";
884 884
 					$additional_query .= "(marine_output.ident like '%".$q_item."%')";
885 885
 					$additional_query .= ")";
@@ -887,11 +887,11 @@  discard block
 block discarded – undo
887 887
 			}
888 888
 		}
889 889
 		if ($globalDBdriver == 'mysql') {
890
-			$query  = "SELECT marine_output.* FROM marine_output 
890
+			$query = "SELECT marine_output.* FROM marine_output 
891 891
 				WHERE marine_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." 
892 892
 				AND marine_output.date < UTC_TIMESTAMP()";
893 893
 		} else {
894
-			$query  = "SELECT marine_output.* FROM marine_output 
894
+			$query = "SELECT marine_output.* FROM marine_output 
895 895
 				WHERE marine_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." 
896 896
 				AND marine_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
897 897
 		}
@@ -910,16 +910,16 @@  discard block
 block discarded – undo
910 910
 	*
911 911
 	*/
912 912
 
913
-	public function countAllMarineOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
913
+	public function countAllMarineOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
914 914
 	{
915 915
 		global $globalDBdriver, $globalArchive;
916 916
 		//$filter_query = $this->getFilter($filters,true,true);
917
-		$Connection= new Connection($this->db);
917
+		$Connection = new Connection($this->db);
918 918
 		if (!$Connection->tableExists('countries')) return array();
919 919
 		require_once('class.SpotterLive.php');
920 920
 		if (!isset($globalArchive) || $globalArchive !== TRUE) {
921 921
 			$MarineLive = new MarineLive($this->db);
922
-			$filter_query = $MarineLive->getFilter($filters,true,true);
922
+			$filter_query = $MarineLive->getFilter($filters, true, true);
923 923
 			$filter_query .= " over_country IS NOT NULL AND over_country <> ''";
924 924
 			if ($olderthanmonths > 0) {
925 925
 				if ($globalDBdriver == 'mysql') {
@@ -939,7 +939,7 @@  discard block
 block discarded – undo
939 939
 		} else {
940 940
 			require_once(dirname(__FILE__)."/class.MarineArchive.php");
941 941
 			$MarineArchive = new MarineArchive($this->db);
942
-			$filter_query = $MarineArchive->getFilter($filters,true,true);
942
+			$filter_query = $MarineArchive->getFilter($filters, true, true);
943 943
 			$filter_query .= " over_country <> ''";
944 944
 			if ($olderthanmonths > 0) {
945 945
 				if ($globalDBdriver == 'mysql') {
@@ -967,7 +967,7 @@  discard block
 block discarded – undo
967 967
 		$flight_array = array();
968 968
 		$temp_array = array();
969 969
         
970
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
970
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
971 971
 		{
972 972
 			$temp_array['marine_count'] = $row['nb'];
973 973
 			$temp_array['marine_country'] = $row['name'];
@@ -986,11 +986,11 @@  discard block
 block discarded – undo
986 986
 	* @return Array the callsign list
987 987
 	*
988 988
 	*/
989
-	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
989
+	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
990 990
 	{
991 991
 		global $globalDBdriver;
992
-		$filter_query = $this->getFilter($filters,true,true);
993
-		$query  = "SELECT DISTINCT marine_output.ident, COUNT(marine_output.ident) AS callsign_icao_count 
992
+		$filter_query = $this->getFilter($filters, true, true);
993
+		$query = "SELECT DISTINCT marine_output.ident, COUNT(marine_output.ident) AS callsign_icao_count 
994 994
                     FROM marine_output".$filter_query." marine_output.ident <> ''";
995 995
 		 if ($olderthanmonths > 0) {
996 996
 			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
@@ -1004,28 +1004,28 @@  discard block
 block discarded – undo
1004 1004
 		if ($year != '') {
1005 1005
 			if ($globalDBdriver == 'mysql') {
1006 1006
 				$query .= " AND YEAR(marine_output.date) = :year";
1007
-				$query_values = array_merge($query_values,array(':year' => $year));
1007
+				$query_values = array_merge($query_values, array(':year' => $year));
1008 1008
 			} else {
1009 1009
 				$query .= " AND EXTRACT(YEAR FROM marine_output.date) = :year";
1010
-				$query_values = array_merge($query_values,array(':year' => $year));
1010
+				$query_values = array_merge($query_values, array(':year' => $year));
1011 1011
 			}
1012 1012
 		}
1013 1013
 		if ($month != '') {
1014 1014
 			if ($globalDBdriver == 'mysql') {
1015 1015
 				$query .= " AND MONTH(marine_output.date) = :month";
1016
-				$query_values = array_merge($query_values,array(':month' => $month));
1016
+				$query_values = array_merge($query_values, array(':month' => $month));
1017 1017
 			} else {
1018 1018
 				$query .= " AND EXTRACT(MONTH FROM marine_output.date) = :month";
1019
-				$query_values = array_merge($query_values,array(':month' => $month));
1019
+				$query_values = array_merge($query_values, array(':month' => $month));
1020 1020
 			}
1021 1021
 		}
1022 1022
 		if ($day != '') {
1023 1023
 			if ($globalDBdriver == 'mysql') {
1024 1024
 				$query .= " AND DAY(marine_output.date) = :day";
1025
-				$query_values = array_merge($query_values,array(':day' => $day));
1025
+				$query_values = array_merge($query_values, array(':day' => $day));
1026 1026
 			} else {
1027 1027
 				$query .= " AND EXTRACT(DAY FROM marine_output.date) = :day";
1028
-				$query_values = array_merge($query_values,array(':day' => $day));
1028
+				$query_values = array_merge($query_values, array(':day' => $day));
1029 1029
 			}
1030 1030
 		}
1031 1031
 		$query .= " GROUP BY marine_output.ident ORDER BY callsign_icao_count DESC";
@@ -1037,7 +1037,7 @@  discard block
 block discarded – undo
1037 1037
 		$callsign_array = array();
1038 1038
 		$temp_array = array();
1039 1039
         
1040
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1040
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1041 1041
 		{
1042 1042
 			$temp_array['callsign_icao'] = $row['ident'];
1043 1043
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -1089,7 +1089,7 @@  discard block
 block discarded – undo
1089 1089
 		$date_array = array();
1090 1090
 		$temp_array = array();
1091 1091
         
1092
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1092
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1093 1093
 		{
1094 1094
 			$temp_array['date_name'] = $row['date_name'];
1095 1095
 			$temp_array['date_count'] = $row['date_count'];
@@ -1115,7 +1115,7 @@  discard block
 block discarded – undo
1115 1115
 			$datetime = new DateTime();
1116 1116
 			$offset = $datetime->format('P');
1117 1117
 		} else $offset = '+00:00';
1118
-		$filter_query = $this->getFilter($filters,true,true);
1118
+		$filter_query = $this->getFilter($filters, true, true);
1119 1119
 		if ($globalDBdriver == 'mysql') {
1120 1120
 			$query  = "SELECT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
1121 1121
 								FROM marine_output".$filter_query." marine_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)";
@@ -1136,7 +1136,7 @@  discard block
 block discarded – undo
1136 1136
 		$date_array = array();
1137 1137
 		$temp_array = array();
1138 1138
         
1139
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1139
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1140 1140
 		{
1141 1141
 			$temp_array['date_name'] = $row['date_name'];
1142 1142
 			$temp_array['date_count'] = $row['date_count'];
@@ -1161,7 +1161,7 @@  discard block
 block discarded – undo
1161 1161
 			$datetime = new DateTime();
1162 1162
 			$offset = $datetime->format('P');
1163 1163
 		} else $offset = '+00:00';
1164
-		$filter_query = $this->getFilter($filters,true,true);
1164
+		$filter_query = $this->getFilter($filters, true, true);
1165 1165
 		if ($globalDBdriver == 'mysql') {
1166 1166
 			$query  = "SELECT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
1167 1167
 								FROM marine_output".$filter_query." marine_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)";
@@ -1182,7 +1182,7 @@  discard block
 block discarded – undo
1182 1182
 		$date_array = array();
1183 1183
 		$temp_array = array();
1184 1184
         
1185
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1185
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1186 1186
 		{
1187 1187
 			$temp_array['date_name'] = $row['date_name'];
1188 1188
 			$temp_array['date_count'] = $row['date_count'];
@@ -1229,7 +1229,7 @@  discard block
 block discarded – undo
1229 1229
 		$date_array = array();
1230 1230
 		$temp_array = array();
1231 1231
         
1232
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1232
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1233 1233
 		{
1234 1234
 			$temp_array['month_name'] = $row['month_name'];
1235 1235
 			$temp_array['year_name'] = $row['year_name'];
@@ -1258,7 +1258,7 @@  discard block
 block discarded – undo
1258 1258
 			$datetime = new DateTime();
1259 1259
 			$offset = $datetime->format('P');
1260 1260
 		} else $offset = '+00:00';
1261
-		$filter_query = $this->getFilter($filters,true,true);
1261
+		$filter_query = $this->getFilter($filters, true, true);
1262 1262
 		if ($globalDBdriver == 'mysql') {
1263 1263
 			$query  = "SELECT MONTH(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count
1264 1264
 								FROM marine_output".$filter_query." marine_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)";
@@ -1279,7 +1279,7 @@  discard block
 block discarded – undo
1279 1279
 		$date_array = array();
1280 1280
 		$temp_array = array();
1281 1281
         
1282
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1282
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1283 1283
 		{
1284 1284
 			$temp_array['year_name'] = $row['year_name'];
1285 1285
 			$temp_array['month_name'] = $row['month_name'];
@@ -1299,7 +1299,7 @@  discard block
 block discarded – undo
1299 1299
 	* @return Array the hour list
1300 1300
 	*
1301 1301
 	*/
1302
-	public function countAllHours($orderby,$filters = array())
1302
+	public function countAllHours($orderby, $filters = array())
1303 1303
 	{
1304 1304
 		global $globalTimezone, $globalDBdriver;
1305 1305
 		if ($globalTimezone != '') {
@@ -1347,7 +1347,7 @@  discard block
 block discarded – undo
1347 1347
 		$hour_array = array();
1348 1348
 		$temp_array = array();
1349 1349
         
1350
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1350
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1351 1351
 		{
1352 1352
 			$temp_array['hour_name'] = $row['hour_name'];
1353 1353
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -1369,8 +1369,8 @@  discard block
 block discarded – undo
1369 1369
 	public function countAllHoursByDate($date, $filters = array())
1370 1370
 	{
1371 1371
 		global $globalTimezone, $globalDBdriver;
1372
-		$filter_query = $this->getFilter($filters,true,true);
1373
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
1372
+		$filter_query = $this->getFilter($filters, true, true);
1373
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
1374 1374
 		if ($globalTimezone != '') {
1375 1375
 			date_default_timezone_set($globalTimezone);
1376 1376
 			$datetime = new DateTime($date);
@@ -1378,12 +1378,12 @@  discard block
 block discarded – undo
1378 1378
 		} else $offset = '+00:00';
1379 1379
 
1380 1380
 		if ($globalDBdriver == 'mysql') {
1381
-			$query  = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
1381
+			$query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
1382 1382
 								FROM marine_output".$filter_query." DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) = :date
1383 1383
 								GROUP BY hour_name 
1384 1384
 								ORDER BY hour_name ASC";
1385 1385
 		} else {
1386
-			$query  = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
1386
+			$query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
1387 1387
 								FROM marine_output".$filter_query." to_char(marine_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date
1388 1388
 								GROUP BY hour_name 
1389 1389
 								ORDER BY hour_name ASC";
@@ -1395,7 +1395,7 @@  discard block
 block discarded – undo
1395 1395
 		$hour_array = array();
1396 1396
 		$temp_array = array();
1397 1397
         
1398
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1398
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1399 1399
 		{
1400 1400
 			$temp_array['hour_name'] = $row['hour_name'];
1401 1401
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -1417,8 +1417,8 @@  discard block
 block discarded – undo
1417 1417
 	public function countAllHoursByIdent($ident, $filters = array())
1418 1418
 	{
1419 1419
 		global $globalTimezone, $globalDBdriver;
1420
-		$filter_query = $this->getFilter($filters,true,true);
1421
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
1420
+		$filter_query = $this->getFilter($filters, true, true);
1421
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
1422 1422
 		if ($globalTimezone != '') {
1423 1423
 			date_default_timezone_set($globalTimezone);
1424 1424
 			$datetime = new DateTime();
@@ -1426,12 +1426,12 @@  discard block
 block discarded – undo
1426 1426
 		} else $offset = '+00:00';
1427 1427
 
1428 1428
 		if ($globalDBdriver == 'mysql') {
1429
-			$query  = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
1429
+			$query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
1430 1430
 								FROM marine_output".$filter_query." marine_output.ident = :ident 
1431 1431
 								GROUP BY hour_name 
1432 1432
 								ORDER BY hour_name ASC";
1433 1433
 		} else {
1434
-			$query  = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
1434
+			$query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
1435 1435
 								FROM marine_output".$filter_query." marine_output.ident = :ident 
1436 1436
 								GROUP BY hour_name 
1437 1437
 								ORDER BY hour_name ASC";
@@ -1439,12 +1439,12 @@  discard block
 block discarded – undo
1439 1439
       
1440 1440
 		
1441 1441
 		$sth = $this->db->prepare($query);
1442
-		$sth->execute(array(':ident' => $ident,':offset' => $offset));
1442
+		$sth->execute(array(':ident' => $ident, ':offset' => $offset));
1443 1443
       
1444 1444
 		$hour_array = array();
1445 1445
 		$temp_array = array();
1446 1446
         
1447
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1447
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1448 1448
 		{
1449 1449
 			$temp_array['hour_name'] = $row['hour_name'];
1450 1450
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -1463,33 +1463,33 @@  discard block
 block discarded – undo
1463 1463
 	* @return Integer the number of vessels
1464 1464
 	*
1465 1465
 	*/
1466
-	public function countOverallMarine($filters = array(),$year = '',$month = '')
1466
+	public function countOverallMarine($filters = array(), $year = '', $month = '')
1467 1467
 	{
1468 1468
 		global $globalDBdriver;
1469 1469
 		//$queryi  = "SELECT COUNT(marine_output.marine_id) AS flight_count FROM marine_output";
1470
-		$queryi  = "SELECT COUNT(DISTINCT marine_output.mmsi) AS flight_count FROM marine_output";
1470
+		$queryi = "SELECT COUNT(DISTINCT marine_output.mmsi) AS flight_count FROM marine_output";
1471 1471
 		$query_values = array();
1472 1472
 		$query = '';
1473 1473
 		if ($year != '') {
1474 1474
 			if ($globalDBdriver == 'mysql') {
1475 1475
 				$query .= " AND YEAR(marine_output.date) = :year";
1476
-				$query_values = array_merge($query_values,array(':year' => $year));
1476
+				$query_values = array_merge($query_values, array(':year' => $year));
1477 1477
 			} else {
1478 1478
 				$query .= " AND EXTRACT(YEAR FROM marine_output.date) = :year";
1479
-				$query_values = array_merge($query_values,array(':year' => $year));
1479
+				$query_values = array_merge($query_values, array(':year' => $year));
1480 1480
 			}
1481 1481
 		}
1482 1482
 		if ($month != '') {
1483 1483
 			if ($globalDBdriver == 'mysql') {
1484 1484
 				$query .= " AND MONTH(marine_output.date) = :month";
1485
-				$query_values = array_merge($query_values,array(':month' => $month));
1485
+				$query_values = array_merge($query_values, array(':month' => $month));
1486 1486
 			} else {
1487 1487
 				$query .= " AND EXTRACT(MONTH FROM marine_output.date) = :month";
1488
-				$query_values = array_merge($query_values,array(':month' => $month));
1488
+				$query_values = array_merge($query_values, array(':month' => $month));
1489 1489
 			}
1490 1490
 		}
1491 1491
 		if (empty($query_values)) $queryi .= $this->getFilter($filters);
1492
-		else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
1492
+		else $queryi .= $this->getFilter($filters, true, true).substr($query, 4);
1493 1493
 		
1494 1494
 		$sth = $this->db->prepare($queryi);
1495 1495
 		$sth->execute($query_values);
@@ -1502,32 +1502,32 @@  discard block
 block discarded – undo
1502 1502
 	* @return Integer the number of vessels
1503 1503
 	*
1504 1504
 	*/
1505
-	public function countOverallMarineTypes($filters = array(),$year = '',$month = '')
1505
+	public function countOverallMarineTypes($filters = array(), $year = '', $month = '')
1506 1506
 	{
1507 1507
 		global $globalDBdriver;
1508
-		$queryi  = "SELECT COUNT(DISTINCT marine_output.type) AS marine_count FROM marine_output";
1508
+		$queryi = "SELECT COUNT(DISTINCT marine_output.type) AS marine_count FROM marine_output";
1509 1509
 		$query_values = array();
1510 1510
 		$query = '';
1511 1511
 		if ($year != '') {
1512 1512
 			if ($globalDBdriver == 'mysql') {
1513 1513
 				$query .= " AND YEAR(marine_output.date) = :year";
1514
-				$query_values = array_merge($query_values,array(':year' => $year));
1514
+				$query_values = array_merge($query_values, array(':year' => $year));
1515 1515
 			} else {
1516 1516
 				$query .= " AND EXTRACT(YEAR FROM marine_output.date) = :year";
1517
-				$query_values = array_merge($query_values,array(':year' => $year));
1517
+				$query_values = array_merge($query_values, array(':year' => $year));
1518 1518
 			}
1519 1519
 		}
1520 1520
 		if ($month != '') {
1521 1521
 			if ($globalDBdriver == 'mysql') {
1522 1522
 				$query .= " AND MONTH(marine_output.date) = :month";
1523
-				$query_values = array_merge($query_values,array(':month' => $month));
1523
+				$query_values = array_merge($query_values, array(':month' => $month));
1524 1524
 			} else {
1525 1525
 				$query .= " AND EXTRACT(MONTH FROM marine_output.date) = :month";
1526
-				$query_values = array_merge($query_values,array(':month' => $month));
1526
+				$query_values = array_merge($query_values, array(':month' => $month));
1527 1527
 			}
1528 1528
 		}
1529 1529
 		if (empty($query_values)) $queryi .= $this->getFilter($filters);
1530
-		else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
1530
+		else $queryi .= $this->getFilter($filters, true, true).substr($query, 4);
1531 1531
 		
1532 1532
 		$sth = $this->db->prepare($queryi);
1533 1533
 		$sth->execute($query_values);
@@ -1544,7 +1544,7 @@  discard block
 block discarded – undo
1544 1544
 	public function countAllHoursFromToday($filters = array())
1545 1545
 	{
1546 1546
 		global $globalTimezone, $globalDBdriver;
1547
-		$filter_query = $this->getFilter($filters,true,true);
1547
+		$filter_query = $this->getFilter($filters, true, true);
1548 1548
 		if ($globalTimezone != '') {
1549 1549
 			date_default_timezone_set($globalTimezone);
1550 1550
 			$datetime = new DateTime();
@@ -1552,12 +1552,12 @@  discard block
 block discarded – undo
1552 1552
 		} else $offset = '+00:00';
1553 1553
 
1554 1554
 		if ($globalDBdriver == 'mysql') {
1555
-			$query  = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
1555
+			$query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
1556 1556
 								FROM marine_output".$filter_query." DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) = CURDATE()
1557 1557
 								GROUP BY hour_name 
1558 1558
 								ORDER BY hour_name ASC";
1559 1559
 		} else {
1560
-			$query  = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
1560
+			$query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
1561 1561
 								FROM marine_output".$filter_query." to_char(marine_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date)
1562 1562
 								GROUP BY hour_name 
1563 1563
 								ORDER BY hour_name ASC";
@@ -1569,7 +1569,7 @@  discard block
 block discarded – undo
1569 1569
 		$hour_array = array();
1570 1570
 		$temp_array = array();
1571 1571
         
1572
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1572
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1573 1573
 		{
1574 1574
 			$temp_array['hour_name'] = $row['hour_name'];
1575 1575
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -1588,9 +1588,9 @@  discard block
 block discarded – undo
1588 1588
 	*/
1589 1589
 	public function getMarineIDBasedOnFamMarineID($fammarine_id)
1590 1590
 	{
1591
-		$fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING);
1591
+		$fammarine_id = filter_var($fammarine_id, FILTER_SANITIZE_STRING);
1592 1592
 
1593
-		$query  = "SELECT marine_output.marine_id
1593
+		$query = "SELECT marine_output.marine_id
1594 1594
 				FROM marine_output 
1595 1595
 				WHERE marine_output.fammarine_id = '".$fammarine_id."'";
1596 1596
         
@@ -1598,7 +1598,7 @@  discard block
 block discarded – undo
1598 1598
 		$sth = $this->db->prepare($query);
1599 1599
 		$sth->execute();
1600 1600
 
1601
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1601
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1602 1602
 		{
1603 1603
 			return $row['marine_id'];
1604 1604
 		}
@@ -1623,23 +1623,23 @@  discard block
 block discarded – undo
1623 1623
 		}
1624 1624
 		
1625 1625
 		$current_date = date("Y-m-d H:i:s");
1626
-		$date = date("Y-m-d H:i:s",strtotime($dateString." UTC"));
1626
+		$date = date("Y-m-d H:i:s", strtotime($dateString." UTC"));
1627 1627
 		
1628 1628
 		$diff = abs(strtotime($current_date) - strtotime($date));
1629 1629
 
1630
-		$time_array['years'] = floor($diff / (365*60*60*24)); 
1630
+		$time_array['years'] = floor($diff/(365*60*60*24)); 
1631 1631
 		$years = $time_array['years'];
1632 1632
 		
1633
-		$time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
1633
+		$time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24));
1634 1634
 		$months = $time_array['months'];
1635 1635
 		
1636
-		$time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
1636
+		$time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24));
1637 1637
 		$days = $time_array['days'];
1638
-		$time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60));
1638
+		$time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60));
1639 1639
 		$hours = $time_array['hours'];
1640
-		$time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60);
1640
+		$time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60);
1641 1641
 		$minutes = $time_array['minutes'];
1642
-		$time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
1642
+		$time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
1643 1643
 		
1644 1644
 		return $time_array;
1645 1645
 	}
@@ -1662,63 +1662,63 @@  discard block
 block discarded – undo
1662 1662
 			$temp_array['direction_degree'] = $direction;
1663 1663
 			$temp_array['direction_shortname'] = "N";
1664 1664
 			$temp_array['direction_fullname'] = "North";
1665
-		} elseif ($direction >= 22.5 && $direction < 45){
1665
+		} elseif ($direction >= 22.5 && $direction < 45) {
1666 1666
 			$temp_array['direction_degree'] = $direction;
1667 1667
 			$temp_array['direction_shortname'] = "NNE";
1668 1668
 			$temp_array['direction_fullname'] = "North-Northeast";
1669
-		} elseif ($direction >= 45 && $direction < 67.5){
1669
+		} elseif ($direction >= 45 && $direction < 67.5) {
1670 1670
 			$temp_array['direction_degree'] = $direction;
1671 1671
 			$temp_array['direction_shortname'] = "NE";
1672 1672
 			$temp_array['direction_fullname'] = "Northeast";
1673
-		} elseif ($direction >= 67.5 && $direction < 90){
1673
+		} elseif ($direction >= 67.5 && $direction < 90) {
1674 1674
 			$temp_array['direction_degree'] = $direction;
1675 1675
 			$temp_array['direction_shortname'] = "ENE";
1676 1676
 			$temp_array['direction_fullname'] = "East-Northeast";
1677
-		} elseif ($direction >= 90 && $direction < 112.5){
1677
+		} elseif ($direction >= 90 && $direction < 112.5) {
1678 1678
 			$temp_array['direction_degree'] = $direction;
1679 1679
 			$temp_array['direction_shortname'] = "E";
1680 1680
 			$temp_array['direction_fullname'] = "East";
1681
-		} elseif ($direction >= 112.5 && $direction < 135){
1681
+		} elseif ($direction >= 112.5 && $direction < 135) {
1682 1682
 			$temp_array['direction_degree'] = $direction;
1683 1683
 			$temp_array['direction_shortname'] = "ESE";
1684 1684
 			$temp_array['direction_fullname'] = "East-Southeast";
1685
-		} elseif ($direction >= 135 && $direction < 157.5){
1685
+		} elseif ($direction >= 135 && $direction < 157.5) {
1686 1686
 			$temp_array['direction_degree'] = $direction;
1687 1687
 			$temp_array['direction_shortname'] = "SE";
1688 1688
 			$temp_array['direction_fullname'] = "Southeast";
1689
-		} elseif ($direction >= 157.5 && $direction < 180){
1689
+		} elseif ($direction >= 157.5 && $direction < 180) {
1690 1690
 			$temp_array['direction_degree'] = $direction;
1691 1691
 			$temp_array['direction_shortname'] = "SSE";
1692 1692
 			$temp_array['direction_fullname'] = "South-Southeast";
1693
-		} elseif ($direction >= 180 && $direction < 202.5){
1693
+		} elseif ($direction >= 180 && $direction < 202.5) {
1694 1694
 			$temp_array['direction_degree'] = $direction;
1695 1695
 			$temp_array['direction_shortname'] = "S";
1696 1696
 			$temp_array['direction_fullname'] = "South";
1697
-		} elseif ($direction >= 202.5 && $direction < 225){
1697
+		} elseif ($direction >= 202.5 && $direction < 225) {
1698 1698
 			$temp_array['direction_degree'] = $direction;
1699 1699
 			$temp_array['direction_shortname'] = "SSW";
1700 1700
 			$temp_array['direction_fullname'] = "South-Southwest";
1701
-		} elseif ($direction >= 225 && $direction < 247.5){
1701
+		} elseif ($direction >= 225 && $direction < 247.5) {
1702 1702
 			$temp_array['direction_degree'] = $direction;
1703 1703
 			$temp_array['direction_shortname'] = "SW";
1704 1704
 			$temp_array['direction_fullname'] = "Southwest";
1705
-		} elseif ($direction >= 247.5 && $direction < 270){
1705
+		} elseif ($direction >= 247.5 && $direction < 270) {
1706 1706
 			$temp_array['direction_degree'] = $direction;
1707 1707
 			$temp_array['direction_shortname'] = "WSW";
1708 1708
 			$temp_array['direction_fullname'] = "West-Southwest";
1709
-		} elseif ($direction >= 270 && $direction < 292.5){
1709
+		} elseif ($direction >= 270 && $direction < 292.5) {
1710 1710
 			$temp_array['direction_degree'] = $direction;
1711 1711
 			$temp_array['direction_shortname'] = "W";
1712 1712
 			$temp_array['direction_fullname'] = "West";
1713
-		} elseif ($direction >= 292.5 && $direction < 315){
1713
+		} elseif ($direction >= 292.5 && $direction < 315) {
1714 1714
 			$temp_array['direction_degree'] = $direction;
1715 1715
 			$temp_array['direction_shortname'] = "WNW";
1716 1716
 			$temp_array['direction_fullname'] = "West-Northwest";
1717
-		} elseif ($direction >= 315 && $direction < 337.5){
1717
+		} elseif ($direction >= 315 && $direction < 337.5) {
1718 1718
 			$temp_array['direction_degree'] = $direction;
1719 1719
 			$temp_array['direction_shortname'] = "NW";
1720 1720
 			$temp_array['direction_fullname'] = "Northwest";
1721
-		} elseif ($direction >= 337.5 && $direction < 360){
1721
+		} elseif ($direction >= 337.5 && $direction < 360) {
1722 1722
 			$temp_array['direction_degree'] = $direction;
1723 1723
 			$temp_array['direction_shortname'] = "NNW";
1724 1724
 			$temp_array['direction_fullname'] = "North-Northwest";
@@ -1735,11 +1735,11 @@  discard block
 block discarded – undo
1735 1735
 	* @param Float $longitude longitute of the flight
1736 1736
 	* @return String the countrie
1737 1737
 	*/
1738
-	public function getCountryFromLatitudeLongitude($latitude,$longitude)
1738
+	public function getCountryFromLatitudeLongitude($latitude, $longitude)
1739 1739
 	{
1740 1740
 		global $globalDBdriver, $globalDebug;
1741
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1742
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1741
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1742
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1743 1743
 	
1744 1744
 		$Connection = new Connection($this->db);
1745 1745
 		if (!$Connection->tableExists('countries')) return '';
@@ -1779,7 +1779,7 @@  discard block
 block discarded – undo
1779 1779
 	public function getCountryFromISO2($iso2)
1780 1780
 	{
1781 1781
 		global $globalDBdriver, $globalDebug;
1782
-		$iso2 = filter_var($iso2,FILTER_SANITIZE_STRING);
1782
+		$iso2 = filter_var($iso2, FILTER_SANITIZE_STRING);
1783 1783
 	
1784 1784
 		$Connection = new Connection($this->db);
1785 1785
 		if (!$Connection->tableExists('countries')) return '';
@@ -1827,7 +1827,7 @@  discard block
 block discarded – undo
1827 1827
 		
1828 1828
 		$bitly_data = json_decode($bitly_data);
1829 1829
 		$bitly_url = '';
1830
-		if ($bitly_data->status_txt = "OK"){
1830
+		if ($bitly_data->status_txt = "OK") {
1831 1831
 			$bitly_url = $bitly_data->data->url;
1832 1832
 		}
1833 1833
 
@@ -1841,11 +1841,11 @@  discard block
 block discarded – undo
1841 1841
 	* @return Array the vessel type list
1842 1842
 	*
1843 1843
 	*/
1844
-	public function countAllMarineTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
1844
+	public function countAllMarineTypes($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
1845 1845
 	{
1846 1846
 		global $globalDBdriver;
1847
-		$filter_query = $this->getFilter($filters,true,true);
1848
-		$query  = "SELECT marine_output.type AS marine_type, COUNT(marine_output.type) AS marine_type_count, marine_output.type_id AS marine_type_id 
1847
+		$filter_query = $this->getFilter($filters, true, true);
1848
+		$query = "SELECT marine_output.type AS marine_type, COUNT(marine_output.type) AS marine_type_count, marine_output.type_id AS marine_type_id 
1849 1849
 		    FROM marine_output ".$filter_query." marine_output.type <> '' AND marine_output.type_id IS NOT NULL";
1850 1850
 		if ($olderthanmonths > 0) {
1851 1851
 			if ($globalDBdriver == 'mysql') {
@@ -1865,28 +1865,28 @@  discard block
 block discarded – undo
1865 1865
 		if ($year != '') {
1866 1866
 			if ($globalDBdriver == 'mysql') {
1867 1867
 				$query .= " AND YEAR(marine_output.date) = :year";
1868
-				$query_values = array_merge($query_values,array(':year' => $year));
1868
+				$query_values = array_merge($query_values, array(':year' => $year));
1869 1869
 			} else {
1870 1870
 				$query .= " AND EXTRACT(YEAR FROM marine_output.date) = :year";
1871
-				$query_values = array_merge($query_values,array(':year' => $year));
1871
+				$query_values = array_merge($query_values, array(':year' => $year));
1872 1872
 			}
1873 1873
 		}
1874 1874
 		if ($month != '') {
1875 1875
 			if ($globalDBdriver == 'mysql') {
1876 1876
 				$query .= " AND MONTH(marine_output.date) = :month";
1877
-				$query_values = array_merge($query_values,array(':month' => $month));
1877
+				$query_values = array_merge($query_values, array(':month' => $month));
1878 1878
 			} else {
1879 1879
 				$query .= " AND EXTRACT(MONTH FROM marine_output.date) = :month";
1880
-				$query_values = array_merge($query_values,array(':month' => $month));
1880
+				$query_values = array_merge($query_values, array(':month' => $month));
1881 1881
 			}
1882 1882
 		}
1883 1883
 		if ($day != '') {
1884 1884
 			if ($globalDBdriver == 'mysql') {
1885 1885
 				$query .= " AND DAY(marine_output.date) = :day";
1886
-				$query_values = array_merge($query_values,array(':day' => $day));
1886
+				$query_values = array_merge($query_values, array(':day' => $day));
1887 1887
 			} else {
1888 1888
 				$query .= " AND EXTRACT(DAY FROM marine_output.date) = :day";
1889
-				$query_values = array_merge($query_values,array(':day' => $day));
1889
+				$query_values = array_merge($query_values, array(':day' => $day));
1890 1890
 			}
1891 1891
 		}
1892 1892
 		$query .= " GROUP BY marine_output.type, marine_output.type_id ORDER BY marine_type_count DESC";
@@ -1895,7 +1895,7 @@  discard block
 block discarded – undo
1895 1895
 		$sth->execute($query_values);
1896 1896
 		$marine_array = array();
1897 1897
 		$temp_array = array();
1898
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1898
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1899 1899
 		{
1900 1900
 			$temp_array['marine_type'] = $row['marine_type'];
1901 1901
 			$temp_array['marine_type_id'] = $row['marine_type_id'];
@@ -1911,13 +1911,13 @@  discard block
 block discarded – undo
1911 1911
 	* @return Array the tracker information
1912 1912
 	*
1913 1913
 	*/
1914
-	public function searchMarineData($q = '', $callsign = '',$mmsi = '', $imo = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array())
1914
+	public function searchMarineData($q = '', $callsign = '', $mmsi = '', $imo = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '', $origLat = '', $origLon = '', $dist = '', $filters = array())
1915 1915
 	{
1916 1916
 		global $globalTimezone, $globalDBdriver;
1917 1917
 		date_default_timezone_set('UTC');
1918 1918
 		$query_values = array();
1919 1919
 		$additional_query = '';
1920
-		$filter_query = $this->getFilter($filters,true,true);
1920
+		$filter_query = $this->getFilter($filters, true, true);
1921 1921
 		if ($q != "")
1922 1922
 		{
1923 1923
 			if (!is_string($q))
@@ -1925,8 +1925,8 @@  discard block
 block discarded – undo
1925 1925
 				return false;
1926 1926
 			} else {
1927 1927
 				$q_array = explode(" ", $q);
1928
-				foreach ($q_array as $q_item){
1929
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
1928
+				foreach ($q_array as $q_item) {
1929
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
1930 1930
 					$additional_query .= " AND (";
1931 1931
 					if (is_int($q_item)) $additional_query .= "(marine_output.marine_id = '".$q_item."') OR ";
1932 1932
 					if (is_int($q_item)) $additional_query .= "(marine_output.mmsi = '".$q_item."') OR ";
@@ -1938,42 +1938,42 @@  discard block
 block discarded – undo
1938 1938
 		}
1939 1939
 		if ($callsign != "")
1940 1940
 		{
1941
-			$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
1941
+			$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
1942 1942
 			if (!is_string($callsign))
1943 1943
 			{
1944 1944
 				return false;
1945 1945
 			} else {
1946 1946
 				$additional_query .= " AND marine_output.ident = :callsign";
1947
-				$query_values = array_merge($query_values,array(':callsign' => $callsign));
1947
+				$query_values = array_merge($query_values, array(':callsign' => $callsign));
1948 1948
 			}
1949 1949
 		}
1950 1950
 		if ($mmsi != "")
1951 1951
 		{
1952
-			$mmsi = filter_var($mmsi,FILTER_SANITIZE_STRING);
1952
+			$mmsi = filter_var($mmsi, FILTER_SANITIZE_STRING);
1953 1953
 			if (!is_numeric($mmsi))
1954 1954
 			{
1955 1955
 				return false;
1956 1956
 			} else {
1957 1957
 				$additional_query .= " AND marine_output.mmsi = :mmsi";
1958
-				$query_values = array_merge($query_values,array(':mmsi' => $mmsi));
1958
+				$query_values = array_merge($query_values, array(':mmsi' => $mmsi));
1959 1959
 			}
1960 1960
 		}
1961 1961
 		if ($imo != "")
1962 1962
 		{
1963
-			$imo = filter_var($imo,FILTER_SANITIZE_STRING);
1963
+			$imo = filter_var($imo, FILTER_SANITIZE_STRING);
1964 1964
 			if (!is_numeric($imo))
1965 1965
 			{
1966 1966
 				return false;
1967 1967
 			} else {
1968 1968
 				$additional_query .= " AND marine_output.imo = :imo";
1969
-				$query_values = array_merge($query_values,array(':imo' => $imo));
1969
+				$query_values = array_merge($query_values, array(':imo' => $imo));
1970 1970
 			}
1971 1971
 		}
1972 1972
 		if ($date_posted != "")
1973 1973
 		{
1974 1974
 			$date_array = explode(",", $date_posted);
1975
-			$date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING);
1976
-			$date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING);
1975
+			$date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING);
1976
+			$date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING);
1977 1977
 			if ($globalTimezone != '') {
1978 1978
 				date_default_timezone_set($globalTimezone);
1979 1979
 				$datetime = new DateTime();
@@ -2000,8 +2000,8 @@  discard block
 block discarded – undo
2000 2000
 		if ($limit != "")
2001 2001
 		{
2002 2002
 			$limit_array = explode(",", $limit);
2003
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
2004
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
2003
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
2004
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
2005 2005
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
2006 2006
 			{
2007 2007
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
@@ -2019,28 +2019,28 @@  discard block
 block discarded – undo
2019 2019
 			}
2020 2020
 		}
2021 2021
 		if ($origLat != "" && $origLon != "" && $dist != "") {
2022
-			$dist = number_format($dist*0.621371,2,'.',''); // convert km to mile
2022
+			$dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile
2023 2023
 			if ($globalDBdriver == 'mysql') {
2024
-				$query="SELECT marine_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - marine_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(marine_archive.latitude*pi()/180)*POWER(SIN(($origLon-marine_archive.longitude)*pi()/180/2),2))) as distance 
2024
+				$query = "SELECT marine_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - marine_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(marine_archive.latitude*pi()/180)*POWER(SIN(($origLon-marine_archive.longitude)*pi()/180/2),2))) as distance 
2025 2025
 				    FROM marine_archive,marine_output".$filter_query." marine_output.fammarine_id = marine_archive.fammarine_id AND marine_output.ident <> '' ".$additional_query."AND marine_archive.longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and marine_archive.latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
2026 2026
 				    AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - marine_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(marine_archive.latitude*pi()/180)*POWER(SIN(($origLon-marine_archive.longitude)*pi()/180/2),2)))) < $dist".$orderby_query;
2027 2027
 			} else {
2028
-				$query="SELECT marine_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(marine_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(marine_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(marine_archive.longitude as double precision))*pi()/180/2),2))) as distance 
2028
+				$query = "SELECT marine_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(marine_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(marine_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(marine_archive.longitude as double precision))*pi()/180/2),2))) as distance 
2029 2029
 				    FROM marine_archive,marine_output".$filter_query." marine_output.fammarine_id = marine_archive.fammarine_id AND marine_output.ident <> '' ".$additional_query."AND CAST(marine_archive.longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(marine_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
2030 2030
 				    AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(marine_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(marine_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(marine_archive.longitude as double precision))*pi()/180/2),2)))) < $dist".$filter_query.$orderby_query;
2031 2031
 			}
2032 2032
 		} else {
2033
-			$query  = "SELECT marine_output.* FROM marine_output".$filter_query." marine_output.ident <> '' 
2033
+			$query = "SELECT marine_output.* FROM marine_output".$filter_query." marine_output.ident <> '' 
2034 2034
 			    ".$additional_query."
2035 2035
 			    ".$orderby_query;
2036 2036
 		}
2037
-		$marine_array = $this->getDataFromDB($query, $query_values,$limit_query);
2037
+		$marine_array = $this->getDataFromDB($query, $query_values, $limit_query);
2038 2038
 		return $marine_array;
2039 2039
 	}
2040 2040
 
2041 2041
 	public function getOrderBy()
2042 2042
 	{
2043
-		$orderby = array("type_asc" => array("key" => "type_asc", "value" => "Type - ASC", "sql" => "ORDER BY marine_output.type ASC"), "type_desc" => array("key" => "type_desc", "value" => "Type - DESC", "sql" => "ORDER BY marine_output.type DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY marine_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY marine_output.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY marine_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY marine_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY marine_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY marine_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY marine_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY marine_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY marine_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY marine_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY marine_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY marine_output.date DESC"),"distance_asc" => array("key" => "distance_asc","value" => "Distance - ASC","sql" => "ORDER BY distance ASC"),"distance_desc" => array("key" => "distance_desc","value" => "Distance - DESC","sql" => "ORDER BY distance DESC"));
2043
+		$orderby = array("type_asc" => array("key" => "type_asc", "value" => "Type - ASC", "sql" => "ORDER BY marine_output.type ASC"), "type_desc" => array("key" => "type_desc", "value" => "Type - DESC", "sql" => "ORDER BY marine_output.type DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY marine_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY marine_output.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY marine_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY marine_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY marine_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY marine_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY marine_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY marine_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY marine_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY marine_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY marine_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY marine_output.date DESC"), "distance_asc" => array("key" => "distance_asc", "value" => "Distance - ASC", "sql" => "ORDER BY distance ASC"), "distance_desc" => array("key" => "distance_desc", "value" => "Distance - DESC", "sql" => "ORDER BY distance DESC"));
2044 2044
 		
2045 2045
 		return $orderby;
2046 2046
 		
Please login to merge, or discard this patch.
Braces   +206 added lines, -73 removed lines patch added patch discarded remove patch
@@ -8,7 +8,9 @@  discard block
 block discarded – undo
8 8
 	public function __construct($dbc = null) {
9 9
 		$Connection = new Connection($dbc);
10 10
 		$this->db = $Connection->db();
11
-		if ($this->db === null) die('Error: No DB connection. (Marine)');
11
+		if ($this->db === null) {
12
+			die('Error: No DB connection. (Marine)');
13
+		}
12 14
 	}
13 15
 
14 16
 	/**
@@ -30,7 +32,9 @@  discard block
 block discarded – undo
30 32
 		if (isset($filter[0]['source'])) {
31 33
 			$filters = array_merge($filters,$filter);
32 34
 		}
33
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
35
+		if (is_array($globalFilter)) {
36
+			$filter = array_merge($filter,$globalFilter);
37
+		}
34 38
 		$filter_query_join = '';
35 39
 		$filter_query_where = '';
36 40
 		foreach($filters as $flt) {
@@ -72,8 +76,11 @@  discard block
 block discarded – undo
72 76
 				$filter_query_where .= " AND EXTRACT(DAY FROM marine_output.date) = '".$filter['day']."'";
73 77
 			}
74 78
 		}
75
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
76
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
79
+		if ($filter_query_where == '' && $where) {
80
+			$filter_query_where = ' WHERE';
81
+		} elseif ($filter_query_where != '' && $and) {
82
+			$filter_query_where .= ' AND';
83
+		}
77 84
 		if ($filter_query_where != '') {
78 85
 			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
79 86
 		}
@@ -127,35 +134,63 @@  discard block
 block discarded – undo
127 134
 				$temp_array['spotter_id'] = $row['spotter_archive_id'];
128 135
 			} elseif (isset($row['spotter_archive_output_id'])) {
129 136
 				$temp_array['spotter_id'] = $row['spotter_archive_output_id'];
130
-			*/} 
131
-			elseif (isset($row['marineid'])) {
137
+			*/} elseif (isset($row['marineid'])) {
132 138
 				$temp_array['marine_id'] = $row['marineid'];
133 139
 			} else {
134 140
 				$temp_array['marine_id'] = '';
135 141
 			}
136
-			if (isset($row['fammarine_id'])) $temp_array['fammarine_id'] = $row['fammarine_id'];
137
-			if (isset($row['mmsi'])) $temp_array['mmsi'] = $row['mmsi'];
138
-			if (isset($row['type'])) $temp_array['type'] = $row['type'];
139
-			if (isset($row['type_id'])) $temp_array['type_id'] = $row['type_id'];
140
-			if (isset($row['status'])) $temp_array['status'] = $row['status'];
141
-			if (isset($row['status_id'])) $temp_array['status_id'] = $row['status_id'];
142
-			if (isset($row['ident'])) $temp_array['ident'] = $row['ident'];
143
-			if (isset($row['arrival_port_name'])) $temp_array['arrival_port_name'] = $row['arrival_port_name'];
144
-			if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude'];
145
-			if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude'];
146
-			if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source'];
142
+			if (isset($row['fammarine_id'])) {
143
+				$temp_array['fammarine_id'] = $row['fammarine_id'];
144
+			}
145
+			if (isset($row['mmsi'])) {
146
+				$temp_array['mmsi'] = $row['mmsi'];
147
+			}
148
+			if (isset($row['type'])) {
149
+				$temp_array['type'] = $row['type'];
150
+			}
151
+			if (isset($row['type_id'])) {
152
+				$temp_array['type_id'] = $row['type_id'];
153
+			}
154
+			if (isset($row['status'])) {
155
+				$temp_array['status'] = $row['status'];
156
+			}
157
+			if (isset($row['status_id'])) {
158
+				$temp_array['status_id'] = $row['status_id'];
159
+			}
160
+			if (isset($row['ident'])) {
161
+				$temp_array['ident'] = $row['ident'];
162
+			}
163
+			if (isset($row['arrival_port_name'])) {
164
+				$temp_array['arrival_port_name'] = $row['arrival_port_name'];
165
+			}
166
+			if (isset($row['latitude'])) {
167
+				$temp_array['latitude'] = $row['latitude'];
168
+			}
169
+			if (isset($row['longitude'])) {
170
+				$temp_array['longitude'] = $row['longitude'];
171
+			}
172
+			if (isset($row['format_source'])) {
173
+				$temp_array['format_source'] = $row['format_source'];
174
+			}
147 175
 			if (isset($row['heading'])) {
148 176
 				$temp_array['heading'] = $row['heading'];
149 177
 				$heading_direction = $this->parseDirection($row['heading']);
150
-				if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
178
+				if (isset($heading_direction[0]['direction_fullname'])) {
179
+					$temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
180
+				}
181
+			}
182
+			if (isset($row['ground_speed'])) {
183
+				$temp_array['ground_speed'] = $row['ground_speed'];
151 184
 			}
152
-			if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed'];
153 185
 
154 186
 			if(isset($temp_array['mmsi']) && $temp_array['mmsi'] != "")
155 187
 			{
156 188
 				$Image = new Image($this->db);
157
-				if (isset($temp_array['ident']) && $temp_array['ident'] != '') $image_array = $Image->getMarineImage($temp_array['mmsi'],'',$temp_array['ident']);
158
-				else $image_array = $Image->getMarineImage($temp_array['mmsi']);
189
+				if (isset($temp_array['ident']) && $temp_array['ident'] != '') {
190
+					$image_array = $Image->getMarineImage($temp_array['mmsi'],'',$temp_array['ident']);
191
+				} else {
192
+					$image_array = $Image->getMarineImage($temp_array['mmsi']);
193
+				}
159 194
 				unset($Image);
160 195
 				if (count($image_array) > 0) {
161 196
 					$temp_array['image'] = $image_array[0]['image'];
@@ -207,13 +242,21 @@  discard block
 block discarded – undo
207 242
 			}
208 243
 			
209 244
 			$fromsource = NULL;
210
-			if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name'];
211
-			if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country'];
212
-			if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance'];
245
+			if (isset($row['source_name']) && $row['source_name'] != '') {
246
+				$temp_array['source_name'] = $row['source_name'];
247
+			}
248
+			if (isset($row['over_country']) && $row['over_country'] != '') {
249
+				$temp_array['over_country'] = $row['over_country'];
250
+			}
251
+			if (isset($row['distance']) && $row['distance'] != '') {
252
+				$temp_array['distance'] = $row['distance'];
253
+			}
213 254
 			$temp_array['query_number_rows'] = $num_rows;
214 255
 			$spotter_array[] = $temp_array;
215 256
 		}
216
-		if ($num_rows == 0) return array();
257
+		if ($num_rows == 0) {
258
+			return array();
259
+		}
217 260
 		$spotter_array[0]['query_number_rows'] = $num_rows;
218 261
 		return $spotter_array;
219 262
 	}	
@@ -239,8 +282,12 @@  discard block
 block discarded – undo
239 282
 			{
240 283
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
241 284
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
242
-			} else $limit_query = "";
243
-		} else $limit_query = "";
285
+			} else {
286
+				$limit_query = "";
287
+			}
288
+		} else {
289
+			$limit_query = "";
290
+		}
244 291
 		if ($sort != "")
245 292
 		{
246 293
 			$search_orderby_array = $this->getOrderBy();
@@ -264,7 +311,9 @@  discard block
 block discarded – undo
264 311
 		global $global_query;
265 312
 		
266 313
 		date_default_timezone_set('UTC');
267
-		if ($id == '') return array();
314
+		if ($id == '') {
315
+			return array();
316
+		}
268 317
 		$additional_query = "marine_output.fammarine_id = :id";
269 318
 		$query_values = array(':id' => $id);
270 319
 		$query  = $global_query." WHERE ".$additional_query." ";
@@ -460,8 +509,11 @@  discard block
 block discarded – undo
460 509
 		$query .= " ORDER BY marine_output.source_name ASC";
461 510
 
462 511
 		$sth = $this->db->prepare($query);
463
-		if (!empty($query_values)) $sth->execute($query_values);
464
-		else $sth->execute();
512
+		if (!empty($query_values)) {
513
+			$sth->execute($query_values);
514
+		} else {
515
+			$sth->execute();
516
+		}
465 517
 
466 518
 		$source_array = array();
467 519
 		$temp_array = array();
@@ -516,8 +568,11 @@  discard block
 block discarded – undo
516 568
 		$sth = $this->db->prepare($query);
517 569
 		$sth->execute(array(':mmsi' => $mmsi));
518 570
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
519
-		if (isset($result[0])) return $result[0];
520
-		else return array();
571
+		if (isset($result[0])) {
572
+			return $result[0];
573
+		} else {
574
+			return array();
575
+		}
521 576
 	}
522 577
 
523 578
 	/**
@@ -558,7 +613,9 @@  discard block
 block discarded – undo
558 613
 			date_default_timezone_set($globalTimezone);
559 614
 			$datetime = new DateTime();
560 615
 			$offset = $datetime->format('P');
561
-		} else $offset = '+00:00';
616
+		} else {
617
+			$offset = '+00:00';
618
+		}
562 619
 
563 620
 		if ($globalDBdriver == 'mysql') {
564 621
 			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) as date
@@ -804,11 +861,21 @@  discard block
 block discarded – undo
804 861
 			$latitude = 0;
805 862
 			$longitude = 0;
806 863
 		}
807
-		if ($type_id == '') $type_id = NULL;
808
-		if ($status_id == '') $status_id = NULL;
809
-		if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
810
-		if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
811
-		if ($arrival_date == '') $arrival_date = NULL;
864
+		if ($type_id == '') {
865
+			$type_id = NULL;
866
+		}
867
+		if ($status_id == '') {
868
+			$status_id = NULL;
869
+		}
870
+		if ($heading == '' || $Common->isInteger($heading) === false) {
871
+			$heading = 0;
872
+		}
873
+		if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) {
874
+			$groundspeed = 0;
875
+		}
876
+		if ($arrival_date == '') {
877
+			$arrival_date = NULL;
878
+		}
812 879
 		$query  = "INSERT INTO marine_output (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, mmsi, type, type_id, status,status_id,imo,arrival_port_name,arrival_port_date) 
813 880
 		    VALUES (:fammarine_id,:ident,:latitude,:longitude,:heading,:speed,:date,:format_source, :source_name,:mmsi,:type,:type_id,:status,:status_id,:imo,:arrival_port_name,:arrival_port_date)";
814 881
 
@@ -915,7 +982,9 @@  discard block
 block discarded – undo
915 982
 		global $globalDBdriver, $globalArchive;
916 983
 		//$filter_query = $this->getFilter($filters,true,true);
917 984
 		$Connection= new Connection($this->db);
918
-		if (!$Connection->tableExists('countries')) return array();
985
+		if (!$Connection->tableExists('countries')) {
986
+			return array();
987
+		}
919 988
 		require_once('class.SpotterLive.php');
920 989
 		if (!isset($globalArchive) || $globalArchive !== TRUE) {
921 990
 			$MarineLive = new MarineLive($this->db);
@@ -959,7 +1028,9 @@  discard block
 block discarded – undo
959 1028
 			$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb FROM countries c INNER JOIN (SELECT DISTINCT fammarine_id,over_country FROM marine_archive".$filter_query.") l ON c.iso2 = l.over_country ";
960 1029
 		}
961 1030
 		$query .= "GROUP BY c.name,c.iso3,c.iso2 ORDER BY nb DESC";
962
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
1031
+		if ($limit) {
1032
+			$query .= " LIMIT 10 OFFSET 0";
1033
+		}
963 1034
 
964 1035
 		$sth = $this->db->prepare($query);
965 1036
 		$sth->execute();
@@ -993,12 +1064,18 @@  discard block
 block discarded – undo
993 1064
 		$query  = "SELECT DISTINCT marine_output.ident, COUNT(marine_output.ident) AS callsign_icao_count 
994 1065
                     FROM marine_output".$filter_query." marine_output.ident <> ''";
995 1066
 		 if ($olderthanmonths > 0) {
996
-			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
997
-			else $query .= " AND marine_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
1067
+			if ($globalDBdriver == 'mysql') {
1068
+				$query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
1069
+			} else {
1070
+				$query .= " AND marine_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
1071
+			}
998 1072
 		}
999 1073
 		if ($sincedate != '') {
1000
-			if ($globalDBdriver == 'mysql') $query .= " AND marine_output.date > '".$sincedate."'";
1001
-			else $query .= " AND marine_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
1074
+			if ($globalDBdriver == 'mysql') {
1075
+				$query .= " AND marine_output.date > '".$sincedate."'";
1076
+			} else {
1077
+				$query .= " AND marine_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
1078
+			}
1002 1079
 		}
1003 1080
 		$query_values = array();
1004 1081
 		if ($year != '') {
@@ -1029,7 +1106,9 @@  discard block
 block discarded – undo
1029 1106
 			}
1030 1107
 		}
1031 1108
 		$query .= " GROUP BY marine_output.ident ORDER BY callsign_icao_count DESC";
1032
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
1109
+		if ($limit) {
1110
+			$query .= " LIMIT 10 OFFSET 0";
1111
+		}
1033 1112
       		
1034 1113
 		$sth = $this->db->prepare($query);
1035 1114
 		$sth->execute($query_values);
@@ -1064,7 +1143,9 @@  discard block
 block discarded – undo
1064 1143
 			date_default_timezone_set($globalTimezone);
1065 1144
 			$datetime = new DateTime();
1066 1145
 			$offset = $datetime->format('P');
1067
-		} else $offset = '+00:00';
1146
+		} else {
1147
+			$offset = '+00:00';
1148
+		}
1068 1149
 
1069 1150
 		if ($globalDBdriver == 'mysql') {
1070 1151
 			$query  = "SELECT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -1114,7 +1195,9 @@  discard block
 block discarded – undo
1114 1195
 			date_default_timezone_set($globalTimezone);
1115 1196
 			$datetime = new DateTime();
1116 1197
 			$offset = $datetime->format('P');
1117
-		} else $offset = '+00:00';
1198
+		} else {
1199
+			$offset = '+00:00';
1200
+		}
1118 1201
 		$filter_query = $this->getFilter($filters,true,true);
1119 1202
 		if ($globalDBdriver == 'mysql') {
1120 1203
 			$query  = "SELECT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -1160,7 +1243,9 @@  discard block
 block discarded – undo
1160 1243
 			date_default_timezone_set($globalTimezone);
1161 1244
 			$datetime = new DateTime();
1162 1245
 			$offset = $datetime->format('P');
1163
-		} else $offset = '+00:00';
1246
+		} else {
1247
+			$offset = '+00:00';
1248
+		}
1164 1249
 		$filter_query = $this->getFilter($filters,true,true);
1165 1250
 		if ($globalDBdriver == 'mysql') {
1166 1251
 			$query  = "SELECT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -1208,7 +1293,9 @@  discard block
 block discarded – undo
1208 1293
 			date_default_timezone_set($globalTimezone);
1209 1294
 			$datetime = new DateTime();
1210 1295
 			$offset = $datetime->format('P');
1211
-		} else $offset = '+00:00';
1296
+		} else {
1297
+			$offset = '+00:00';
1298
+		}
1212 1299
 
1213 1300
 		if ($globalDBdriver == 'mysql') {
1214 1301
 			$query  = "SELECT YEAR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
@@ -1257,7 +1344,9 @@  discard block
 block discarded – undo
1257 1344
 			date_default_timezone_set($globalTimezone);
1258 1345
 			$datetime = new DateTime();
1259 1346
 			$offset = $datetime->format('P');
1260
-		} else $offset = '+00:00';
1347
+		} else {
1348
+			$offset = '+00:00';
1349
+		}
1261 1350
 		$filter_query = $this->getFilter($filters,true,true);
1262 1351
 		if ($globalDBdriver == 'mysql') {
1263 1352
 			$query  = "SELECT MONTH(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count
@@ -1306,7 +1395,9 @@  discard block
 block discarded – undo
1306 1395
 			date_default_timezone_set($globalTimezone);
1307 1396
 			$datetime = new DateTime();
1308 1397
 			$offset = $datetime->format('P');
1309
-		} else $offset = '+00:00';
1398
+		} else {
1399
+			$offset = '+00:00';
1400
+		}
1310 1401
 
1311 1402
 		$orderby_sql = '';
1312 1403
 		if ($orderby == "hour")
@@ -1375,7 +1466,9 @@  discard block
 block discarded – undo
1375 1466
 			date_default_timezone_set($globalTimezone);
1376 1467
 			$datetime = new DateTime($date);
1377 1468
 			$offset = $datetime->format('P');
1378
-		} else $offset = '+00:00';
1469
+		} else {
1470
+			$offset = '+00:00';
1471
+		}
1379 1472
 
1380 1473
 		if ($globalDBdriver == 'mysql') {
1381 1474
 			$query  = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -1423,7 +1516,9 @@  discard block
 block discarded – undo
1423 1516
 			date_default_timezone_set($globalTimezone);
1424 1517
 			$datetime = new DateTime();
1425 1518
 			$offset = $datetime->format('P');
1426
-		} else $offset = '+00:00';
1519
+		} else {
1520
+			$offset = '+00:00';
1521
+		}
1427 1522
 
1428 1523
 		if ($globalDBdriver == 'mysql') {
1429 1524
 			$query  = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -1488,8 +1583,11 @@  discard block
 block discarded – undo
1488 1583
 				$query_values = array_merge($query_values,array(':month' => $month));
1489 1584
 			}
1490 1585
 		}
1491
-		if (empty($query_values)) $queryi .= $this->getFilter($filters);
1492
-		else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
1586
+		if (empty($query_values)) {
1587
+			$queryi .= $this->getFilter($filters);
1588
+		} else {
1589
+			$queryi .= $this->getFilter($filters,true,true).substr($query,4);
1590
+		}
1493 1591
 		
1494 1592
 		$sth = $this->db->prepare($queryi);
1495 1593
 		$sth->execute($query_values);
@@ -1526,8 +1624,11 @@  discard block
 block discarded – undo
1526 1624
 				$query_values = array_merge($query_values,array(':month' => $month));
1527 1625
 			}
1528 1626
 		}
1529
-		if (empty($query_values)) $queryi .= $this->getFilter($filters);
1530
-		else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
1627
+		if (empty($query_values)) {
1628
+			$queryi .= $this->getFilter($filters);
1629
+		} else {
1630
+			$queryi .= $this->getFilter($filters,true,true).substr($query,4);
1631
+		}
1531 1632
 		
1532 1633
 		$sth = $this->db->prepare($queryi);
1533 1634
 		$sth->execute($query_values);
@@ -1549,7 +1650,9 @@  discard block
 block discarded – undo
1549 1650
 			date_default_timezone_set($globalTimezone);
1550 1651
 			$datetime = new DateTime();
1551 1652
 			$offset = $datetime->format('P');
1552
-		} else $offset = '+00:00';
1653
+		} else {
1654
+			$offset = '+00:00';
1655
+		}
1553 1656
 
1554 1657
 		if ($globalDBdriver == 'mysql') {
1555 1658
 			$query  = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -1653,7 +1756,9 @@  discard block
 block discarded – undo
1653 1756
 	*/
1654 1757
 	public function parseDirection($direction = 0)
1655 1758
 	{
1656
-		if ($direction == '') $direction = 0;
1759
+		if ($direction == '') {
1760
+			$direction = 0;
1761
+		}
1657 1762
 		$direction_array = array();
1658 1763
 		$temp_array = array();
1659 1764
 
@@ -1742,7 +1847,9 @@  discard block
 block discarded – undo
1742 1847
 		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1743 1848
 	
1744 1849
 		$Connection = new Connection($this->db);
1745
-		if (!$Connection->tableExists('countries')) return '';
1850
+		if (!$Connection->tableExists('countries')) {
1851
+			return '';
1852
+		}
1746 1853
 	
1747 1854
 		try {
1748 1855
 			/*
@@ -1762,9 +1869,13 @@  discard block
 block discarded – undo
1762 1869
 			$sth->closeCursor();
1763 1870
 			if (count($row) > 0) {
1764 1871
 				return $row;
1765
-			} else return '';
1872
+			} else {
1873
+				return '';
1874
+			}
1766 1875
 		} catch (PDOException $e) {
1767
-			if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n";
1876
+			if (isset($globalDebug) && $globalDebug) {
1877
+				echo 'Error : '.$e->getMessage()."\n";
1878
+			}
1768 1879
 			return '';
1769 1880
 		}
1770 1881
 	
@@ -1782,7 +1893,9 @@  discard block
 block discarded – undo
1782 1893
 		$iso2 = filter_var($iso2,FILTER_SANITIZE_STRING);
1783 1894
 	
1784 1895
 		$Connection = new Connection($this->db);
1785
-		if (!$Connection->tableExists('countries')) return '';
1896
+		if (!$Connection->tableExists('countries')) {
1897
+			return '';
1898
+		}
1786 1899
 	
1787 1900
 		try {
1788 1901
 			$query = "SELECT name,iso2,iso3 FROM countries WHERE iso2 = :iso2 LIMIT 1";
@@ -1794,9 +1907,13 @@  discard block
 block discarded – undo
1794 1907
 			$sth->closeCursor();
1795 1908
 			if (count($row) > 0) {
1796 1909
 				return $row;
1797
-			} else return '';
1910
+			} else {
1911
+				return '';
1912
+			}
1798 1913
 		} catch (PDOException $e) {
1799
-			if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n";
1914
+			if (isset($globalDebug) && $globalDebug) {
1915
+				echo 'Error : '.$e->getMessage()."\n";
1916
+			}
1800 1917
 			return '';
1801 1918
 		}
1802 1919
 	
@@ -1814,7 +1931,9 @@  discard block
 block discarded – undo
1814 1931
 	{
1815 1932
 		global $globalBitlyAccessToken;
1816 1933
 		
1817
-		if ($globalBitlyAccessToken == '') return $url;
1934
+		if ($globalBitlyAccessToken == '') {
1935
+			return $url;
1936
+		}
1818 1937
         
1819 1938
 		$google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url;
1820 1939
 		
@@ -1890,7 +2009,9 @@  discard block
 block discarded – undo
1890 2009
 			}
1891 2010
 		}
1892 2011
 		$query .= " GROUP BY marine_output.type, marine_output.type_id ORDER BY marine_type_count DESC";
1893
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
2012
+		if ($limit) {
2013
+			$query .= " LIMIT 10 OFFSET 0";
2014
+		}
1894 2015
 		$sth = $this->db->prepare($query);
1895 2016
 		$sth->execute($query_values);
1896 2017
 		$marine_array = array();
@@ -1928,9 +2049,15 @@  discard block
 block discarded – undo
1928 2049
 				foreach ($q_array as $q_item){
1929 2050
 					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
1930 2051
 					$additional_query .= " AND (";
1931
-					if (is_int($q_item)) $additional_query .= "(marine_output.marine_id = '".$q_item."') OR ";
1932
-					if (is_int($q_item)) $additional_query .= "(marine_output.mmsi = '".$q_item."') OR ";
1933
-					if (is_int($q_item)) $additional_query .= "(marine_output.imo = '".$q_item."') OR ";
2052
+					if (is_int($q_item)) {
2053
+						$additional_query .= "(marine_output.marine_id = '".$q_item."') OR ";
2054
+					}
2055
+					if (is_int($q_item)) {
2056
+						$additional_query .= "(marine_output.mmsi = '".$q_item."') OR ";
2057
+					}
2058
+					if (is_int($q_item)) {
2059
+						$additional_query .= "(marine_output.imo = '".$q_item."') OR ";
2060
+					}
1934 2061
 					$additional_query .= "(marine_output.ident like '%".$q_item."%') OR ";
1935 2062
 					$additional_query .= ")";
1936 2063
 				}
@@ -1978,7 +2105,9 @@  discard block
 block discarded – undo
1978 2105
 				date_default_timezone_set($globalTimezone);
1979 2106
 				$datetime = new DateTime();
1980 2107
 				$offset = $datetime->format('P');
1981
-			} else $offset = '+00:00';
2108
+			} else {
2109
+				$offset = '+00:00';
2110
+			}
1982 2111
 			if ($date_array[1] != "")
1983 2112
 			{
1984 2113
 				$date_array[0] = date("Y-m-d H:i:s", strtotime($date_array[0]));
@@ -2005,8 +2134,12 @@  discard block
 block discarded – undo
2005 2134
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
2006 2135
 			{
2007 2136
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
2008
-			} else $limit_query = "";
2009
-		} else $limit_query = "";
2137
+			} else {
2138
+				$limit_query = "";
2139
+			}
2140
+		} else {
2141
+			$limit_query = "";
2142
+		}
2010 2143
 		if ($sort != "")
2011 2144
 		{
2012 2145
 			$search_orderby_array = $this->getOrderBy();
Please login to merge, or discard this patch.
live-geojson.php 3 patches
Indentation   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -5,23 +5,23 @@  discard block
 block discarded – undo
5 5
 $marine = false;
6 6
 $usecoord = false;
7 7
 if (isset($_GET['tracker'])) {
8
-    $tracker = true;
8
+	$tracker = true;
9 9
 }
10 10
 if (isset($_GET['marine'])) {
11
-    $marine = true;
11
+	$marine = true;
12 12
 }
13 13
 if ($tracker) {
14
-    require_once('require/class.Tracker.php');
15
-    require_once('require/class.TrackerLive.php');
16
-    require_once('require/class.TrackerArchive.php');
14
+	require_once('require/class.Tracker.php');
15
+	require_once('require/class.TrackerLive.php');
16
+	require_once('require/class.TrackerArchive.php');
17 17
 } elseif ($marine) {
18
-    require_once('require/class.Marine.php');
19
-    require_once('require/class.MarineLive.php');
20
-    require_once('require/class.MarineArchive.php');
18
+	require_once('require/class.Marine.php');
19
+	require_once('require/class.MarineLive.php');
20
+	require_once('require/class.MarineArchive.php');
21 21
 } else {
22
-    require_once('require/class.Spotter.php');
23
-    require_once('require/class.SpotterLive.php');
24
-    require_once('require/class.SpotterArchive.php');
22
+	require_once('require/class.Spotter.php');
23
+	require_once('require/class.SpotterLive.php');
24
+	require_once('require/class.SpotterArchive.php');
25 25
 }
26 26
 
27 27
 $begintime = microtime(true);
@@ -41,10 +41,10 @@  discard block
 block discarded – undo
41 41
 $Common = new Common();
42 42
 
43 43
 if (isset($_GET['download'])) {
44
-    if ($_GET['download'] == "true")
45
-    {
44
+	if ($_GET['download'] == "true")
45
+	{
46 46
 	header('Content-disposition: attachment; filename="flightairmap.json"');
47
-    }
47
+	}
48 48
 }
49 49
 header('Content-Type: text/javascript');
50 50
 
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	$usecoord = true;
109 109
 	$coord = explode(',',$_GET['coord']);
110 110
 	if (filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) 
111
-	    && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0) {
111
+		&& $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0) {
112 112
 		if ($tracker) {
113 113
 			$spotter_array = $TrackerLive->getLiveTrackerDatabyCoord($coord,$filter);
114 114
 		} elseif ($marine) {
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	$usecoord = true;
122 122
 	$coord = explode(',',$_GET['coord']);
123 123
 	if (filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) 
124
-	    && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0) {
124
+		&& $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0) {
125 125
 		if ($tracker) {
126 126
 			$spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord,$filter);
127 127
 		} elseif ($marine) {
@@ -538,17 +538,17 @@  discard block
 block discarded – undo
538 538
 				if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history'];
539 539
 				
540 540
 				if (
541
-				    (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') 
542
-				    || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory)
541
+					(isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') 
542
+					|| ((isset($globalMapHistory) && $globalMapHistory) || $allhistory)
543 543
 				//    || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id']))
544 544
 				//    || (isset($history) && $history != '' && $history != 'NA' && $history == $spotter_item['ident'])
545
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
546
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])
547
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id']))
548
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id'])
549
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid']))
550
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid'])
551
-				    ) {
545
+					|| (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
546
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])
547
+					|| (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id']))
548
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id'])
549
+					|| (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid']))
550
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid'])
551
+					) {
552 552
 					if ($tracker) {
553 553
 						if ($from_archive || $globalArchive) {
554 554
 							$spotter_history_array = $TrackerArchive->getAllArchiveTrackerDataById($spotter_item['famtrackid']);
@@ -637,65 +637,65 @@  discard block
 block discarded – undo
637 637
 				}
638 638
 				
639 639
 				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
640
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
641
-				     && (isset($spotter_item['departure_airport']) 
642
-				        && $spotter_item['departure_airport'] != 'NA' 
643
-				        && isset($spotter_item['arrival_airport']) 
644
-				        && $spotter_item['arrival_airport'] != 'NA' 
645
-				        && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") 
646
-				    	    || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) {
647
-				    if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
648
-				    else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
649
-				    if (isset($spotter_item['departure_airport_latitude'])) {
640
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
641
+					 && (isset($spotter_item['departure_airport']) 
642
+						&& $spotter_item['departure_airport'] != 'NA' 
643
+						&& isset($spotter_item['arrival_airport']) 
644
+						&& $spotter_item['arrival_airport'] != 'NA' 
645
+						&& ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") 
646
+							|| (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) {
647
+					if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
648
+					else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
649
+					if (isset($spotter_item['departure_airport_latitude'])) {
650 650
 					$output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],';
651
-				    } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') {
651
+					} elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') {
652 652
 					$dairport = $Spotter->getAllAirportInfo($spotter_item['departure_airport']);
653 653
 					if (isset($dairport[0]['latitude'])) {
654
-					    $output_air .= '['.$dairport[0]['longitude'].','.$dairport[0]['latitude'].'],';
654
+						$output_air .= '['.$dairport[0]['longitude'].','.$dairport[0]['latitude'].'],';
655 655
 					}
656
-				    }
657
-				    if (isset($spotter_item['arrival_airport_latitude'])) {
656
+					}
657
+					if (isset($spotter_item['arrival_airport_latitude'])) {
658 658
 					$output_air .= '['.$spotter_item['arrival_airport_longitude'].','.$spotter_item['arrival_airport_latitude'].'],';
659
-				    } elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
659
+					} elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
660 660
 					$aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']);
661 661
 					if (isset($aairport[0]['latitude'])) {
662
-					    $output_air .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].'],';
662
+						$output_air .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].'],';
663 663
 					}
664
-				    }
665
-				    $output_air  = substr($output_air, 0, -1);
666
-				    $output_air .= ']}},';
667
-				    $output .= $output_air;
668
-				    unset($output_air);
664
+					}
665
+					$output_air  = substr($output_air, 0, -1);
666
+					$output_air .= ']}},';
667
+					$output .= $output_air;
668
+					unset($output_air);
669 669
 				}
670 670
 
671 671
 				//if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA' && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) {
672 672
 				//if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) {
673 673
 				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
674
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
675
-				     && (isset($spotter_item['arrival_airport']) 
676
-				        && $spotter_item['arrival_airport'] != 'NA' 
677
-				        && ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == "true") 
678
-				    	    || (!isset($_COOKIE['MapRemainaingRoute']) && (!isset($globalMapRemainingRoute) 
679
-				    	    || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) {
680
-				    $havedata = false;
681
-				    if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
682
-				    else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
683
-				    $output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],';
674
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
675
+					 && (isset($spotter_item['arrival_airport']) 
676
+						&& $spotter_item['arrival_airport'] != 'NA' 
677
+						&& ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == "true") 
678
+							|| (!isset($_COOKIE['MapRemainaingRoute']) && (!isset($globalMapRemainingRoute) 
679
+							|| (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) {
680
+					$havedata = false;
681
+					if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
682
+					else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
683
+					$output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],';
684 684
 
685
-				    if (isset($spotter_item['arrival_airport_latitude'])) {
685
+					if (isset($spotter_item['arrival_airport_latitude'])) {
686 686
 					$output_dest .= '['.$spotter_item['arrival_airport_longitude'].','.$spotter_item['arrival_airport_latitude'].']';
687 687
 					$havedata = true;
688
-				    } elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
688
+					} elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
689 689
 					$aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']);
690 690
 					if (isset($aairport[0]['latitude'])) {
691
-					    $output_dest .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].']';
692
-					    $havedata = true;
691
+						$output_dest .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].']';
692
+						$havedata = true;
693 693
 					}
694
-				    }
695
-				    //$output_dest  = substr($output_dest, 0, -1);
696
-				    $output_dest .= ']}},';
697
-				    if ($havedata) $output .= $output_dest;
698
-				    unset($output_dest);
694
+					}
695
+					//$output_dest  = substr($output_dest, 0, -1);
696
+					$output_dest .= ']}},';
697
+					if ($havedata) $output .= $output_dest;
698
+					unset($output_dest);
699 699
 				}
700 700
 			}
701 701
 			$output  = substr($output, 0, -1);
Please login to merge, or discard this patch.
Braces   +300 added lines, -117 removed lines patch added patch discarded remove patch
@@ -48,28 +48,55 @@  discard block
 block discarded – undo
48 48
 }
49 49
 header('Content-Type: text/javascript');
50 50
 
51
-if (!isset($globalJsonCompress)) $compress = true;
52
-else $compress = $globalJsonCompress;
51
+if (!isset($globalJsonCompress)) {
52
+	$compress = true;
53
+} else {
54
+	$compress = $globalJsonCompress;
55
+}
53 56
 
54 57
 $from_archive = false;
55 58
 $min = true;
56 59
 $allhistory = false;
57 60
 $filter['source'] = array();
58
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
59
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
60
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
61
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
62
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
63
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
64
-if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
65
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
66
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
67
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
68
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
61
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') {
62
+	$filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
63
+}
64
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') {
65
+	$filter['source'] = array_merge($filter['source'],array('whazzup'));
66
+}
67
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') {
68
+	$filter['source'] = array_merge($filter['source'],array('phpvmacars'));
69
+}
70
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') {
71
+	$filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
72
+}
73
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') {
74
+	$filter['source'] = array_merge($filter['source'],array('aprs'));
75
+}
76
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') {
77
+	$filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
78
+}
79
+if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') {
80
+	$filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
81
+}
82
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') {
83
+	$filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
84
+}
85
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') {
86
+	$filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
87
+}
88
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') {
89
+	$filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
90
+}
91
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') {
92
+	$filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
93
+}
69 94
 
70 95
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
71 96
 	$min = true;
72
-} else $min = false;
97
+} else {
98
+	$min = false;
99
+}
73 100
 
74 101
 $spotter_array = array();
75 102
 
@@ -171,24 +198,38 @@  discard block
 block discarded – undo
171 198
 			$flightcnt = $SpotterLive->getLiveSpotterCount($filter);
172 199
 		}
173 200
 	}
174
-	if ($flightcnt == '') $flightcnt = 0;
175
-} else $flightcnt = 0;
201
+	if ($flightcnt == '') {
202
+		$flightcnt = 0;
203
+	}
204
+	} else {
205
+	$flightcnt = 0;
206
+}
176 207
 
177 208
 $sqltime = round(microtime(true)-$begintime,2);
178 209
 
179 210
 $currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
180
-if ($currenttime != '') $currenttime = round($currenttime/1000);
211
+if ($currenttime != '') {
212
+	$currenttime = round($currenttime/1000);
213
+}
181 214
 
182
-if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false;
183
-else $usenextlatlon = true;
184
-if ($usenextlatlon === false) $currenttime = '';
215
+if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) {
216
+	$usenextlatlon = false;
217
+} else {
218
+	$usenextlatlon = true;
219
+}
220
+if ($usenextlatlon === false) {
221
+	$currenttime = '';
222
+}
185 223
 $j = 0;
186 224
 $prev_flightaware_id = '';
187 225
 $aircrafts_shadow = array();
188 226
 $output = '{';
189 227
 	$output .= '"type": "FeatureCollection",';
190
-		if ($min) $output .= '"minimal": "true",';
191
-		else $output .= '"minimal": "false",';
228
+		if ($min) {
229
+			$output .= '"minimal": "true",';
230
+		} else {
231
+			$output .= '"minimal": "false",';
232
+		}
192 233
 		//$output .= '"fc": "'.$flightcnt.'",';
193 234
 		$output .= '"sqt": "'.$sqltime.'",';
194 235
 
@@ -232,18 +273,29 @@  discard block
 block discarded – undo
232 273
 						}
233 274
 						$output .= '"properties": {';
234 275
 						if (isset($spotter_item['flightaware_id'])) {
235
-							if ($compress) $output .= '"fi": "'.$spotter_item['flightaware_id'].'",';
236
-							else $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",';
276
+							if ($compress) {
277
+								$output .= '"fi": "'.$spotter_item['flightaware_id'].'",';
278
+							} else {
279
+								$output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",';
280
+							}
237 281
 						} elseif (isset($spotter_item['famtrackid'])) {
238
-							if ($compress) $output .= '"fti": "'.$spotter_item['famtrackid'].'",';
239
-							else $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",';
282
+							if ($compress) {
283
+								$output .= '"fti": "'.$spotter_item['famtrackid'].'",';
284
+							} else {
285
+								$output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",';
286
+							}
240 287
 						} elseif (isset($spotter_item['fammarine_id'])) {
241
-							if ($compress) $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",';
242
-							else $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",';
288
+							if ($compress) {
289
+								$output .= '"fmi": "'.$spotter_item['fammarine_id'].'",';
290
+							} else {
291
+								$output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",';
292
+							}
243 293
 						}
244 294
 							$output .= '"fc": "'.$flightcnt.'",';
245 295
 							$output .= '"sqt": "'.$sqltime.'",';
246
-							if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
296
+							if (isset($begindate)) {
297
+								$output .= '"archive_date": "'.$begindate.'",';
298
+							}
247 299
 
248 300
 /*
249 301
 							if ($min) $output .= '"minimal": "true",';
@@ -251,14 +303,22 @@  discard block
 block discarded – undo
251 303
 */
252 304
 							//$output .= '"fc": "'.$spotter_item['nb'].'",';
253 305
 						if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') {
254
-							if ($compress) $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",';
255
-							else $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",';
306
+							if ($compress) {
307
+								$output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",';
308
+							} else {
309
+								$output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",';
310
+							}
256 311
 							//"
257 312
 						} else {
258
-							if ($compress) $output .= '"c": "NA",';
259
-							else $output .= '"callsign": "NA",';
313
+							if ($compress) {
314
+								$output .= '"c": "NA",';
315
+							} else {
316
+								$output .= '"callsign": "NA",';
317
+							}
318
+						}
319
+						if (isset($spotter_item['registration'])) {
320
+							$output .= '"registration": "'.$spotter_item['registration'].'",';
260 321
 						}
261
-						if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",';
262 322
 						if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) {
263 323
 							$output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",';
264 324
 							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",';
@@ -271,16 +331,23 @@  discard block
 block discarded – undo
271 331
 							$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
272 332
 						}
273 333
 						if (!isset($spotter_item['aircraft_shadow']) && !$tracker) {
274
-							if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = '';
275
-							else {
334
+							if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') {
335
+								$spotter_item['aircraft_shadow'] = '';
336
+							} else {
276 337
 								$aircraft_icao = $spotter_item['aircraft_icao'];
277
-								if (isset($aircrafts_shadow[$aircraft_icao])) $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao];
278
-								else {
338
+								if (isset($aircrafts_shadow[$aircraft_icao])) {
339
+									$spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao];
340
+								} else {
279 341
 									$aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']);
280
-									if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
281
-									elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png';
282
-									elseif ($aircraft_icao == 'PARAGLIDER') $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png';
283
-									else $spotter_item['aircraft_shadow'] = '';
342
+									if (count($aircraft_info) > 0) {
343
+										$spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
344
+									} elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') {
345
+										$spotter_item['aircraft_shadow'] = 'PA18.png';
346
+									} elseif ($aircraft_icao == 'PARAGLIDER') {
347
+										$spotter_item['aircraft_shadow'] = 'PARAGLIDER.png';
348
+									} else {
349
+										$spotter_item['aircraft_shadow'] = '';
350
+									}
284 351
 									$aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow'];
285 352
 								}
286 353
 							}
@@ -288,73 +355,139 @@  discard block
 block discarded – undo
288 355
 						if (!isset($spotter_item['aircraft_shadow']) || $spotter_item['aircraft_shadow'] == '') {
289 356
 							if ($tracker) {
290 357
 								if (isset($spotter_item['type']) && $spotter_item['type'] == 'Ambulance') {
291
-									if ($compress) $output .= '"as": "ambulance.png",';
292
-									else $output .= '"aircraft_shadow": "ambulance.png",';
358
+									if ($compress) {
359
+										$output .= '"as": "ambulance.png",';
360
+									} else {
361
+										$output .= '"aircraft_shadow": "ambulance.png",';
362
+									}
293 363
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') {
294
-									if ($compress) $output .= '"as": "police.png",';
295
-									else $output .= '"aircraft_shadow": "police.png",';
364
+									if ($compress) {
365
+										$output .= '"as": "police.png",';
366
+									} else {
367
+										$output .= '"aircraft_shadow": "police.png",';
368
+									}
296 369
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') {
297
-									if ($compress) $output .= '"as": "ship.png",';
298
-									else $output .= '"aircraft_shadow": "ship.png",';
370
+									if ($compress) {
371
+										$output .= '"as": "ship.png",';
372
+									} else {
373
+										$output .= '"aircraft_shadow": "ship.png",';
374
+									}
299 375
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') {
300
-									if ($compress) $output .= '"as": "ship.png",';
301
-									else $output .= '"aircraft_shadow": "ship.png",';
376
+									if ($compress) {
377
+										$output .= '"as": "ship.png",';
378
+									} else {
379
+										$output .= '"aircraft_shadow": "ship.png",';
380
+									}
302 381
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') {
303
-									if ($compress) $output .= '"as": "ship.png",';
304
-									else $output .= '"aircraft_shadow": "ship.png",';
382
+									if ($compress) {
383
+										$output .= '"as": "ship.png",';
384
+									} else {
385
+										$output .= '"aircraft_shadow": "ship.png",';
386
+									}
305 387
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') {
306
-									if ($compress) $output .= '"as": "truck.png",';
307
-									else $output .= '"aircraft_shadow": "truck.png",';
388
+									if ($compress) {
389
+										$output .= '"as": "truck.png",';
390
+									} else {
391
+										$output .= '"aircraft_shadow": "truck.png",';
392
+									}
308 393
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') {
309
-									if ($compress) $output .= '"as": "truck.png",';
310
-									else $output .= '"aircraft_shadow": "truck.png",';
394
+									if ($compress) {
395
+										$output .= '"as": "truck.png",';
396
+									} else {
397
+										$output .= '"aircraft_shadow": "truck.png",';
398
+									}
311 399
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') {
312
-									if ($compress) $output .= '"as": "aircraft.png",';
313
-									else $output .= '"aircraft_shadow": "aircraft.png",';
400
+									if ($compress) {
401
+										$output .= '"as": "aircraft.png",';
402
+									} else {
403
+										$output .= '"aircraft_shadow": "aircraft.png",';
404
+									}
314 405
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') {
315
-									if ($compress) $output .= '"as": "aircraft.png",';
316
-									else $output .= '"aircraft_shadow": "aircraft.png",';
406
+									if ($compress) {
407
+										$output .= '"as": "aircraft.png",';
408
+									} else {
409
+										$output .= '"aircraft_shadow": "aircraft.png",';
410
+									}
317 411
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') {
318
-									if ($compress) $output .= '"as": "helico.png",';
319
-									else $output .= '"aircraft_shadow": "helico.png",';
412
+									if ($compress) {
413
+										$output .= '"as": "helico.png",';
414
+									} else {
415
+										$output .= '"aircraft_shadow": "helico.png",';
416
+									}
320 417
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') {
321
-									if ($compress) $output .= '"as": "rail.png",';
322
-									else $output .= '"aircraft_shadow": "rail.png",';
418
+									if ($compress) {
419
+										$output .= '"as": "rail.png",';
420
+									} else {
421
+										$output .= '"aircraft_shadow": "rail.png",';
422
+									}
323 423
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') {
324
-									if ($compress) $output .= '"as": "firetruck.png",';
325
-									else $output .= '"aircraft_shadow": "firetruck.png",';
424
+									if ($compress) {
425
+										$output .= '"as": "firetruck.png",';
426
+									} else {
427
+										$output .= '"aircraft_shadow": "firetruck.png",';
428
+									}
326 429
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') {
327
-									if ($compress) $output .= '"as": "bus.png",';
328
-									else $output .= '"aircraft_shadow": "bus.png",';
430
+									if ($compress) {
431
+										$output .= '"as": "bus.png",';
432
+									} else {
433
+										$output .= '"aircraft_shadow": "bus.png",';
434
+									}
329 435
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') {
330
-									if ($compress) $output .= '"as": "phone.png",';
331
-									else $output .= '"aircraft_shadow": "phone.png",';
436
+									if ($compress) {
437
+										$output .= '"as": "phone.png",';
438
+									} else {
439
+										$output .= '"aircraft_shadow": "phone.png",';
440
+									}
332 441
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') {
333
-									if ($compress) $output .= '"as": "jogger.png",';
334
-									else $output .= '"aircraft_shadow": "jogger.png",';
442
+									if ($compress) {
443
+										$output .= '"as": "jogger.png",';
444
+									} else {
445
+										$output .= '"aircraft_shadow": "jogger.png",';
446
+									}
335 447
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') {
336
-									if ($compress) $output .= '"as": "bike.png",';
337
-									else $output .= '"aircraft_shadow": "bike.png",';
448
+									if ($compress) {
449
+										$output .= '"as": "bike.png",';
450
+									} else {
451
+										$output .= '"aircraft_shadow": "bike.png",';
452
+									}
338 453
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') {
339
-									if ($compress) $output .= '"as": "motorcycle.png",';
340
-									else $output .= '"aircraft_shadow": "motorcycle.png",';
454
+									if ($compress) {
455
+										$output .= '"as": "motorcycle.png",';
456
+									} else {
457
+										$output .= '"aircraft_shadow": "motorcycle.png",';
458
+									}
341 459
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') {
342
-									if ($compress) $output .= '"as": "balloon.png",';
343
-									else $output .= '"aircraft_shadow": "balloon.png",';
460
+									if ($compress) {
461
+										$output .= '"as": "balloon.png",';
462
+									} else {
463
+										$output .= '"aircraft_shadow": "balloon.png",';
464
+									}
344 465
 								} else {
345
-									if ($compress) $output .= '"as": "car.png",';
346
-									else $output .= '"aircraft_shadow": "car.png",';
466
+									if ($compress) {
467
+										$output .= '"as": "car.png",';
468
+									} else {
469
+										$output .= '"aircraft_shadow": "car.png",';
470
+									}
347 471
 								}
348 472
 							} elseif ($marine) {
349
-								if ($compress) $output .= '"as": "ship.png",';
350
-								else $output .= '"aircraft_shadow": "ship.png",';
473
+								if ($compress) {
474
+									$output .= '"as": "ship.png",';
475
+								} else {
476
+									$output .= '"aircraft_shadow": "ship.png",';
477
+								}
351 478
 							} else {
352
-								if ($compress) $output .= '"as": "default.png",';
353
-								else $output .= '"aircraft_shadow": "default.png",';
479
+								if ($compress) {
480
+									$output .= '"as": "default.png",';
481
+								} else {
482
+									$output .= '"aircraft_shadow": "default.png",';
483
+								}
354 484
 							}
355 485
 						} else {
356
-							if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
357
-							else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
486
+							if ($compress) {
487
+								$output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
488
+							} else {
489
+								$output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
490
+							}
358 491
 						}
359 492
 						if (isset($spotter_item['airline_name'])) {
360 493
 							$output .= '"airline_name": "'.$spotter_item['airline_name'].'",';
@@ -362,8 +495,11 @@  discard block
 block discarded – undo
362 495
 							$output .= '"airline_name": "NA",';
363 496
 						}
364 497
 						if (isset($spotter_item['departure_airport'])) {
365
-							if ($compress) $output .= '"dac": "'.$spotter_item['departure_airport'].'",';
366
-							else $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",';
498
+							if ($compress) {
499
+								$output .= '"dac": "'.$spotter_item['departure_airport'].'",';
500
+							} else {
501
+								$output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",';
502
+							}
367 503
 						}
368 504
 						if (isset($spotter_item['departure_airport_city'])) {
369 505
 							$output .= '"departure_airport": "'.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_country'].'",';
@@ -375,8 +511,11 @@  discard block
 block discarded – undo
375 511
 							$output .= '"arrival_airport_time": "'.$spotter_item['arrival_airport_time'].'",';
376 512
 						}
377 513
 						if (isset($spotter_item['arrival_airport'])) {
378
-							if ($compress) $output .= '"aac": "'.$spotter_item['arrival_airport'].'",';
379
-							else $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",';
514
+							if ($compress) {
515
+								$output .= '"aac": "'.$spotter_item['arrival_airport'].'",';
516
+							} else {
517
+								$output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",';
518
+							}
380 519
 						}
381 520
 						if (isset($spotter_item['arrival_airport_city'])) {
382 521
 							$output .= '"arrival_airport": "'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].'",';
@@ -395,11 +534,17 @@  discard block
 block discarded – undo
395 534
 						}
396 535
 						
397 536
 						if (isset($spotter_item['altitude'])) {
398
-							if ($compress) $output .= '"a": "'.$spotter_item['altitude'].'",';
399
-							else $output .= '"altitude": "'.$spotter_item['altitude'].'",';
537
+							if ($compress) {
538
+								$output .= '"a": "'.$spotter_item['altitude'].'",';
539
+							} else {
540
+								$output .= '"altitude": "'.$spotter_item['altitude'].'",';
541
+							}
542
+						}
543
+						if ($compress) {
544
+							$output .= '"h": "'.$spotter_item['heading'].'",';
545
+						} else {
546
+							$output .= '"heading": "'.$spotter_item['heading'].'",';
400 547
 						}
401
-						if ($compress)$output .= '"h": "'.$spotter_item['heading'].'",';
402
-						else $output .= '"heading": "'.$spotter_item['heading'].'",';
403 548
 						
404 549
 						if ($currenttime != '') {
405 550
 							if (strtotime($spotter_item['date']) < $currenttime) {
@@ -421,7 +566,9 @@  discard block
 block discarded – undo
421 566
 							}
422 567
 						}
423 568
 
424
-						if (!$min) $output .= '"image": "'.$image.'",';
569
+						if (!$min) {
570
+							$output .= '"image": "'.$image.'",';
571
+						}
425 572
 						if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') {
426 573
 							$output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",';
427 574
 						}
@@ -429,8 +576,11 @@  discard block
 block discarded – undo
429 576
 							$output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",';
430 577
 						}
431 578
 						if (isset($spotter_item['squawk'])) {
432
-							if ($compress) $output .= '"sq": "'.$spotter_item['squawk'].'",';
433
-							else $output .= '"squawk": "'.$spotter_item['squawk'].'",';
579
+							if ($compress) {
580
+								$output .= '"sq": "'.$spotter_item['squawk'].'",';
581
+							} else {
582
+								$output .= '"squawk": "'.$spotter_item['squawk'].'",';
583
+							}
434 584
 						}
435 585
 						if (isset($spotter_item['squawk_usage'])) {
436 586
 							$output .= '"squawk_usage": "'.$spotter_item['squawk_usage'].'",';
@@ -449,14 +599,23 @@  discard block
 block discarded – undo
449 599
 						}
450 600
 						// type when not aircraft ?
451 601
 						if (isset($spotter_item['type'])) {
452
-							if ($compress) $output .= '"t": "'.$spotter_item['type'].'"';
453
-							else $output .= '"type": "'.$spotter_item['type'].'"';
602
+							if ($compress) {
603
+								$output .= '"t": "'.$spotter_item['type'].'"';
604
+							} else {
605
+								$output .= '"type": "'.$spotter_item['type'].'"';
606
+							}
454 607
 						} elseif ($marine) {
455
-							if ($compress) $output .= '"t": "ship"';
456
-							else $output .= '"type": "ship"';
608
+							if ($compress) {
609
+								$output .= '"t": "ship"';
610
+							} else {
611
+								$output .= '"type": "ship"';
612
+							}
457 613
 						} else {
458
-							if ($compress) $output .= '"t": "aircraft"';
459
-							else $output .= '"type": "aircraft"';
614
+							if ($compress) {
615
+								$output .= '"t": "aircraft"';
616
+							} else {
617
+								$output .= '"type": "aircraft"';
618
+							}
460 619
 						}
461 620
 						$output .= '},';
462 621
 						$output .= '"geometry": {';
@@ -464,7 +623,9 @@  discard block
 block discarded – undo
464 623
 								$output .= '"coordinates": [';
465 624
 								if ($currenttime != '') {
466 625
 									if (strtotime($spotter_item['date']) < $currenttime) {
467
-										if (!isset($archivespeed)) $archivespeed = 1;
626
+										if (!isset($archivespeed)) {
627
+											$archivespeed = 1;
628
+										}
468 629
 										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed,$currenttime-strtotime($spotter_item['date']));
469 630
 										$output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
470 631
 									} else {
@@ -535,7 +696,9 @@  discard block
 block discarded – undo
535 696
 			}
536 697
 */
537 698
 				$history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING);
538
-				if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history'];
699
+				if ($history == '' && isset($_COOKIE['history'])) {
700
+					$history = $_COOKIE['history'];
701
+				}
539 702
 				
540 703
 				if (
541 704
 				    (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') 
@@ -579,8 +742,11 @@  discard block
 block discarded – undo
579 742
 									$output_history .= ']}},';
580 743
 									$output .= $output_history;
581 744
 								}
582
-								if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
583
-								else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
745
+								if ($compress) {
746
+									$output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
747
+								} else {
748
+									$output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
749
+								}
584 750
 							}
585 751
 							$output_history .= '[';
586 752
 							$output_history .=  $spotter_history['longitude'].', ';
@@ -599,9 +765,14 @@  discard block
 block discarded – undo
599 765
 							$prev_alt = $alt;
600 766
 						} else {
601 767
 							if ($d == false) {
602
-								if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history"},"geometry": {"type": "LineString","coordinates": [';
603
-								else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": [';
604
-							} else $d = true;
768
+								if ($compress) {
769
+									$output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history"},"geometry": {"type": "LineString","coordinates": [';
770
+								} else {
771
+									$output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": [';
772
+								}
773
+							} else {
774
+								$d = true;
775
+							}
605 776
 							$output_history .= '[';
606 777
 							$output_history .=  $spotter_history['longitude'].', ';
607 778
 							$output_history .=  $spotter_history['latitude'];
@@ -622,7 +793,9 @@  discard block
 block discarded – undo
622 793
 							$output_historyd = '[';
623 794
 							$output_historyd .=  $spotter_item['longitude'].', ';
624 795
 							$output_historyd .=  $spotter_item['latitude'];
625
-							if (isset($spotter_history['altitude'])) $output_historyd .=  ','.$spotter_item['altitude']*30.48;
796
+							if (isset($spotter_history['altitude'])) {
797
+								$output_historyd .=  ','.$spotter_item['altitude']*30.48;
798
+							}
626 799
 							$output_historyd .= '],';
627 800
 							//$output_history = $output_historyd.$output_history;
628 801
 							$output_history = $output_history.$output_historyd;
@@ -644,8 +817,11 @@  discard block
 block discarded – undo
644 817
 				        && $spotter_item['arrival_airport'] != 'NA' 
645 818
 				        && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") 
646 819
 				    	    || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) {
647
-				    if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
648
-				    else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
820
+				    if ($compress) {
821
+				    	$output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
822
+				    } else {
823
+				    	$output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
824
+				    }
649 825
 				    if (isset($spotter_item['departure_airport_latitude'])) {
650 826
 					$output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],';
651 827
 				    } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') {
@@ -678,8 +854,11 @@  discard block
 block discarded – undo
678 854
 				    	    || (!isset($_COOKIE['MapRemainaingRoute']) && (!isset($globalMapRemainingRoute) 
679 855
 				    	    || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) {
680 856
 				    $havedata = false;
681
-				    if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
682
-				    else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
857
+				    if ($compress) {
858
+				    	$output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
859
+				    } else {
860
+				    	$output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
861
+				    }
683 862
 				    $output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],';
684 863
 
685 864
 				    if (isset($spotter_item['arrival_airport_latitude'])) {
@@ -694,7 +873,9 @@  discard block
 block discarded – undo
694 873
 				    }
695 874
 				    //$output_dest  = substr($output_dest, 0, -1);
696 875
 				    $output_dest .= ']}},';
697
-				    if ($havedata) $output .= $output_dest;
876
+				    if ($havedata) {
877
+				    	$output .= $output_dest;
878
+				    }
698 879
 				    unset($output_dest);
699 880
 				}
700 881
 			}
@@ -702,7 +883,9 @@  discard block
 block discarded – undo
702 883
 			$output .= ']';
703 884
 			$output .= ',"initial_sqltime": "'.$sqltime.'",';
704 885
 			$output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",';
705
-			if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
886
+			if (isset($begindate)) {
887
+				$output .= '"archive_date": "'.$begindate.'",';
888
+			}
706 889
 			$output .= '"fc": "'.$j.'"';
707 890
 		} else {
708 891
 			$output .= '"features": ';
Please login to merge, or discard this patch.
Spacing   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -55,17 +55,17 @@  discard block
 block discarded – undo
55 55
 $min = true;
56 56
 $allhistory = false;
57 57
 $filter['source'] = array();
58
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
59
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
60
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
61
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
62
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
63
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
64
-if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
65
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
66
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
67
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
68
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
58
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt'));
59
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup'));
60
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars'));
61
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs'));
62
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs'));
63
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING);
64
+if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'], FILTER_SANITIZE_STRING);
65
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING);
66
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING);
67
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING);
68
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING);
69 69
 
70 70
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
71 71
 	$min = true;
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 $spotter_array = array();
75 75
 
76 76
 if (isset($_GET['ident'])) {
77
-	$ident = urldecode(filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING));
77
+	$ident = urldecode(filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING));
78 78
 	if ($tracker) {
79 79
 		$spotter_array = $TrackerLive->getLastLiveTrackerDataByIdent($ident);
80 80
 	} elseif ($marine) {
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	}
89 89
 	$allhistory = true;
90 90
 } elseif (isset($_GET['flightaware_id'])) {
91
-	$flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
91
+	$flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING);
92 92
 	$spotter_array = $SpotterLive->getLastLiveSpotterDataById($flightaware_id);
93 93
 	if (empty($spotter_array)) {
94 94
 		$from_archive = true;
@@ -96,38 +96,38 @@  discard block
 block discarded – undo
96 96
 	}
97 97
 	$allhistory = true;
98 98
 } elseif (isset($_GET['famtrack_id'])) {
99
-	$famtrack_id = urldecode(filter_input(INPUT_GET,'famtrack_id',FILTER_SANITIZE_STRING));
99
+	$famtrack_id = urldecode(filter_input(INPUT_GET, 'famtrack_id', FILTER_SANITIZE_STRING));
100 100
 	$spotter_array = $TrackerLive->getLastLiveTrackerDataById($famtrack_id);
101 101
 	$allhistory = true;
102 102
 } elseif (isset($_GET['fammarine_id'])) {
103
-	$fammarine_id = urldecode(filter_input(INPUT_GET,'fammarine_id',FILTER_SANITIZE_STRING));
103
+	$fammarine_id = urldecode(filter_input(INPUT_GET, 'fammarine_id', FILTER_SANITIZE_STRING));
104 104
 	$spotter_array = $MarineLive->getLastLiveMarineDataById($fammarine_id);
105 105
 	$allhistory = true;
106 106
 } elseif (isset($globalMapUseBbox) && $globalMapUseBbox && isset($_GET['coord']) && (!isset($globalMapPopup) || $globalMapPopup || (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true'))) {
107 107
 //} elseif (isset($_GET['coord'])) {
108 108
 	$usecoord = true;
109
-	$coord = explode(',',$_GET['coord']);
110
-	if (filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) 
109
+	$coord = explode(',', $_GET['coord']);
110
+	if (filter_var($coord[0], FILTER_VALIDATE_FLOAT) && filter_var($coord[1], FILTER_VALIDATE_FLOAT) && filter_var($coord[2], FILTER_VALIDATE_FLOAT) && filter_var($coord[3], FILTER_VALIDATE_FLOAT) 
111 111
 	    && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0) {
112 112
 		if ($tracker) {
113
-			$spotter_array = $TrackerLive->getLiveTrackerDatabyCoord($coord,$filter);
113
+			$spotter_array = $TrackerLive->getLiveTrackerDatabyCoord($coord, $filter);
114 114
 		} elseif ($marine) {
115
-			$spotter_array = $MarineLive->getLiveMarineDatabyCoord($coord,$filter);
115
+			$spotter_array = $MarineLive->getLiveMarineDatabyCoord($coord, $filter);
116 116
 		} else {
117
-			$spotter_array = $SpotterLive->getLiveSpotterDatabyCoord($coord,$filter);
117
+			$spotter_array = $SpotterLive->getLiveSpotterDatabyCoord($coord, $filter);
118 118
 		}
119 119
 	}
120 120
 } elseif (isset($globalMapUseBbox) && $globalMapUseBbox && isset($_GET['coord']) && $min) {
121 121
 	$usecoord = true;
122
-	$coord = explode(',',$_GET['coord']);
123
-	if (filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) 
122
+	$coord = explode(',', $_GET['coord']);
123
+	if (filter_var($coord[0], FILTER_VALIDATE_FLOAT) && filter_var($coord[1], FILTER_VALIDATE_FLOAT) && filter_var($coord[2], FILTER_VALIDATE_FLOAT) && filter_var($coord[3], FILTER_VALIDATE_FLOAT) 
124 124
 	    && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0) {
125 125
 		if ($tracker) {
126
-			$spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord,$filter);
126
+			$spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord, $filter);
127 127
 		} elseif ($marine) {
128
-			$spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord,$filter);
128
+			$spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord, $filter);
129 129
 		} else {
130
-			$spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord,$filter);
130
+			$spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord, $filter);
131 131
 		}
132 132
 	} else {
133 133
 		if ($tracker) {
@@ -142,12 +142,12 @@  discard block
 block discarded – undo
142 142
 	$from_archive = true;
143 143
 //	$begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
144 144
 //	$enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
145
-	$begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT);
146
-	$enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT);
147
-	$archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT);
148
-	$begindate = date('Y-m-d H:i:s',$begindate);
149
-	$enddate = date('Y-m-d H:i:s',$enddate);
150
-	$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter);
145
+	$begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT);
146
+	$enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT);
147
+	$archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT);
148
+	$begindate = date('Y-m-d H:i:s', $begindate);
149
+	$enddate = date('Y-m-d H:i:s', $enddate);
150
+	$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter);
151 151
 } elseif ($min) {
152 152
 	if ($tracker) {
153 153
 		$spotter_array = $TrackerLive->getMinLiveTrackerData($filter);
@@ -159,17 +159,17 @@  discard block
 block discarded – undo
159 159
 #	$min = true;
160 160
 } else {
161 161
 	if ($tracker) {
162
-		$spotter_array = $TrackerLive->getLiveTrackerData('','',$filter);
162
+		$spotter_array = $TrackerLive->getLiveTrackerData('', '', $filter);
163 163
 	} elseif ($marine) {
164
-		$spotter_array = $marineLive->getLiveMarineData('','',$filter);
164
+		$spotter_array = $marineLive->getLiveMarineData('', '', $filter);
165 165
 	} else {
166
-		$spotter_array = $SpotterLive->getLiveSpotterData('','',$filter);
166
+		$spotter_array = $SpotterLive->getLiveSpotterData('', '', $filter);
167 167
 	}
168 168
 }
169 169
 
170 170
 if ($usecoord) {
171 171
 	if (isset($_GET['archive'])) {
172
-		$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter);
172
+		$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter);
173 173
 	} else {
174 174
 		if ($tracker) {
175 175
 			$flightcnt = $TrackerLive->getLiveTrackerCount($filter);
@@ -182,9 +182,9 @@  discard block
 block discarded – undo
182 182
 	if ($flightcnt == '') $flightcnt = 0;
183 183
 } else $flightcnt = 0;
184 184
 
185
-$sqltime = round(microtime(true)-$begintime,2);
185
+$sqltime = round(microtime(true) - $begintime, 2);
186 186
 
187
-$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
187
+$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT);
188 188
 if ($currenttime != '') $currenttime = round($currenttime/1000);
189 189
 
190 190
 if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false;
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 		if (!empty($spotter_array) && is_array($spotter_array))
204 204
 		{
205 205
 			$output .= '"features": [';
206
-			foreach($spotter_array as $spotter_item)
206
+			foreach ($spotter_array as $spotter_item)
207 207
 			{
208 208
 				$j++;
209 209
 				date_default_timezone_set('UTC');
@@ -259,8 +259,8 @@  discard block
 block discarded – undo
259 259
 */
260 260
 							//$output .= '"fc": "'.$spotter_item['nb'].'",';
261 261
 						if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') {
262
-							if ($compress) $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",';
263
-							else $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",';
262
+							if ($compress) $output .= '"c": "'.str_replace('\\', '', $spotter_item['ident']).'",';
263
+							else $output .= '"callsign": "'.str_replace('\\', '', $spotter_item['ident']).'",';
264 264
 							//"
265 265
 						} else {
266 266
 							if ($compress) $output .= '"c": "NA",';
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 						if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",';
270 270
 						if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) {
271 271
 							$output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",';
272
-							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",';
272
+							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ', '_', $spotter_item['aircraft_name'])).'",';
273 273
 						} elseif (isset($spotter_item['aircraft_type'])) {
274 274
 							$output .= '"aircraft_name": "NA ('.$spotter_item['aircraft_type'].')",';
275 275
 						} elseif (!$min) {
@@ -412,34 +412,34 @@  discard block
 block discarded – undo
412 412
 						if ($currenttime != '') {
413 413
 							if (strtotime($spotter_item['date']) < $currenttime) {
414 414
 								if (isset($archivespeed)) {
415
-									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
415
+									$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading'], $archivespeed, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh));
416 416
 									$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
417 417
 								} elseif ($usenextlatlon) {
418
-									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
418
+									$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading'], 1, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh));
419 419
 									$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
420 420
 								}
421 421
 							} else {
422 422
 								if (isset($archivespeed)) {
423
-									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed);
423
+									$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading'], $archivespeed);
424 424
 									$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
425 425
 								} elseif ($usenextlatlon) {
426
-									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading']);
426
+									$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading']);
427 427
 									$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
428 428
 								}
429 429
 							}
430 430
 						} else {
431 431
 							if (isset($archivespeed)) {
432
-								$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed);
432
+								$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading'], $archivespeed);
433 433
 								$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
434 434
 							} elseif ($usenextlatlon) {
435
-								$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading']);
435
+								$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading']);
436 436
 								$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
437 437
 							}
438 438
 						}
439 439
 
440 440
 						if (!$min) $output .= '"image": "'.$image.'",';
441 441
 						if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') {
442
-							$output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",';
442
+							$output .= '"image_copyright": "'.str_replace('"', "'", trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $spotter_item['image_copyright']))).'",';
443 443
 						}
444 444
 						if (isset($spotter_item['image_source_website'])) {
445 445
 							$output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",';
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
 							$output .= '"waypoints": "'.$spotter_item['waypoints'].'",';
462 462
 						}
463 463
 						if (isset($spotter_item['acars'])) {
464
-							$output .= '"acars": "'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"), '<br />',$spotter_item['acars']['message'])).'",';
464
+							$output .= '"acars": "'.trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '<br />', $spotter_item['acars']['message'])).'",';
465 465
 						}
466 466
 						// type when not aircraft ?
467 467
 						if (isset($spotter_item['type'])) {
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
 								if ($currenttime != '') {
482 482
 									if (strtotime($spotter_item['date']) < $currenttime) {
483 483
 										if (!isset($archivespeed)) $archivespeed = 1;
484
-										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed,$currenttime-strtotime($spotter_item['date']));
484
+										$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading'], $archivespeed, $currenttime - strtotime($spotter_item['date']));
485 485
 										$output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
486 486
 									} else {
487 487
 										$output .= $spotter_item['longitude'].', ';
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
                 
551 551
 			}
552 552
 */
553
-				$history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING);
553
+				$history = filter_input(INPUT_GET, 'history', FILTER_SANITIZE_STRING);
554 554
 				if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history'];
555 555
 				
556 556
 				if (
@@ -558,11 +558,11 @@  discard block
 block discarded – undo
558 558
 				    || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory)
559 559
 				//    || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id']))
560 560
 				//    || (isset($history) && $history != '' && $history != 'NA' && $history == $spotter_item['ident'])
561
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
561
+				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id']))
562 562
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])
563
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id']))
563
+				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['fammarine_id']))
564 564
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id'])
565
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid']))
565
+				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['famtrackid']))
566 566
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid'])
567 567
 				    ) {
568 568
 					if ($tracker) {
@@ -599,9 +599,9 @@  discard block
 block discarded – undo
599 599
 								else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
600 600
 							}
601 601
 							$output_history .= '[';
602
-							$output_history .=  $spotter_history['longitude'].', ';
603
-							$output_history .=  $spotter_history['latitude'].', ';
604
-							$output_history .=  $spotter_history['altitude']*30.48;
602
+							$output_history .= $spotter_history['longitude'].', ';
603
+							$output_history .= $spotter_history['latitude'].', ';
604
+							$output_history .= $spotter_history['altitude']*30.48;
605 605
 							$output_history .= '],';
606 606
 							/*
607 607
 							if ($from_archive === false) {
@@ -619,8 +619,8 @@  discard block
 block discarded – undo
619 619
 								else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": [';
620 620
 							} else $d = true;
621 621
 							$output_history .= '[';
622
-							$output_history .=  $spotter_history['longitude'].', ';
623
-							$output_history .=  $spotter_history['latitude'];
622
+							$output_history .= $spotter_history['longitude'].', ';
623
+							$output_history .= $spotter_history['latitude'];
624 624
 							$output_history .= '],';
625 625
 							/*
626 626
 							if ($from_archive === false) {
@@ -636,9 +636,9 @@  discard block
 block discarded – undo
636 636
 					
637 637
 						if ($from_archive === false) {
638 638
 							$output_historyd = '[';
639
-							$output_historyd .=  $spotter_item['longitude'].', ';
640
-							$output_historyd .=  $spotter_item['latitude'];
641
-							if (isset($spotter_history['altitude'])) $output_historyd .=  ','.$spotter_item['altitude']*30.48;
639
+							$output_historyd .= $spotter_item['longitude'].', ';
640
+							$output_historyd .= $spotter_item['latitude'];
641
+							if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48;
642 642
 							$output_historyd .= '],';
643 643
 							//$output_history = $output_historyd.$output_history;
644 644
 							$output_history = $output_history.$output_historyd;
@@ -652,7 +652,7 @@  discard block
 block discarded – undo
652 652
 					}
653 653
 				}
654 654
 				
655
-				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
655
+				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id']))
656 656
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
657 657
 				     && (isset($spotter_item['departure_airport']) 
658 658
 				        && $spotter_item['departure_airport'] != 'NA' 
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
 
687 687
 				//if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA' && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) {
688 688
 				//if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) {
689
-				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
689
+				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id']))
690 690
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
691 691
 				     && (isset($spotter_item['arrival_airport']) 
692 692
 				        && $spotter_item['arrival_airport'] != 'NA' 
@@ -717,7 +717,7 @@  discard block
 block discarded – undo
717 717
 			$output  = substr($output, 0, -1);
718 718
 			$output .= ']';
719 719
 			$output .= ',"initial_sqltime": "'.$sqltime.'",';
720
-			$output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",';
720
+			$output .= '"totaltime": "'.round(microtime(true) - $begintime, 2).'",';
721 721
 			if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
722 722
 			$output .= '"fc": "'.$j.'"';
723 723
 		} else {
Please login to merge, or discard this patch.