Completed
Push — master ( cb13e2...855cef )
by Yannick
34:31
created
require/class.SpotterLive.php 3 patches
Indentation   +210 added lines, -210 removed lines patch added patch discarded remove patch
@@ -13,10 +13,10 @@  discard block
 block discarded – undo
13 13
 
14 14
 
15 15
 	/**
16
-	* Get SQL query part for filter used
17
-	* @param Array $filter the filter
18
-	* @return Array the SQL part
19
-	*/
16
+	 * Get SQL query part for filter used
17
+	 * @param Array $filter the filter
18
+	 * @return Array the SQL part
19
+	 */
20 20
 	public function getFilter($filter = array(),$where = false,$and = false) {
21 21
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
22 22
 		$filters = array();
@@ -139,11 +139,11 @@  discard block
 block discarded – undo
139 139
 	}
140 140
 
141 141
 	/**
142
-	* Gets all the spotter information based on the latest data entry
143
-	*
144
-	* @return Array the spotter information
145
-	*
146
-	*/
142
+	 * Gets all the spotter information based on the latest data entry
143
+	 *
144
+	 * @return Array the spotter information
145
+	 *
146
+	 */
147 147
 	public function getLiveSpotterData($limit = '', $sort = '', $filter = array())
148 148
 	{
149 149
 		global $globalDBdriver, $globalLiveInterval;
@@ -186,11 +186,11 @@  discard block
 block discarded – undo
186 186
 	}
187 187
 
188 188
 	/**
189
-	* Gets Minimal Live Spotter data
190
-	*
191
-	* @return Array the spotter information
192
-	*
193
-	*/
189
+	 * Gets Minimal Live Spotter data
190
+	 *
191
+	 * @return Array the spotter information
192
+	 *
193
+	 */
194 194
 	public function getMinLiveSpotterData($limit = 0,$filter = array())
195 195
 	{
196 196
 		global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap2DAircraftsLimit;
@@ -242,11 +242,11 @@  discard block
 block discarded – undo
242 242
 	}
243 243
 
244 244
 	/**
245
-	* Gets Minimal Live Spotter data since xx seconds
246
-	*
247
-	* @return Array the spotter information
248
-	*
249
-	*/
245
+	 * Gets Minimal Live Spotter data since xx seconds
246
+	 *
247
+	 * @return Array the spotter information
248
+	 *
249
+	 */
250 250
 	public function getMinLastLiveSpotterData($coord = array(),$filter = array(), $limit = false, $id = '')
251 251
 	{
252 252
 		global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap3DAircraftsLimit;
@@ -343,11 +343,11 @@  discard block
 block discarded – undo
343 343
 	}
344 344
 
345 345
 	/**
346
-	* Gets Minimal Live Spotter data since xx seconds
347
-	*
348
-	* @return Array the spotter information
349
-	*
350
-	*/
346
+	 * Gets Minimal Live Spotter data since xx seconds
347
+	 *
348
+	 * @return Array the spotter information
349
+	 *
350
+	 */
351 351
 	public function getMinLastLiveSpotterDataByID($id = '',$filter = array(), $limit = false)
352 352
 	{
353 353
 		global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap3DAircraftsLimit;
@@ -412,11 +412,11 @@  discard block
 block discarded – undo
412 412
 	}
413 413
 
414 414
 	/**
415
-	* Gets number of latest data entry
416
-	*
417
-	* @return String number of entry
418
-	*
419
-	*/
415
+	 * Gets number of latest data entry
416
+	 *
417
+	 * @return String number of entry
418
+	 *
419
+	 */
420 420
 	public function getLiveSpotterCount($filter = array())
421 421
 	{
422 422
 		global $globalDBdriver, $globalLiveInterval;
@@ -443,11 +443,11 @@  discard block
 block discarded – undo
443 443
 	}
444 444
 
445 445
 	/**
446
-	* Gets all the spotter information based on the latest data entry and coord
447
-	*
448
-	* @return Array the spotter information
449
-	*
450
-	*/
446
+	 * Gets all the spotter information based on the latest data entry and coord
447
+	 *
448
+	 * @return Array the spotter information
449
+	 *
450
+	 */
451 451
 	public function getLiveSpotterDatabyCoord($coord, $filter = array())
452 452
 	{
453 453
 		global $globalDBdriver, $globalLiveInterval,$globalMap2DAircraftsLimit;
@@ -475,11 +475,11 @@  discard block
 block discarded – undo
475 475
 	}
476 476
 
477 477
 	/**
478
-	* Gets all the spotter information based on the latest data entry and coord
479
-	*
480
-	* @return Array the spotter information
481
-	*
482
-	*/
478
+	 * Gets all the spotter information based on the latest data entry and coord
479
+	 *
480
+	 * @return Array the spotter information
481
+	 *
482
+	 */
483 483
 	public function getMinLiveSpotterDatabyCoord($coord,$limit = 0, $filter = array())
484 484
 	{
485 485
 		global $globalDBdriver, $globalLiveInterval, $globalArchive,$globalMap2DAircraftsLimit;
@@ -570,11 +570,11 @@  discard block
 block discarded – undo
570 570
 	}
571 571
 
572 572
 	/**
573
-	* Gets all the spotter information based on a user's latitude and longitude
574
-	*
575
-	* @return Array the spotter information
576
-	*
577
-	*/
573
+	 * Gets all the spotter information based on a user's latitude and longitude
574
+	 *
575
+	 * @return Array the spotter information
576
+	 *
577
+	 */
578 578
 	public function getLatestSpotterForLayar($lat, $lng, $radius, $interval)
579 579
 	{
580 580
 		$Spotter = new Spotter($this->db);
@@ -584,98 +584,98 @@  discard block
 block discarded – undo
584 584
 				return false;
585 585
 			}
586 586
 		}
587
-        if ($lng != '')
588
-                {
589
-                        if (!is_numeric($lng))
590
-                        {
591
-                                return false;
592
-                        }
593
-                }
594
-
595
-                if ($radius != '')
596
-                {
597
-                        if (!is_numeric($radius))
598
-                        {
599
-                                return false;
600
-                        }
601
-                }
587
+		if ($lng != '')
588
+				{
589
+						if (!is_numeric($lng))
590
+						{
591
+								return false;
592
+						}
593
+				}
594
+
595
+				if ($radius != '')
596
+				{
597
+						if (!is_numeric($radius))
598
+						{
599
+								return false;
600
+						}
601
+				}
602 602
 		$additional_query = '';
603
-        if ($interval != '')
604
-                {
605
-                        if (!is_string($interval))
606
-                        {
607
-                                //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
608
-			        return false;
609
-                        } else {
610
-                if ($interval == '1m')
611
-                {
612
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
613
-                } else if ($interval == '15m'){
614
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date ';
615
-                } 
616
-            }
617
-                } else {
618
-         $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';   
619
-        }
620
-
621
-                $query  = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live 
603
+		if ($interval != '')
604
+				{
605
+						if (!is_string($interval))
606
+						{
607
+								//$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
608
+					return false;
609
+						} else {
610
+				if ($interval == '1m')
611
+				{
612
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
613
+				} else if ($interval == '15m'){
614
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date ';
615
+				} 
616
+			}
617
+				} else {
618
+		 $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';   
619
+		}
620
+
621
+				$query  = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live 
622 622
                    WHERE spotter_live.latitude <> '' 
623 623
                                    AND spotter_live.longitude <> '' 
624 624
                    ".$additional_query."
625 625
                    HAVING distance < :radius  
626 626
                                    ORDER BY distance";
627 627
 
628
-                $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
628
+				$spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
629 629
 
630
-                return $spotter_array;
631
-        }
630
+				return $spotter_array;
631
+		}
632 632
 
633 633
     
634
-        /**
635
-	* Gets all the spotter information based on a particular callsign
636
-	*
637
-	* @return Array the spotter information
638
-	*
639
-	*/
634
+		/**
635
+		 * Gets all the spotter information based on a particular callsign
636
+		 *
637
+		 * @return Array the spotter information
638
+		 *
639
+		 */
640 640
 	public function getLastLiveSpotterDataByIdent($ident)
641 641
 	{
642 642
 		$Spotter = new Spotter($this->db);
643 643
 		date_default_timezone_set('UTC');
644 644
 
645 645
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
646
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
646
+				$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
647 647
 
648 648
 		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true);
649 649
 
650 650
 		return $spotter_array;
651 651
 	}
652 652
 
653
-        /**
654
-	* Gets all the spotter information based on a particular callsign
655
-	*
656
-	* @return Array the spotter information
657
-	*
658
-	*/
653
+		/**
654
+		 * Gets all the spotter information based on a particular callsign
655
+		 *
656
+		 * @return Array the spotter information
657
+		 *
658
+		 */
659 659
 	public function getDateLiveSpotterDataByIdent($ident,$date)
660 660
 	{
661 661
 		$Spotter = new Spotter($this->db);
662 662
 		date_default_timezone_set('UTC');
663 663
 
664 664
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
665
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
665
+				$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
666 666
 
667
-                $date = date('c',$date);
667
+				$date = date('c',$date);
668 668
 		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
669 669
 
670 670
 		return $spotter_array;
671 671
 	}
672 672
 
673
-        /**
674
-	* Gets last spotter information based on a particular callsign
675
-	*
676
-	* @return Array the spotter information
677
-	*
678
-	*/
673
+		/**
674
+		 * Gets last spotter information based on a particular callsign
675
+		 *
676
+		 * @return Array the spotter information
677
+		 *
678
+		 */
679 679
 	public function getLastLiveSpotterDataById($id)
680 680
 	{
681 681
 		$Spotter = new Spotter($this->db);
@@ -686,12 +686,12 @@  discard block
 block discarded – undo
686 686
 		return $spotter_array;
687 687
 	}
688 688
 
689
-        /**
690
-	* Gets last spotter information based on a particular callsign
691
-	*
692
-	* @return Array the spotter information
693
-	*
694
-	*/
689
+		/**
690
+		 * Gets last spotter information based on a particular callsign
691
+		 *
692
+		 * @return Array the spotter information
693
+		 *
694
+		 */
695 695
 	public function getDateLiveSpotterDataById($id,$date)
696 696
 	{
697 697
 		$Spotter = new Spotter($this->db);
@@ -704,21 +704,21 @@  discard block
 block discarded – undo
704 704
 		return $spotter_array;
705 705
 	}
706 706
 
707
-        /**
708
-	* Gets altitude information based on a particular callsign
709
-	*
710
-	* @return Array the spotter information
711
-	*
712
-	*/
707
+		/**
708
+		 * Gets altitude information based on a particular callsign
709
+		 *
710
+		 * @return Array the spotter information
711
+		 *
712
+		 */
713 713
 	public function getAltitudeLiveSpotterDataByIdent($ident)
714 714
 	{
715 715
 
716 716
 		date_default_timezone_set('UTC');
717 717
 
718 718
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
719
-                $query  = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
719
+				$query  = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
720 720
 
721
-    		try {
721
+			try {
722 722
 			
723 723
 			$sth = $this->db->prepare($query);
724 724
 			$sth->execute(array(':ident' => $ident));
@@ -731,12 +731,12 @@  discard block
 block discarded – undo
731 731
 		return $spotter_array;
732 732
 	}
733 733
 
734
-        /**
735
-	* Gets all the spotter information based on a particular id
736
-	*
737
-	* @return Array the spotter information
738
-	*
739
-	*/
734
+		/**
735
+		 * Gets all the spotter information based on a particular id
736
+		 *
737
+		 * @return Array the spotter information
738
+		 *
739
+		 */
740 740
 	public function getAllLiveSpotterDataById($id,$liveinterval = false)
741 741
 	{
742 742
 		global $globalDBdriver, $globalLiveInterval;
@@ -764,18 +764,18 @@  discard block
 block discarded – undo
764 764
 		return $spotter_array;
765 765
 	}
766 766
 
767
-        /**
768
-	* Gets all the spotter information based on a particular ident
769
-	*
770
-	* @return Array the spotter information
771
-	*
772
-	*/
767
+		/**
768
+		 * Gets all the spotter information based on a particular ident
769
+		 *
770
+		 * @return Array the spotter information
771
+		 *
772
+		 */
773 773
 	public function getAllLiveSpotterDataByIdent($ident)
774 774
 	{
775 775
 		date_default_timezone_set('UTC');
776 776
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
777 777
 		$query  = self::$global_query.' WHERE spotter_live.ident = :ident';
778
-    		try {
778
+			try {
779 779
 			
780 780
 			$sth = $this->db->prepare($query);
781 781
 			$sth->execute(array(':ident' => $ident));
@@ -789,23 +789,23 @@  discard block
 block discarded – undo
789 789
 
790 790
 
791 791
 	/**
792
-	* Deletes all info in the table
793
-	*
794
-	* @return String success or false
795
-	*
796
-	*/
792
+	 * Deletes all info in the table
793
+	 *
794
+	 * @return String success or false
795
+	 *
796
+	 */
797 797
 	public function deleteLiveSpotterData()
798 798
 	{
799 799
 		global $globalDBdriver;
800 800
 		if ($globalDBdriver == 'mysql') {
801 801
 			//$query  = "DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= spotter_live.date";
802 802
 			$query  = 'DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= spotter_live.date';
803
-            		//$query  = "DELETE FROM spotter_live WHERE spotter_live.id IN (SELECT spotter_live.id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= spotter_live.date)";
803
+					//$query  = "DELETE FROM spotter_live WHERE spotter_live.id IN (SELECT spotter_live.id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= spotter_live.date)";
804 804
 		} else {
805 805
 			$query  = "DELETE FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= spotter_live.date";
806 806
 		}
807 807
         
808
-    		try {
808
+			try {
809 809
 			
810 810
 			$sth = $this->db->prepare($query);
811 811
 			$sth->execute();
@@ -817,18 +817,18 @@  discard block
 block discarded – undo
817 817
 	}
818 818
 
819 819
 	/**
820
-	* Deletes all info in the table for aircraft not seen since 2 HOUR
821
-	*
822
-	* @return String success or false
823
-	*
824
-	*/
820
+	 * Deletes all info in the table for aircraft not seen since 2 HOUR
821
+	 *
822
+	 * @return String success or false
823
+	 *
824
+	 */
825 825
 	public function deleteLiveSpotterDataNotUpdated()
826 826
 	{
827 827
 		global $globalDBdriver, $globalDebug;
828 828
 		if ($globalDBdriver == 'mysql') {
829 829
 			//$query = 'SELECT flightaware_id FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) >= spotter_live.date AND spotter_live.flightaware_id NOT IN (SELECT flightaware_id FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) < spotter_live.date) LIMIT 800 OFFSET 0';
830
-    			$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 2000 OFFSET 0";
831
-    			try {
830
+				$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 2000 OFFSET 0";
831
+				try {
832 832
 				
833 833
 				$sth = $this->db->prepare($query);
834 834
 				$sth->execute();
@@ -836,8 +836,8 @@  discard block
 block discarded – undo
836 836
 				return "error";
837 837
 			}
838 838
 			$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
839
-                        $i = 0;
840
-                        $j =0;
839
+						$i = 0;
840
+						$j =0;
841 841
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
842 842
 			foreach($all as $row)
843 843
 			{
@@ -845,20 +845,20 @@  discard block
 block discarded – undo
845 845
 				$j++;
846 846
 				if ($j == 30) {
847 847
 					if ($globalDebug) echo ".";
848
-				    	try {
848
+						try {
849 849
 						
850 850
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
851 851
 						$sth->execute();
852 852
 					} catch(PDOException $e) {
853 853
 						return "error";
854 854
 					}
855
-                                	$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
856
-                                	$j = 0;
855
+									$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
856
+									$j = 0;
857 857
 				}
858 858
 				$query_delete .= "'".$row['flightaware_id']."',";
859 859
 			}
860 860
 			if ($i > 0) {
861
-    				try {
861
+					try {
862 862
 					
863 863
 					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
864 864
 					$sth->execute();
@@ -869,9 +869,9 @@  discard block
 block discarded – undo
869 869
 			return "success";
870 870
 		} elseif ($globalDBdriver == 'pgsql') {
871 871
 			//$query = "SELECT flightaware_id FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= spotter_live.date AND spotter_live.flightaware_id NOT IN (SELECT flightaware_id FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' < spotter_live.date) LIMIT 800 OFFSET 0";
872
-    			//$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0";
873
-    			$query = "DELETE FROM spotter_live WHERE flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 2000 OFFSET 0)";
874
-    			try {
872
+				//$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0";
873
+				$query = "DELETE FROM spotter_live WHERE flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 2000 OFFSET 0)";
874
+				try {
875 875
 				
876 876
 				$sth = $this->db->prepare($query);
877 877
 				$sth->execute();
@@ -915,17 +915,17 @@  discard block
 block discarded – undo
915 915
 	}
916 916
 
917 917
 	/**
918
-	* Deletes all info in the table for an ident
919
-	*
920
-	* @return String success or false
921
-	*
922
-	*/
918
+	 * Deletes all info in the table for an ident
919
+	 *
920
+	 * @return String success or false
921
+	 *
922
+	 */
923 923
 	public function deleteLiveSpotterDataByIdent($ident)
924 924
 	{
925 925
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
926 926
 		$query  = 'DELETE FROM spotter_live WHERE ident = :ident';
927 927
         
928
-    		try {
928
+			try {
929 929
 			
930 930
 			$sth = $this->db->prepare($query);
931 931
 			$sth->execute(array(':ident' => $ident));
@@ -937,17 +937,17 @@  discard block
 block discarded – undo
937 937
 	}
938 938
 
939 939
 	/**
940
-	* Deletes all info in the table for an id
941
-	*
942
-	* @return String success or false
943
-	*
944
-	*/
940
+	 * Deletes all info in the table for an id
941
+	 *
942
+	 * @return String success or false
943
+	 *
944
+	 */
945 945
 	public function deleteLiveSpotterDataById($id)
946 946
 	{
947 947
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
948 948
 		$query  = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
949 949
         
950
-    		try {
950
+			try {
951 951
 			
952 952
 			$sth = $this->db->prepare($query);
953 953
 			$sth->execute(array(':id' => $id));
@@ -960,11 +960,11 @@  discard block
 block discarded – undo
960 960
 
961 961
 
962 962
 	/**
963
-	* Gets the aircraft ident within the last hour
964
-	*
965
-	* @return String the ident
966
-	*
967
-	*/
963
+	 * Gets the aircraft ident within the last hour
964
+	 *
965
+	 * @return String the ident
966
+	 *
967
+	 */
968 968
 	public function getIdentFromLastHour($ident)
969 969
 	{
970 970
 		global $globalDBdriver, $globalTimezone;
@@ -990,14 +990,14 @@  discard block
 block discarded – undo
990 990
 			$ident_result = $row['ident'];
991 991
 		}
992 992
 		return $ident_result;
993
-        }
993
+		}
994 994
 
995 995
 	/**
996
-	* Check recent aircraft
997
-	*
998
-	* @return String the ident
999
-	*
1000
-	*/
996
+	 * Check recent aircraft
997
+	 *
998
+	 * @return String the ident
999
+	 *
1000
+	 */
1001 1001
 	public function checkIdentRecent($ident)
1002 1002
 	{
1003 1003
 		global $globalDBdriver, $globalTimezone;
@@ -1023,14 +1023,14 @@  discard block
 block discarded – undo
1023 1023
 			$ident_result = $row['flightaware_id'];
1024 1024
 		}
1025 1025
 		return $ident_result;
1026
-        }
1026
+		}
1027 1027
 
1028 1028
 	/**
1029
-	* Check recent aircraft by id
1030
-	*
1031
-	* @return String the ident
1032
-	*
1033
-	*/
1029
+	 * Check recent aircraft by id
1030
+	 *
1031
+	 * @return String the ident
1032
+	 *
1033
+	 */
1034 1034
 	public function checkIdRecent($id)
1035 1035
 	{
1036 1036
 		global $globalDBdriver, $globalTimezone;
@@ -1056,14 +1056,14 @@  discard block
 block discarded – undo
1056 1056
 			$ident_result = $row['flightaware_id'];
1057 1057
 		}
1058 1058
 		return $ident_result;
1059
-        }
1059
+		}
1060 1060
 
1061 1061
 	/**
1062
-	* Check recent aircraft by ModeS
1063
-	*
1064
-	* @return String the ModeS
1065
-	*
1066
-	*/
1062
+	 * Check recent aircraft by ModeS
1063
+	 *
1064
+	 * @return String the ModeS
1065
+	 *
1066
+	 */
1067 1067
 	public function checkModeSRecent($modes)
1068 1068
 	{
1069 1069
 		global $globalDBdriver, $globalTimezone;
@@ -1093,11 +1093,11 @@  discard block
 block discarded – undo
1093 1093
 	}
1094 1094
 
1095 1095
 	/**
1096
-	* Gets the aircraft data from the last 20 seconds
1097
-	*
1098
-	* @return Array the spotter data
1099
-	*
1100
-	*/
1096
+	 * Gets the aircraft data from the last 20 seconds
1097
+	 *
1098
+	 * @return Array the spotter data
1099
+	 *
1100
+	 */
1101 1101
 	public function getRealTimeData($q = '')
1102 1102
 	{
1103 1103
 		global $globalDBdriver;
@@ -1139,16 +1139,16 @@  discard block
 block discarded – undo
1139 1139
 	}
1140 1140
 
1141 1141
 	/**
1142
-	* Adds a new spotter data
1143
-	*
1144
-	* @param String $flightaware_id the ID from flightaware
1145
-	* @param String $ident the flight ident
1146
-	* @param String $aircraft_icao the aircraft type
1147
-	* @param String $departure_airport_icao the departure airport
1148
-	* @param String $arrival_airport_icao the arrival airport
1149
-	* @return String success or false
1150
-	*
1151
-	*/
1142
+	 * Adds a new spotter data
1143
+	 *
1144
+	 * @param String $flightaware_id the ID from flightaware
1145
+	 * @param String $ident the flight ident
1146
+	 * @param String $aircraft_icao the aircraft type
1147
+	 * @param String $departure_airport_icao the departure airport
1148
+	 * @param String $arrival_airport_icao the arrival airport
1149
+	 * @return String success or false
1150
+	 *
1151
+	 */
1152 1152
 	public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '',$heading = '', $groundspeed = '', $date = '',$departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false,$registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false,$format_source = '', $source_name = '', $over_country = '')
1153 1153
 	{
1154 1154
 		global $globalURL, $globalArchive, $globalDebug;
@@ -1291,10 +1291,10 @@  discard block
 block discarded – undo
1291 1291
 		$arrival_airport_country = '';
1292 1292
 		
1293 1293
             	
1294
-            	if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
1295
-            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
1296
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
1297
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
1294
+				if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
1295
+				if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
1296
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
1297
+				if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
1298 1298
 		
1299 1299
 		$query = '';
1300 1300
 		if ($globalArchive) {
@@ -1315,10 +1315,10 @@  discard block
 block discarded – undo
1315 1315
 			return "error : ".$e->getMessage();
1316 1316
 		}
1317 1317
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
1318
-		    if ($globalDebug) echo '(Add to SBS archive : ';
1319
-		    $SpotterArchive = new SpotterArchive($this->db);
1320
-		    $result =  $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $altitude_real,$heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country);
1321
-		    if ($globalDebug) echo $result.')';
1318
+			if ($globalDebug) echo '(Add to SBS archive : ';
1319
+			$SpotterArchive = new SpotterArchive($this->db);
1320
+			$result =  $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $altitude_real,$heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country);
1321
+			if ($globalDebug) echo $result.')';
1322 1322
 		} elseif ($globalDebug && $putinarchive !== true) {
1323 1323
 			echo '(Not adding to archive)';
1324 1324
 		} elseif ($globalDebug && $noarchive === true) {
Please login to merge, or discard this patch.
Spacing   +153 added lines, -153 removed lines patch added patch discarded remove patch
@@ -17,62 +17,62 @@  discard block
 block discarded – undo
17 17
 	* @param Array $filter the filter
18 18
 	* @return Array the SQL part
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['airlines']) && !empty($flt['airlines'])) {
38 38
 				if ($flt['airlines'][0] != '' && $flt['airlines'][0] != 'all') {
39 39
 					if (isset($flt['source'])) {
40
-						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id";
40
+						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id";
41 41
 					} else {
42
-						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id";
42
+						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id";
43 43
 					}
44 44
 				}
45 45
 			}
46 46
 			if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) {
47 47
 				if (isset($flt['source'])) {
48
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id";
48
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id";
49 49
 				} else {
50
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id";
50
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id";
51 51
 				}
52 52
 			}
53 53
 			if (isset($flt['idents']) && !empty($flt['idents'])) {
54 54
 				if (isset($flt['source'])) {
55
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id";
55
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id";
56 56
 				} else {
57
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id";
57
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id";
58 58
 				}
59 59
 			}
60 60
 			if (isset($flt['registrations']) && !empty($flt['registrations'])) {
61 61
 				if (isset($flt['source'])) {
62
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','",$flt['registrations'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id";
62
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','", $flt['registrations'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id";
63 63
 				} else {
64
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','",$flt['registrations'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id";
64
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','", $flt['registrations'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id";
65 65
 				}
66 66
 			}
67 67
 			if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id']) && isset($flt['idents']) && empty($flt['idents'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']) && !isset($flt['idents']) && !isset($flt['registrations']))) {
68 68
 				if (isset($flt['source'])) {
69
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) ssf ON ssf.flightaware_id = spotter_live.flightaware_id";
69
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) ssf ON ssf.flightaware_id = spotter_live.flightaware_id";
70 70
 				}
71 71
 			}
72 72
 		}
73 73
 		if (isset($filter['airlines']) && !empty($filter['airlines'])) {
74 74
 			if ($filter['airlines'][0] != '' && $filter['airlines'][0] != 'all') {
75
-				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) sai ON sai.flightaware_id = spotter_live.flightaware_id";
75
+				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) sai ON sai.flightaware_id = spotter_live.flightaware_id";
76 76
 			}
77 77
 		}
78 78
 		if (isset($filter['alliance']) && !empty($filter['alliance'])) {
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_live.flightaware_id ";
83 83
 		}
84 84
 		if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) {
85
-			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) sp ON sp.flightaware_id = spotter_live.flightaware_id";
85
+			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) sp ON sp.flightaware_id = spotter_live.flightaware_id";
86 86
 		}
87 87
 		if (isset($filter['blocked']) && $filter['blocked'] == true) {
88 88
 			$filter_query_join .= " INNER JOIN (SELECT callsign FROM aircraft_block) cblk ON cblk.callsign = spotter_live.ident";
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 			if (count($filter['source']) == 1) {
92 92
 				$filter_query_where .= " AND format_source = '".$filter['source'][0]."'";
93 93
 			} else {
94
-				$filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')";
94
+				$filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')";
95 95
 			}
96 96
 		}
97 97
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
@@ -124,15 +124,15 @@  discard block
 block discarded – undo
124 124
 					$filter_query_date .= " AND EXTRACT(DAY FROM spotter_output.date) = '".$filter['day']."'";
125 125
 				}
126 126
 			}
127
-			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.flightaware_id = spotter_live.flightaware_id";
127
+			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.flightaware_id = spotter_live.flightaware_id";
128 128
 		}
129 129
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
130
-			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
130
+			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
131 131
 		}
132 132
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
133 133
 		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
134 134
 		if ($filter_query_where != '') {
135
-			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
135
+			$filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where);
136 136
 		}
137 137
 		$filter_query = $filter_query_join.$filter_query_where;
138 138
 		return $filter_query;
@@ -155,8 +155,8 @@  discard block
 block discarded – undo
155 155
 		if ($limit != '')
156 156
 		{
157 157
 			$limit_array = explode(',', $limit);
158
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
159
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
158
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
159
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
160 160
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
161 161
 			{
162 162
 				$limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0];
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 		} else {
181 181
 			$query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate".$filter_query.$orderby_query;
182 182
 		}
183
-		$spotter_array = $Spotter->getDataFromDB($query.$limit_query,array(),'',true);
183
+		$spotter_array = $Spotter->getDataFromDB($query.$limit_query, array(), '', true);
184 184
 
185 185
 		return $spotter_array;
186 186
 	}
@@ -191,34 +191,34 @@  discard block
 block discarded – undo
191 191
 	* @return Array the spotter information
192 192
 	*
193 193
 	*/
194
-	public function getMinLiveSpotterData($limit = 0,$filter = array())
194
+	public function getMinLiveSpotterData($limit = 0, $filter = array())
195 195
 	{
196 196
 		global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap2DAircraftsLimit;
197 197
 		date_default_timezone_set('UTC');
198
-		$filter_query = $this->getFilter($filter,true,true);
198
+		$filter_query = $this->getFilter($filter, true, true);
199 199
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
200 200
 		if ($globalDBdriver == 'mysql') {
201 201
 			if (isset($globalArchive) && $globalArchive === TRUE) {
202 202
 			//	$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
203 203
 			//	FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= spotter_live.date AND'." spotter_live.latitude <> 0 AND spotter_live.longitude <> 0 ORDER BY date DESC";
204
-				$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
204
+				$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
205 205
 				FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= spotter_live.date AND'." spotter_live.latitude <> 0 AND spotter_live.longitude <> 0";
206 206
 			} else {
207 207
 			//	$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
208 208
 			//	FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query." spotter_live.latitude <> 0 AND spotter_live.longitude <> 0 ORDER BY date DESC";
209
-				$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
209
+				$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
210 210
 				FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query." spotter_live.latitude <> 0 AND spotter_live.longitude <> 0";
211 211
 			}
212 212
 		} else {
213 213
 			if (isset($globalArchive) && $globalArchive === TRUE) {
214 214
 			//	$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
215 215
 			//	FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date AND  spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' ORDER BY date DESC";
216
-				$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
216
+				$query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
217 217
 				FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date AND  spotter_live.latitude <> '0' AND spotter_live.longitude <> '0'";
218 218
 			} else {
219 219
 			//	$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
220 220
 			//	FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate".$filter_query." spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' ORDER BY date DESC";
221
-				$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
221
+				$query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
222 222
 				FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate".$filter_query." spotter_live.latitude <> '0' AND spotter_live.longitude <> '0'";
223 223
 			}
224 224
 		}
@@ -226,14 +226,14 @@  discard block
 block discarded – undo
226 226
 		if ($limit == 0 && isset($globalMap2DAircraftsLimit) && $globalMap2DAircraftsLimit != '') {
227 227
 			$limit = $globalMap2DAircraftsLimit;
228 228
 		}
229
-		if ($limit != 0 && filter_var($limit,FILTER_VALIDATE_INT)) {
229
+		if ($limit != 0 && filter_var($limit, FILTER_VALIDATE_INT)) {
230 230
 			$query .= ' LIMIT '.$limit;
231 231
 		}
232 232
 
233 233
 		try {
234 234
 			$sth = $this->db->prepare($query);
235 235
 			$sth->execute();
236
-		} catch(PDOException $e) {
236
+		} catch (PDOException $e) {
237 237
 			echo $e->getMessage();
238 238
 			die;
239 239
 		}
@@ -247,20 +247,20 @@  discard block
 block discarded – undo
247 247
 	* @return Array the spotter information
248 248
 	*
249 249
 	*/
250
-	public function getMinLastLiveSpotterData($coord = array(),$filter = array(), $limit = false, $id = '')
250
+	public function getMinLastLiveSpotterData($coord = array(), $filter = array(), $limit = false, $id = '')
251 251
 	{
252 252
 		global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap3DAircraftsLimit;
253 253
 		date_default_timezone_set('UTC');
254 254
 		$usecoord = false;
255 255
 		if (is_array($coord) && !empty($coord)) {
256
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
257
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
258
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
259
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
256
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
257
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
258
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
259
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
260 260
 			$usecoord = true;
261 261
 		}
262
-		$id = filter_var($id,FILTER_SANITIZE_STRING);
263
-		$filter_query = $this->getFilter($filter,true,true);
262
+		$id = filter_var($id, FILTER_SANITIZE_STRING);
263
+		$filter_query = $this->getFilter($filter, true, true);
264 264
 
265 265
 		if (!isset($globalLiveInterval) || $globalLiveInterval == '') $globalLiveInterval = '200';
266 266
 		if (!isset($globalMap3DAircraftsLimit) || $globalMap3DAircraftsLimit == '') $globalMap3DAircraftsLimit = '300';
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 				WHERE spotter_archive.latitude <> '0' AND spotter_archive.longitude <> '0' 
273 273
 				ORDER BY spotter_archive.flightaware_id, spotter_archive.date";
274 274
 				*/
275
-				$query  = 'SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source, spotter_archive.registration 
275
+				$query = 'SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source, spotter_archive.registration 
276 276
 				FROM spotter_archive INNER JOIN (SELECT flightaware_id FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date) l ON l.flightaware_id = spotter_archive.flightaware_id ";
277 277
 				if ($usecoord) $query .= "AND (spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
278 278
 				if ($id != '') $query .= "OR spotter_archive.flightaware_id = :id ";
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 				ORDER BY flightaware_id, date";
287 287
 				if ($limit) $query .= " LIMIT ".$globalMap3DAircraftsLimit;
288 288
 			} else {
289
-				$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
289
+				$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
290 290
 				FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date ";
291 291
 				if ($usecoord) $query .= "AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
292 292
 				if ($id != '') $query .= "OR spotter_live.flightaware_id = :id ";
@@ -302,13 +302,13 @@  discard block
 block discarded – undo
302 302
 				WHERE spotter_archive.latitude <> '0' AND spotter_archive.longitude <> '0' 
303 303
 				ORDER BY spotter_archive.flightaware_id, spotter_archive.date";
304 304
                                */
305
-				$query  = "SELECT * FROM (
305
+				$query = "SELECT * FROM (
306 306
 				SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source, spotter_archive.registration 
307 307
 				FROM spotter_archive 
308 308
 				INNER JOIN (
309 309
 				    SELECT flightaware_id 
310 310
 				    FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date";
311
-				$query.= ") l ON l.flightaware_id = spotter_archive.flightaware_id ";
311
+				$query .= ") l ON l.flightaware_id = spotter_archive.flightaware_id ";
312 312
 				if ($usecoord) $query .= "AND (spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
313 313
 				if ($id != '') $query .= "OR spotter_archive.flightaware_id = :id ";
314 314
 				$query .= "UNION
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
 		try {
335 335
 			$sth = $this->db->prepare($query);
336 336
 			$sth->execute($query_values);
337
-		} catch(PDOException $e) {
337
+		} catch (PDOException $e) {
338 338
 			echo $e->getMessage();
339 339
 			die;
340 340
 		}
@@ -348,12 +348,12 @@  discard block
 block discarded – undo
348 348
 	* @return Array the spotter information
349 349
 	*
350 350
 	*/
351
-	public function getMinLastLiveSpotterDataByID($id = '',$filter = array(), $limit = false)
351
+	public function getMinLastLiveSpotterDataByID($id = '', $filter = array(), $limit = false)
352 352
 	{
353 353
 		global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap3DAircraftsLimit;
354 354
 		date_default_timezone_set('UTC');
355
-		$id = filter_var($id,FILTER_SANITIZE_STRING);
356
-		$filter_query = $this->getFilter($filter,true,true);
355
+		$id = filter_var($id, FILTER_SANITIZE_STRING);
356
+		$filter_query = $this->getFilter($filter, true, true);
357 357
 
358 358
 		if (!isset($globalLiveInterval) || $globalLiveInterval == '') $globalLiveInterval = '200';
359 359
 		if (!isset($globalMap3DAircraftsLimit) || $globalMap3DAircraftsLimit == '') $globalMap3DAircraftsLimit = '300';
@@ -377,13 +377,13 @@  discard block
 block discarded – undo
377 377
 			}
378 378
 		} else {
379 379
 			if (isset($globalArchive) && $globalArchive === TRUE) {
380
-				$query  = "SELECT * FROM (
380
+				$query = "SELECT * FROM (
381 381
 				SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source, spotter_archive.registration 
382 382
 				FROM spotter_archive 
383 383
 				INNER JOIN (
384 384
 				    SELECT flightaware_id 
385 385
 				    FROM spotter_live".$filter_query." spotter_live.flightaware_id = :id";
386
-				$query.= ") l ON l.flightaware_id = spotter_archive.flightaware_id ";
386
+				$query .= ") l ON l.flightaware_id = spotter_archive.flightaware_id ";
387 387
 				$query .= "UNION
388 388
 				    SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
389 389
 				    FROM spotter_live".$filter_query." spotter_live.flightaware_id = :id";
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 		try {
404 404
 			$sth = $this->db->prepare($query);
405 405
 			$sth->execute($query_values);
406
-		} catch(PDOException $e) {
406
+		} catch (PDOException $e) {
407 407
 			echo $e->getMessage();
408 408
 			die;
409 409
 		}
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
 	public function getLiveSpotterCount($filter = array())
421 421
 	{
422 422
 		global $globalDBdriver, $globalLiveInterval;
423
-		$filter_query = $this->getFilter($filter,true,true);
423
+		$filter_query = $this->getFilter($filter, true, true);
424 424
 
425 425
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
426 426
 		if ($globalDBdriver == 'mysql') {
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 		try {
434 434
 			$sth = $this->db->prepare($query);
435 435
 			$sth->execute();
436
-		} catch(PDOException $e) {
436
+		} catch (PDOException $e) {
437 437
 			echo $e->getMessage();
438 438
 			die;
439 439
 		}
@@ -450,16 +450,16 @@  discard block
 block discarded – undo
450 450
 	*/
451 451
 	public function getLiveSpotterDatabyCoord($coord, $filter = array())
452 452
 	{
453
-		global $globalDBdriver, $globalLiveInterval,$globalMap2DAircraftsLimit;
453
+		global $globalDBdriver, $globalLiveInterval, $globalMap2DAircraftsLimit;
454 454
 		$Spotter = new Spotter($this->db);
455 455
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
456 456
 		$filter_query = $this->getFilter($filter);
457 457
 
458 458
 		if (is_array($coord)) {
459
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
460
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
461
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
462
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
459
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
460
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
461
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
462
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
463 463
 		} else return array();
464 464
 		if ($globalDBdriver == 'mysql') {
465 465
 			$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY spotter_live.flightaware_id'.$filter_query;
@@ -480,28 +480,28 @@  discard block
 block discarded – undo
480 480
 	* @return Array the spotter information
481 481
 	*
482 482
 	*/
483
-	public function getMinLiveSpotterDatabyCoord($coord,$limit = 0, $filter = array())
483
+	public function getMinLiveSpotterDatabyCoord($coord, $limit = 0, $filter = array())
484 484
 	{
485
-		global $globalDBdriver, $globalLiveInterval, $globalArchive,$globalMap2DAircraftsLimit;
485
+		global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap2DAircraftsLimit;
486 486
 		$Spotter = new Spotter($this->db);
487 487
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
488
-		$filter_query = $this->getFilter($filter,true,true);
488
+		$filter_query = $this->getFilter($filter, true, true);
489 489
 
490 490
 		if (is_array($coord)) {
491
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
492
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
493
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
494
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
491
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
492
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
493
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
494
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
495 495
 		} else return array();
496 496
 		if ($globalDBdriver == 'mysql') {
497 497
 			if (isset($globalArchive) && $globalArchive === TRUE) {
498
-				$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
498
+				$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
499 499
 				FROM spotter_live 
500 500
 				'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= spotter_live.date 
501 501
 				AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.'
502 502
 				AND spotter_live.latitude <> 0 AND spotter_live.longitude <> 0 ORDER BY date DESC';
503 503
 			} else {
504
-				$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
504
+				$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
505 505
 				FROM spotter_live 
506 506
 				INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate 
507 507
 				    FROM spotter_live l 
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
 				AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong." 
522 522
 				AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' ORDER BY date DESC";
523 523
 				*/
524
-				$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
524
+				$query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
525 525
 				FROM spotter_live 
526 526
 				".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date 
527 527
 				AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." 
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
 				) s on spotter_live.flightaware_id = s.flightaware_id 
541 541
 				AND spotter_live.date = s.maxdate".$filter_query." spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' ORDER BY date DESC";
542 542
 				*/
543
-				$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
543
+				$query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
544 544
 				FROM spotter_live 
545 545
 				INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate 
546 546
 				    FROM spotter_live l 
@@ -555,13 +555,13 @@  discard block
 block discarded – undo
555 555
 		if ($limit == 0 && isset($globalMap2DAircraftsLimit) && $globalMap2DAircraftsLimit != '') {
556 556
 			$limit = $globalMap2DAircraftsLimit;
557 557
 		}
558
-		if ($limit != 0 && filter_var($limit,FILTER_VALIDATE_INT)) {
558
+		if ($limit != 0 && filter_var($limit, FILTER_VALIDATE_INT)) {
559 559
 			$query .= ' LIMIT '.$limit;
560 560
 		}
561 561
 		try {
562 562
 			$sth = $this->db->prepare($query);
563 563
 			$sth->execute();
564
-		} catch(PDOException $e) {
564
+		} catch (PDOException $e) {
565 565
 			echo $e->getMessage();
566 566
 			die;
567 567
 		}
@@ -610,7 +610,7 @@  discard block
 block discarded – undo
610 610
                 if ($interval == '1m')
611 611
                 {
612 612
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
613
-                } else if ($interval == '15m'){
613
+                } else if ($interval == '15m') {
614 614
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date ';
615 615
                 } 
616 616
             }
@@ -618,14 +618,14 @@  discard block
 block discarded – undo
618 618
          $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';   
619 619
         }
620 620
 
621
-                $query  = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live 
621
+                $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live 
622 622
                    WHERE spotter_live.latitude <> '' 
623 623
                                    AND spotter_live.longitude <> '' 
624 624
                    ".$additional_query."
625 625
                    HAVING distance < :radius  
626 626
                                    ORDER BY distance";
627 627
 
628
-                $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
628
+                $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius));
629 629
 
630 630
                 return $spotter_array;
631 631
         }
@@ -643,9 +643,9 @@  discard block
 block discarded – undo
643 643
 		date_default_timezone_set('UTC');
644 644
 
645 645
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
646
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
646
+                $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
647 647
 
648
-		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true);
648
+		$spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident), '', true);
649 649
 
650 650
 		return $spotter_array;
651 651
 	}
@@ -656,16 +656,16 @@  discard block
 block discarded – undo
656 656
 	* @return Array the spotter information
657 657
 	*
658 658
 	*/
659
-	public function getDateLiveSpotterDataByIdent($ident,$date)
659
+	public function getDateLiveSpotterDataByIdent($ident, $date)
660 660
 	{
661 661
 		$Spotter = new Spotter($this->db);
662 662
 		date_default_timezone_set('UTC');
663 663
 
664 664
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
665
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
665
+                $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
666 666
 
667
-                $date = date('c',$date);
668
-		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
667
+                $date = date('c', $date);
668
+		$spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date));
669 669
 
670 670
 		return $spotter_array;
671 671
 	}
@@ -681,8 +681,8 @@  discard block
 block discarded – undo
681 681
 		$Spotter = new Spotter($this->db);
682 682
 		date_default_timezone_set('UTC');
683 683
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
684
-		$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
685
-		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id),'',true);
684
+		$query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
685
+		$spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id), '', true);
686 686
 		return $spotter_array;
687 687
 	}
688 688
 
@@ -692,15 +692,15 @@  discard block
 block discarded – undo
692 692
 	* @return Array the spotter information
693 693
 	*
694 694
 	*/
695
-	public function getDateLiveSpotterDataById($id,$date)
695
+	public function getDateLiveSpotterDataById($id, $date)
696 696
 	{
697 697
 		$Spotter = new Spotter($this->db);
698 698
 		date_default_timezone_set('UTC');
699 699
 
700 700
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
701
-		$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
702
-		$date = date('c',$date);
703
-		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
701
+		$query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
702
+		$date = date('c', $date);
703
+		$spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true);
704 704
 		return $spotter_array;
705 705
 	}
706 706
 
@@ -716,13 +716,13 @@  discard block
 block discarded – undo
716 716
 		date_default_timezone_set('UTC');
717 717
 
718 718
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
719
-                $query  = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
719
+                $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
720 720
 
721 721
     		try {
722 722
 			
723 723
 			$sth = $this->db->prepare($query);
724 724
 			$sth->execute(array(':ident' => $ident));
725
-		} catch(PDOException $e) {
725
+		} catch (PDOException $e) {
726 726
 			echo $e->getMessage();
727 727
 			die;
728 728
 		}
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
 	* @return Array the spotter information
738 738
 	*
739 739
 	*/
740
-	public function getAllLiveSpotterDataById($id,$liveinterval = false)
740
+	public function getAllLiveSpotterDataById($id, $liveinterval = false)
741 741
 	{
742 742
 		global $globalDBdriver, $globalLiveInterval;
743 743
 		date_default_timezone_set('UTC');
@@ -756,7 +756,7 @@  discard block
 block discarded – undo
756 756
 		try {
757 757
 			$sth = $this->db->prepare($query);
758 758
 			$sth->execute(array(':id' => $id));
759
-		} catch(PDOException $e) {
759
+		} catch (PDOException $e) {
760 760
 			echo $e->getMessage();
761 761
 			die;
762 762
 		}
@@ -774,12 +774,12 @@  discard block
 block discarded – undo
774 774
 	{
775 775
 		date_default_timezone_set('UTC');
776 776
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
777
-		$query  = self::$global_query.' WHERE spotter_live.ident = :ident';
777
+		$query = self::$global_query.' WHERE spotter_live.ident = :ident';
778 778
     		try {
779 779
 			
780 780
 			$sth = $this->db->prepare($query);
781 781
 			$sth->execute(array(':ident' => $ident));
782
-		} catch(PDOException $e) {
782
+		} catch (PDOException $e) {
783 783
 			echo $e->getMessage();
784 784
 			die;
785 785
 		}
@@ -809,7 +809,7 @@  discard block
 block discarded – undo
809 809
 			
810 810
 			$sth = $this->db->prepare($query);
811 811
 			$sth->execute();
812
-		} catch(PDOException $e) {
812
+		} catch (PDOException $e) {
813 813
 			return "error";
814 814
 		}
815 815
 
@@ -832,14 +832,14 @@  discard block
 block discarded – undo
832 832
 				
833 833
 				$sth = $this->db->prepare($query);
834 834
 				$sth->execute();
835
-			} catch(PDOException $e) {
835
+			} catch (PDOException $e) {
836 836
 				return "error";
837 837
 			}
838 838
 			$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
839 839
                         $i = 0;
840
-                        $j =0;
840
+                        $j = 0;
841 841
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
842
-			foreach($all as $row)
842
+			foreach ($all as $row)
843 843
 			{
844 844
 				$i++;
845 845
 				$j++;
@@ -847,9 +847,9 @@  discard block
 block discarded – undo
847 847
 					if ($globalDebug) echo ".";
848 848
 				    	try {
849 849
 						
850
-						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
850
+						$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
851 851
 						$sth->execute();
852
-					} catch(PDOException $e) {
852
+					} catch (PDOException $e) {
853 853
 						return "error";
854 854
 					}
855 855
                                 	$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
@@ -860,9 +860,9 @@  discard block
 block discarded – undo
860 860
 			if ($i > 0) {
861 861
     				try {
862 862
 					
863
-					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
863
+					$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
864 864
 					$sth->execute();
865
-				} catch(PDOException $e) {
865
+				} catch (PDOException $e) {
866 866
 					return "error";
867 867
 				}
868 868
 			}
@@ -875,7 +875,7 @@  discard block
 block discarded – undo
875 875
 				
876 876
 				$sth = $this->db->prepare($query);
877 877
 				$sth->execute();
878
-			} catch(PDOException $e) {
878
+			} catch (PDOException $e) {
879 879
 				return "error";
880 880
 			}
881 881
 /*			$query_delete = "DELETE FROM spotter_live WHERE flightaware_id IN (";
@@ -923,13 +923,13 @@  discard block
 block discarded – undo
923 923
 	public function deleteLiveSpotterDataByIdent($ident)
924 924
 	{
925 925
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
926
-		$query  = 'DELETE FROM spotter_live WHERE ident = :ident';
926
+		$query = 'DELETE FROM spotter_live WHERE ident = :ident';
927 927
         
928 928
     		try {
929 929
 			
930 930
 			$sth = $this->db->prepare($query);
931 931
 			$sth->execute(array(':ident' => $ident));
932
-		} catch(PDOException $e) {
932
+		} catch (PDOException $e) {
933 933
 			return "error";
934 934
 		}
935 935
 
@@ -945,13 +945,13 @@  discard block
 block discarded – undo
945 945
 	public function deleteLiveSpotterDataById($id)
946 946
 	{
947 947
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
948
-		$query  = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
948
+		$query = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
949 949
         
950 950
     		try {
951 951
 			
952 952
 			$sth = $this->db->prepare($query);
953 953
 			$sth->execute(array(':id' => $id));
954
-		} catch(PDOException $e) {
954
+		} catch (PDOException $e) {
955 955
 			return "error";
956 956
 		}
957 957
 
@@ -969,13 +969,13 @@  discard block
 block discarded – undo
969 969
 	{
970 970
 		global $globalDBdriver, $globalTimezone;
971 971
 		if ($globalDBdriver == 'mysql') {
972
-			$query  = 'SELECT spotter_live.ident FROM spotter_live 
972
+			$query = 'SELECT spotter_live.ident FROM spotter_live 
973 973
 				WHERE spotter_live.ident = :ident 
974 974
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
975 975
 				AND spotter_live.date < UTC_TIMESTAMP()';
976 976
 			$query_data = array(':ident' => $ident);
977 977
 		} else {
978
-			$query  = "SELECT spotter_live.ident FROM spotter_live 
978
+			$query = "SELECT spotter_live.ident FROM spotter_live 
979 979
 				WHERE spotter_live.ident = :ident 
980 980
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
981 981
 				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -984,8 +984,8 @@  discard block
 block discarded – undo
984 984
 		
985 985
 		$sth = $this->db->prepare($query);
986 986
 		$sth->execute($query_data);
987
-		$ident_result='';
988
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
987
+		$ident_result = '';
988
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
989 989
 		{
990 990
 			$ident_result = $row['ident'];
991 991
 		}
@@ -1002,13 +1002,13 @@  discard block
 block discarded – undo
1002 1002
 	{
1003 1003
 		global $globalDBdriver, $globalTimezone;
1004 1004
 		if ($globalDBdriver == 'mysql') {
1005
-			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
1005
+			$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
1006 1006
 				WHERE spotter_live.ident = :ident 
1007 1007
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 MINUTE)'; 
1008 1008
 //				AND spotter_live.date < UTC_TIMESTAMP()";
1009 1009
 			$query_data = array(':ident' => $ident);
1010 1010
 		} else {
1011
-			$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
1011
+			$query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
1012 1012
 				WHERE spotter_live.ident = :ident 
1013 1013
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '20 MINUTES'";
1014 1014
 //				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -1017,8 +1017,8 @@  discard block
 block discarded – undo
1017 1017
 		
1018 1018
 		$sth = $this->db->prepare($query);
1019 1019
 		$sth->execute($query_data);
1020
-		$ident_result='';
1021
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1020
+		$ident_result = '';
1021
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1022 1022
 		{
1023 1023
 			$ident_result = $row['flightaware_id'];
1024 1024
 		}
@@ -1035,13 +1035,13 @@  discard block
 block discarded – undo
1035 1035
 	{
1036 1036
 		global $globalDBdriver, $globalTimezone;
1037 1037
 		if ($globalDBdriver == 'mysql') {
1038
-			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
1038
+			$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
1039 1039
 				WHERE spotter_live.flightaware_id = :id 
1040 1040
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; 
1041 1041
 //				AND spotter_live.date < UTC_TIMESTAMP()";
1042 1042
 			$query_data = array(':id' => $id);
1043 1043
 		} else {
1044
-			$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
1044
+			$query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
1045 1045
 				WHERE spotter_live.flightaware_id = :id 
1046 1046
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'";
1047 1047
 //				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -1050,8 +1050,8 @@  discard block
 block discarded – undo
1050 1050
 		
1051 1051
 		$sth = $this->db->prepare($query);
1052 1052
 		$sth->execute($query_data);
1053
-		$ident_result='';
1054
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1053
+		$ident_result = '';
1054
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1055 1055
 		{
1056 1056
 			$ident_result = $row['flightaware_id'];
1057 1057
 		}
@@ -1068,13 +1068,13 @@  discard block
 block discarded – undo
1068 1068
 	{
1069 1069
 		global $globalDBdriver, $globalTimezone;
1070 1070
 		if ($globalDBdriver == 'mysql') {
1071
-			$query  = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
1071
+			$query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
1072 1072
 				WHERE spotter_live.ModeS = :modes 
1073 1073
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 MINUTE)'; 
1074 1074
 //				AND spotter_live.date < UTC_TIMESTAMP()";
1075 1075
 			$query_data = array(':modes' => $modes);
1076 1076
 		} else {
1077
-			$query  = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
1077
+			$query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
1078 1078
 				WHERE spotter_live.ModeS = :modes 
1079 1079
 				AND spotter_live.date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 MINUTE'";
1080 1080
 //			//	AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
@@ -1083,8 +1083,8 @@  discard block
 block discarded – undo
1083 1083
 		
1084 1084
 		$sth = $this->db->prepare($query);
1085 1085
 		$sth->execute($query_data);
1086
-		$ident_result='';
1087
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1086
+		$ident_result = '';
1087
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1088 1088
 		{
1089 1089
 			//$ident_result = $row['spotter_live_id'];
1090 1090
 			$ident_result = $row['flightaware_id'];
@@ -1109,8 +1109,8 @@  discard block
 block discarded – undo
1109 1109
 				return array();
1110 1110
 			} else {
1111 1111
 				$q_array = explode(" ", $q);
1112
-				foreach ($q_array as $q_item){
1113
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
1112
+				foreach ($q_array as $q_item) {
1113
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
1114 1114
 					$additional_query .= " AND (";
1115 1115
 					$additional_query .= "(spotter_live.aircraft_icao like '%".$q_item."%') OR ";
1116 1116
 					$additional_query .= "(spotter_live.aircraft_name like '%".$q_item."%') OR ";
@@ -1125,11 +1125,11 @@  discard block
 block discarded – undo
1125 1125
 			}
1126 1126
 		}
1127 1127
 		if ($globalDBdriver == 'mysql') {
1128
-			$query  = "SELECT spotter_live.* FROM spotter_live 
1128
+			$query = "SELECT spotter_live.* FROM spotter_live 
1129 1129
 			    WHERE spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." 
1130 1130
 			    AND spotter_live.date < UTC_TIMESTAMP()";
1131 1131
 		} else {
1132
-			$query  = "SELECT spotter_live.* FROM spotter_live 
1132
+			$query = "SELECT spotter_live.* FROM spotter_live 
1133 1133
 			    WHERE spotter_live.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." 
1134 1134
 			    AND spotter_live.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
1135 1135
 		}
@@ -1149,7 +1149,7 @@  discard block
 block discarded – undo
1149 1149
 	* @return String success or false
1150 1150
 	*
1151 1151
 	*/
1152
-	public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '',$heading = '', $groundspeed = '', $date = '',$departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false,$registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false,$format_source = '', $source_name = '', $over_country = '')
1152
+	public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false, $registration = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false, $format_source = '', $source_name = '', $over_country = '')
1153 1153
 	{
1154 1154
 		global $globalURL, $globalArchive, $globalDebug;
1155 1155
 		$Common = new Common();
@@ -1249,27 +1249,27 @@  discard block
 block discarded – undo
1249 1249
 		if ($date == '') $date = date("Y-m-d H:i:s", time());
1250 1250
 
1251 1251
         
1252
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
1253
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
1254
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
1255
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
1256
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
1257
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1258
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1259
-		$waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING);
1260
-		$altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1261
-		$altitude_real = filter_var($altitude_real,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1262
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
1263
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1264
-		$squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT);
1265
-		$route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING);
1266
-		$ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING);
1267
-		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING);
1268
-		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
1269
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
1270
-		$source_name = filter_var($source_name,FILTER_SANITIZE_STRING);
1271
-		$over_country = filter_var($over_country,FILTER_SANITIZE_STRING);
1272
-		$verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT);
1252
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
1253
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
1254
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
1255
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
1256
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
1257
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1258
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1259
+		$waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING);
1260
+		$altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1261
+		$altitude_real = filter_var($altitude_real, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1262
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
1263
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1264
+		$squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT);
1265
+		$route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING);
1266
+		$ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING);
1267
+		$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING);
1268
+		$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
1269
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
1270
+		$source_name = filter_var($source_name, FILTER_SANITIZE_STRING);
1271
+		$over_country = filter_var($over_country, FILTER_SANITIZE_STRING);
1272
+		$verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT);
1273 1273
 
1274 1274
 		$airline_name = '';
1275 1275
 		$airline_icao = '';
@@ -1291,10 +1291,10 @@  discard block
 block discarded – undo
1291 1291
 		$arrival_airport_country = '';
1292 1292
 		
1293 1293
             	
1294
-            	if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
1295
-            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
1296
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
1297
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
1294
+            	if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
1295
+            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
1296
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
1297
+            	if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
1298 1298
 		
1299 1299
 		$query = '';
1300 1300
 		if ($globalArchive) {
@@ -1305,19 +1305,19 @@  discard block
 block discarded – undo
1305 1305
 		$query  .= 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country, real_altitude) 
1306 1306
 		VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_shadow,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name, :departure_airport_city, :departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date,:departure_airport_time,:arrival_airport_time,:squawk,:route_stop,:ModeS, :pilot_id, :pilot_name, :verticalrate, :ground, :format_source, :source_name, :over_country, :real_altitude)';
1307 1307
 
1308
-		$query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_shadow' => $aircraft_shadow,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk,':route_stop' => $route_stop,':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source,':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country,':real_altitude' => $altitude_real);
1308
+		$query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_shadow' => $aircraft_shadow, ':aircraft_type' => $aircraft_type, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country, ':real_altitude' => $altitude_real);
1309 1309
 		try {
1310 1310
 			
1311 1311
 			$sth = $this->db->prepare($query);
1312 1312
 			$sth->execute($query_values);
1313 1313
 			$sth->closeCursor();
1314
-		} catch(PDOException $e) {
1314
+		} catch (PDOException $e) {
1315 1315
 			return "error : ".$e->getMessage();
1316 1316
 		}
1317 1317
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
1318 1318
 		    if ($globalDebug) echo '(Add to SBS archive : ';
1319 1319
 		    $SpotterArchive = new SpotterArchive($this->db);
1320
-		    $result =  $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $altitude_real,$heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country);
1320
+		    $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time, $arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date, $latitude, $longitude, $waypoints, $altitude, $altitude_real, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name, $verticalrate, $format_source, $source_name, $over_country);
1321 1321
 		    if ($globalDebug) echo $result.')';
1322 1322
 		} elseif ($globalDebug && $putinarchive !== true) {
1323 1323
 			echo '(Not adding to archive)';
@@ -1330,7 +1330,7 @@  discard block
 block discarded – undo
1330 1330
 
1331 1331
 	public function getOrderBy()
1332 1332
 	{
1333
-		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC"));
1333
+		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC"));
1334 1334
 		return $orderby;
1335 1335
 	}
1336 1336
 
Please login to merge, or discard this patch.
Braces   +161 added lines, -54 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. (SpotterLive)');
11
+		if ($this->db === null) {
12
+			die('Error: No DB connection. (SpotterLive)');
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) {
@@ -129,8 +133,11 @@  discard block
 block discarded – undo
129 133
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
130 134
 			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
131 135
 		}
132
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
133
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
136
+		if ($filter_query_where == '' && $where) {
137
+			$filter_query_where = ' WHERE';
138
+		} elseif ($filter_query_where != '' && $and) {
139
+			$filter_query_where .= ' AND';
140
+		}
134 141
 		if ($filter_query_where != '') {
135 142
 			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
136 143
 		}
@@ -171,9 +178,13 @@  discard block
 block discarded – undo
171 178
 				$orderby_query = ' '.$search_orderby_array[$sort]['sql'];
172 179
 			}
173 180
 		}
174
-		if ($orderby_query == '') $orderby_query = ' ORDER BY date DESC';
181
+		if ($orderby_query == '') {
182
+			$orderby_query = ' ORDER BY date DESC';
183
+		}
175 184
 
176
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
185
+		if (!isset($globalLiveInterval)) {
186
+			$globalLiveInterval = '200';
187
+		}
177 188
 		if ($globalDBdriver == 'mysql') {
178 189
 			//$query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate";
179 190
 			$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query.$orderby_query;
@@ -196,7 +207,9 @@  discard block
 block discarded – undo
196 207
 		global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap2DAircraftsLimit;
197 208
 		date_default_timezone_set('UTC');
198 209
 		$filter_query = $this->getFilter($filter,true,true);
199
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
210
+		if (!isset($globalLiveInterval)) {
211
+			$globalLiveInterval = '200';
212
+		}
200 213
 		if ($globalDBdriver == 'mysql') {
201 214
 			if (isset($globalArchive) && $globalArchive === TRUE) {
202 215
 			//	$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
@@ -262,8 +275,12 @@  discard block
 block discarded – undo
262 275
 		$id = filter_var($id,FILTER_SANITIZE_STRING);
263 276
 		$filter_query = $this->getFilter($filter,true,true);
264 277
 
265
-		if (!isset($globalLiveInterval) || $globalLiveInterval == '') $globalLiveInterval = '200';
266
-		if (!isset($globalMap3DAircraftsLimit) || $globalMap3DAircraftsLimit == '') $globalMap3DAircraftsLimit = '300';
278
+		if (!isset($globalLiveInterval) || $globalLiveInterval == '') {
279
+			$globalLiveInterval = '200';
280
+		}
281
+		if (!isset($globalMap3DAircraftsLimit) || $globalMap3DAircraftsLimit == '') {
282
+			$globalMap3DAircraftsLimit = '300';
283
+		}
267 284
 		if ($globalDBdriver == 'mysql') {
268 285
 			if (isset($globalArchive) && $globalArchive === TRUE) {
269 286
 				/*
@@ -274,25 +291,41 @@  discard block
 block discarded – undo
274 291
 				*/
275 292
 				$query  = 'SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source, spotter_archive.registration 
276 293
 				FROM spotter_archive INNER JOIN (SELECT flightaware_id FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date) l ON l.flightaware_id = spotter_archive.flightaware_id ";
277
-				if ($usecoord) $query .= "AND (spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
278
-				if ($id != '') $query .= "OR spotter_archive.flightaware_id = :id ";
294
+				if ($usecoord) {
295
+					$query .= "AND (spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
296
+				}
297
+				if ($id != '') {
298
+					$query .= "OR spotter_archive.flightaware_id = :id ";
299
+				}
279 300
 				$query .= "UNION
280 301
 				SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
281 302
 				FROM spotter_live".$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date";
282
-				if ($usecoord) $query .= " AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")";
283
-				if ($id != '') $query .= " OR spotter_live.flightaware_id = :id";
303
+				if ($usecoord) {
304
+					$query .= " AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")";
305
+				}
306
+				if ($id != '') {
307
+					$query .= " OR spotter_live.flightaware_id = :id";
308
+				}
284 309
 				$query .= ") AS spotter 
285 310
 				WHERE latitude <> '0' AND longitude <> '0' 
286 311
 				ORDER BY flightaware_id, date";
287
-				if ($limit) $query .= " LIMIT ".$globalMap3DAircraftsLimit;
312
+				if ($limit) {
313
+					$query .= " LIMIT ".$globalMap3DAircraftsLimit;
314
+				}
288 315
 			} else {
289 316
 				$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
290 317
 				FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date ";
291
-				if ($usecoord) $query .= "AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
292
-				if ($id != '') $query .= "OR spotter_live.flightaware_id = :id ";
318
+				if ($usecoord) {
319
+					$query .= "AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
320
+				}
321
+				if ($id != '') {
322
+					$query .= "OR spotter_live.flightaware_id = :id ";
323
+				}
293 324
 				$query .= "AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' 
294 325
 				ORDER BY spotter_live.flightaware_id, spotter_live.date";
295
-				if ($limit) $query .= " LIMIT ".$globalMap3DAircraftsLimit;
326
+				if ($limit) {
327
+					$query .= " LIMIT ".$globalMap3DAircraftsLimit;
328
+				}
296 329
 			}
297 330
 		} else {
298 331
 			if (isset($globalArchive) && $globalArchive === TRUE) {
@@ -309,28 +342,46 @@  discard block
 block discarded – undo
309 342
 				    SELECT flightaware_id 
310 343
 				    FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date";
311 344
 				$query.= ") l ON l.flightaware_id = spotter_archive.flightaware_id ";
312
-				if ($usecoord) $query .= "AND (spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
313
-				if ($id != '') $query .= "OR spotter_archive.flightaware_id = :id ";
345
+				if ($usecoord) {
346
+					$query .= "AND (spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
347
+				}
348
+				if ($id != '') {
349
+					$query .= "OR spotter_archive.flightaware_id = :id ";
350
+				}
314 351
 				$query .= "UNION
315 352
 				    SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
316 353
 				    FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date";
317
-				if ($usecoord) $query .= " AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")";
318
-				if ($id != '') $query .= " OR spotter_live.flightaware_id = :id";
354
+				if ($usecoord) {
355
+					$query .= " AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")";
356
+				}
357
+				if ($id != '') {
358
+					$query .= " OR spotter_live.flightaware_id = :id";
359
+				}
319 360
 				$query .= ") AS spotter WHERE latitude <> '0' AND longitude <> '0' ";
320 361
 				$query .= "ORDER BY flightaware_id, date";
321
-				if ($limit) $query .= " LIMIT ".$globalMap3DAircraftsLimit;
362
+				if ($limit) {
363
+					$query .= " LIMIT ".$globalMap3DAircraftsLimit;
364
+				}
322 365
 			} else {
323 366
 				$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
324 367
 				FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date ";
325
-				if ($usecoord) $query .= "AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
326
-				if ($id != '') $query .= "OR spotter_live.flightaware_id = :id ";
368
+				if ($usecoord) {
369
+					$query .= "AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
370
+				}
371
+				if ($id != '') {
372
+					$query .= "OR spotter_live.flightaware_id = :id ";
373
+				}
327 374
 				$query .= "AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' 
328 375
 				ORDER BY spotter_live.flightaware_id, spotter_live.date";
329
-				if ($limit) $query .= " LIMIT ".$globalMap3DAircraftsLimit;
376
+				if ($limit) {
377
+					$query .= " LIMIT ".$globalMap3DAircraftsLimit;
378
+				}
330 379
 			}
331 380
 		}
332 381
 		$query_values = array();
333
-		if ($id != '') $query_values = array(':id' => $id);
382
+		if ($id != '') {
383
+			$query_values = array(':id' => $id);
384
+		}
334 385
 		try {
335 386
 			$sth = $this->db->prepare($query);
336 387
 			$sth->execute($query_values);
@@ -355,8 +406,12 @@  discard block
 block discarded – undo
355 406
 		$id = filter_var($id,FILTER_SANITIZE_STRING);
356 407
 		$filter_query = $this->getFilter($filter,true,true);
357 408
 
358
-		if (!isset($globalLiveInterval) || $globalLiveInterval == '') $globalLiveInterval = '200';
359
-		if (!isset($globalMap3DAircraftsLimit) || $globalMap3DAircraftsLimit == '') $globalMap3DAircraftsLimit = '300';
409
+		if (!isset($globalLiveInterval) || $globalLiveInterval == '') {
410
+			$globalLiveInterval = '200';
411
+		}
412
+		if (!isset($globalMap3DAircraftsLimit) || $globalMap3DAircraftsLimit == '') {
413
+			$globalMap3DAircraftsLimit = '300';
414
+		}
360 415
 		if ($globalDBdriver == 'mysql') {
361 416
 			if (isset($globalArchive) && $globalArchive === TRUE) {
362 417
 				$query  = 'SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source, spotter_archive.registration 
@@ -367,13 +422,17 @@  discard block
 block discarded – undo
367 422
 				$query .= ") AS spotter 
368 423
 				WHERE latitude <> '0' AND longitude <> '0' 
369 424
 				ORDER BY flightaware_id, date";
370
-				if ($limit) $query .= " LIMIT ".$globalMap3DAircraftsLimit;
425
+				if ($limit) {
426
+					$query .= " LIMIT ".$globalMap3DAircraftsLimit;
427
+				}
371 428
 			} else {
372 429
 				$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
373 430
 				FROM spotter_live'.$filter_query.' spotter_live.flightaware_id = :id ';
374 431
 				$query .= "AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' 
375 432
 				ORDER BY spotter_live.flightaware_id, spotter_live.date";
376
-				if ($limit) $query .= " LIMIT ".$globalMap3DAircraftsLimit;
433
+				if ($limit) {
434
+					$query .= " LIMIT ".$globalMap3DAircraftsLimit;
435
+				}
377 436
 			}
378 437
 		} else {
379 438
 			if (isset($globalArchive) && $globalArchive === TRUE) {
@@ -389,13 +448,17 @@  discard block
 block discarded – undo
389 448
 				    FROM spotter_live".$filter_query." spotter_live.flightaware_id = :id";
390 449
 				$query .= ") AS spotter WHERE latitude <> '0' AND longitude <> '0' ";
391 450
 				$query .= "ORDER BY flightaware_id, date";
392
-				if ($limit) $query .= " LIMIT ".$globalMap3DAircraftsLimit;
451
+				if ($limit) {
452
+					$query .= " LIMIT ".$globalMap3DAircraftsLimit;
453
+				}
393 454
 			} else {
394 455
 				$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
395 456
 				FROM spotter_live".$filter_query." spotter_live.flightaware_id = :id ";
396 457
 				$query .= "AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' 
397 458
 				ORDER BY spotter_live.flightaware_id, spotter_live.date";
398
-				if ($limit) $query .= " LIMIT ".$globalMap3DAircraftsLimit;
459
+				if ($limit) {
460
+					$query .= " LIMIT ".$globalMap3DAircraftsLimit;
461
+				}
399 462
 			}
400 463
 		}
401 464
 		$query_values = array();
@@ -422,7 +485,9 @@  discard block
 block discarded – undo
422 485
 		global $globalDBdriver, $globalLiveInterval;
423 486
 		$filter_query = $this->getFilter($filter,true,true);
424 487
 
425
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
488
+		if (!isset($globalLiveInterval)) {
489
+			$globalLiveInterval = '200';
490
+		}
426 491
 		if ($globalDBdriver == 'mysql') {
427 492
 			//$query  = 'SELECT COUNT(*) as nb FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query;
428 493
 			$query = 'SELECT COUNT(DISTINCT spotter_live.flightaware_id) as nb FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
@@ -452,7 +517,9 @@  discard block
 block discarded – undo
452 517
 	{
453 518
 		global $globalDBdriver, $globalLiveInterval,$globalMap2DAircraftsLimit;
454 519
 		$Spotter = new Spotter($this->db);
455
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
520
+		if (!isset($globalLiveInterval)) {
521
+			$globalLiveInterval = '200';
522
+		}
456 523
 		$filter_query = $this->getFilter($filter);
457 524
 
458 525
 		if (is_array($coord)) {
@@ -460,7 +527,9 @@  discard block
 block discarded – undo
460 527
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
461 528
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
462 529
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
463
-		} else return array();
530
+		} else {
531
+			return array();
532
+		}
464 533
 		if ($globalDBdriver == 'mysql') {
465 534
 			$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY spotter_live.flightaware_id'.$filter_query;
466 535
 		} else {
@@ -484,7 +553,9 @@  discard block
 block discarded – undo
484 553
 	{
485 554
 		global $globalDBdriver, $globalLiveInterval, $globalArchive,$globalMap2DAircraftsLimit;
486 555
 		$Spotter = new Spotter($this->db);
487
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
556
+		if (!isset($globalLiveInterval)) {
557
+			$globalLiveInterval = '200';
558
+		}
488 559
 		$filter_query = $this->getFilter($filter,true,true);
489 560
 
490 561
 		if (is_array($coord)) {
@@ -492,7 +563,9 @@  discard block
 block discarded – undo
492 563
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
493 564
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
494 565
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
495
-		} else return array();
566
+		} else {
567
+			return array();
568
+		}
496 569
 		if ($globalDBdriver == 'mysql') {
497 570
 			if (isset($globalArchive) && $globalArchive === TRUE) {
498 571
 				$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
@@ -745,11 +818,15 @@  discard block
 block discarded – undo
745 818
 		//$query  = self::$global_query.' WHERE spotter_live.flightaware_id = :id ORDER BY date';
746 819
 		if ($globalDBdriver == 'mysql') {
747 820
 			$query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id';
748
-			if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
821
+			if ($liveinterval) {
822
+				$query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
823
+			}
749 824
 			$query .= ' ORDER BY date';
750 825
 		} else {
751 826
 			$query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id';
752
-			if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
827
+			if ($liveinterval) {
828
+				$query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
829
+			}
753 830
 			$query .= ' ORDER BY date';
754 831
 		}
755 832
 
@@ -844,7 +921,9 @@  discard block
 block discarded – undo
844 921
 				$i++;
845 922
 				$j++;
846 923
 				if ($j == 30) {
847
-					if ($globalDebug) echo ".";
924
+					if ($globalDebug) {
925
+						echo ".";
926
+					}
848 927
 				    	try {
849 928
 						
850 929
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
@@ -1197,7 +1276,9 @@  discard block
 block discarded – undo
1197 1276
 			{
1198 1277
 				return false;
1199 1278
 			}
1200
-		} else return '';
1279
+		} else {
1280
+			return '';
1281
+		}
1201 1282
 
1202 1283
 		if ($longitude != '')
1203 1284
 		{
@@ -1205,7 +1286,9 @@  discard block
 block discarded – undo
1205 1286
 			{
1206 1287
 				return false;
1207 1288
 			}
1208
-		} else return '';
1289
+		} else {
1290
+			return '';
1291
+		}
1209 1292
 
1210 1293
 		if ($waypoints != '')
1211 1294
 		{
@@ -1221,14 +1304,18 @@  discard block
 block discarded – undo
1221 1304
 			{
1222 1305
 				return false;
1223 1306
 			}
1224
-		} else $altitude = 0;
1307
+		} else {
1308
+			$altitude = 0;
1309
+		}
1225 1310
 		if ($altitude_real != '')
1226 1311
 		{
1227 1312
 			if (!is_numeric($altitude_real))
1228 1313
 			{
1229 1314
 				return false;
1230 1315
 			}
1231
-		} else $altitude_real = 0;
1316
+		} else {
1317
+			$altitude_real = 0;
1318
+		}
1232 1319
 
1233 1320
 		if ($heading != '')
1234 1321
 		{
@@ -1236,7 +1323,9 @@  discard block
 block discarded – undo
1236 1323
 			{
1237 1324
 				return false;
1238 1325
 			}
1239
-		} else $heading = 0;
1326
+		} else {
1327
+			$heading = 0;
1328
+		}
1240 1329
 
1241 1330
 		if ($groundspeed != '')
1242 1331
 		{
@@ -1244,9 +1333,13 @@  discard block
 block discarded – undo
1244 1333
 			{
1245 1334
 				return false;
1246 1335
 			}
1247
-		} else $groundspeed = 0;
1336
+		} else {
1337
+			$groundspeed = 0;
1338
+		}
1248 1339
 		date_default_timezone_set('UTC');
1249
-		if ($date == '') $date = date("Y-m-d H:i:s", time());
1340
+		if ($date == '') {
1341
+			$date = date("Y-m-d H:i:s", time());
1342
+		}
1250 1343
 
1251 1344
         
1252 1345
 		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
@@ -1291,14 +1384,24 @@  discard block
 block discarded – undo
1291 1384
 		$arrival_airport_country = '';
1292 1385
 		
1293 1386
             	
1294
-            	if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
1295
-            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
1296
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
1297
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
1387
+            	if ($squawk == '' || $Common->isInteger($squawk) === false ) {
1388
+            		$squawk = NULL;
1389
+            	}
1390
+            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) {
1391
+            		$verticalrate = NULL;
1392
+            	}
1393
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) {
1394
+            		$groundspeed = 0;
1395
+            	}
1396
+            	if ($heading == '' || $Common->isInteger($heading) === false ) {
1397
+            		$heading = 0;
1398
+            	}
1298 1399
 		
1299 1400
 		$query = '';
1300 1401
 		if ($globalArchive) {
1301
-			if ($globalDebug) echo '-- Delete previous data -- ';
1402
+			if ($globalDebug) {
1403
+				echo '-- Delete previous data -- ';
1404
+			}
1302 1405
 			$query .= 'DELETE FROM spotter_live WHERE flightaware_id = :flightaware_id;';
1303 1406
 		}
1304 1407
 
@@ -1315,10 +1418,14 @@  discard block
 block discarded – undo
1315 1418
 			return "error : ".$e->getMessage();
1316 1419
 		}
1317 1420
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
1318
-		    if ($globalDebug) echo '(Add to SBS archive : ';
1421
+		    if ($globalDebug) {
1422
+		    	echo '(Add to SBS archive : ';
1423
+		    }
1319 1424
 		    $SpotterArchive = new SpotterArchive($this->db);
1320 1425
 		    $result =  $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $altitude_real,$heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country);
1321
-		    if ($globalDebug) echo $result.')';
1426
+		    if ($globalDebug) {
1427
+		    	echo $result.')';
1428
+		    }
1322 1429
 		} elseif ($globalDebug && $putinarchive !== true) {
1323 1430
 			echo '(Not adding to archive)';
1324 1431
 		} elseif ($globalDebug && $noarchive === true) {
Please login to merge, or discard this patch.
live-geojson.php 2 patches
Spacing   +92 added lines, -92 removed lines patch added patch discarded remove patch
@@ -65,18 +65,18 @@  discard block
 block discarded – undo
65 65
 $min = true;
66 66
 $allhistory = false;
67 67
 $filter['source'] = array();
68
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
69
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
70
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
71
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
72
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
73
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
74
-if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
75
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
76
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
77
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
78
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
79
-if (isset($_COOKIE['filter_race']) && $_COOKIE['filter_race'] != 'all') $filter['race'] = filter_var($_COOKIE['filter_race'],FILTER_SANITIZE_NUMBER_INT);
68
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt'));
69
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup'));
70
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars'));
71
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs'));
72
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs'));
73
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING);
74
+if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'], FILTER_SANITIZE_STRING);
75
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING);
76
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING);
77
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING);
78
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING);
79
+if (isset($_COOKIE['filter_race']) && $_COOKIE['filter_race'] != 'all') $filter['race'] = filter_var($_COOKIE['filter_race'], FILTER_SANITIZE_NUMBER_INT);
80 80
 if (isset($_COOKIE['filter_blocked']) && $_COOKIE['filter_blocked'] == 'true') $filter['blocked'] = true;
81 81
 
82 82
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
@@ -85,13 +85,13 @@  discard block
 block discarded – undo
85 85
 
86 86
 
87 87
 if (isset($_COOKIE['map_2d_limit'])) {
88
-	$limit = filter_var($_COOKIE['map_2d_limit'],FILTER_SANITIZE_NUMBER_INT);
88
+	$limit = filter_var($_COOKIE['map_2d_limit'], FILTER_SANITIZE_NUMBER_INT);
89 89
 }
90 90
 
91 91
 $spotter_array = array();
92 92
 
93 93
 if (isset($_GET['ident'])) {
94
-	$ident = urldecode(filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING));
94
+	$ident = urldecode(filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING));
95 95
 	if ($tracker) {
96 96
 		$spotter_array = $TrackerLive->getLastLiveTrackerDataByIdent($ident);
97 97
 	} elseif ($marine) {
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 	}
106 106
 	$allhistory = true;
107 107
 } elseif (isset($_GET['flightaware_id'])) {
108
-	$flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
108
+	$flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING);
109 109
 	$spotter_array = $SpotterLive->getLastLiveSpotterDataById($flightaware_id);
110 110
 	if (empty($spotter_array)) {
111 111
 		$from_archive = true;
@@ -113,11 +113,11 @@  discard block
 block discarded – undo
113 113
 	}
114 114
 	$allhistory = true;
115 115
 } elseif (isset($_GET['famtrack_id'])) {
116
-	$famtrack_id = urldecode(filter_input(INPUT_GET,'famtrack_id',FILTER_SANITIZE_STRING));
116
+	$famtrack_id = urldecode(filter_input(INPUT_GET, 'famtrack_id', FILTER_SANITIZE_STRING));
117 117
 	$spotter_array = $TrackerLive->getLastLiveTrackerDataById($famtrack_id);
118 118
 	$allhistory = true;
119 119
 } elseif (isset($_GET['fammarine_id'])) {
120
-	$fammarine_id = urldecode(filter_input(INPUT_GET,'fammarine_id',FILTER_SANITIZE_STRING));
120
+	$fammarine_id = urldecode(filter_input(INPUT_GET, 'fammarine_id', FILTER_SANITIZE_STRING));
121 121
 	$spotter_array = $MarineLive->getLastLiveMarineDataById($fammarine_id);
122 122
 	$allhistory = true;
123 123
 /*
@@ -137,15 +137,15 @@  discard block
 block discarded – undo
137 137
 */
138 138
 } elseif (isset($globalMapUseBbox) && $globalMapUseBbox && isset($_GET['coord']) && $min && !isset($_GET['archive'])) {
139 139
 	$usecoord = true;
140
-	$coord = explode(',',$_GET['coord']);
141
-	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) 
140
+	$coord = explode(',', $_GET['coord']);
141
+	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) 
142 142
 	    && $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) {
143 143
 		if ($tracker) {
144
-			$spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord,$filter);
144
+			$spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord, $filter);
145 145
 		} elseif ($marine) {
146
-			$spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord,$filter);
146
+			$spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord, $filter);
147 147
 		} else {
148
-			$spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord,$limit,$filter);
148
+			$spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord, $limit, $filter);
149 149
 		}
150 150
 	} else {
151 151
 		if ($tracker) {
@@ -153,19 +153,19 @@  discard block
 block discarded – undo
153 153
 		} elseif ($marine) {
154 154
 			$spotter_array = $MarineLive->getMinLiveMarineData($filter);
155 155
 		} else {
156
-			$spotter_array = $SpotterLive->getMinLiveSpotterData($limit,$filter);
156
+			$spotter_array = $SpotterLive->getMinLiveSpotterData($limit, $filter);
157 157
 		}
158 158
 	}
159 159
 } elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed']) && !isset($_GET['tracker']) && !isset($_GET['marine'])) {
160 160
 	$from_archive = true;
161 161
 //	$begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
162 162
 //	$enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
163
-	$begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT);
164
-	$enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT);
165
-	$archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT);
166
-	$begindate = date('Y-m-d H:i:s',$begindate);
167
-	$enddate = date('Y-m-d H:i:s',$enddate);
168
-	$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter);
163
+	$begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT);
164
+	$enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT);
165
+	$archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT);
166
+	$begindate = date('Y-m-d H:i:s', $begindate);
167
+	$enddate = date('Y-m-d H:i:s', $enddate);
168
+	$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter);
169 169
 } elseif ($min) {
170 170
 	if ($tracker) {
171 171
 		$spotter_array = $TrackerLive->getMinLiveTrackerData($filter);
@@ -177,17 +177,17 @@  discard block
 block discarded – undo
177 177
 #	$min = true;
178 178
 } else {
179 179
 	if ($tracker) {
180
-		$spotter_array = $TrackerLive->getLiveTrackerData('','',$filter);
180
+		$spotter_array = $TrackerLive->getLiveTrackerData('', '', $filter);
181 181
 	} elseif ($marine) {
182
-		$spotter_array = $marineLive->getLiveMarineData('','',$filter);
182
+		$spotter_array = $marineLive->getLiveMarineData('', '', $filter);
183 183
 	} else {
184
-		$spotter_array = $SpotterLive->getLiveSpotterData('','',$filter);
184
+		$spotter_array = $SpotterLive->getLiveSpotterData('', '', $filter);
185 185
 	}
186 186
 }
187 187
 
188 188
 if ($usecoord) {
189 189
 	if (isset($_GET['archive'])) {
190
-		$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter);
190
+		$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter);
191 191
 	} else {
192 192
 		if ($tracker) {
193 193
 			$flightcnt = $TrackerLive->getLiveTrackerCount($filter);
@@ -200,9 +200,9 @@  discard block
 block discarded – undo
200 200
 	if ($flightcnt == '') $flightcnt = 0;
201 201
 } else $flightcnt = 0;
202 202
 
203
-$sqltime = round(microtime(true)-$begintime,2);
203
+$sqltime = round(microtime(true) - $begintime, 2);
204 204
 
205
-$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
205
+$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT);
206 206
 if ($currenttime != '') $currenttime = round($currenttime/1000);
207 207
 
208 208
 if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false;
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 		if (!empty($spotter_array) && is_array($spotter_array))
222 222
 		{
223 223
 			$output .= '"features": [';
224
-			foreach($spotter_array as $spotter_item)
224
+			foreach ($spotter_array as $spotter_item)
225 225
 			{
226 226
 				$j++;
227 227
 				unset($idistance);
@@ -278,8 +278,8 @@  discard block
 block discarded – undo
278 278
 */
279 279
 							//$output .= '"fc": "'.$spotter_item['nb'].'",';
280 280
 						if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') {
281
-							if ($compress) $output .= '"c": '.json_encode(str_replace('\\','',$spotter_item['ident'])).',';
282
-							else $output .= '"callsign": '.json_encode(str_replace('\\','',$spotter_item['ident'])).',';
281
+							if ($compress) $output .= '"c": '.json_encode(str_replace('\\', '', $spotter_item['ident'])).',';
282
+							else $output .= '"callsign": '.json_encode(str_replace('\\', '', $spotter_item['ident'])).',';
283 283
 							//'
284 284
 						} else {
285 285
 							if ($compress) $output .= '"c": "NA",';
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 						}
292 292
 						if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) {
293 293
 							$output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",';
294
-							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",';
294
+							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ', '_', $spotter_item['aircraft_name'])).'",';
295 295
 						} elseif (isset($spotter_item['aircraft_type'])) {
296 296
 							$output .= '"aircraft_name": "NA ('.$spotter_item['aircraft_type'].')",';
297 297
 						} elseif (!$min) {
@@ -377,19 +377,19 @@  discard block
 block discarded – undo
377 377
 									else $output .= '"aircraft_shadow": "car.png",';
378 378
 								}
379 379
 							} elseif ($marine) {
380
-								if (isset($spotter_item['type']) && ($spotter_item['type']  == '50&#39; Performance Cruiser' || $spotter_item['type']  == '50\' Performance Cruiser' || $spotter_item['type'] == 'Sail')) {
380
+								if (isset($spotter_item['type']) && ($spotter_item['type'] == '50&#39; Performance Cruiser' || $spotter_item['type'] == '50\' Performance Cruiser' || $spotter_item['type'] == 'Sail')) {
381 381
 									if ($compress) $output .= '"as": "50perfcruiser.png",';
382 382
 									else $output .= '"aircraft_shadow": "50perfcruiser.png",';
383
-								} elseif (isset($spotter_item['type']) && $spotter_item['type']  == 'Sailaway Cruiser 38') {
383
+								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Sailaway Cruiser 38') {
384 384
 									if ($compress) $output .= '"as": "cruiser38.png",';
385 385
 									else $output .= '"aircraft_shadow": "cruiser38.png",';
386
-								} elseif (isset($spotter_item['type']) && $spotter_item['type']  == 'Mini Transat') {
386
+								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Mini Transat') {
387 387
 									if ($compress) $output .= '"as": "transat.png",';
388 388
 									else $output .= '"aircraft_shadow": "transat.png",';
389
-								} elseif (isset($spotter_item['type']) && $spotter_item['type']  == '52&#39; Cruising Cat') {
389
+								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == '52&#39; Cruising Cat') {
390 390
 									if ($compress) $output .= '"as": "catamaran.png",';
391 391
 									else $output .= '"aircraft_shadow": "catamaran.png",';
392
-								} elseif (isset($spotter_item['type']) && $spotter_item['type']  == 'Caribbean Rose') {
392
+								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Caribbean Rose') {
393 393
 									if ($compress) $output .= '"as": "carib.png",';
394 394
 									else $output .= '"aircraft_shadow": "carib.png",';
395 395
 								} else {
@@ -455,15 +455,15 @@  discard block
 block discarded – undo
455 455
 						if (isset($archivespeed) || $usenextlatlon) {
456 456
 							if (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
457 457
 								if (isset($spotter_item['arrival_airport_latitude'])) {
458
-									$cheading = $Common->getHeading($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['arrival_airport_latitude'],$spotter_item['arrival_airport_longitude']);
459
-									$idistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['arrival_airport_latitude'],$spotter_item['arrival_airport_longitude']);
458
+									$cheading = $Common->getHeading($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['arrival_airport_latitude'], $spotter_item['arrival_airport_longitude']);
459
+									$idistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['arrival_airport_latitude'], $spotter_item['arrival_airport_longitude']);
460 460
 									$farr_lat = $spotter_item['arrival_airport_latitude'];
461 461
 									$farr_lon = $spotter_item['arrival_airport_longitude'];
462 462
 								} else {
463 463
 									$aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']);
464 464
 									if (isset($aairport[0]['latitude'])) {
465
-										$cheading = $Common->getHeading($spotter_item['latitude'],$spotter_item['longitude'],$aairport[0]['latitude'],$aairport[0]['longitude']);
466
-										$idistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$aairport[0]['latitude'],$aairport[0]['longitude']);
465
+										$cheading = $Common->getHeading($spotter_item['latitude'], $spotter_item['longitude'], $aairport[0]['latitude'], $aairport[0]['longitude']);
466
+										$idistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $aairport[0]['latitude'], $aairport[0]['longitude']);
467 467
 										$farr_lat = $aairport[0]['latitude'];
468 468
 										$farr_lon = $aairport[0]['longitude'];
469 469
 									}
@@ -476,59 +476,59 @@  discard block
 block discarded – undo
476 476
 						if ($currenttime != '') {
477 477
 							if (strtotime($spotter_item['date']) < $currenttime) {
478 478
 								if (isset($archivespeed)) {
479
-									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
480
-									$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
479
+									$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh));
480
+									$fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']);
481 481
 									if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
482 482
 									else {
483
-										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
484
-										$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
483
+										$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, $archivespeed, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh));
484
+										$fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']);
485 485
 										if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
486 486
 										else {
487
-											$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed);
487
+											$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed);
488 488
 											$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
489 489
 										}
490 490
 									}
491 491
 								} elseif ($usenextlatlon) {
492
-									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
493
-									$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
492
+									$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, 1, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh));
493
+									$fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']);
494 494
 									if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
495 495
 									else {
496
-										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
497
-										$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
496
+										$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, 1, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh));
497
+										$fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']);
498 498
 										if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
499 499
 										else {
500
-											$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading);
500
+											$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading);
501 501
 											$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
502 502
 										}
503 503
 									}
504 504
 								}
505 505
 							} else {
506 506
 								if (isset($archivespeed)) {
507
-									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed);
507
+									$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed);
508 508
 									$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
509 509
 								} elseif ($usenextlatlon) {
510
-									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading);
510
+									$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading);
511 511
 									$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
512 512
 								}
513 513
 							}
514 514
 						} else {
515 515
 							if (isset($archivespeed)) {
516
-								$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed);
517
-								$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
516
+								$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed);
517
+								$fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']);
518 518
 								if (!isset($idistance) || $fdistance < $idistance) {
519 519
 									$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
520 520
 								} else {
521
-									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed);
521
+									$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, $archivespeed);
522 522
 									//$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
523 523
 									$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
524 524
 								}
525 525
 							} elseif ($usenextlatlon) {
526
-								$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading);
527
-								$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
526
+								$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading);
527
+								$fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']);
528 528
 								if (!isset($idistance) || $fdistance < $idistance) {
529 529
 										$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
530 530
 								} else {
531
-									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading);
531
+									$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading);
532 532
 									//$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
533 533
 									$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
534 534
 								}
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
 
538 538
 						if (!$min) $output .= '"image": "'.$image.'",';
539 539
 						if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') {
540
-							$output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",';
540
+							$output .= '"image_copyright": "'.str_replace('"', "'", trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $spotter_item['image_copyright']))).'",';
541 541
 						}
542 542
 						if (isset($spotter_item['image_source_website'])) {
543 543
 							$output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",';
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
 							$output .= '"waypoints": "'.$spotter_item['waypoints'].'",';
572 572
 						}
573 573
 						if (isset($spotter_item['acars'])) {
574
-							$output .= '"acars": "'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"), '<br />',$spotter_item['acars']['message'])).'",';
574
+							$output .= '"acars": "'.trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '<br />', $spotter_item['acars']['message'])).'",';
575 575
 						}
576 576
 						// type when not aircraft ?
577 577
 						if (isset($spotter_item['type'])) {
@@ -591,12 +591,12 @@  discard block
 block discarded – undo
591 591
 								if ($currenttime != '') {
592 592
 									if (strtotime($spotter_item['date']) < $currenttime) {
593 593
 										if (!isset($archivespeed)) $archivespeed = 1;
594
-										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date'])));
595
-										$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
594
+										$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed, ($currenttime - strtotime($spotter_item['date'])));
595
+										$fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']);
596 596
 										if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
597 597
 										else {
598
-											$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date'])));
599
-											$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
598
+											$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, $archivespeed, ($currenttime - strtotime($spotter_item['date'])));
599
+											$fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']);
600 600
 											if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
601 601
 											else {
602 602
 												$output .= $spotter_item['longitude'].', ';
@@ -675,7 +675,7 @@  discard block
 block discarded – undo
675 675
                 
676 676
 			}
677 677
 */
678
-				$history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING);
678
+				$history = filter_input(INPUT_GET, 'history', FILTER_SANITIZE_STRING);
679 679
 				if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history'];
680 680
 				
681 681
 				if (
@@ -683,11 +683,11 @@  discard block
 block discarded – undo
683 683
 				    || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory)
684 684
 				//    || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id']))
685 685
 				//    || (isset($history) && $history != '' && $history != 'NA' && $history == $spotter_item['ident'])
686
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
686
+				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id']))
687 687
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])
688
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id']))
688
+				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['fammarine_id']))
689 689
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id'])
690
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid']))
690
+				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['famtrackid']))
691 691
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid'])
692 692
 				    ) {
693 693
 					if ($tracker) {
@@ -716,9 +716,9 @@  discard block
 block discarded – undo
716 716
 							require(dirname(__FILE__).'/require/class.MapMatching.php');
717 717
 							$MapMatching = new MapMatching();
718 718
 							if (isset($spotter_item['date_iso_8601'])) {
719
-								$spotter_history_array_mm = array_merge($spotter_history_array,array(array('latitude' => $spotter_item['latitude'],'longitude' => $spotter_item['longitude'],'date' => date('c',strtotime($spotter_item['date_iso_8601'])))));
719
+								$spotter_history_array_mm = array_merge($spotter_history_array, array(array('latitude' => $spotter_item['latitude'], 'longitude' => $spotter_item['longitude'], 'date' => date('c', strtotime($spotter_item['date_iso_8601'])))));
720 720
 							} else {
721
-								$spotter_history_array_mm = array_merge($spotter_history_array,array(array('latitude' => $spotter_item['latitude'],'longitude' => $spotter_item['longitude'],'date' => date('c',strtotime($spotter_item['date'])))));
721
+								$spotter_history_array_mm = array_merge($spotter_history_array, array(array('latitude' => $spotter_item['latitude'], 'longitude' => $spotter_item['longitude'], 'date' => date('c', strtotime($spotter_item['date'])))));
722 722
 							}
723 723
 							$spotter_history_array = $MapMatching->match($spotter_history_array_mm);
724 724
 						}
@@ -750,9 +750,9 @@  discard block
 block discarded – undo
750 750
 								else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
751 751
 							}
752 752
 							$output_history .= '[';
753
-							$output_history .=  $spotter_history['longitude'].', ';
754
-							$output_history .=  $spotter_history['latitude'].', ';
755
-							$output_history .=  $spotter_history['altitude']*30.48;
753
+							$output_history .= $spotter_history['longitude'].', ';
754
+							$output_history .= $spotter_history['latitude'].', ';
755
+							$output_history .= $spotter_history['altitude']*30.48;
756 756
 							$output_history .= '],';
757 757
 							/*
758 758
 							if ($from_archive === false) {
@@ -775,8 +775,8 @@  discard block
 block discarded – undo
775 775
 								$d = true;
776 776
 							}
777 777
 							$output_history .= '[';
778
-							$output_history .=  $spotter_history['longitude'].', ';
779
-							$output_history .=  $spotter_history['latitude'];
778
+							$output_history .= $spotter_history['longitude'].', ';
779
+							$output_history .= $spotter_history['latitude'];
780 780
 							$output_history .= '],';
781 781
 							/*
782 782
 							if ($from_archive === false) {
@@ -792,9 +792,9 @@  discard block
 block discarded – undo
792 792
 						//echo $output_history;
793 793
 						if ($from_archive === false && !isset($spotter_history_array[0]['mapmatching_engine'])) {
794 794
 							$output_historyd = '[';
795
-							$output_historyd .=  $spotter_item['longitude'].', ';
796
-							$output_historyd .=  $spotter_item['latitude'];
797
-							if (isset($spotter_history['altitude'])) $output_historyd .=  ','.$spotter_item['altitude']*30.48;
795
+							$output_historyd .= $spotter_item['longitude'].', ';
796
+							$output_historyd .= $spotter_item['latitude'];
797
+							if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48;
798 798
 							$output_historyd .= '],';
799 799
 							//$output_history = $output_historyd.$output_history;
800 800
 							$output_history = $output_history.$output_historyd;
@@ -802,7 +802,7 @@  discard block
 block discarded – undo
802 802
 							$last = array_pop($spotter_history_array);
803 803
 							$latitude = $last['latitude'];
804 804
 							$longitude = $last['longitude'];
805
-							$output = str_replace('"coordinates": ['.$spotter_item['longitude'].', '.$spotter_item['latitude'].']}','"coordinates": ['.$longitude.', '.$latitude.']}',$output);
805
+							$output = str_replace('"coordinates": ['.$spotter_item['longitude'].', '.$spotter_item['latitude'].']}', '"coordinates": ['.$longitude.', '.$latitude.']}', $output);
806 806
 						}
807 807
 						
808 808
 						$output_history  = substr($output_history, 0, -1);
@@ -814,7 +814,7 @@  discard block
 block discarded – undo
814 814
 					
815 815
 				}
816 816
 				
817
-				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
817
+				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id']))
818 818
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
819 819
 				     && (isset($spotter_item['departure_airport']) 
820 820
 				        && $spotter_item['departure_airport'] != 'NA' 
@@ -848,7 +848,7 @@  discard block
 block discarded – undo
848 848
 
849 849
 				//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))))) {
850 850
 				//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))))) {
851
-				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
851
+				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id']))
852 852
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
853 853
 				     && (isset($spotter_item['arrival_airport']) 
854 854
 				        && $spotter_item['arrival_airport'] != 'NA' 
@@ -875,11 +875,11 @@  discard block
 block discarded – undo
875 875
 					}
876 876
 				    }
877 877
 				    if ($havedata) {
878
-					$line = $Common->greatCircle($spotter_item['latitude'],$spotter_item['longitude'],$end_lat,$end_lon);
878
+					$line = $Common->greatCircle($spotter_item['latitude'], $spotter_item['longitude'], $end_lat, $end_lon);
879 879
 					foreach ($line[0] as $coord) {
880 880
 						$output_dest .= '['.$coord[0].','.$coord[1].'],';
881 881
 					}
882
-					$output_dest  = substr($output_dest, 0, -1);
882
+					$output_dest = substr($output_dest, 0, -1);
883 883
 				    }
884 884
 				    $output_dest .= ']}},';
885 885
 				    if ($havedata) $output .= $output_dest;
@@ -889,7 +889,7 @@  discard block
 block discarded – undo
889 889
 			$output  = substr($output, 0, -1);
890 890
 			$output .= ']';
891 891
 			$output .= ',"initial_sqltime": "'.$sqltime.'",';
892
-			$output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",';
892
+			$output .= '"totaltime": "'.round(microtime(true) - $begintime, 2).'",';
893 893
 			if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
894 894
 			$output .= '"fc": "'.$j.'"';
895 895
 		} else {
Please login to merge, or discard this patch.
Braces   +364 added lines, -147 removed lines patch added patch discarded remove patch
@@ -12,7 +12,9 @@  discard block
 block discarded – undo
12 12
 $tracker = false;
13 13
 $marine = false;
14 14
 $usecoord = false;
15
-if (isset($_GET['test'])) exit();
15
+if (isset($_GET['test'])) {
16
+	exit();
17
+}
16 18
 if (isset($_GET['tracker'])) {
17 19
     $tracker = true;
18 20
 }
@@ -57,31 +59,62 @@  discard block
 block discarded – undo
57 59
 }
58 60
 header('Content-Type: text/javascript');
59 61
 
60
-if (!isset($globalJsonCompress)) $compress = true;
61
-else $compress = $globalJsonCompress;
62
+if (!isset($globalJsonCompress)) {
63
+	$compress = true;
64
+} else {
65
+	$compress = $globalJsonCompress;
66
+}
62 67
 
63 68
 $limit = 0;
64 69
 $from_archive = false;
65 70
 $min = true;
66 71
 $allhistory = false;
67 72
 $filter['source'] = array();
68
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
69
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
70
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
71
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
72
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
73
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
74
-if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
75
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
76
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
77
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
78
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
79
-if (isset($_COOKIE['filter_race']) && $_COOKIE['filter_race'] != 'all') $filter['race'] = filter_var($_COOKIE['filter_race'],FILTER_SANITIZE_NUMBER_INT);
80
-if (isset($_COOKIE['filter_blocked']) && $_COOKIE['filter_blocked'] == 'true') $filter['blocked'] = true;
73
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') {
74
+	$filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
75
+}
76
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') {
77
+	$filter['source'] = array_merge($filter['source'],array('whazzup'));
78
+}
79
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') {
80
+	$filter['source'] = array_merge($filter['source'],array('phpvmacars'));
81
+}
82
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') {
83
+	$filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
84
+}
85
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') {
86
+	$filter['source'] = array_merge($filter['source'],array('aprs'));
87
+}
88
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') {
89
+	$filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
90
+}
91
+if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') {
92
+	$filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
93
+}
94
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') {
95
+	$filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
96
+}
97
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') {
98
+	$filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
99
+}
100
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') {
101
+	$filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
102
+}
103
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') {
104
+	$filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
105
+}
106
+if (isset($_COOKIE['filter_race']) && $_COOKIE['filter_race'] != 'all') {
107
+	$filter['race'] = filter_var($_COOKIE['filter_race'],FILTER_SANITIZE_NUMBER_INT);
108
+}
109
+if (isset($_COOKIE['filter_blocked']) && $_COOKIE['filter_blocked'] == 'true') {
110
+	$filter['blocked'] = true;
111
+}
81 112
 
82 113
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
83 114
 	$min = true;
84
-} else $min = false;
115
+} else {
116
+	$min = false;
117
+}
85 118
 
86 119
 
87 120
 if (isset($_COOKIE['map_2d_limit'])) {
@@ -197,24 +230,38 @@  discard block
 block discarded – undo
197 230
 			$flightcnt = $SpotterLive->getLiveSpotterCount($filter);
198 231
 		}
199 232
 	}
200
-	if ($flightcnt == '') $flightcnt = 0;
201
-} else $flightcnt = 0;
233
+	if ($flightcnt == '') {
234
+		$flightcnt = 0;
235
+	}
236
+	} else {
237
+	$flightcnt = 0;
238
+}
202 239
 
203 240
 $sqltime = round(microtime(true)-$begintime,2);
204 241
 
205 242
 $currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
206
-if ($currenttime != '') $currenttime = round($currenttime/1000);
243
+if ($currenttime != '') {
244
+	$currenttime = round($currenttime/1000);
245
+}
207 246
 
208
-if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false;
209
-else $usenextlatlon = true;
210
-if ($usenextlatlon === false) $currenttime = '';
247
+if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) {
248
+	$usenextlatlon = false;
249
+} else {
250
+	$usenextlatlon = true;
251
+}
252
+if ($usenextlatlon === false) {
253
+	$currenttime = '';
254
+}
211 255
 $j = 0;
212 256
 $prev_flightaware_id = '';
213 257
 $aircrafts_shadow = array();
214 258
 $output = '{';
215 259
 	$output .= '"type": "FeatureCollection",';
216
-		if ($min) $output .= '"minimal": "true",';
217
-		else $output .= '"minimal": "false",';
260
+		if ($min) {
261
+			$output .= '"minimal": "true",';
262
+		} else {
263
+			$output .= '"minimal": "false",';
264
+		}
218 265
 		//$output .= '"fc": "'.$flightcnt.'",';
219 266
 		$output .= '"sqt": "'.$sqltime.'",';
220 267
 
@@ -259,18 +306,29 @@  discard block
 block discarded – undo
259 306
 						}
260 307
 						$output .= '"properties": {';
261 308
 						if (isset($spotter_item['flightaware_id'])) {
262
-							if ($compress) $output .= '"fi": "'.$spotter_item['flightaware_id'].'",';
263
-							else $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",';
309
+							if ($compress) {
310
+								$output .= '"fi": "'.$spotter_item['flightaware_id'].'",';
311
+							} else {
312
+								$output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",';
313
+							}
264 314
 						} elseif (isset($spotter_item['famtrackid'])) {
265
-							if ($compress) $output .= '"fti": "'.$spotter_item['famtrackid'].'",';
266
-							else $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",';
315
+							if ($compress) {
316
+								$output .= '"fti": "'.$spotter_item['famtrackid'].'",';
317
+							} else {
318
+								$output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",';
319
+							}
267 320
 						} elseif (isset($spotter_item['fammarine_id'])) {
268
-							if ($compress) $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",';
269
-							else $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",';
321
+							if ($compress) {
322
+								$output .= '"fmi": "'.$spotter_item['fammarine_id'].'",';
323
+							} else {
324
+								$output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",';
325
+							}
270 326
 						}
271 327
 						$output .= '"fc": "'.$flightcnt.'",';
272 328
 						$output .= '"sqt": "'.$sqltime.'",';
273
-						if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
329
+						if (isset($begindate)) {
330
+							$output .= '"archive_date": "'.$begindate.'",';
331
+						}
274 332
 
275 333
 /*
276 334
 							if ($min) $output .= '"minimal": "true",';
@@ -278,16 +336,25 @@  discard block
 block discarded – undo
278 336
 */
279 337
 							//$output .= '"fc": "'.$spotter_item['nb'].'",';
280 338
 						if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') {
281
-							if ($compress) $output .= '"c": '.json_encode(str_replace('\\','',$spotter_item['ident'])).',';
282
-							else $output .= '"callsign": '.json_encode(str_replace('\\','',$spotter_item['ident'])).',';
339
+							if ($compress) {
340
+								$output .= '"c": '.json_encode(str_replace('\\','',$spotter_item['ident'])).',';
341
+							} else {
342
+								$output .= '"callsign": '.json_encode(str_replace('\\','',$spotter_item['ident'])).',';
343
+							}
283 344
 							//'
284 345
 						} else {
285
-							if ($compress) $output .= '"c": "NA",';
286
-							else $output .= '"callsign": "NA",';
346
+							if ($compress) {
347
+								$output .= '"c": "NA",';
348
+							} else {
349
+								$output .= '"callsign": "NA",';
350
+							}
287 351
 						}
288 352
 						if (isset($spotter_item['registration'])) {
289
-							if ($compress) $output .= '"reg": '.json_encode($spotter_item['registration']).',';
290
-							else $output .= '"registration": '.json_encode($spotter_item['registration']).',';
353
+							if ($compress) {
354
+								$output .= '"reg": '.json_encode($spotter_item['registration']).',';
355
+							} else {
356
+								$output .= '"registration": '.json_encode($spotter_item['registration']).',';
357
+							}
291 358
 						}
292 359
 						if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) {
293 360
 							$output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",';
@@ -298,20 +365,30 @@  discard block
 block discarded – undo
298 365
 							$output .= '"aircraft_name": "NA",';
299 366
 						}
300 367
 						if (isset($spotter_item['aircraft_icao'])) {
301
-							if ($compress) $output .= '"ai": "'.$spotter_item['aircraft_icao'].'",';
302
-							else $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
368
+							if ($compress) {
369
+								$output .= '"ai": "'.$spotter_item['aircraft_icao'].'",';
370
+							} else {
371
+								$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
372
+							}
303 373
 						}
304 374
 						if (!isset($spotter_item['aircraft_shadow']) && !$tracker && !$marine) {
305
-							if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = '';
306
-							else {
375
+							if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') {
376
+								$spotter_item['aircraft_shadow'] = '';
377
+							} else {
307 378
 								$aircraft_icao = $spotter_item['aircraft_icao'];
308
-								if (isset($aircrafts_shadow[$aircraft_icao])) $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao];
309
-								else {
379
+								if (isset($aircrafts_shadow[$aircraft_icao])) {
380
+									$spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao];
381
+								} else {
310 382
 									$aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']);
311
-									if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
312
-									elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png';
313
-									elseif ($aircraft_icao == 'PARAGLIDER') $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png';
314
-									else $spotter_item['aircraft_shadow'] = '';
383
+									if (count($aircraft_info) > 0) {
384
+										$spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
385
+									} elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') {
386
+										$spotter_item['aircraft_shadow'] = 'PA18.png';
387
+									} elseif ($aircraft_icao == 'PARAGLIDER') {
388
+										$spotter_item['aircraft_shadow'] = 'PARAGLIDER.png';
389
+									} else {
390
+										$spotter_item['aircraft_shadow'] = '';
391
+									}
315 392
 									$aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow'];
316 393
 								}
317 394
 							}
@@ -319,90 +396,171 @@  discard block
 block discarded – undo
319 396
 						if (!isset($spotter_item['aircraft_shadow']) || $spotter_item['aircraft_shadow'] == '') {
320 397
 							if ($tracker) {
321 398
 								if (isset($spotter_item['type']) && $spotter_item['type'] == 'Ambulance') {
322
-									if ($compress) $output .= '"as": "ambulance.png",';
323
-									else $output .= '"aircraft_shadow": "ambulance.png",';
399
+									if ($compress) {
400
+										$output .= '"as": "ambulance.png",';
401
+									} else {
402
+										$output .= '"aircraft_shadow": "ambulance.png",';
403
+									}
324 404
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') {
325
-									if ($compress) $output .= '"as": "police.png",';
326
-									else $output .= '"aircraft_shadow": "police.png",';
405
+									if ($compress) {
406
+										$output .= '"as": "police.png",';
407
+									} else {
408
+										$output .= '"aircraft_shadow": "police.png",';
409
+									}
327 410
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') {
328
-									if ($compress) $output .= '"as": "ship.png",';
329
-									else $output .= '"aircraft_shadow": "ship.png",';
411
+									if ($compress) {
412
+										$output .= '"as": "ship.png",';
413
+									} else {
414
+										$output .= '"aircraft_shadow": "ship.png",';
415
+									}
330 416
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') {
331
-									if ($compress) $output .= '"as": "ship.png",';
332
-									else $output .= '"aircraft_shadow": "ship.png",';
417
+									if ($compress) {
418
+										$output .= '"as": "ship.png",';
419
+									} else {
420
+										$output .= '"aircraft_shadow": "ship.png",';
421
+									}
333 422
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') {
334
-									if ($compress) $output .= '"as": "ship.png",';
335
-									else $output .= '"aircraft_shadow": "ship.png",';
423
+									if ($compress) {
424
+										$output .= '"as": "ship.png",';
425
+									} else {
426
+										$output .= '"aircraft_shadow": "ship.png",';
427
+									}
336 428
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') {
337
-									if ($compress) $output .= '"as": "truck.png",';
338
-									else $output .= '"aircraft_shadow": "truck.png",';
429
+									if ($compress) {
430
+										$output .= '"as": "truck.png",';
431
+									} else {
432
+										$output .= '"aircraft_shadow": "truck.png",';
433
+									}
339 434
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') {
340
-									if ($compress) $output .= '"as": "truck.png",';
341
-									else $output .= '"aircraft_shadow": "truck.png",';
435
+									if ($compress) {
436
+										$output .= '"as": "truck.png",';
437
+									} else {
438
+										$output .= '"aircraft_shadow": "truck.png",';
439
+									}
342 440
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') {
343
-									if ($compress) $output .= '"as": "aircraft.png",';
344
-									else $output .= '"aircraft_shadow": "aircraft.png",';
441
+									if ($compress) {
442
+										$output .= '"as": "aircraft.png",';
443
+									} else {
444
+										$output .= '"aircraft_shadow": "aircraft.png",';
445
+									}
345 446
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') {
346
-									if ($compress) $output .= '"as": "aircraft.png",';
347
-									else $output .= '"aircraft_shadow": "aircraft.png",';
447
+									if ($compress) {
448
+										$output .= '"as": "aircraft.png",';
449
+									} else {
450
+										$output .= '"aircraft_shadow": "aircraft.png",';
451
+									}
348 452
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') {
349
-									if ($compress) $output .= '"as": "helico.png",';
350
-									else $output .= '"aircraft_shadow": "helico.png",';
453
+									if ($compress) {
454
+										$output .= '"as": "helico.png",';
455
+									} else {
456
+										$output .= '"aircraft_shadow": "helico.png",';
457
+									}
351 458
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') {
352
-									if ($compress) $output .= '"as": "rail.png",';
353
-									else $output .= '"aircraft_shadow": "rail.png",';
459
+									if ($compress) {
460
+										$output .= '"as": "rail.png",';
461
+									} else {
462
+										$output .= '"aircraft_shadow": "rail.png",';
463
+									}
354 464
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') {
355
-									if ($compress) $output .= '"as": "firetruck.png",';
356
-									else $output .= '"aircraft_shadow": "firetruck.png",';
465
+									if ($compress) {
466
+										$output .= '"as": "firetruck.png",';
467
+									} else {
468
+										$output .= '"aircraft_shadow": "firetruck.png",';
469
+									}
357 470
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') {
358
-									if ($compress) $output .= '"as": "bus.png",';
359
-									else $output .= '"aircraft_shadow": "bus.png",';
471
+									if ($compress) {
472
+										$output .= '"as": "bus.png",';
473
+									} else {
474
+										$output .= '"aircraft_shadow": "bus.png",';
475
+									}
360 476
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') {
361
-									if ($compress) $output .= '"as": "phone.png",';
362
-									else $output .= '"aircraft_shadow": "phone.png",';
477
+									if ($compress) {
478
+										$output .= '"as": "phone.png",';
479
+									} else {
480
+										$output .= '"aircraft_shadow": "phone.png",';
481
+									}
363 482
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') {
364
-									if ($compress) $output .= '"as": "jogger.png",';
365
-									else $output .= '"aircraft_shadow": "jogger.png",';
483
+									if ($compress) {
484
+										$output .= '"as": "jogger.png",';
485
+									} else {
486
+										$output .= '"aircraft_shadow": "jogger.png",';
487
+									}
366 488
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') {
367
-									if ($compress) $output .= '"as": "bike.png",';
368
-									else $output .= '"aircraft_shadow": "bike.png",';
489
+									if ($compress) {
490
+										$output .= '"as": "bike.png",';
491
+									} else {
492
+										$output .= '"aircraft_shadow": "bike.png",';
493
+									}
369 494
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') {
370
-									if ($compress) $output .= '"as": "motorcycle.png",';
371
-									else $output .= '"aircraft_shadow": "motorcycle.png",';
495
+									if ($compress) {
496
+										$output .= '"as": "motorcycle.png",';
497
+									} else {
498
+										$output .= '"aircraft_shadow": "motorcycle.png",';
499
+									}
372 500
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') {
373
-									if ($compress) $output .= '"as": "balloon.png",';
374
-									else $output .= '"aircraft_shadow": "balloon.png",';
501
+									if ($compress) {
502
+										$output .= '"as": "balloon.png",';
503
+									} else {
504
+										$output .= '"aircraft_shadow": "balloon.png",';
505
+									}
375 506
 								} else {
376
-									if ($compress) $output .= '"as": "car.png",';
377
-									else $output .= '"aircraft_shadow": "car.png",';
507
+									if ($compress) {
508
+										$output .= '"as": "car.png",';
509
+									} else {
510
+										$output .= '"aircraft_shadow": "car.png",';
511
+									}
378 512
 								}
379 513
 							} elseif ($marine) {
380 514
 								if (isset($spotter_item['type']) && ($spotter_item['type']  == '50&#39; Performance Cruiser' || $spotter_item['type']  == '50\' Performance Cruiser' || $spotter_item['type'] == 'Sail')) {
381
-									if ($compress) $output .= '"as": "50perfcruiser.png",';
382
-									else $output .= '"aircraft_shadow": "50perfcruiser.png",';
515
+									if ($compress) {
516
+										$output .= '"as": "50perfcruiser.png",';
517
+									} else {
518
+										$output .= '"aircraft_shadow": "50perfcruiser.png",';
519
+									}
383 520
 								} elseif (isset($spotter_item['type']) && $spotter_item['type']  == 'Sailaway Cruiser 38') {
384
-									if ($compress) $output .= '"as": "cruiser38.png",';
385
-									else $output .= '"aircraft_shadow": "cruiser38.png",';
521
+									if ($compress) {
522
+										$output .= '"as": "cruiser38.png",';
523
+									} else {
524
+										$output .= '"aircraft_shadow": "cruiser38.png",';
525
+									}
386 526
 								} elseif (isset($spotter_item['type']) && $spotter_item['type']  == 'Mini Transat') {
387
-									if ($compress) $output .= '"as": "transat.png",';
388
-									else $output .= '"aircraft_shadow": "transat.png",';
527
+									if ($compress) {
528
+										$output .= '"as": "transat.png",';
529
+									} else {
530
+										$output .= '"aircraft_shadow": "transat.png",';
531
+									}
389 532
 								} elseif (isset($spotter_item['type']) && $spotter_item['type']  == '52&#39; Cruising Cat') {
390
-									if ($compress) $output .= '"as": "catamaran.png",';
391
-									else $output .= '"aircraft_shadow": "catamaran.png",';
533
+									if ($compress) {
534
+										$output .= '"as": "catamaran.png",';
535
+									} else {
536
+										$output .= '"aircraft_shadow": "catamaran.png",';
537
+									}
392 538
 								} elseif (isset($spotter_item['type']) && $spotter_item['type']  == 'Caribbean Rose') {
393
-									if ($compress) $output .= '"as": "carib.png",';
394
-									else $output .= '"aircraft_shadow": "carib.png",';
539
+									if ($compress) {
540
+										$output .= '"as": "carib.png",';
541
+									} else {
542
+										$output .= '"aircraft_shadow": "carib.png",';
543
+									}
395 544
 								} else {
396
-									if ($compress) $output .= '"as": "ship.png",';
397
-									else $output .= '"aircraft_shadow": "ship.png",';
545
+									if ($compress) {
546
+										$output .= '"as": "ship.png",';
547
+									} else {
548
+										$output .= '"aircraft_shadow": "ship.png",';
549
+									}
398 550
 								}
399 551
 							} else {
400
-								if ($compress) $output .= '"as": "default.png",';
401
-								else $output .= '"aircraft_shadow": "default.png",';
552
+								if ($compress) {
553
+									$output .= '"as": "default.png",';
554
+								} else {
555
+									$output .= '"aircraft_shadow": "default.png",';
556
+								}
402 557
 							}
403 558
 						} else {
404
-							if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
405
-							else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
559
+							if ($compress) {
560
+								$output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
561
+							} else {
562
+								$output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
563
+							}
406 564
 						}
407 565
 						if (isset($spotter_item['airline_name'])) {
408 566
 							$output .= '"airline_name": "'.$spotter_item['airline_name'].'",';
@@ -410,8 +568,11 @@  discard block
 block discarded – undo
410 568
 							$output .= '"airline_name": "NA",';
411 569
 						}
412 570
 						if (isset($spotter_item['departure_airport'])) {
413
-							if ($compress) $output .= '"dac": "'.$spotter_item['departure_airport'].'",';
414
-							else $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",';
571
+							if ($compress) {
572
+								$output .= '"dac": "'.$spotter_item['departure_airport'].'",';
573
+							} else {
574
+								$output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",';
575
+							}
415 576
 						}
416 577
 						if (isset($spotter_item['departure_airport_city'])) {
417 578
 							$output .= '"departure_airport": "'.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_country'].'",';
@@ -423,8 +584,11 @@  discard block
 block discarded – undo
423 584
 							$output .= '"arrival_airport_time": "'.$spotter_item['arrival_airport_time'].'",';
424 585
 						}
425 586
 						if (isset($spotter_item['arrival_airport'])) {
426
-							if ($compress) $output .= '"aac": "'.$spotter_item['arrival_airport'].'",';
427
-							else $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",';
587
+							if ($compress) {
588
+								$output .= '"aac": "'.$spotter_item['arrival_airport'].'",';
589
+							} else {
590
+								$output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",';
591
+							}
428 592
 						}
429 593
 						if (isset($spotter_item['arrival_airport_city'])) {
430 594
 							$output .= '"arrival_airport": "'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].'",';
@@ -443,11 +607,17 @@  discard block
 block discarded – undo
443 607
 						}
444 608
 						
445 609
 						if (isset($spotter_item['real_altitude'])) {
446
-							if ($compress) $output .= '"a": "'.($spotter_item['real_altitude']/100).'",';
447
-							else $output .= '"altitude": "'.($spotter_item['real_altitude']/100).'",';
610
+							if ($compress) {
611
+								$output .= '"a": "'.($spotter_item['real_altitude']/100).'",';
612
+							} else {
613
+								$output .= '"altitude": "'.($spotter_item['real_altitude']/100).'",';
614
+							}
448 615
 						} elseif (isset($spotter_item['altitude'])) {
449
-							if ($compress) $output .= '"a": "'.$spotter_item['altitude'].'",';
450
-							else $output .= '"altitude": "'.$spotter_item['altitude'].'",';
616
+							if ($compress) {
617
+								$output .= '"a": "'.$spotter_item['altitude'].'",';
618
+							} else {
619
+								$output .= '"altitude": "'.$spotter_item['altitude'].'",';
620
+							}
451 621
 						}
452 622
 						
453 623
 						$heading = $spotter_item['heading'];
@@ -471,19 +641,24 @@  discard block
 block discarded – undo
471 641
 							}
472 642
 						}
473 643
 						
474
-						if ($compress)$output .= '"h": "'.$heading.'",';
475
-						else $output .= '"heading": "'.$heading.'",';
644
+						if ($compress) {
645
+							$output .= '"h": "'.$heading.'",';
646
+						} else {
647
+							$output .= '"heading": "'.$heading.'",';
648
+						}
476 649
 						if ($currenttime != '') {
477 650
 							if (strtotime($spotter_item['date']) < $currenttime) {
478 651
 								if (isset($archivespeed)) {
479 652
 									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
480 653
 									$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
481
-									if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
482
-									else {
654
+									if (!isset($idistance) || $fdistance < $idistance) {
655
+										$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
656
+									} else {
483 657
 										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
484 658
 										$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
485
-										if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
486
-										else {
659
+										if (!isset($idistance) || $fdistance < $idistance) {
660
+											$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
661
+										} else {
487 662
 											$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed);
488 663
 											$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
489 664
 										}
@@ -491,12 +666,14 @@  discard block
 block discarded – undo
491 666
 								} elseif ($usenextlatlon) {
492 667
 									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
493 668
 									$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
494
-									if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
495
-									else {
669
+									if (!isset($idistance) || $fdistance < $idistance) {
670
+										$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
671
+									} else {
496 672
 										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
497 673
 										$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
498
-										if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
499
-										else {
674
+										if (!isset($idistance) || $fdistance < $idistance) {
675
+											$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
676
+										} else {
500 677
 											$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading);
501 678
 											$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
502 679
 										}
@@ -535,7 +712,9 @@  discard block
 block discarded – undo
535 712
 							}
536 713
 						}
537 714
 
538
-						if (!$min) $output .= '"image": "'.$image.'",';
715
+						if (!$min) {
716
+							$output .= '"image": "'.$image.'",';
717
+						}
539 718
 						if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') {
540 719
 							$output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",';
541 720
 						}
@@ -543,8 +722,11 @@  discard block
 block discarded – undo
543 722
 							$output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",';
544 723
 						}
545 724
 						if (isset($spotter_item['squawk'])) {
546
-							if ($compress) $output .= '"sq": "'.$spotter_item['squawk'].'",';
547
-							else $output .= '"squawk": "'.$spotter_item['squawk'].'",';
725
+							if ($compress) {
726
+								$output .= '"sq": "'.$spotter_item['squawk'].'",';
727
+							} else {
728
+								$output .= '"squawk": "'.$spotter_item['squawk'].'",';
729
+							}
548 730
 						}
549 731
 						if (isset($spotter_item['squawk_usage'])) {
550 732
 							$output .= '"squawk_usage": "'.$spotter_item['squawk_usage'].'",';
@@ -575,14 +757,23 @@  discard block
 block discarded – undo
575 757
 						}
576 758
 						// type when not aircraft ?
577 759
 						if (isset($spotter_item['type'])) {
578
-							if ($compress) $output .= '"t": "'.$spotter_item['type'].'"';
579
-							else $output .= '"type": "'.$spotter_item['type'].'"';
760
+							if ($compress) {
761
+								$output .= '"t": "'.$spotter_item['type'].'"';
762
+							} else {
763
+								$output .= '"type": "'.$spotter_item['type'].'"';
764
+							}
580 765
 						} elseif ($marine) {
581
-							if ($compress) $output .= '"t": "ship"';
582
-							else $output .= '"type": "ship"';
766
+							if ($compress) {
767
+								$output .= '"t": "ship"';
768
+							} else {
769
+								$output .= '"type": "ship"';
770
+							}
583 771
 						} else {
584
-							if ($compress) $output .= '"t": "aircraft"';
585
-							else $output .= '"type": "aircraft"';
772
+							if ($compress) {
773
+								$output .= '"t": "aircraft"';
774
+							} else {
775
+								$output .= '"type": "aircraft"';
776
+							}
586 777
 						}
587 778
 						$output .= '},';
588 779
 						$output .= '"geometry": {';
@@ -590,15 +781,19 @@  discard block
 block discarded – undo
590 781
 								$output .= '"coordinates": [';
591 782
 								if ($currenttime != '') {
592 783
 									if (strtotime($spotter_item['date']) < $currenttime) {
593
-										if (!isset($archivespeed)) $archivespeed = 1;
784
+										if (!isset($archivespeed)) {
785
+											$archivespeed = 1;
786
+										}
594 787
 										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date'])));
595 788
 										$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
596
-										if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
597
-										else {
789
+										if (!isset($idistance) || $fdistance < $idistance) {
790
+											$output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
791
+										} else {
598 792
 											$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date'])));
599 793
 											$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
600
-											if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
601
-											else {
794
+											if (!isset($idistance) || $fdistance < $idistance) {
795
+												$output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
796
+											} else {
602 797
 												$output .= $spotter_item['longitude'].', ';
603 798
 												$output .= $spotter_item['latitude'];
604 799
 											}
@@ -676,7 +871,9 @@  discard block
 block discarded – undo
676 871
 			}
677 872
 */
678 873
 				$history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING);
679
-				if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history'];
874
+				if ($history == '' && isset($_COOKIE['history'])) {
875
+					$history = $_COOKIE['history'];
876
+				}
680 877
 				
681 878
 				if (
682 879
 				    (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') 
@@ -746,8 +943,11 @@  discard block
 block discarded – undo
746 943
 									$output_history .= ']}},';
747 944
 									$output .= $output_history;
748 945
 								}
749
-								if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
750
-								else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
946
+								if ($compress) {
947
+									$output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
948
+								} else {
949
+									$output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
950
+								}
751 951
 							}
752 952
 							$output_history .= '[';
753 953
 							$output_history .=  $spotter_history['longitude'].', ';
@@ -768,10 +968,15 @@  discard block
 block discarded – undo
768 968
 							if ($d == false) {
769 969
 								if ($compress) {
770 970
 									$output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'",';
771
-									if (isset($spotter_history_array[0]['mapmatching_engine']) && $spotter_history_array[0]['mapmatching_engine'] == 'graphhopper') $output_history .= '"atr": "Powered by <a href=\"https://www.graphhopper.com/\">GraphHopper API</a>", Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",';
772
-									elseif (isset($spotter_history_array[0]['mapmatching_engine'])) $output_history .= '"atr": "Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",';
971
+									if (isset($spotter_history_array[0]['mapmatching_engine']) && $spotter_history_array[0]['mapmatching_engine'] == 'graphhopper') {
972
+										$output_history .= '"atr": "Powered by <a href=\"https://www.graphhopper.com/\">GraphHopper API</a>", Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",';
973
+									} elseif (isset($spotter_history_array[0]['mapmatching_engine'])) {
974
+										$output_history .= '"atr": "Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",';
975
+									}
773 976
 									$output_history .= '"t": "history"},"geometry": {"type": "LineString","coordinates": [';
774
-								} else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": [';
977
+								} else {
978
+									$output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": [';
979
+								}
775 980
 								$d = true;
776 981
 							}
777 982
 							$output_history .= '[';
@@ -794,7 +999,9 @@  discard block
 block discarded – undo
794 999
 							$output_historyd = '[';
795 1000
 							$output_historyd .=  $spotter_item['longitude'].', ';
796 1001
 							$output_historyd .=  $spotter_item['latitude'];
797
-							if (isset($spotter_history['altitude'])) $output_historyd .=  ','.$spotter_item['altitude']*30.48;
1002
+							if (isset($spotter_history['altitude'])) {
1003
+								$output_historyd .=  ','.$spotter_item['altitude']*30.48;
1004
+							}
798 1005
 							$output_historyd .= '],';
799 1006
 							//$output_history = $output_historyd.$output_history;
800 1007
 							$output_history = $output_history.$output_historyd;
@@ -822,8 +1029,11 @@  discard block
 block discarded – undo
822 1029
 				        && $spotter_item['arrival_airport'] != 'NA' 
823 1030
 				        && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") 
824 1031
 				    	    || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) {
825
-				    if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
826
-				    else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
1032
+				    if ($compress) {
1033
+				    	$output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
1034
+				    } else {
1035
+				    	$output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
1036
+				    }
827 1037
 				    if (isset($spotter_item['departure_airport_latitude'])) {
828 1038
 					$output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],';
829 1039
 				    } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') {
@@ -856,8 +1066,11 @@  discard block
 block discarded – undo
856 1066
 				    	    || (!isset($_COOKIE['MapRemainingRoute']) && (!isset($globalMapRemainingRoute) 
857 1067
 				    	    || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) {
858 1068
 				    $havedata = false;
859
-				    if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
860
-				    else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
1069
+				    if ($compress) {
1070
+				    	$output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
1071
+				    } else {
1072
+				    	$output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
1073
+				    }
861 1074
 				    
862 1075
 				    //$output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],';
863 1076
 				    if (isset($spotter_item['arrival_airport_latitude'])) {
@@ -882,7 +1095,9 @@  discard block
 block discarded – undo
882 1095
 					$output_dest  = substr($output_dest, 0, -1);
883 1096
 				    }
884 1097
 				    $output_dest .= ']}},';
885
-				    if ($havedata) $output .= $output_dest;
1098
+				    if ($havedata) {
1099
+				    	$output .= $output_dest;
1100
+				    }
886 1101
 				    unset($output_dest);
887 1102
 				}
888 1103
 			}
@@ -890,7 +1105,9 @@  discard block
 block discarded – undo
890 1105
 			$output .= ']';
891 1106
 			$output .= ',"initial_sqltime": "'.$sqltime.'",';
892 1107
 			$output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",';
893
-			if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
1108
+			if (isset($begindate)) {
1109
+				$output .= '"archive_date": "'.$begindate.'",';
1110
+			}
894 1111
 			$output .= '"fc": "'.$j.'"';
895 1112
 		} else {
896 1113
 			$output .= '"features": ';
Please login to merge, or discard this patch.
index.php 2 patches
Indentation   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     <?php }; if (isset($globalSatellite) && $globalSatellite) { ?><td><div id="ibxsatellite"><h4><?php echo _("Satellites Displayed"); ?></h4><br /><i class="fa fa-spinner fa-pulse fa-fw"></i></div></td><?php } ?>
56 56
 </tr></table></div>
57 57
 <?php
58
-    if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
58
+	if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
59 59
 ?>
60 60
 <script src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) print '?tsk='.$tsk; ?>"></script>
61 61
 <script src="<?php echo $globalURL; ?>/js/meuusjs.1.0.3.min.js"></script>
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 <script src="<?php echo $globalURL; ?>/js/map-marine.3d.js.php"></script>
82 82
 <?php
83 83
 	}
84
-    }
84
+	}
85 85
 ?>
86 86
 
87 87
 <div id="sidebar" class="sidebar collapsed">
@@ -92,13 +92,13 @@  discard block
 block discarded – undo
92 92
 	<li><a href="" onclick="getUserLocation(); return false;" title="<?php echo _("Plot your Location"); ?>"><i class="fa fa-map-marker"></i></a></li>
93 93
 	<li><a href="" onclick="getCompassDirection(); return false;" title="<?php echo _("Compass Mode"); ?>"><i class="fa fa-compass"></i></a></li>
94 94
 <?php
95
-    //if ((isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') || (isset($globalBeta) && $globalBeta === TRUE)) {
95
+	//if ((isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') || (isset($globalBeta) && $globalBeta === TRUE)) {
96 96
 	if (isset($globalArchive) && $globalArchive == TRUE && (!isset($globalAircraft) || $globalAircraft === TRUE)) {
97 97
 ?>
98 98
 	<li><a href="#archive" role="tab" title="<?php echo _("Archive"); ?>"><i class="fa fa-archive"></i></a></li>
99 99
 <?php
100 100
 	}
101
-    //}
101
+	//}
102 102
 ?>
103 103
 	<li><a href="#home" role="tab" title="<?php echo _("Layers"); ?>"><i class="fa fa-map"></i></a></li>
104 104
 	<li><a href="#filters" role="tab" title="<?php echo _("Filters"); ?>"><i class="fa fa-filter"></i></a></li>
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 ?>
113 113
 
114 114
 <?php
115
-    if (isset($globalMap3D) && $globalMap3D) {
115
+	if (isset($globalMap3D) && $globalMap3D) {
116 116
 	if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
117 117
 ?>
118 118
 	<li><a href="" onclick="show3D(); return false;" role="tab" title="3D"><b>3D</b></a></li>
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	<li><a href="" onclick="show2D(); return false;" role="tab" title="2D"><b>2D</b></a></li>
123 123
 <?php
124 124
 	}
125
-    }
125
+	}
126 126
 ?>
127 127
     </ul>
128 128
 
@@ -306,15 +306,15 @@  discard block
 block discarded – undo
306 306
 		    </div>
307 307
 		</li>
308 308
 		<?php
309
-		    if (isset($globalDemo) && $globalDemo) {
309
+			if (isset($globalDemo) && $globalDemo) {
310 310
 		?>
311 311
 		<li><button type="button" class="btn btn-primary disabled"><?php echo _("Show archive"); ?></button> Disabled in Demo mode</li>
312 312
 		<?php
313
-		    } else {
313
+			} else {
314 314
 		?>
315 315
 		<li><button type="button" onclick="addarchive(begindate,enddate);" class="btn btn-primary"><?php echo _("Show archive"); ?></button></li>
316 316
 		<?php
317
-		    }
317
+			}
318 318
 		?>
319 319
 	    </ul>
320 320
 	    <ul>
@@ -333,83 +333,83 @@  discard block
 block discarded – undo
333 333
 				if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
334 334
 					if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider;
335 335
 					else $MapType = $_COOKIE['MapType'];
336
-			    ?>
336
+				?>
337 337
 			<select  class="selectpicker" onchange="mapType(this);">
338 338
 			    <?php
339 339
 				} else {
340 340
 					if (!isset($_COOKIE['MapType3D']) || $_COOKIE['MapType3D'] == '') $MapType = $globalMapProvider;
341 341
 					else $MapType = $_COOKIE['MapType3D'];
342
-			    ?>
342
+				?>
343 343
 			<select  class="selectpicker" onchange="mapType3D(this);">
344 344
 			    <?php
345 345
 				}
346
-			    ?>
346
+				?>
347 347
 			    <?php
348 348
 				if (isset($globalMapOffline) && $globalMapOffline === TRUE) {
349
-			    ?>
349
+				?>
350 350
 			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option>
351 351
 			    <?php
352 352
 				} else {
353
-				    if (file_exists(dirname(__FILE__).'/js/Cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml')) {
354
-			    ?>
353
+					if (file_exists(dirname(__FILE__).'/js/Cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml')) {
354
+				?>
355 355
 			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option>
356 356
 			    <?php
357
-				    }
358
-			    ?>
357
+					}
358
+				?>
359 359
 			    <option value="ArcGIS-Streetmap"<?php if ($MapType == 'ArcGIS-Streetmap') print ' selected'; ?>>ArcGIS Streetmap</option>
360 360
 			    <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Satellite') print ' selected'; ?>>ArcGIS Satellite</option>
361 361
 			    <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Ocean') print ' selected'; ?>>ArcGIS Ocean</option>
362 362
 			    <?php
363
-				    if (isset($globalBingMapKey) && $globalBingMapKey != '') {
364
-			    ?>
363
+					if (isset($globalBingMapKey) && $globalBingMapKey != '') {
364
+				?>
365 365
 			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option>
366 366
 			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option>
367 367
 			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option>
368 368
 			    <?php
369
-				    }
370
-			    ?>
369
+					}
370
+				?>
371 371
 			    <?php
372
-				    if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
373
-			    ?>
372
+					if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
373
+				?>
374 374
 			    <?php
375 375
 					if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
376
-			    ?>
376
+				?>
377 377
 			    <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option>
378 378
 			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option>
379 379
 			    <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option>
380 380
 			    <?php
381 381
 					}
382
-			    ?>
382
+				?>
383 383
 			    <?php
384 384
 					if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
385
-			    ?>
385
+				?>
386 386
 			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option>
387 387
 			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option>
388 388
 			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option>
389 389
 			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option>
390 390
 			    <?php
391 391
 					}
392
-			    ?>
392
+				?>
393 393
 			    <?php
394 394
 					if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
395
-			    ?>
395
+				?>
396 396
 			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option>
397 397
 			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option>
398 398
 			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option>
399 399
 			    <?php
400 400
 					}
401
-			    ?>
401
+				?>
402 402
 			    <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option>
403 403
 			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth</option>
404 404
 			    <?php
405
-				    }
406
-			    ?>
405
+					}
406
+				?>
407 407
 			    <option value="NatGeo-Street"<?php if ($MapType == 'NatGeo-Street') print ' selected'; ?>>National Geographic Street</option>
408 408
 			    <?php
409
-				    if (isset($globalMapboxToken) && $globalMapboxToken != '') {
409
+					if (isset($globalMapboxToken) && $globalMapboxToken != '') {
410 410
 					if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default';
411 411
 					else $MapBoxId = $_COOKIE['MapTypeId'];
412
-			    ?>
412
+				?>
413 413
 			    <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') print ' selected'; ?>>Mapbox GL</option>
414 414
 			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option>
415 415
 			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option>
@@ -424,16 +424,16 @@  discard block
 block discarded – undo
424 424
 			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option>
425 425
 			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option>
426 426
 			    <?php
427
-				    }
428
-			    ?>
427
+					}
428
+				?>
429 429
 			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option>
430 430
 			    <?php
431 431
 				}
432
-			    ?>
432
+				?>
433 433
 			</select>
434 434
 		    </li>
435 435
 <?php
436
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d' && (!isset($globalMapOffline) || $globalMapOffline === FALSE)) {
436
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d' && (!isset($globalMapOffline) || $globalMapOffline === FALSE)) {
437 437
 ?>
438 438
 		    <li><?php echo _("Type of Terrain:"); ?>
439 439
 			<select  class="selectpicker" onchange="terrainType(this);">
@@ -444,18 +444,18 @@  discard block
 block discarded – undo
444 444
 			</select>
445 445
 		    </li>
446 446
 <?php
447
-    }
447
+	}
448 448
 ?>
449 449
 
450 450
 <?php
451
-    if (isset($globalMap3D) && $globalMap3D) {
451
+	if (isset($globalMap3D) && $globalMap3D) {
452 452
 ?>
453 453
 		    <li><div class="checkbox"><label><input type="checkbox" name="synchro2d3d" value="1" onclick="clickSyncMap2D3D(this)" <?php if (isset($_COOKIE['Map2D3DSync']) && $_COOKIE['Map2D3DSync'] == 'true') print 'checked'; ?> ><?php echo _("Use same type of map for 2D & 3D"); ?></label></div></li>
454 454
 <?php
455
-    }
455
+	}
456 456
 ?>
457 457
 <?php
458
-    if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
458
+	if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
459 459
 ?>
460 460
 		    <li><div class="checkbox"><label><input type="checkbox" name="display2dbuildings" value="1" onclick="clickDisplay2DBuildings(this)" <?php if (isset($_COOKIE['Map2DBuildings']) && $_COOKIE['Map2DBuildings'] == 'true') print 'checked'; ?> ><?php echo _("Display 2.5D buidings on map"); ?></label></div></li>
461 461
 
@@ -478,12 +478,12 @@  discard block
 block discarded – undo
478 478
 		    <li><div class="checkbox"><label><input type="checkbox" name="satelliteestimation" value="1" onclick="clickSatelliteEstimation(this)" <?php if ((isset($_COOKIE['satelliteestimation']) && $_COOKIE['satelliteestimation'] == 'true') || (!isset($_COOKIE['satelliteestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['satelliteestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Satellites animate between updates"); ?></label></div></li>
479 479
 <?php
480 480
 	}
481
-    }
482
-    if (!isset($globalAircraft) || $globalAircraft === TRUE) {
481
+	}
482
+	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
483 483
 ?>
484 484
 		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true' || !isset($_COOKIE['displayairports'])) print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li>
485 485
 <?php
486
-    }
486
+	}
487 487
 ?>
488 488
 		    <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) print 'checked'; ?> ><?php echo _("Display ground station on map"); ?></label></div></li>
489 489
 		    <li><div class="checkbox"><label><input type="checkbox" name="displayweatherstation" value="1" onclick="clickDisplayWeatherStation(this)" <?php if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) print 'checked'; ?> ><?php echo _("Display weather station on map"); ?></label></div></li>
@@ -502,88 +502,88 @@  discard block
 block discarded – undo
502 502
 ?>
503 503
 		    <li><div class="checkbox"><label><input type="checkbox" name="truelight" value="1" onclick="clickTrueLight(this)" <?php if ((!isset($_COOKIE['truelight']) && (!isset($globalMapTrueLight) || $globalMapTrueLight)) || (isset($_COOKIE['truelight']) && $_COOKIE['truelight'] == 'true')) print 'checked'; ?> ><?php echo _("Enable globe sun lighting"); ?></label></div></li>
504 504
 <?php
505
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
505
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
506 506
 ?>
507 507
 		    <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) print 'checked'; ?> ><?php echo _("Show mini-map"); ?></label></div></li>
508 508
 		    <li><div class="checkbox"><label><input type="checkbox" name="shadows" value="1" onclick="clickShadows(this)" <?php if ((!isset($_COOKIE['map3dnoshadows']) && (!isset($globalMap3DShadows) || $globalMap3DShadows)) || (isset($_COOKIE['map3dnoshadows']) && $_COOKIE['map3dnoshadows'] == 'false')) print 'checked'; ?> ><?php echo _("Use shadows"); ?></label></div></li>
509 509
 		    <li><div class="checkbox"><label><input type="checkbox" name="one3dmodel" value="1" onclick="useOne3Dmodel(this)" <?php if ((isset($_COOKIE['one3dmodel']) && $_COOKIE['one3dmodel'] == 'true') || (!isset($_COOKIE['one3dmodel']) && isset($globalMap3DOneModel) && $globalMap3DOneModel)) print 'checked'; ?> ><?php echo _("Use same 3D model for all aircraft (use fewer resources)"); ?></label></div></li>
510 510
 		    <li><div class="checkbox"><label><input type="checkbox" name="updaterealtime" value="1" onclick="clickUpdateRealtime(this)" <?php if ((isset($_COOKIE['updaterealtime']) && $_COOKIE['updaterealtime'] == 'true') || !isset($_COOKIE['updaterealtime'])) print 'checked'; ?> ><?php echo _("Display realtime data in infobox"); ?></label></div></li>
511 511
 <?php
512
-    }
513
-    if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
512
+	}
513
+	if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
514 514
 ?>
515 515
 		    <li><div class="checkbox"><label><input type="checkbox" name="displaysanta" value="1" onclick="clickSanta(this)"><i class="fa fa-snowflake-o" aria-hidden="true"></i> <?php echo _("Show Santa Claus now"); ?> <i class="fa fa-snowflake-o" aria-hidden="true"></i></label></div></li>
516 516
 <?php
517
-    }
517
+	}
518 518
 ?>
519 519
 		    <?php
520 520
 			if (function_exists('array_column')) {
521
-			    if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
522
-		    ?>
521
+				if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
522
+			?>
523 523
 		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
524 524
 		    <?php
525
-			    }
525
+				}
526 526
 			} elseif (isset($globalSources)) {
527
-			    $dispolar = false;
528
-			    foreach ($globalSources as $testsource) {
529
-			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
530
-			    }
531
-			    if ($dispolar) {
532
-		    ?>
527
+				$dispolar = false;
528
+				foreach ($globalSources as $testsource) {
529
+					if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
530
+				}
531
+				if ($dispolar) {
532
+			?>
533 533
 		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
534 534
 		    <?php
535
-			    }
536
-		        }
537
-		    ?>
535
+				}
536
+				}
537
+			?>
538 538
 <?php
539
-    if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
539
+	if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
540 540
 ?>
541 541
 		    <?php
542 542
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
543
-		    ?>
543
+			?>
544 544
 		    <li><?php echo _("Max number of flights to display:"); ?> <input type="number" name="2dlimit" value="<?php if (isset($_COOKIE['map_2d_limit'])) print $_COOKIE['map_2d_limit']; elseif (isset($globalMap2DAircraftsLimit)) print $globalMapAircraftsLimit; else print 15000; ?>" onchange="map2dlimit(this.value);" /></li>
545 545
 		    <?php
546 546
 			}
547
-		    ?>
547
+			?>
548 548
 		    <?php
549 549
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
550
-		    	    if (extension_loaded('gd') && function_exists('gd_info')) {
551
-		    ?>
550
+					if (extension_loaded('gd') && function_exists('gd_info')) {
551
+			?>
552 552
 		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') print 'checked'; ?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
553 553
 		    <?php 
554 554
 				if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') {
555
-		    ?>
555
+			?>
556 556
 			<li><?php echo _("Aircraft icon color:"); ?> <input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(this.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print '1a3151'; ?>"></li>
557 557
 		    <?php
558 558
 				}
559
-			    }
560
-		        }
561
-		    ?>
559
+				}
560
+				}
561
+			?>
562 562
 		    <?php
563 563
 			if (isset($globalMarine) && $globalMarine === TRUE) {
564
-			    if (extension_loaded('gd') && function_exists('gd_info')) {
565
-		    ?>
564
+				if (extension_loaded('gd') && function_exists('gd_info')) {
565
+			?>
566 566
 		    <li><?php echo _("Marine icon color:"); ?>
567 567
 			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print '1a3151'; ?>">
568 568
 		    </li>
569 569
 		    <?php
570
-			    }
571
-		        }
572
-		    ?>
570
+				}
571
+				}
572
+			?>
573 573
 		    <?php
574 574
 			if (isset($globalTracker) && $globalTracker === TRUE) {
575
-			    if (extension_loaded('gd') && function_exists('gd_info')) {
576
-		    ?>
575
+				if (extension_loaded('gd') && function_exists('gd_info')) {
576
+			?>
577 577
 		    <li><?php echo _("Tracker icon color:"); ?>
578 578
 			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) print $_COOKIE['TrackerIconColor']; elseif (isset($globalTrackerIconColor)) print $globalTrackerIconColor; else print '1a3151'; ?>">
579 579
 		    </li>
580 580
 		    <?php
581
-			    }
582
-		        }
583
-		    ?>
581
+				}
582
+				}
583
+			?>
584 584
 		    <?php
585 585
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
586
-		    ?>
586
+			?>
587 587
 		    <li><?php echo _("Show airport icon at zoom level:"); ?>
588 588
 			<div class="range">
589 589
 			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?>">
@@ -592,9 +592,9 @@  discard block
 block discarded – undo
592 592
 		    </li>
593 593
 		    <?php
594 594
 			}
595
-		    ?>
595
+			?>
596 596
 <?php
597
-    } elseif (isset($_COOKIE['MapFormat']) || $_COOKIE['MapFOrmat'] == '3d') {
597
+	} elseif (isset($_COOKIE['MapFormat']) || $_COOKIE['MapFOrmat'] == '3d') {
598 598
 ?>
599 599
 		    <li><?php echo _("Set scaling factor for rendering resolution:"); ?>
600 600
 			<div class="range">
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
 		    </li>
633 633
 <?php
634 634
 	}
635
-    }
635
+	}
636 636
 ?>
637 637
 		    <li><?php echo _("Distance unit:"); ?>
638 638
 			<select class="selectpicker" onchange="unitdistance(this);">
@@ -672,19 +672,19 @@  discard block
 block discarded – undo
672 672
 		    <ul>
673 673
 		    <?php
674 674
 			if (!isset($globalAircraft) || $globalAircraft) {
675
-		    ?>
675
+			?>
676 676
 		    <?php
677 677
 			if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) {
678
-		    ?>
678
+			?>
679 679
 			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') || !isset($_COOKIE['filter_ShowVATSIM'])) print 'checked'; ?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
680 680
 			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') || !isset($_COOKIE['filter_ShowIVAO'])) print 'checked'; ?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
681 681
 			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') || !isset($_COOKIE['filter_ShowVMS'])) print 'checked'; ?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
682 682
 		    <?php
683 683
 			}
684
-		    ?>
684
+			?>
685 685
 		    <?php
686 686
 			if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) {
687
-		    ?>
687
+			?>
688 688
 			<?php if (isset($globalSBS1) && $globalSBS1) { ?>
689 689
 			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') || !isset($_COOKIE['filter_ShowSBS1'])) print 'checked'; ?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
690 690
 			<?php } ?>
@@ -694,7 +694,7 @@  discard block
 block discarded – undo
694 694
 			<li><div class="checkbox"><label><input type="checkbox" name="blocked" value="1" onclick="clickBlocked(this)" <?php if (isset($_COOKIE['filter_blocked']) && $_COOKIE['filter_blocked'] == 'true') print 'checked'; ?> ><?php echo _("Only display FAA ASDI blocked aircrafts"); ?></label></div></li>
695 695
 		    <?php
696 696
 			}
697
-		    ?>
697
+			?>
698 698
 		    <li><?php echo _("Display airlines:"); ?>
699 699
 		    <br/>
700 700
 			<select class="selectpicker" multiple onchange="airlines(this);" id="display_airlines">
@@ -714,14 +714,14 @@  discard block
 block discarded – undo
714 714
 						echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>';
715 715
 					}
716 716
 				}
717
-			    ?>
717
+				?>
718 718
 			</select>
719 719
 		    </li>
720 720
 		    <?php
721 721
 			$Spotter = new Spotter();
722 722
 			$allalliancenames = $Spotter->getAllAllianceNames();
723 723
 			if (!empty($allalliancenames)) {
724
-		    ?>
724
+			?>
725 725
 		    <li><?php echo _("Display alliance:"); ?>
726 726
 		    <br/>
727 727
 			<select class="selectpicker" onchange="alliance(this);" id="display_alliance">
@@ -735,18 +735,18 @@  discard block
 block discarded – undo
735 735
 						echo '<option value="'.$alliance_name.'">'.$alliance_name.'</option>';
736 736
 					}
737 737
 				}
738
-			    ?>
738
+				?>
739 739
 			</select>
740 740
 		    </li>
741 741
 		    <?php
742 742
 			}
743
-		    ?>
743
+			?>
744 744
 		    <?php
745 745
 			}
746
-		    ?>
746
+			?>
747 747
 		    <?php
748 748
 			if (isset($globalAPRS) && $globalAPRS) {
749
-		    ?>
749
+			?>
750 750
 		    <li><?php echo _("Display APRS sources name:"); ?>
751 751
 			<select class="selectpicker" multiple onchange="sources(this);">
752 752
 			    <?php
@@ -770,18 +770,18 @@  discard block
 block discarded – undo
770 770
 						echo '<option value="'.$src['name'].'">'.$src['name'].'</option>';
771 771
 					}
772 772
 				}
773
-			    ?>
773
+				?>
774 774
 			</select>
775 775
 		    </li>
776 776
 		    <?php
777 777
 			}
778
-		    ?>
778
+			?>
779 779
 		    <?php
780 780
 			if (!isset($globalAircraft) || $globalAircraft) {
781
-		    ?>
781
+			?>
782 782
 		    <?php
783
-			    if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS)) {
784
-		    ?>
783
+				if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS)) {
784
+			?>
785 785
 		    <li><?php echo _("Display airlines of type:"); ?><br/>
786 786
 			<select class="selectpicker" onchange="airlinestype(this);">
787 787
 			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
@@ -791,14 +791,14 @@  discard block
 block discarded – undo
791 791
 			</select>
792 792
 		    </li>
793 793
 		    <?php
794
-			    }
795
-		    ?>
794
+				}
795
+			?>
796 796
 		    <?php
797 797
 			}
798
-		    ?>
798
+			?>
799 799
 		    <?php
800 800
 			if (isset($globalMarine) && $globalMarine) {
801
-		    ?>
801
+			?>
802 802
 		    <li>
803 803
 			<?php echo _("Display vessels with MMSI:"); ?>
804 804
 			<input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) print $_COOKIE['filter_mmsi']; ?>" />
@@ -821,7 +821,7 @@  discard block
 block discarded – undo
821 821
 								print '<option value="'.$race['race_id'].'">'.$race['race_name'].'</option>';
822 822
 							}
823 823
 						}
824
-			    ?>
824
+				?>
825 825
 			</select>
826 826
 		    </li>
827 827
 
@@ -829,7 +829,7 @@  discard block
 block discarded – undo
829 829
 					}
830 830
 				}
831 831
 			}
832
-		    ?>
832
+			?>
833 833
 		    <li>
834 834
 			<?php echo _("Display with ident:"); ?>
835 835
 			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" />
@@ -842,7 +842,7 @@  discard block
 block discarded – undo
842 842
 	    </form>
843 843
     	</div>
844 844
 <?php
845
-    if (isset($globalSatellite) && $globalSatellite) {
845
+	if (isset($globalSatellite) && $globalSatellite) {
846 846
 ?>
847 847
         <div class="sidebar-pane" id="satellites">
848 848
 	    <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
@@ -882,14 +882,14 @@  discard block
 block discarded – undo
882 882
 						print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>';
883 883
 					}
884 884
 				}
885
-			    ?>
885
+				?>
886 886
 			</select>
887 887
 		    </li>
888 888
 		</ul>
889 889
 	    </form>
890 890
 	</div>
891 891
 <?php
892
-    }
892
+	}
893 893
 ?>
894 894
     </div>
895 895
 </div>
Please login to merge, or discard this patch.
Braces   +606 added lines, -152 removed lines patch added patch discarded remove patch
@@ -57,7 +57,10 @@  discard block
 block discarded – undo
57 57
 <?php
58 58
     if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
59 59
 ?>
60
-<script src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) print '?tsk='.$tsk; ?>"></script>
60
+<script src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) {
61
+	print '?tsk='.$tsk;
62
+}
63
+?>"></script>
61 64
 <script src="<?php echo $globalURL; ?>/js/meuusjs.1.0.3.min.js"></script>
62 65
 <script src="<?php echo $globalURL; ?>/js/map.3d.weather.js"></script>
63 66
 <?php
@@ -137,10 +140,22 @@  discard block
 block discarded – undo
137 140
 			<h1>Weather</h1>
138 141
 			<ul>
139 142
 			
140
-				<li><div class="checkbox"><label><input type="checkbox" name="wind" value="1" onclick="clickWind(this);" <?php if (isset($_COOKIE['weather_wind']) && $_COOKIE['weather_wind'] == 'true') print 'checked'; ?> /><?php echo _("Weather Winds"); ?></label></div></li>
141
-				<li><div class="checkbox"><label><input type="checkbox" name="wave" value="1" onclick="clickWave(this);" <?php if (isset($_COOKIE['weather_wave']) && $_COOKIE['weather_wave'] == 'true') print 'checked'; ?> /><?php echo _("Ocean surface currents"); ?></label></div></li>
142
-				<li><div class="checkbox"><label><input type="checkbox" name="fire" value="1" onclick="clickFire(this);" <?php if (isset($_COOKIE['weather_fire']) && $_COOKIE['weather_fire'] == 'true') print 'checked'; ?> /><?php echo _("NASA Fire Hotspots"); ?></label></div></li>
143
-				<!-- <li><div class="checkbox"><label><input type="checkbox" name="backwave" value="1" onclick="clickBackWave(this);" <?php if (isset($_COOKIE['weather_backwave']) && $_COOKIE['weather_backwave'] == 'true') print 'checked'; ?> /><?php echo _("Weather Waves height background"); ?></label></div></li> -->
143
+				<li><div class="checkbox"><label><input type="checkbox" name="wind" value="1" onclick="clickWind(this);" <?php if (isset($_COOKIE['weather_wind']) && $_COOKIE['weather_wind'] == 'true') {
144
+	print 'checked';
145
+}
146
+?> /><?php echo _("Weather Winds"); ?></label></div></li>
147
+				<li><div class="checkbox"><label><input type="checkbox" name="wave" value="1" onclick="clickWave(this);" <?php if (isset($_COOKIE['weather_wave']) && $_COOKIE['weather_wave'] == 'true') {
148
+	print 'checked';
149
+}
150
+?> /><?php echo _("Ocean surface currents"); ?></label></div></li>
151
+				<li><div class="checkbox"><label><input type="checkbox" name="fire" value="1" onclick="clickFire(this);" <?php if (isset($_COOKIE['weather_fire']) && $_COOKIE['weather_fire'] == 'true') {
152
+	print 'checked';
153
+}
154
+?> /><?php echo _("NASA Fire Hotspots"); ?></label></div></li>
155
+				<!-- <li><div class="checkbox"><label><input type="checkbox" name="backwave" value="1" onclick="clickBackWave(this);" <?php if (isset($_COOKIE['weather_backwave']) && $_COOKIE['weather_backwave'] == 'true') {
156
+	print 'checked';
157
+}
158
+?> /><?php echo _("Weather Waves height background"); ?></label></div></li> -->
144 159
 			
145 160
 <?php
146 161
 		if (isset($globalOpenWeatherMapKey) && $globalOpenWeatherMapKey != '') {
@@ -162,12 +177,18 @@  discard block
 block discarded – undo
162 177
 <?php
163 178
 		if (isset($globalMETAR) && isset($globalMETARcycle) && $globalMETAR && $globalMETARcycle) {
164 179
 ?>
165
-				<li><div class="checkbox"><label><input type="checkbox" name="displayweather" value="1" onclick="clickDisplayWeather(this)" <?php if ((isset($_COOKIE['show_Weather']) && $_COOKIE['show_Weather'] == 'true') || (!isset($_COOKIE['show_Weather']) && (isset($globalMapWeather) && $globalMapWeather === TRUE))) print 'checked'; ?> ><?php echo _("Display 3D weather"); ?></label></div></li>
180
+				<li><div class="checkbox"><label><input type="checkbox" name="displayweather" value="1" onclick="clickDisplayWeather(this)" <?php if ((isset($_COOKIE['show_Weather']) && $_COOKIE['show_Weather'] == 'true') || (!isset($_COOKIE['show_Weather']) && (isset($globalMapWeather) && $globalMapWeather === TRUE))) {
181
+	print 'checked';
182
+}
183
+?> ><?php echo _("Display 3D weather"); ?></label></div></li>
166 184
 			<!--	<li><div class="checkbox"><label><input type="checkbox" name="displayrain" value="1" onclick="clickDisplayRain(this)" ><?php echo _("Display rain on 3D map"); ?></label></div></li>-->
167 185
 <?php
168 186
 		}
169 187
 ?>
170
-				<li><div class="checkbox"><label><input type="checkbox" name="fire" value="1" onclick="clickFire(this);" <?php if (isset($_COOKIE['weather_fire']) && $_COOKIE['weather_fire'] == 'true') print 'checked'; ?> /><?php echo _("NASA Fire Hotspots"); ?></label></div></li>
188
+				<li><div class="checkbox"><label><input type="checkbox" name="fire" value="1" onclick="clickFire(this);" <?php if (isset($_COOKIE['weather_fire']) && $_COOKIE['weather_fire'] == 'true') {
189
+	print 'checked';
190
+}
191
+?> /><?php echo _("NASA Fire Hotspots"); ?></label></div></li>
171 192
 			</ul>
172 193
 <?php
173 194
 	}
@@ -183,13 +204,22 @@  discard block
 block discarded – undo
183 204
 <?php
184 205
 		if (!isset($globalAircraft) || $globalAircraft) {
185 206
 ?>
186
-				<li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') print 'checked'; ?> /><?php echo _("Display waypoints"); ?></label></div></li>
187
-				<li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') print 'checked'; ?> /><?php echo _("Display airspace"); ?></label></div></li>
207
+				<li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') {
208
+	print 'checked';
209
+}
210
+?> /><?php echo _("Display waypoints"); ?></label></div></li>
211
+				<li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') {
212
+	print 'checked';
213
+}
214
+?> /><?php echo _("Display airspace"); ?></label></div></li>
188 215
 <?php
189 216
 		}
190 217
 		if (isset($globalMarine) && $globalMarine) {
191 218
 ?>
192
-				<li><div class="checkbox"><label><input type="checkbox" name="openseamap" value="1" onclick="clickOpenSeaMap(this);" <?php if (isset($_COOKIE['openseamap']) && $_COOKIE['openseamap'] == 'true') print 'checked'; ?> /><?php echo _("Display OpenSeaMap"); ?></label></div></li>
219
+				<li><div class="checkbox"><label><input type="checkbox" name="openseamap" value="1" onclick="clickOpenSeaMap(this);" <?php if (isset($_COOKIE['openseamap']) && $_COOKIE['openseamap'] == 'true') {
220
+	print 'checked';
221
+}
222
+?> /><?php echo _("Display OpenSeaMap"); ?></label></div></li>
193 223
 <?php
194 224
 		}
195 225
 ?>
@@ -204,13 +234,22 @@  discard block
 block discarded – undo
204 234
 <?php
205 235
 		if (!isset($globalAircraft) || $globalAircraft) {
206 236
 ?>
207
-				<li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') print 'checked'; ?> /><?php echo _("Display waypoints"); ?> Beta</label></div></li>
208
-				<li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') print 'checked'; ?> /><?php echo _("Display airspace"); ?> Beta</label></div></li>
237
+				<li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') {
238
+	print 'checked';
239
+}
240
+?> /><?php echo _("Display waypoints"); ?> Beta</label></div></li>
241
+				<li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') {
242
+	print 'checked';
243
+}
244
+?> /><?php echo _("Display airspace"); ?> Beta</label></div></li>
209 245
 <?php
210 246
 		}
211 247
 		if (isset($globalMarine) && $globalMarine) {
212 248
 ?>
213
-				<li><div class="checkbox"><label><input type="checkbox" name="openseamap" value="1" onclick="clickOpenSeaMap(this);" <?php if (isset($_COOKIE['openseamap']) && $_COOKIE['openseamap'] == 'true') print 'checked'; ?> /><?php echo _("Display OpenSeaMap"); ?></label></div></li>
249
+				<li><div class="checkbox"><label><input type="checkbox" name="openseamap" value="1" onclick="clickOpenSeaMap(this);" <?php if (isset($_COOKIE['openseamap']) && $_COOKIE['openseamap'] == 'true') {
250
+	print 'checked';
251
+}
252
+?> /><?php echo _("Display OpenSeaMap"); ?></label></div></li>
214 253
 <?php
215 254
 		}
216 255
 ?>
@@ -225,14 +264,32 @@  discard block
 block discarded – undo
225 264
 		<h1>NOTAM</h1>
226 265
 		<form>
227 266
 			<ul>
228
-				<li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam(this);" <?php if (isset($_COOKIE['notam']) && $_COOKIE['notam'] == 'true') print 'checked'; ?> /><?php echo _("Display NOTAM"); ?></label></div></li>
267
+				<li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam(this);" <?php if (isset($_COOKIE['notam']) && $_COOKIE['notam'] == 'true') {
268
+	print 'checked';
269
+}
270
+?> /><?php echo _("Display NOTAM"); ?></label></div></li>
229 271
 				<li><?php echo _("NOTAM scope:"); ?>
230 272
 					<select class="selectpicker" onchange="notamscope(this);">
231
-						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') print ' selected'; ?>>All</option>
232
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') print ' selected'; ?>>Airport/Enroute warning</option>
233
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') print ' selected'; ?>>Airport warning</option>
234
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') print ' selected'; ?>>Navigation warning</option>
235
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') print ' selected'; ?>>Enroute warning</option>
273
+						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') {
274
+	print ' selected';
275
+}
276
+?>>All</option>
277
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') {
278
+	print ' selected';
279
+}
280
+?>>Airport/Enroute warning</option>
281
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') {
282
+	print ' selected';
283
+}
284
+?>>Airport warning</option>
285
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') {
286
+	print ' selected';
287
+}
288
+?>>Navigation warning</option>
289
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') {
290
+	print ' selected';
291
+}
292
+?>>Enroute warning</option>
236 293
 					</select
237 294
 				</li>
238 295
 			</ul>
@@ -260,7 +317,10 @@  discard block
 block discarded – undo
260 317
 		    <div class="form-group">
261 318
 			<label><?php echo _("From:"); ?></label>
262 319
 			<div class='input-group date' id='datetimepicker1'>
263
-			    <input type='text' id="start_date" name="start_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') print date("Y-m-d H:i",$_COOKIE['archive_begin']).' UTC'; ?>" required />
320
+			    <input type='text' id="start_date" name="start_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') {
321
+	print date("Y-m-d H:i",$_COOKIE['archive_begin']).' UTC';
322
+}
323
+?>" required />
264 324
 			    <span class="input-group-addon">
265 325
 				<span class="glyphicon glyphicon-calendar"></span>
266 326
 			    </span>
@@ -269,7 +329,10 @@  discard block
 block discarded – undo
269 329
 		    <div class="form-group">
270 330
 			<label><?php echo _("To:"); ?></label>
271 331
 			<div class='input-group date' id='datetimepicker2'>
272
-			    <input type='text' id="end_date" name="end_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_end']) && $_COOKIE['archive_end'] != '') print date("Y-m-d H:i",$_COOKIE['archive_end']).' UTC'; ?>" />
332
+			    <input type='text' id="end_date" name="end_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_end']) && $_COOKIE['archive_end'] != '') {
333
+	print date("Y-m-d H:i",$_COOKIE['archive_end']).' UTC';
334
+}
335
+?>" />
273 336
 			    <span class="input-group-addon">
274 337
 				<span class="glyphicon glyphicon-calendar"></span>
275 338
 			    </span>
@@ -301,8 +364,20 @@  discard block
 block discarded – undo
301 364
 		    </script>
302 365
 		<li><?php echo _("Playback speed:"); ?>
303 366
 		    <div class="range">
304
-			<input type="range" min="0" max="50" step="1" id="archivespeed" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php  if (isset($_POST['archivespeed'])) print $_POST['archivespeed']; elseif (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?>">
305
-			<output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?></output>
367
+			<input type="range" min="0" max="50" step="1" id="archivespeed" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php  if (isset($_POST['archivespeed'])) {
368
+	print $_POST['archivespeed'];
369
+} elseif (isset($_COOKIE['archive_speed'])) {
370
+	print $_COOKIE['archive_speed'];
371
+} else {
372
+	print '1';
373
+}
374
+?>">
375
+			<output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) {
376
+	print $_COOKIE['archive_speed'];
377
+} else {
378
+	print '1';
379
+}
380
+?></output>
306 381
 		    </div>
307 382
 		</li>
308 383
 		<?php
@@ -331,14 +406,20 @@  discard block
 block discarded – undo
331 406
 		    <li><?php echo _("Type of Map:"); ?>
332 407
 			    <?php
333 408
 				if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
334
-					if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider;
335
-					else $MapType = $_COOKIE['MapType'];
409
+					if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') {
410
+						$MapType = $globalMapProvider;
411
+					} else {
412
+						$MapType = $_COOKIE['MapType'];
413
+					}
336 414
 			    ?>
337 415
 			<select  class="selectpicker" onchange="mapType(this);">
338 416
 			    <?php
339 417
 				} else {
340
-					if (!isset($_COOKIE['MapType3D']) || $_COOKIE['MapType3D'] == '') $MapType = $globalMapProvider;
341
-					else $MapType = $_COOKIE['MapType3D'];
418
+					if (!isset($_COOKIE['MapType3D']) || $_COOKIE['MapType3D'] == '') {
419
+						$MapType = $globalMapProvider;
420
+					} else {
421
+						$MapType = $_COOKIE['MapType3D'];
422
+					}
342 423
 			    ?>
343 424
 			<select  class="selectpicker" onchange="mapType3D(this);">
344 425
 			    <?php
@@ -347,24 +428,48 @@  discard block
 block discarded – undo
347 428
 			    <?php
348 429
 				if (isset($globalMapOffline) && $globalMapOffline === TRUE) {
349 430
 			    ?>
350
-			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option>
431
+			    <option value="offline"<?php if ($MapType == 'offline') {
432
+	print ' selected';
433
+}
434
+?>>Natural Earth (local)</option>
351 435
 			    <?php
352 436
 				} else {
353 437
 				    if (file_exists(dirname(__FILE__).'/js/Cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml')) {
354 438
 			    ?>
355
-			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option>
439
+			    <option value="offline"<?php if ($MapType == 'offline') {
440
+	print ' selected';
441
+}
442
+?>>Natural Earth (local)</option>
356 443
 			    <?php
357 444
 				    }
358 445
 			    ?>
359
-			    <option value="ArcGIS-Streetmap"<?php if ($MapType == 'ArcGIS-Streetmap') print ' selected'; ?>>ArcGIS Streetmap</option>
360
-			    <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Satellite') print ' selected'; ?>>ArcGIS Satellite</option>
361
-			    <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Ocean') print ' selected'; ?>>ArcGIS Ocean</option>
446
+			    <option value="ArcGIS-Streetmap"<?php if ($MapType == 'ArcGIS-Streetmap') {
447
+	print ' selected';
448
+}
449
+?>>ArcGIS Streetmap</option>
450
+			    <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Satellite') {
451
+	print ' selected';
452
+}
453
+?>>ArcGIS Satellite</option>
454
+			    <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Ocean') {
455
+	print ' selected';
456
+}
457
+?>>ArcGIS Ocean</option>
362 458
 			    <?php
363 459
 				    if (isset($globalBingMapKey) && $globalBingMapKey != '') {
364 460
 			    ?>
365
-			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option>
366
-			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option>
367
-			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option>
461
+			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') {
462
+	print ' selected';
463
+}
464
+?>>Bing-Aerial</option>
465
+			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') {
466
+	print ' selected';
467
+}
468
+?>>Bing-Hybrid</option>
469
+			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') {
470
+	print ' selected';
471
+}
472
+?>>Bing-Road</option>
368 473
 			    <?php
369 474
 				    }
370 475
 			    ?>
@@ -374,59 +479,143 @@  discard block
 block discarded – undo
374 479
 			    <?php
375 480
 					if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
376 481
 			    ?>
377
-			    <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option>
378
-			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option>
379
-			    <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option>
482
+			    <option value="Here-Aerial"<?php if ($MapType == 'Here') {
483
+	print ' selected';
484
+}
485
+?>>Here-Aerial</option>
486
+			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') {
487
+	print ' selected';
488
+}
489
+?>>Here-Hybrid</option>
490
+			    <option value="Here-Road"<?php if ($MapType == 'Here') {
491
+	print ' selected';
492
+}
493
+?>>Here-Road</option>
380 494
 			    <?php
381 495
 					}
382 496
 			    ?>
383 497
 			    <?php
384 498
 					if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
385 499
 			    ?>
386
-			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option>
387
-			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option>
388
-			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option>
389
-			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option>
500
+			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') {
501
+	print ' selected';
502
+}
503
+?>>Google Roadmap</option>
504
+			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') {
505
+	print ' selected';
506
+}
507
+?>>Google Satellite</option>
508
+			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') {
509
+	print ' selected';
510
+}
511
+?>>Google Hybrid</option>
512
+			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') {
513
+	print ' selected';
514
+}
515
+?>>Google Terrain</option>
390 516
 			    <?php
391 517
 					}
392 518
 			    ?>
393 519
 			    <?php
394 520
 					if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
395 521
 			    ?>
396
-			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option>
397
-			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option>
398
-			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option>
522
+			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') {
523
+	print ' selected';
524
+}
525
+?>>MapQuest-OSM</option>
526
+			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') {
527
+	print ' selected';
528
+}
529
+?>>MapQuest-Aerial</option>
530
+			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') {
531
+	print ' selected';
532
+}
533
+?>>MapQuest-Hybrid</option>
399 534
 			    <?php
400 535
 					}
401 536
 			    ?>
402
-			    <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option>
403
-			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth</option>
537
+			    <option value="Yandex"<?php if ($MapType == 'Yandex') {
538
+	print ' selected';
539
+}
540
+?>>Yandex</option>
541
+			    <option value="offline"<?php if ($MapType == 'offline') {
542
+	print ' selected';
543
+}
544
+?>>Natural Earth</option>
404 545
 			    <?php
405 546
 				    }
406 547
 			    ?>
407
-			    <option value="NatGeo-Street"<?php if ($MapType == 'NatGeo-Street') print ' selected'; ?>>National Geographic Street</option>
548
+			    <option value="NatGeo-Street"<?php if ($MapType == 'NatGeo-Street') {
549
+	print ' selected';
550
+}
551
+?>>National Geographic Street</option>
408 552
 			    <?php
409 553
 				    if (isset($globalMapboxToken) && $globalMapboxToken != '') {
410
-					if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default';
411
-					else $MapBoxId = $_COOKIE['MapTypeId'];
554
+					if (!isset($_COOKIE['MapTypeId'])) {
555
+						$MapBoxId = 'default';
556
+					} else {
557
+						$MapBoxId = $_COOKIE['MapTypeId'];
558
+					}
412 559
 			    ?>
413
-			    <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') print ' selected'; ?>>Mapbox GL</option>
414
-			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option>
415
-			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option>
416
-			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option>
417
-			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') print ' selected'; ?>>Mapbox dark</option>
418
-			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') print ' selected'; ?>>Mapbox satellite</option>
419
-			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') print ' selected'; ?>>Mapbox streets-satellite</option>
420
-			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') print ' selected'; ?>>Mapbox streets-basic</option>
421
-			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') print ' selected'; ?>>Mapbox comic</option>
422
-			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') print ' selected'; ?>>Mapbox outdoors</option>
423
-			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') print ' selected'; ?>>Mapbox pencil</option>
424
-			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option>
425
-			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option>
560
+			    <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') {
561
+	print ' selected';
562
+}
563
+?>>Mapbox GL</option>
564
+			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') {
565
+	print ' selected';
566
+}
567
+?>>Mapbox default</option>
568
+			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') {
569
+	print ' selected';
570
+}
571
+?>>Mapbox streets</option>
572
+			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') {
573
+	print ' selected';
574
+}
575
+?>>Mapbox light</option>
576
+			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') {
577
+	print ' selected';
578
+}
579
+?>>Mapbox dark</option>
580
+			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') {
581
+	print ' selected';
582
+}
583
+?>>Mapbox satellite</option>
584
+			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') {
585
+	print ' selected';
586
+}
587
+?>>Mapbox streets-satellite</option>
588
+			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') {
589
+	print ' selected';
590
+}
591
+?>>Mapbox streets-basic</option>
592
+			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') {
593
+	print ' selected';
594
+}
595
+?>>Mapbox comic</option>
596
+			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') {
597
+	print ' selected';
598
+}
599
+?>>Mapbox outdoors</option>
600
+			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') {
601
+	print ' selected';
602
+}
603
+?>>Mapbox pencil</option>
604
+			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') {
605
+	print ' selected';
606
+}
607
+?>>Mapbox pirates</option>
608
+			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') {
609
+	print ' selected';
610
+}
611
+?>>Mapbox emerald</option>
426 612
 			    <?php
427 613
 				    }
428 614
 			    ?>
429
-			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option>
615
+			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') {
616
+	print ' selected';
617
+}
618
+?>>OpenStreetMap</option>
430 619
 			    <?php
431 620
 				}
432 621
 			    ?>
@@ -437,10 +626,22 @@  discard block
 block discarded – undo
437 626
 ?>
438 627
 		    <li><?php echo _("Type of Terrain:"); ?>
439 628
 			<select  class="selectpicker" onchange="terrainType(this);">
440
-			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option>
441
-			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option>
442
-			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option>
443
-			    <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected';?>>ArticDEM</option>
629
+			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') {
630
+	print ' selected';
631
+}
632
+?>>stk terrain</option>
633
+			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') {
634
+	print ' selected';
635
+}
636
+?>>ellipsoid</option>
637
+			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') {
638
+	print ' selected';
639
+}
640
+?>>vr terrain</option>
641
+			    <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') {
642
+	print ' selected';
643
+}
644
+?>>ArticDEM</option>
444 645
 			</select>
445 646
 		    </li>
446 647
 <?php
@@ -450,64 +651,124 @@  discard block
 block discarded – undo
450 651
 <?php
451 652
     if (isset($globalMap3D) && $globalMap3D) {
452 653
 ?>
453
-		    <li><div class="checkbox"><label><input type="checkbox" name="synchro2d3d" value="1" onclick="clickSyncMap2D3D(this)" <?php if (isset($_COOKIE['Map2D3DSync']) && $_COOKIE['Map2D3DSync'] == 'true') print 'checked'; ?> ><?php echo _("Use same type of map for 2D & 3D"); ?></label></div></li>
654
+		    <li><div class="checkbox"><label><input type="checkbox" name="synchro2d3d" value="1" onclick="clickSyncMap2D3D(this)" <?php if (isset($_COOKIE['Map2D3DSync']) && $_COOKIE['Map2D3DSync'] == 'true') {
655
+	print 'checked';
656
+}
657
+?> ><?php echo _("Use same type of map for 2D & 3D"); ?></label></div></li>
454 658
 <?php
455 659
     }
456 660
 ?>
457 661
 <?php
458 662
     if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
459 663
 ?>
460
-		    <li><div class="checkbox"><label><input type="checkbox" name="display2dbuildings" value="1" onclick="clickDisplay2DBuildings(this)" <?php if (isset($_COOKIE['Map2DBuildings']) && $_COOKIE['Map2DBuildings'] == 'true') print 'checked'; ?> ><?php echo _("Display 2.5D buidings on map"); ?></label></div></li>
664
+		    <li><div class="checkbox"><label><input type="checkbox" name="display2dbuildings" value="1" onclick="clickDisplay2DBuildings(this)" <?php if (isset($_COOKIE['Map2DBuildings']) && $_COOKIE['Map2DBuildings'] == 'true') {
665
+	print 'checked';
666
+}
667
+?> ><?php echo _("Display 2.5D buidings on map"); ?></label></div></li>
461 668
 
462 669
 <?php
463 670
 	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
464 671
 ?>
465
-		    <!--<li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') print 'checked'; ?> ><?php echo _("Display flight info as popup"); ?></label></div></li>-->
466
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true')) print 'checked'; ?> ><?php echo _("Display flight path"); ?></label></div></li>
467
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)) print 'checked'; ?> ><?php echo _("Display flight route on click"); ?></label></div></li>
468
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightremainingroute" value="1" onclick="clickFlightRemainingRoute(this)" <?php if ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == 'true') || (!isset($_COOKIE['MapRemainingRoute']) && isset($globalMapRemainingRoute) && $globalMapRemainingRoute)) print 'checked'; ?> ><?php echo _("Display flight remaining route on click"); ?></label></div></li>
469
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Planes animate between updates"); ?></label></div></li>
672
+		    <!--<li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') {
673
+	print 'checked';
674
+}
675
+?> ><?php echo _("Display flight info as popup"); ?></label></div></li>-->
676
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true')) {
677
+	print 'checked';
678
+}
679
+?> ><?php echo _("Display flight path"); ?></label></div></li>
680
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)) {
681
+	print 'checked';
682
+}
683
+?> ><?php echo _("Display flight route on click"); ?></label></div></li>
684
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightremainingroute" value="1" onclick="clickFlightRemainingRoute(this)" <?php if ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == 'true') || (!isset($_COOKIE['MapRemainingRoute']) && isset($globalMapRemainingRoute) && $globalMapRemainingRoute)) {
685
+	print 'checked';
686
+}
687
+?> ><?php echo _("Display flight remaining route on click"); ?></label></div></li>
688
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) {
689
+	print 'checked';
690
+}
691
+?> ><?php echo _("Planes animate between updates"); ?></label></div></li>
470 692
 <?php
471 693
 	} elseif (!isset($globalTracker) || $globalTracker === TRUE) {
472 694
 ?>
473
-		    <li><div class="checkbox"><label><input type="checkbox" name="mapmatching" value="1" onclick="clickMapMatching(this)" <?php if ((isset($_COOKIE['mapmatching']) && $_COOKIE['mapmatching'] == 'true') || (!isset($_COOKIE['mapmatching']) && isset($globalMapMatching) && $globalMapMatching)) print 'checked'; ?> ><?php echo _("Enable map matching"); ?></label></div></li>
695
+		    <li><div class="checkbox"><label><input type="checkbox" name="mapmatching" value="1" onclick="clickMapMatching(this)" <?php if ((isset($_COOKIE['mapmatching']) && $_COOKIE['mapmatching'] == 'true') || (!isset($_COOKIE['mapmatching']) && isset($globalMapMatching) && $globalMapMatching)) {
696
+	print 'checked';
697
+}
698
+?> ><?php echo _("Enable map matching"); ?></label></div></li>
474 699
 <?php
475 700
 	}
476 701
 	if (isset($globalSatellite) && $globalSatellite === TRUE) {
477 702
 ?>
478
-		    <li><div class="checkbox"><label><input type="checkbox" name="satelliteestimation" value="1" onclick="clickSatelliteEstimation(this)" <?php if ((isset($_COOKIE['satelliteestimation']) && $_COOKIE['satelliteestimation'] == 'true') || (!isset($_COOKIE['satelliteestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['satelliteestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Satellites animate between updates"); ?></label></div></li>
703
+		    <li><div class="checkbox"><label><input type="checkbox" name="satelliteestimation" value="1" onclick="clickSatelliteEstimation(this)" <?php if ((isset($_COOKIE['satelliteestimation']) && $_COOKIE['satelliteestimation'] == 'true') || (!isset($_COOKIE['satelliteestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['satelliteestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) {
704
+	print 'checked';
705
+}
706
+?> ><?php echo _("Satellites animate between updates"); ?></label></div></li>
479 707
 <?php
480 708
 	}
481 709
     }
482 710
     if (!isset($globalAircraft) || $globalAircraft === TRUE) {
483 711
 ?>
484
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true' || !isset($_COOKIE['displayairports'])) print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li>
712
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true' || !isset($_COOKIE['displayairports'])) {
713
+	print 'checked';
714
+}
715
+?> ><?php echo _("Display airports on map"); ?></label></div></li>
485 716
 <?php
486 717
     }
487 718
 ?>
488
-		    <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) print 'checked'; ?> ><?php echo _("Display ground station on map"); ?></label></div></li>
489
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayweatherstation" value="1" onclick="clickDisplayWeatherStation(this)" <?php if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) print 'checked'; ?> ><?php echo _("Display weather station on map"); ?></label></div></li>
490
-		    <li><div class="checkbox"><label><input type="checkbox" name="displaylightning" value="1" onclick="clickDisplayLightning(this)" <?php if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') || (!isset($_COOKIE['show_Lightning']) && (isset($globalMapLightning) && $globalMapLightning === TRUE))) print 'checked'; ?> ><?php echo _("Display lightning on map"); ?></label></div></li>
719
+		    <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) {
720
+	print 'checked';
721
+}
722
+?> ><?php echo _("Display ground station on map"); ?></label></div></li>
723
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayweatherstation" value="1" onclick="clickDisplayWeatherStation(this)" <?php if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) {
724
+	print 'checked';
725
+}
726
+?> ><?php echo _("Display weather station on map"); ?></label></div></li>
727
+		    <li><div class="checkbox"><label><input type="checkbox" name="displaylightning" value="1" onclick="clickDisplayLightning(this)" <?php if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') || (!isset($_COOKIE['show_Lightning']) && (isset($globalMapLightning) && $globalMapLightning === TRUE))) {
728
+	print 'checked';
729
+}
730
+?> ><?php echo _("Display lightning on map"); ?></label></div></li>
491 731
 <?php
492 732
 	if (isset($globalFires) && $globalFires) {
493 733
 ?>
494
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayfires" value="1" onclick="clickDisplayFires(this)" <?php if ((isset($_COOKIE['show_Fires']) && $_COOKIE['show_Fires'] == 'true') || (!isset($_COOKIE['show_Fires']) && (isset($globalMapFires) && $globalMapFires === TRUE))) print 'checked'; ?> ><?php echo _("Display fires on map"); ?></label></div></li>
734
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayfires" value="1" onclick="clickDisplayFires(this)" <?php if ((isset($_COOKIE['show_Fires']) && $_COOKIE['show_Fires'] == 'true') || (!isset($_COOKIE['show_Fires']) && (isset($globalMapFires) && $globalMapFires === TRUE))) {
735
+	print 'checked';
736
+}
737
+?> ><?php echo _("Display fires on map"); ?></label></div></li>
495 738
 <?php
496 739
 	}
497 740
 	if (isset($globalMap3D) && $globalMap3D) {
498 741
 ?>
499
-		    <li><div class="checkbox"><label><input type="checkbox" name="singlemodel" value="1" onclick="clickSingleModel(this)" <?php if ((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') || (!isset($_COOKIE['singlemodel']) && isset($globalMap3DSelected) && $globalMap3DSelected)) print 'checked'; ?> ><?php echo _("Only display selected flight on 3D mode"); ?></label></div></li>
742
+		    <li><div class="checkbox"><label><input type="checkbox" name="singlemodel" value="1" onclick="clickSingleModel(this)" <?php if ((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') || (!isset($_COOKIE['singlemodel']) && isset($globalMap3DSelected) && $globalMap3DSelected)) {
743
+	print 'checked';
744
+}
745
+?> ><?php echo _("Only display selected flight on 3D mode"); ?></label></div></li>
500 746
 <?php
501 747
 	}
502 748
 ?>
503
-		    <li><div class="checkbox"><label><input type="checkbox" name="truelight" value="1" onclick="clickTrueLight(this)" <?php if ((!isset($_COOKIE['truelight']) && (!isset($globalMapTrueLight) || $globalMapTrueLight)) || (isset($_COOKIE['truelight']) && $_COOKIE['truelight'] == 'true')) print 'checked'; ?> ><?php echo _("Enable globe sun lighting"); ?></label></div></li>
749
+		    <li><div class="checkbox"><label><input type="checkbox" name="truelight" value="1" onclick="clickTrueLight(this)" <?php if ((!isset($_COOKIE['truelight']) && (!isset($globalMapTrueLight) || $globalMapTrueLight)) || (isset($_COOKIE['truelight']) && $_COOKIE['truelight'] == 'true')) {
750
+	print 'checked';
751
+}
752
+?> ><?php echo _("Enable globe sun lighting"); ?></label></div></li>
504 753
 <?php
505 754
     if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
506 755
 ?>
507
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) print 'checked'; ?> ><?php echo _("Show mini-map"); ?></label></div></li>
508
-		    <li><div class="checkbox"><label><input type="checkbox" name="shadows" value="1" onclick="clickShadows(this)" <?php if ((!isset($_COOKIE['map3dnoshadows']) && (!isset($globalMap3DShadows) || $globalMap3DShadows)) || (isset($_COOKIE['map3dnoshadows']) && $_COOKIE['map3dnoshadows'] == 'false')) print 'checked'; ?> ><?php echo _("Use shadows"); ?></label></div></li>
509
-		    <li><div class="checkbox"><label><input type="checkbox" name="one3dmodel" value="1" onclick="useOne3Dmodel(this)" <?php if ((isset($_COOKIE['one3dmodel']) && $_COOKIE['one3dmodel'] == 'true') || (!isset($_COOKIE['one3dmodel']) && isset($globalMap3DOneModel) && $globalMap3DOneModel)) print 'checked'; ?> ><?php echo _("Use same 3D model for all aircraft (use fewer resources)"); ?></label></div></li>
510
-		    <li><div class="checkbox"><label><input type="checkbox" name="updaterealtime" value="1" onclick="clickUpdateRealtime(this)" <?php if ((isset($_COOKIE['updaterealtime']) && $_COOKIE['updaterealtime'] == 'true') || !isset($_COOKIE['updaterealtime'])) print 'checked'; ?> ><?php echo _("Display realtime data in infobox"); ?></label></div></li>
756
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) {
757
+	print 'checked';
758
+}
759
+?> ><?php echo _("Show mini-map"); ?></label></div></li>
760
+		    <li><div class="checkbox"><label><input type="checkbox" name="shadows" value="1" onclick="clickShadows(this)" <?php if ((!isset($_COOKIE['map3dnoshadows']) && (!isset($globalMap3DShadows) || $globalMap3DShadows)) || (isset($_COOKIE['map3dnoshadows']) && $_COOKIE['map3dnoshadows'] == 'false')) {
761
+	print 'checked';
762
+}
763
+?> ><?php echo _("Use shadows"); ?></label></div></li>
764
+		    <li><div class="checkbox"><label><input type="checkbox" name="one3dmodel" value="1" onclick="useOne3Dmodel(this)" <?php if ((isset($_COOKIE['one3dmodel']) && $_COOKIE['one3dmodel'] == 'true') || (!isset($_COOKIE['one3dmodel']) && isset($globalMap3DOneModel) && $globalMap3DOneModel)) {
765
+	print 'checked';
766
+}
767
+?> ><?php echo _("Use same 3D model for all aircraft (use fewer resources)"); ?></label></div></li>
768
+		    <li><div class="checkbox"><label><input type="checkbox" name="updaterealtime" value="1" onclick="clickUpdateRealtime(this)" <?php if ((isset($_COOKIE['updaterealtime']) && $_COOKIE['updaterealtime'] == 'true') || !isset($_COOKIE['updaterealtime'])) {
769
+	print 'checked';
770
+}
771
+?> ><?php echo _("Display realtime data in infobox"); ?></label></div></li>
511 772
 <?php
512 773
     }
513 774
     if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
@@ -520,17 +781,25 @@  discard block
 block discarded – undo
520 781
 			if (function_exists('array_column')) {
521 782
 			    if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
522 783
 		    ?>
523
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
784
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
785
+	print 'checked';
786
+}
787
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
524 788
 		    <?php
525 789
 			    }
526 790
 			} elseif (isset($globalSources)) {
527 791
 			    $dispolar = false;
528 792
 			    foreach ($globalSources as $testsource) {
529
-			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
793
+			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) {
794
+			        	$dispolar = true;
795
+			        }
530 796
 			    }
531 797
 			    if ($dispolar) {
532 798
 		    ?>
533
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
799
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
800
+	print 'checked';
801
+}
802
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
534 803
 		    <?php
535 804
 			    }
536 805
 		        }
@@ -541,7 +810,14 @@  discard block
 block discarded – undo
541 810
 		    <?php
542 811
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
543 812
 		    ?>
544
-		    <li><?php echo _("Max number of flights to display:"); ?> <input type="number" name="2dlimit" value="<?php if (isset($_COOKIE['map_2d_limit'])) print $_COOKIE['map_2d_limit']; elseif (isset($globalMap2DAircraftsLimit)) print $globalMapAircraftsLimit; else print 15000; ?>" onchange="map2dlimit(this.value);" /></li>
813
+		    <li><?php echo _("Max number of flights to display:"); ?> <input type="number" name="2dlimit" value="<?php if (isset($_COOKIE['map_2d_limit'])) {
814
+	print $_COOKIE['map_2d_limit'];
815
+} elseif (isset($globalMap2DAircraftsLimit)) {
816
+	print $globalMapAircraftsLimit;
817
+} else {
818
+	print 15000;
819
+}
820
+?>" onchange="map2dlimit(this.value);" /></li>
545 821
 		    <?php
546 822
 			}
547 823
 		    ?>
@@ -549,11 +825,21 @@  discard block
 block discarded – undo
549 825
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
550 826
 		    	    if (extension_loaded('gd') && function_exists('gd_info')) {
551 827
 		    ?>
552
-		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') print 'checked'; ?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
828
+		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') {
829
+	print 'checked';
830
+}
831
+?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
553 832
 		    <?php 
554 833
 				if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') {
555 834
 		    ?>
556
-			<li><?php echo _("Aircraft icon color:"); ?> <input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(this.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print '1a3151'; ?>"></li>
835
+			<li><?php echo _("Aircraft icon color:"); ?> <input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(this.value);" value="#<?php if (isset($_COOKIE['IconColor'])) {
836
+	print $_COOKIE['IconColor'];
837
+} elseif (isset($globalAircraftIconColor)) {
838
+	print $globalAircraftIconColor;
839
+} else {
840
+	print '1a3151';
841
+}
842
+?>"></li>
557 843
 		    <?php
558 844
 				}
559 845
 			    }
@@ -564,7 +850,14 @@  discard block
 block discarded – undo
564 850
 			    if (extension_loaded('gd') && function_exists('gd_info')) {
565 851
 		    ?>
566 852
 		    <li><?php echo _("Marine icon color:"); ?>
567
-			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print '1a3151'; ?>">
853
+			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) {
854
+	print $_COOKIE['MarineIconColor'];
855
+} elseif (isset($globalMarineIconColor)) {
856
+	print $globalMarineIconColor;
857
+} else {
858
+	print '1a3151';
859
+}
860
+?>">
568 861
 		    </li>
569 862
 		    <?php
570 863
 			    }
@@ -575,7 +868,14 @@  discard block
 block discarded – undo
575 868
 			    if (extension_loaded('gd') && function_exists('gd_info')) {
576 869
 		    ?>
577 870
 		    <li><?php echo _("Tracker icon color:"); ?>
578
-			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) print $_COOKIE['TrackerIconColor']; elseif (isset($globalTrackerIconColor)) print $globalTrackerIconColor; else print '1a3151'; ?>">
871
+			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) {
872
+	print $_COOKIE['TrackerIconColor'];
873
+} elseif (isset($globalTrackerIconColor)) {
874
+	print $globalTrackerIconColor;
875
+} else {
876
+	print '1a3151';
877
+}
878
+?>">
579 879
 		    </li>
580 880
 		    <?php
581 881
 			    }
@@ -586,8 +886,22 @@  discard block
 block discarded – undo
586 886
 		    ?>
587 887
 		    <li><?php echo _("Show airport icon at zoom level:"); ?>
588 888
 			<div class="range">
589
-			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?>">
590
-			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?></output>
889
+			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) {
890
+	print $_COOKIE['AirportZoom'];
891
+} elseif (isset($globalAirportZoom)) {
892
+	print $globalAirportZoom;
893
+} else {
894
+	print '7';
895
+}
896
+?>">
897
+			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) {
898
+	print $_COOKIE['AirportZoom'];
899
+} elseif (isset($globalAirportZoom)) {
900
+	print $globalAirportZoom;
901
+} else {
902
+	print '7';
903
+}
904
+?></output>
591 905
 			</div>
592 906
 		    </li>
593 907
 		    <?php
@@ -598,17 +912,40 @@  discard block
 block discarded – undo
598 912
 ?>
599 913
 		    <li><?php echo _("Set scaling factor for rendering resolution:"); ?>
600 914
 			<div class="range">
601
-			    <input type="range" min="0.5" max="2" step="0.5" name="resolutionscale" onchange="scale.value=value;resolutionScale(resolutionscale.value);" value="<?php if (isset($_COOKIE['resolutionScale'])) print $_COOKIE['resolutionScale']; else print '1'; ?>">
602
-			    <output id="scale"><?php if (isset($_COOKIE['resolutionScale'])) print $_COOKIE['resolutionScale']; else print '1'; ?></output>
915
+			    <input type="range" min="0.5" max="2" step="0.5" name="resolutionscale" onchange="scale.value=value;resolutionScale(resolutionscale.value);" value="<?php if (isset($_COOKIE['resolutionScale'])) {
916
+	print $_COOKIE['resolutionScale'];
917
+} else {
918
+	print '1';
919
+}
920
+?>">
921
+			    <output id="scale"><?php if (isset($_COOKIE['resolutionScale'])) {
922
+	print $_COOKIE['resolutionScale'];
923
+} else {
924
+	print '1';
925
+}
926
+?></output>
603 927
 			</div>
604 928
 		    </li>
605 929
 <?php
606 930
 	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
607 931
 ?>
608
-		    <li><input type="checkbox" name="useliveries" value="1" onclick="useLiveries(this)" <?php if (isset($_COOKIE['UseLiveries']) && $_COOKIE['UseLiveries'] == 'true') print 'checked'; ?> > <?php echo _("Use airlines liveries"); ?></li>
609
-		    <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') print 'checked'; ?> > <?php echo _("Force Aircraft color"); ?>&nbsp;
932
+		    <li><input type="checkbox" name="useliveries" value="1" onclick="useLiveries(this)" <?php if (isset($_COOKIE['UseLiveries']) && $_COOKIE['UseLiveries'] == 'true') {
933
+	print 'checked';
934
+}
935
+?> > <?php echo _("Use airlines liveries"); ?></li>
936
+		    <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') {
937
+	print 'checked';
938
+}
939
+?> > <?php echo _("Force Aircraft color"); ?>&nbsp;
610 940
 		    <!--<li><?php echo _("Aircraft icon color:"); ?>-->
611
-			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print 'ff0000'; ?>">
941
+			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) {
942
+	print $_COOKIE['IconColor'];
943
+} elseif (isset($globalAircraftIconColor)) {
944
+	print $globalAircraftIconColor;
945
+} else {
946
+	print 'ff0000';
947
+}
948
+?>">
612 949
 		    </li>
613 950
 <?php
614 951
 	}
@@ -616,9 +953,19 @@  discard block
 block discarded – undo
616 953
 <?php
617 954
 	if (isset($globalMarine) && $globalMarine === TRUE) {
618 955
 ?>
619
-		    <li><input type="checkbox" name="marinecolorforce" value="1" onclick="MarineiconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Marine color"); ?>&nbsp;
956
+		    <li><input type="checkbox" name="marinecolorforce" value="1" onclick="MarineiconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') {
957
+	print 'checked';
958
+}
959
+?> ><?php echo _("Force Marine color"); ?>&nbsp;
620 960
 		    <!--<li><?php echo _("Marine icon color:"); ?>-->
621
-			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print 'ff0000'; ?>">
961
+			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) {
962
+	print $_COOKIE['MarineIconColor'];
963
+} elseif (isset($globalMarineIconColor)) {
964
+	print $globalMarineIconColor;
965
+} else {
966
+	print 'ff0000';
967
+}
968
+?>">
622 969
 		    </li>
623 970
 <?php
624 971
 	}
@@ -626,9 +973,19 @@  discard block
 block discarded – undo
626 973
 <?php
627 974
 	if (isset($globalTracker) && $globalTracker === TRUE) {
628 975
 ?>
629
-		    <li><input type="checkbox" name="trackercolorforce" value="1" onclick="TrackericonColorForce(this)" <?php if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Tracker color"); ?>&nbsp;
976
+		    <li><input type="checkbox" name="trackercolorforce" value="1" onclick="TrackericonColorForce(this)" <?php if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true') {
977
+	print 'checked';
978
+}
979
+?> ><?php echo _("Force Tracker color"); ?>&nbsp;
630 980
 		    <!--<li><?php echo _("Tracker icon color:"); ?>-->
631
-			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) print $_COOKIE['TrackerIconColor']; elseif (isset($globalTrackerIconColor)) print $globalTrackerIconColor; else print 'ff0000'; ?>">
981
+			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) {
982
+	print $_COOKIE['TrackerIconColor'];
983
+} elseif (isset($globalTrackerIconColor)) {
984
+	print $globalTrackerIconColor;
985
+} else {
986
+	print 'ff0000';
987
+}
988
+?>">
632 989
 		    </li>
633 990
 <?php
634 991
 	}
@@ -636,29 +993,62 @@  discard block
 block discarded – undo
636 993
 ?>
637 994
 		    <li><?php echo _("Distance unit:"); ?>
638 995
 			<select class="selectpicker" onchange="unitdistance(this);">
639
-			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) echo ' selected'; ?>>km</option>
640
-			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) echo ' selected'; ?>>nm</option>
641
-			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) echo ' selected'; ?>>mi</option>
996
+			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) {
997
+	echo ' selected';
998
+}
999
+?>>km</option>
1000
+			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
1001
+	echo ' selected';
1002
+}
1003
+?>>nm</option>
1004
+			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
1005
+	echo ' selected';
1006
+}
1007
+?>>mi</option>
642 1008
 		        </select>
643 1009
 		    </li>
644 1010
 		    <li><?php echo _("Altitude unit:"); ?>
645 1011
 			<select class="selectpicker" onchange="unitaltitude(this);">
646
-			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) echo ' selected'; ?>>m</option>
647
-			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) echo ' selected'; ?>>feet</option>
1012
+			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) {
1013
+	echo ' selected';
1014
+}
1015
+?>>m</option>
1016
+			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) {
1017
+	echo ' selected';
1018
+}
1019
+?>>feet</option>
648 1020
 		        </select>
649 1021
 		    </li>
650 1022
 		    <li><?php echo _("Speed unit:"); ?>
651 1023
 			<select class="selectpicker" onchange="unitspeed(this);">
652
-			    <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) echo ' selected'; ?>>km/h</option>
653
-			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) echo ' selected'; ?>>mph</option>
654
-			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) echo ' selected'; ?>>knots</option>
1024
+			    <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) {
1025
+	echo ' selected';
1026
+}
1027
+?>>km/h</option>
1028
+			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) {
1029
+	echo ' selected';
1030
+}
1031
+?>>mph</option>
1032
+			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) {
1033
+	echo ' selected';
1034
+}
1035
+?>>knots</option>
655 1036
 		        </select>
656 1037
 		    </li>
657 1038
 		    <li><?php echo _("Coordinate unit:"); ?>
658 1039
 			<select class="selectpicker" onchange="unitcoordinate(this);">
659
-			    <option value="dd"<?php if ((!isset($_COOKIE['unitcoordinate']) && (!isset($globalUnitCoordinate) || (isset($globalUnitCoordinate) && $globalUnitCoordinate == 'dd'))) || (isset($_COOKIE['unitcoordinate']) && $_COOKIE['unitcoordinate'] == 'dd')) echo ' selected'; ?>>DD</option>
660
-			    <option value="dms"<?php if ((!isset($_COOKIE['unitcoordinate']) && isset($globalUnitCoordinate) && $globalUnitCoordinate == 'dms') || (isset($_COOKIE['unitcoordinate']) && $_COOKIE['unitcoordinate'] == 'dms')) echo ' selected'; ?>>DMS</option>
661
-			    <option value="dm"<?php if ((!isset($_COOKIE['unitcoordinate']) && isset($globalUnitCoordinate) && $globalUnitCoordinate == 'dm') || (isset($_COOKIE['unitcoordinate']) && $_COOKIE['unitcoordinate'] == 'dm')) echo ' selected'; ?>>DM</option>
1040
+			    <option value="dd"<?php if ((!isset($_COOKIE['unitcoordinate']) && (!isset($globalUnitCoordinate) || (isset($globalUnitCoordinate) && $globalUnitCoordinate == 'dd'))) || (isset($_COOKIE['unitcoordinate']) && $_COOKIE['unitcoordinate'] == 'dd')) {
1041
+	echo ' selected';
1042
+}
1043
+?>>DD</option>
1044
+			    <option value="dms"<?php if ((!isset($_COOKIE['unitcoordinate']) && isset($globalUnitCoordinate) && $globalUnitCoordinate == 'dms') || (isset($_COOKIE['unitcoordinate']) && $_COOKIE['unitcoordinate'] == 'dms')) {
1045
+	echo ' selected';
1046
+}
1047
+?>>DMS</option>
1048
+			    <option value="dm"<?php if ((!isset($_COOKIE['unitcoordinate']) && isset($globalUnitCoordinate) && $globalUnitCoordinate == 'dm') || (isset($_COOKIE['unitcoordinate']) && $_COOKIE['unitcoordinate'] == 'dm')) {
1049
+	echo ' selected';
1050
+}
1051
+?>>DM</option>
662 1052
 		        </select>
663 1053
 		    </li>
664 1054
 
@@ -676,9 +1066,18 @@  discard block
 block discarded – undo
676 1066
 		    <?php
677 1067
 			if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) {
678 1068
 		    ?>
679
-			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') || !isset($_COOKIE['filter_ShowVATSIM'])) print 'checked'; ?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
680
-			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') || !isset($_COOKIE['filter_ShowIVAO'])) print 'checked'; ?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
681
-			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') || !isset($_COOKIE['filter_ShowVMS'])) print 'checked'; ?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
1069
+			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') || !isset($_COOKIE['filter_ShowVATSIM'])) {
1070
+	print 'checked';
1071
+}
1072
+?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
1073
+			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') || !isset($_COOKIE['filter_ShowIVAO'])) {
1074
+	print 'checked';
1075
+}
1076
+?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
1077
+			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') || !isset($_COOKIE['filter_ShowVMS'])) {
1078
+	print 'checked';
1079
+}
1080
+?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
682 1081
 		    <?php
683 1082
 			}
684 1083
 		    ?>
@@ -686,12 +1085,21 @@  discard block
 block discarded – undo
686 1085
 			if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) {
687 1086
 		    ?>
688 1087
 			<?php if (isset($globalSBS1) && $globalSBS1) { ?>
689
-			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') || !isset($_COOKIE['filter_ShowSBS1'])) print 'checked'; ?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
1088
+			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') || !isset($_COOKIE['filter_ShowSBS1'])) {
1089
+	print 'checked';
1090
+}
1091
+?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
690 1092
 			<?php } ?>
691 1093
 			<?php if (isset($globalAPRS) && $globalAPRS) { ?>
692
-			    <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') || !isset($_COOKIE['filter_ShowAPRS'])) print 'checked'; ?> ><?php echo _("Display APRS data"); ?></label></div></li>
1094
+			    <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') || !isset($_COOKIE['filter_ShowAPRS'])) {
1095
+	print 'checked';
1096
+}
1097
+?> ><?php echo _("Display APRS data"); ?></label></div></li>
693 1098
 			<?php } ?>
694
-			<li><div class="checkbox"><label><input type="checkbox" name="blocked" value="1" onclick="clickBlocked(this)" <?php if (isset($_COOKIE['filter_blocked']) && $_COOKIE['filter_blocked'] == 'true') print 'checked'; ?> ><?php echo _("Only display FAA ASDI blocked aircrafts"); ?></label></div></li>
1099
+			<li><div class="checkbox"><label><input type="checkbox" name="blocked" value="1" onclick="clickBlocked(this)" <?php if (isset($_COOKIE['filter_blocked']) && $_COOKIE['filter_blocked'] == 'true') {
1100
+	print 'checked';
1101
+}
1102
+?> ><?php echo _("Only display FAA ASDI blocked aircrafts"); ?></label></div></li>
695 1103
 		    <?php
696 1104
 			}
697 1105
 		    ?>
@@ -707,7 +1115,9 @@  discard block
 block discarded – undo
707 1115
 				}
708 1116
 				foreach($allairlinenames as $airline) {
709 1117
 					$airline_name = $airline['airline_name'];
710
-					if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...';
1118
+					if (strlen($airline_name) > 30) {
1119
+						$airline_name = substr($airline_name,0,30).'...';
1120
+					}
711 1121
 					if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['filter_Airlines']))) {
712 1122
 						echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>';
713 1123
 					} else {
@@ -725,7 +1135,10 @@  discard block
 block discarded – undo
725 1135
 		    <li><?php echo _("Display alliance:"); ?>
726 1136
 		    <br/>
727 1137
 			<select class="selectpicker" onchange="alliance(this);" id="display_alliance">
728
-			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
1138
+			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') {
1139
+	echo ' selected';
1140
+}
1141
+?>><?php echo _("All"); ?></option>
729 1142
 			    <?php
730 1143
 				foreach($allalliancenames as $alliance) {
731 1144
 					$alliance_name = $alliance['alliance'];
@@ -784,10 +1197,22 @@  discard block
 block discarded – undo
784 1197
 		    ?>
785 1198
 		    <li><?php echo _("Display airlines of type:"); ?><br/>
786 1199
 			<select class="selectpicker" onchange="airlinestype(this);">
787
-			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
788
-			    <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') echo ' selected'; ?>><?php echo _("Passenger"); ?></option>
789
-			    <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') echo ' selected'; ?>><?php echo _("Cargo"); ?></option>
790
-			    <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') echo ' selected'; ?>><?php echo _("Military"); ?></option>
1200
+			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') {
1201
+	echo ' selected';
1202
+}
1203
+?>><?php echo _("All"); ?></option>
1204
+			    <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') {
1205
+	echo ' selected';
1206
+}
1207
+?>><?php echo _("Passenger"); ?></option>
1208
+			    <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') {
1209
+	echo ' selected';
1210
+}
1211
+?>><?php echo _("Cargo"); ?></option>
1212
+			    <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') {
1213
+	echo ' selected';
1214
+}
1215
+?>><?php echo _("Military"); ?></option>
791 1216
 			</select>
792 1217
 		    </li>
793 1218
 		    <?php
@@ -801,7 +1226,10 @@  discard block
 block discarded – undo
801 1226
 		    ?>
802 1227
 		    <li>
803 1228
 			<?php echo _("Display vessels with MMSI:"); ?>
804
-			<input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) print $_COOKIE['filter_mmsi']; ?>" />
1229
+			<input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) {
1230
+	print $_COOKIE['filter_mmsi'];
1231
+}
1232
+?>" />
805 1233
 		    </li>
806 1234
 			<?php
807 1235
 				if (isset($globalVM) && $globalVM) {
@@ -832,7 +1260,10 @@  discard block
 block discarded – undo
832 1260
 		    ?>
833 1261
 		    <li>
834 1262
 			<?php echo _("Display with ident:"); ?>
835
-			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" />
1263
+			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) {
1264
+	print $_COOKIE['filter_ident'];
1265
+}
1266
+?>" />
836 1267
 		    </li>
837 1268
 		</ul>
838 1269
 	    </form>
@@ -848,7 +1279,10 @@  discard block
 block discarded – undo
848 1279
 	    <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
849 1280
 	    <form>
850 1281
 		<ul>
851
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if ((isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') || !isset($_COOKIE['displayiss'])) print 'checked'; ?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li>
1282
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if ((isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') || !isset($_COOKIE['displayiss'])) {
1283
+	print 'checked';
1284
+}
1285
+?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li>
852 1286
 		    <li><?php echo _("Type:"); ?>
853 1287
 			<select class="selectpicker" multiple onchange="sattypes(this);">
854 1288
 			    <?php
@@ -856,25 +1290,45 @@  discard block
 block discarded – undo
856 1290
 				$types = $Satellite->get_tle_types();
857 1291
 				foreach ($types as $type) {
858 1292
 					$type_name = $type['tle_type'];
859
-					if ($type_name == 'musson') $type_name = 'Russian LEO Navigation';
860
-					else if ($type_name == 'nnss') $type_name = 'Navi Navigation Satellite System';
861
-					else if ($type_name == 'sbas') $type_name = 'Satellite-Based Augmentation System';
862
-					else if ($type_name == 'glo-ops') $type_name = 'Glonass Operational';
863
-					else if ($type_name == 'gps-ops') $type_name = 'GPS Operational';
864
-					else if ($type_name == 'argos') $type_name = 'ARGOS Data Collection System';
865
-					else if ($type_name == 'tdrss') $type_name = 'Tracking and Data Relay Satellite System';
866
-					else if ($type_name == 'sarsat') $type_name = 'Search & Rescue';
867
-					else if ($type_name == 'dmc') $type_name = 'Disaster Monitoring';
868
-					else if ($type_name == 'resource') $type_name = 'Earth Resources';
869
-					else if ($type_name == 'stations') $type_name = 'Space Stations';
870
-					else if ($type_name == 'geo') $type_name = 'Geostationary';
871
-					else if ($type_name == 'amateur') $type_name = 'Amateur Radio';
872
-					else if ($type_name == 'x-comm') $type_name = 'Experimental';
873
-					else if ($type_name == 'other-comm') $type_name = 'Other Comm';
874
-					else if ($type_name == 'science') $type_name = 'Space & Earth Science';
875
-					else if ($type_name == 'military') $type_name = 'Miscellaneous Military';
876
-					else if ($type_name == 'radar') $type_name = 'Radar Calibration';
877
-					else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches';
1293
+					if ($type_name == 'musson') {
1294
+						$type_name = 'Russian LEO Navigation';
1295
+					} else if ($type_name == 'nnss') {
1296
+						$type_name = 'Navi Navigation Satellite System';
1297
+					} else if ($type_name == 'sbas') {
1298
+						$type_name = 'Satellite-Based Augmentation System';
1299
+					} else if ($type_name == 'glo-ops') {
1300
+						$type_name = 'Glonass Operational';
1301
+					} else if ($type_name == 'gps-ops') {
1302
+						$type_name = 'GPS Operational';
1303
+					} else if ($type_name == 'argos') {
1304
+						$type_name = 'ARGOS Data Collection System';
1305
+					} else if ($type_name == 'tdrss') {
1306
+						$type_name = 'Tracking and Data Relay Satellite System';
1307
+					} else if ($type_name == 'sarsat') {
1308
+						$type_name = 'Search & Rescue';
1309
+					} else if ($type_name == 'dmc') {
1310
+						$type_name = 'Disaster Monitoring';
1311
+					} else if ($type_name == 'resource') {
1312
+						$type_name = 'Earth Resources';
1313
+					} else if ($type_name == 'stations') {
1314
+						$type_name = 'Space Stations';
1315
+					} else if ($type_name == 'geo') {
1316
+						$type_name = 'Geostationary';
1317
+					} else if ($type_name == 'amateur') {
1318
+						$type_name = 'Amateur Radio';
1319
+					} else if ($type_name == 'x-comm') {
1320
+						$type_name = 'Experimental';
1321
+					} else if ($type_name == 'other-comm') {
1322
+						$type_name = 'Other Comm';
1323
+					} else if ($type_name == 'science') {
1324
+						$type_name = 'Space & Earth Science';
1325
+					} else if ($type_name == 'military') {
1326
+						$type_name = 'Miscellaneous Military';
1327
+					} else if ($type_name == 'radar') {
1328
+						$type_name = 'Radar Calibration';
1329
+					} else if ($type_name == 'tle-new') {
1330
+						$type_name = 'Last 30 days launches';
1331
+					}
878 1332
 					
879 1333
 					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) {
880 1334
 						print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>';
Please login to merge, or discard this patch.