Completed
Push — master ( cb13e2...855cef )
by Yannick
34:31
created
require/class.SpotterLive.php 1 patch
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.
index.php 1 patch
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.