Completed
Push — master ( c396ef...4342b6 )
by Yannick
34:34
created
owner-statistics-registration.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@
 block discarded – undo
4 4
 require_once('require/class.SpotterArchive.php');
5 5
 require_once('require/class.Language.php');
6 6
 if (!isset($_GET['owner'])) {
7
-        header('Location: '.$globalURL.'/owner');
8
-        die();
7
+		header('Location: '.$globalURL.'/owner');
8
+		die();
9 9
 }
10 10
 $Spotter = new Spotter();
11 11
 $SpotterArchive = new SpotterArchive();
Please login to merge, or discard this patch.
owner-statistics-arrival-airport.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@
 block discarded – undo
4 4
 require_once('require/class.SpotterArchive.php');
5 5
 require_once('require/class.Language.php');
6 6
 if (!isset($_GET['owner'])) {
7
-        header('Location: '.$globalURL.'/owner');
8
-        die();
7
+		header('Location: '.$globalURL.'/owner');
8
+		die();
9 9
 }
10 10
 $Spotter = new Spotter();
11 11
 $SpotterArchive = new SpotterArchive();
Please login to merge, or discard this patch.
require/class.SpotterLive.php 1 patch
Indentation   +265 added lines, -265 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 string the SQL part
19
-	*/
16
+	 * Get SQL query part for filter used
17
+	 * @param array $filter the filter
18
+	 * @return string 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();
@@ -138,14 +138,14 @@  discard block
 block discarded – undo
138 138
 		return $filter_query;
139 139
 	}
140 140
 
141
-    /**
142
-     * Gets all the spotter information based on the latest data entry
143
-     *
144
-     * @param string $limit
145
-     * @param string $sort
146
-     * @param array $filter
147
-     * @return array the spotter information
148
-     */
141
+	/**
142
+	 * Gets all the spotter information based on the latest data entry
143
+	 *
144
+	 * @param string $limit
145
+	 * @param string $sort
146
+	 * @param array $filter
147
+	 * @return array the spotter information
148
+	 */
149 149
 	public function getLiveSpotterData($limit = '', $sort = '', $filter = array())
150 150
 	{
151 151
 		global $globalDBdriver, $globalLiveInterval;
@@ -187,13 +187,13 @@  discard block
 block discarded – undo
187 187
 		return $spotter_array;
188 188
 	}
189 189
 
190
-    /**
191
-     * Gets Minimal Live Spotter data
192
-     *
193
-     * @param int $limit
194
-     * @param array $filter
195
-     * @return array the spotter information
196
-     */
190
+	/**
191
+	 * Gets Minimal Live Spotter data
192
+	 *
193
+	 * @param int $limit
194
+	 * @param array $filter
195
+	 * @return array the spotter information
196
+	 */
197 197
 	public function getMinLiveSpotterData($limit = 0,$filter = array())
198 198
 	{
199 199
 		global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap2DAircraftsLimit;
@@ -244,15 +244,15 @@  discard block
 block discarded – undo
244 244
 		return $spotter_array;
245 245
 	}
246 246
 
247
-    /**
248
-     * Gets Minimal Live Spotter data since xx seconds
249
-     *
250
-     * @param array $coord
251
-     * @param array $filter
252
-     * @param int $limit
253
-     * @param string $id
254
-     * @return array the spotter information
255
-     */
247
+	/**
248
+	 * Gets Minimal Live Spotter data since xx seconds
249
+	 *
250
+	 * @param array $coord
251
+	 * @param array $filter
252
+	 * @param int $limit
253
+	 * @param string $id
254
+	 * @return array the spotter information
255
+	 */
256 256
 	public function getMinLastLiveSpotterData($coord = array(),$filter = array(), $limit = 0, $id = '')
257 257
 	{
258 258
 		global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap3DAircraftsLimit;
@@ -354,14 +354,14 @@  discard block
 block discarded – undo
354 354
 		return $spotter_array;
355 355
 	}
356 356
 
357
-    /**
358
-     * Gets Minimal Live Spotter data since xx seconds
359
-     *
360
-     * @param string $id
361
-     * @param array $filter
362
-     * @param int $limit
363
-     * @return array the spotter information
364
-     */
357
+	/**
358
+	 * Gets Minimal Live Spotter data since xx seconds
359
+	 *
360
+	 * @param string $id
361
+	 * @param array $filter
362
+	 * @param int $limit
363
+	 * @return array the spotter information
364
+	 */
365 365
 	public function getMinLastLiveSpotterDataByID($id = '',$filter = array(), $limit = 0)
366 366
 	{
367 367
 		global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap3DAircraftsLimit;
@@ -426,12 +426,12 @@  discard block
 block discarded – undo
426 426
 		return $spotter_array;
427 427
 	}
428 428
 
429
-    /**
430
-     * Gets number of latest data entry
431
-     *
432
-     * @param array $filter
433
-     * @return String number of entry
434
-     */
429
+	/**
430
+	 * Gets number of latest data entry
431
+	 *
432
+	 * @param array $filter
433
+	 * @return String number of entry
434
+	 */
435 435
 	public function getLiveSpotterCount($filter = array())
436 436
 	{
437 437
 		global $globalDBdriver, $globalLiveInterval;
@@ -457,13 +457,13 @@  discard block
 block discarded – undo
457 457
 		return $result['nb'];
458 458
 	}
459 459
 
460
-    /**
461
-     * Gets all the spotter information based on the latest data entry and coord
462
-     *
463
-     * @param $coord
464
-     * @param array $filter
465
-     * @return array the spotter information
466
-     */
460
+	/**
461
+	 * Gets all the spotter information based on the latest data entry and coord
462
+	 *
463
+	 * @param $coord
464
+	 * @param array $filter
465
+	 * @return array the spotter information
466
+	 */
467 467
 	public function getLiveSpotterDatabyCoord($coord, $filter = array())
468 468
 	{
469 469
 		global $globalDBdriver, $globalLiveInterval,$globalMap2DAircraftsLimit;
@@ -490,14 +490,14 @@  discard block
 block discarded – undo
490 490
 		return $spotter_array;
491 491
 	}
492 492
 
493
-    /**
494
-     * Gets all the spotter information based on the latest data entry and coord
495
-     *
496
-     * @param $coord
497
-     * @param int $limit
498
-     * @param array $filter
499
-     * @return array the spotter information
500
-     */
493
+	/**
494
+	 * Gets all the spotter information based on the latest data entry and coord
495
+	 *
496
+	 * @param $coord
497
+	 * @param int $limit
498
+	 * @param array $filter
499
+	 * @return array the spotter information
500
+	 */
501 501
 	public function getMinLiveSpotterDatabyCoord($coord,$limit = 0, $filter = array())
502 502
 	{
503 503
 		global $globalDBdriver, $globalLiveInterval, $globalArchive,$globalMap2DAircraftsLimit;
@@ -587,15 +587,15 @@  discard block
 block discarded – undo
587 587
 		return $spotter_array;
588 588
 	}
589 589
 
590
-    /**
591
-     * Gets all the spotter information based on a user's latitude and longitude
592
-     *
593
-     * @param $lat
594
-     * @param $lng
595
-     * @param $radius
596
-     * @param $interval
597
-     * @return array the spotter information
598
-     */
590
+	/**
591
+	 * Gets all the spotter information based on a user's latitude and longitude
592
+	 *
593
+	 * @param $lat
594
+	 * @param $lng
595
+	 * @param $radius
596
+	 * @param $interval
597
+	 * @return array the spotter information
598
+	 */
599 599
 	public function getLatestSpotterForLayar($lat, $lng, $radius, $interval)
600 600
 	{
601 601
 		$Spotter = new Spotter($this->db);
@@ -605,95 +605,95 @@  discard block
 block discarded – undo
605 605
 				return array();
606 606
 			}
607 607
 		}
608
-        if ($lng != '')
609
-        {
610
-        	if (!is_numeric($lng))
611
-            {
612
-            	return array();
613
-            }
614
-        }
615
-        if ($radius != '')
616
-        {
617
-        	if (!is_numeric($radius))
618
-        	{
619
-        		return array();
620
-        	}
621
-        }
608
+		if ($lng != '')
609
+		{
610
+			if (!is_numeric($lng))
611
+			{
612
+				return array();
613
+			}
614
+		}
615
+		if ($radius != '')
616
+		{
617
+			if (!is_numeric($radius))
618
+			{
619
+				return array();
620
+			}
621
+		}
622 622
 		$additional_query = '';
623
-        if ($interval != '')
624
-        {
625
-        	if (!is_string($interval))
626
-        	{
627
-        		return array();
628
-        	} else {
629
-                if ($interval == '1m')
630
-                {
631
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
632
-                } else if ($interval == '15m'){
633
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date ';
634
-                } 
635
-            }
636
-        } else {
637
-        	$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
638
-        }
639
-	        $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 
623
+		if ($interval != '')
624
+		{
625
+			if (!is_string($interval))
626
+			{
627
+				return array();
628
+			} else {
629
+				if ($interval == '1m')
630
+				{
631
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
632
+				} else if ($interval == '15m'){
633
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date ';
634
+				} 
635
+			}
636
+		} else {
637
+			$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
638
+		}
639
+			$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 
640 640
                    WHERE spotter_live.latitude <> '' 
641 641
                    AND spotter_live.longitude <> '' 
642 642
                   ".$additional_query."
643 643
                    HAVING distance < :radius  
644 644
                    ORDER BY distance";
645 645
 
646
-            $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
647
-            return $spotter_array;
648
-        }
646
+			$spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
647
+			return $spotter_array;
648
+		}
649 649
 
650 650
 
651
-    /**
652
-     * Gets all the spotter information based on a particular callsign
653
-     *
654
-     * @param $ident
655
-     * @return array the spotter information
656
-     */
651
+	/**
652
+	 * Gets all the spotter information based on a particular callsign
653
+	 *
654
+	 * @param $ident
655
+	 * @return array the spotter information
656
+	 */
657 657
 	public function getLastLiveSpotterDataByIdent($ident)
658 658
 	{
659 659
 		$Spotter = new Spotter($this->db);
660 660
 		date_default_timezone_set('UTC');
661 661
 
662 662
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
663
-                $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';
663
+				$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';
664 664
 
665 665
 		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true);
666 666
 
667 667
 		return $spotter_array;
668 668
 	}
669 669
 
670
-    /**
671
-     * Gets all the spotter information based on a particular callsign
672
-     *
673
-     * @param $ident
674
-     * @param $date
675
-     * @return array the spotter information
676
-     */
670
+	/**
671
+	 * Gets all the spotter information based on a particular callsign
672
+	 *
673
+	 * @param $ident
674
+	 * @param $date
675
+	 * @return array the spotter information
676
+	 */
677 677
 	public function getDateLiveSpotterDataByIdent($ident,$date)
678 678
 	{
679 679
 		$Spotter = new Spotter($this->db);
680 680
 		date_default_timezone_set('UTC');
681 681
 
682 682
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
683
-                $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';
683
+				$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';
684 684
 
685
-                $date = date('c',$date);
685
+				$date = date('c',$date);
686 686
 		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
687 687
 
688 688
 		return $spotter_array;
689 689
 	}
690 690
 
691
-    /**
692
-     * Gets last spotter information based on a particular callsign
693
-     *
694
-     * @param $id
695
-     * @return array the spotter information
696
-     */
691
+	/**
692
+	 * Gets last spotter information based on a particular callsign
693
+	 *
694
+	 * @param $id
695
+	 * @return array the spotter information
696
+	 */
697 697
 	public function getLastLiveSpotterDataById($id)
698 698
 	{
699 699
 		$Spotter = new Spotter($this->db);
@@ -704,13 +704,13 @@  discard block
 block discarded – undo
704 704
 		return $spotter_array;
705 705
 	}
706 706
 
707
-    /**
708
-     * Gets last spotter information based on a particular callsign
709
-     *
710
-     * @param $id
711
-     * @param $date
712
-     * @return array the spotter information
713
-     */
707
+	/**
708
+	 * Gets last spotter information based on a particular callsign
709
+	 *
710
+	 * @param $id
711
+	 * @param $date
712
+	 * @return array the spotter information
713
+	 */
714 714
 	public function getDateLiveSpotterDataById($id,$date)
715 715
 	{
716 716
 		$Spotter = new Spotter($this->db);
@@ -723,21 +723,21 @@  discard block
 block discarded – undo
723 723
 		return $spotter_array;
724 724
 	}
725 725
 
726
-    /**
727
-     * Gets altitude information based on a particular callsign
728
-     *
729
-     * @param $ident
730
-     * @return array the spotter information
731
-     */
726
+	/**
727
+	 * Gets altitude information based on a particular callsign
728
+	 *
729
+	 * @param $ident
730
+	 * @return array the spotter information
731
+	 */
732 732
 	public function getAltitudeLiveSpotterDataByIdent($ident)
733 733
 	{
734 734
 
735 735
 		date_default_timezone_set('UTC');
736 736
 
737 737
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
738
-                $query  = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
738
+				$query  = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
739 739
 
740
-    		try {
740
+			try {
741 741
 			
742 742
 			$sth = $this->db->prepare($query);
743 743
 			$sth->execute(array(':ident' => $ident));
@@ -750,13 +750,13 @@  discard block
 block discarded – undo
750 750
 		return $spotter_array;
751 751
 	}
752 752
 
753
-    /**
754
-     * Gets all the spotter information based on a particular id
755
-     *
756
-     * @param $id
757
-     * @param bool $liveinterval
758
-     * @return array the spotter information
759
-     */
753
+	/**
754
+	 * Gets all the spotter information based on a particular id
755
+	 *
756
+	 * @param $id
757
+	 * @param bool $liveinterval
758
+	 * @return array the spotter information
759
+	 */
760 760
 	public function getAllLiveSpotterDataById($id,$liveinterval = false)
761 761
 	{
762 762
 		global $globalDBdriver, $globalLiveInterval;
@@ -784,18 +784,18 @@  discard block
 block discarded – undo
784 784
 		return $spotter_array;
785 785
 	}
786 786
 
787
-    /**
788
-     * Gets all the spotter information based on a particular ident
789
-     *
790
-     * @param $ident
791
-     * @return array the spotter information
792
-     */
787
+	/**
788
+	 * Gets all the spotter information based on a particular ident
789
+	 *
790
+	 * @param $ident
791
+	 * @return array the spotter information
792
+	 */
793 793
 	public function getAllLiveSpotterDataByIdent($ident)
794 794
 	{
795 795
 		date_default_timezone_set('UTC');
796 796
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
797 797
 		$query  = self::$global_query.' WHERE spotter_live.ident = :ident';
798
-    		try {
798
+			try {
799 799
 			
800 800
 			$sth = $this->db->prepare($query);
801 801
 			$sth->execute(array(':ident' => $ident));
@@ -809,23 +809,23 @@  discard block
 block discarded – undo
809 809
 
810 810
 
811 811
 	/**
812
-	* Deletes all info in the table
813
-	*
814
-	* @return String success or false
815
-	*
816
-	*/
812
+	 * Deletes all info in the table
813
+	 *
814
+	 * @return String success or false
815
+	 *
816
+	 */
817 817
 	public function deleteLiveSpotterData()
818 818
 	{
819 819
 		global $globalDBdriver;
820 820
 		if ($globalDBdriver == 'mysql') {
821 821
 			//$query  = "DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= spotter_live.date";
822 822
 			$query  = 'DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= spotter_live.date';
823
-            		//$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)";
823
+					//$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)";
824 824
 		} else {
825 825
 			$query  = "DELETE FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= spotter_live.date";
826 826
 		}
827 827
         
828
-    		try {
828
+			try {
829 829
 			
830 830
 			$sth = $this->db->prepare($query);
831 831
 			$sth->execute();
@@ -837,18 +837,18 @@  discard block
 block discarded – undo
837 837
 	}
838 838
 
839 839
 	/**
840
-	* Deletes all info in the table for aircraft not seen since 2 HOUR
841
-	*
842
-	* @return String success or false
843
-	*
844
-	*/
840
+	 * Deletes all info in the table for aircraft not seen since 2 HOUR
841
+	 *
842
+	 * @return String success or false
843
+	 *
844
+	 */
845 845
 	public function deleteLiveSpotterDataNotUpdated()
846 846
 	{
847 847
 		global $globalDBdriver, $globalDebug;
848 848
 		if ($globalDBdriver == 'mysql') {
849 849
 			//$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';
850
-    			$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";
851
-    			try {
850
+				$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";
851
+				try {
852 852
 				
853 853
 				$sth = $this->db->prepare($query);
854 854
 				$sth->execute();
@@ -856,8 +856,8 @@  discard block
 block discarded – undo
856 856
 				return "error";
857 857
 			}
858 858
 			$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
859
-                        $i = 0;
860
-                        $j =0;
859
+						$i = 0;
860
+						$j =0;
861 861
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
862 862
 			foreach($all as $row)
863 863
 			{
@@ -865,20 +865,20 @@  discard block
 block discarded – undo
865 865
 				$j++;
866 866
 				if ($j == 30) {
867 867
 					if ($globalDebug) echo ".";
868
-				    	try {
868
+						try {
869 869
 						
870 870
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
871 871
 						$sth->execute();
872 872
 					} catch(PDOException $e) {
873 873
 						return "error";
874 874
 					}
875
-                                	$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
876
-                                	$j = 0;
875
+									$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
876
+									$j = 0;
877 877
 				}
878 878
 				$query_delete .= "'".$row['flightaware_id']."',";
879 879
 			}
880 880
 			if ($i > 0) {
881
-    				try {
881
+					try {
882 882
 					
883 883
 					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
884 884
 					$sth->execute();
@@ -889,9 +889,9 @@  discard block
 block discarded – undo
889 889
 			return "success";
890 890
 		} elseif ($globalDBdriver == 'pgsql') {
891 891
 			//$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";
892
-    			//$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";
893
-    			$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)";
894
-    			try {
892
+				//$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";
893
+				$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)";
894
+				try {
895 895
 				
896 896
 				$sth = $this->db->prepare($query);
897 897
 				$sth->execute();
@@ -934,18 +934,18 @@  discard block
 block discarded – undo
934 934
 		}
935 935
 	}
936 936
 
937
-    /**
938
-     * Deletes all info in the table for an ident
939
-     *
940
-     * @param $ident
941
-     * @return String success or false
942
-     */
937
+	/**
938
+	 * Deletes all info in the table for an ident
939
+	 *
940
+	 * @param $ident
941
+	 * @return String success or false
942
+	 */
943 943
 	public function deleteLiveSpotterDataByIdent($ident)
944 944
 	{
945 945
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
946 946
 		$query  = 'DELETE FROM spotter_live WHERE ident = :ident';
947 947
         
948
-    		try {
948
+			try {
949 949
 			
950 950
 			$sth = $this->db->prepare($query);
951 951
 			$sth->execute(array(':ident' => $ident));
@@ -956,18 +956,18 @@  discard block
 block discarded – undo
956 956
 		return "success";
957 957
 	}
958 958
 
959
-    /**
960
-     * Deletes all info in the table for an id
961
-     *
962
-     * @param $id
963
-     * @return String success or false
964
-     */
959
+	/**
960
+	 * Deletes all info in the table for an id
961
+	 *
962
+	 * @param $id
963
+	 * @return String success or false
964
+	 */
965 965
 	public function deleteLiveSpotterDataById($id)
966 966
 	{
967 967
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
968 968
 		$query  = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
969 969
         
970
-    		try {
970
+			try {
971 971
 			
972 972
 			$sth = $this->db->prepare($query);
973 973
 			$sth->execute(array(':id' => $id));
@@ -979,12 +979,12 @@  discard block
 block discarded – undo
979 979
 	}
980 980
 
981 981
 
982
-    /**
983
-     * Gets the aircraft ident within the last hour
984
-     *
985
-     * @param $ident
986
-     * @return String the ident
987
-     */
982
+	/**
983
+	 * Gets the aircraft ident within the last hour
984
+	 *
985
+	 * @param $ident
986
+	 * @return String the ident
987
+	 */
988 988
 	public function getIdentFromLastHour($ident)
989 989
 	{
990 990
 		global $globalDBdriver, $globalTimezone;
@@ -1010,14 +1010,14 @@  discard block
 block discarded – undo
1010 1010
 			$ident_result = $row['ident'];
1011 1011
 		}
1012 1012
 		return $ident_result;
1013
-        }
1014
-
1015
-    /**
1016
-     * Check recent aircraft
1017
-     *
1018
-     * @param $ident
1019
-     * @return String the ident
1020
-     */
1013
+		}
1014
+
1015
+	/**
1016
+	 * Check recent aircraft
1017
+	 *
1018
+	 * @param $ident
1019
+	 * @return String the ident
1020
+	 */
1021 1021
 	public function checkIdentRecent($ident)
1022 1022
 	{
1023 1023
 		global $globalDBdriver, $globalTimezone;
@@ -1043,14 +1043,14 @@  discard block
 block discarded – undo
1043 1043
 			$ident_result = $row['flightaware_id'];
1044 1044
 		}
1045 1045
 		return $ident_result;
1046
-        }
1047
-
1048
-    /**
1049
-     * Check recent aircraft by id
1050
-     *
1051
-     * @param $id
1052
-     * @return String the ident
1053
-     */
1046
+		}
1047
+
1048
+	/**
1049
+	 * Check recent aircraft by id
1050
+	 *
1051
+	 * @param $id
1052
+	 * @return String the ident
1053
+	 */
1054 1054
 	public function checkIdRecent($id)
1055 1055
 	{
1056 1056
 		global $globalDBdriver, $globalTimezone;
@@ -1076,14 +1076,14 @@  discard block
 block discarded – undo
1076 1076
 			$ident_result = $row['flightaware_id'];
1077 1077
 		}
1078 1078
 		return $ident_result;
1079
-        }
1080
-
1081
-    /**
1082
-     * Check recent aircraft by ModeS
1083
-     *
1084
-     * @param $modes
1085
-     * @return String the ModeS
1086
-     */
1079
+		}
1080
+
1081
+	/**
1082
+	 * Check recent aircraft by ModeS
1083
+	 *
1084
+	 * @param $modes
1085
+	 * @return String the ModeS
1086
+	 */
1087 1087
 	public function checkModeSRecent($modes)
1088 1088
 	{
1089 1089
 		global $globalDBdriver, $globalTimezone;
@@ -1112,12 +1112,12 @@  discard block
 block discarded – undo
1112 1112
 		return $ident_result;
1113 1113
 	}
1114 1114
 
1115
-    /**
1116
-     * Gets the aircraft data from the last 20 seconds
1117
-     *
1118
-     * @param string $q
1119
-     * @return array the spotter data
1120
-     */
1115
+	/**
1116
+	 * Gets the aircraft data from the last 20 seconds
1117
+	 *
1118
+	 * @param string $q
1119
+	 * @return array the spotter data
1120
+	 */
1121 1121
 	public function getRealTimeData($q = '')
1122 1122
 	{
1123 1123
 		global $globalDBdriver;
@@ -1158,39 +1158,39 @@  discard block
 block discarded – undo
1158 1158
 		return $spotter_array;
1159 1159
 	}
1160 1160
 
1161
-    /**
1162
-     * Adds a new spotter data
1163
-     *
1164
-     * @param String $flightaware_id the ID from flightaware
1165
-     * @param String $ident the flight ident
1166
-     * @param String $aircraft_icao the aircraft type
1167
-     * @param String $departure_airport_icao the departure airport
1168
-     * @param String $arrival_airport_icao the arrival airport
1169
-     * @param string $latitude
1170
-     * @param string $longitude
1171
-     * @param string $waypoints
1172
-     * @param string $altitude
1173
-     * @param string $altitude_real
1174
-     * @param string $heading
1175
-     * @param string $groundspeed
1176
-     * @param string $date
1177
-     * @param string $departure_airport_time
1178
-     * @param string $arrival_airport_time
1179
-     * @param string $squawk
1180
-     * @param string $route_stop
1181
-     * @param string $ModeS
1182
-     * @param bool $putinarchive
1183
-     * @param string $registration
1184
-     * @param string $pilot_id
1185
-     * @param string $pilot_name
1186
-     * @param string $verticalrate
1187
-     * @param bool $noarchive
1188
-     * @param bool $ground
1189
-     * @param string $format_source
1190
-     * @param string $source_name
1191
-     * @param string $over_country
1192
-     * @return String success or false
1193
-     */
1161
+	/**
1162
+	 * Adds a new spotter data
1163
+	 *
1164
+	 * @param String $flightaware_id the ID from flightaware
1165
+	 * @param String $ident the flight ident
1166
+	 * @param String $aircraft_icao the aircraft type
1167
+	 * @param String $departure_airport_icao the departure airport
1168
+	 * @param String $arrival_airport_icao the arrival airport
1169
+	 * @param string $latitude
1170
+	 * @param string $longitude
1171
+	 * @param string $waypoints
1172
+	 * @param string $altitude
1173
+	 * @param string $altitude_real
1174
+	 * @param string $heading
1175
+	 * @param string $groundspeed
1176
+	 * @param string $date
1177
+	 * @param string $departure_airport_time
1178
+	 * @param string $arrival_airport_time
1179
+	 * @param string $squawk
1180
+	 * @param string $route_stop
1181
+	 * @param string $ModeS
1182
+	 * @param bool $putinarchive
1183
+	 * @param string $registration
1184
+	 * @param string $pilot_id
1185
+	 * @param string $pilot_name
1186
+	 * @param string $verticalrate
1187
+	 * @param bool $noarchive
1188
+	 * @param bool $ground
1189
+	 * @param string $format_source
1190
+	 * @param string $source_name
1191
+	 * @param string $over_country
1192
+	 * @return String success or false
1193
+	 */
1194 1194
 	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 = '')
1195 1195
 	{
1196 1196
 		global $globalURL, $globalArchive, $globalDebug;
@@ -1333,10 +1333,10 @@  discard block
 block discarded – undo
1333 1333
 		$arrival_airport_country = '';
1334 1334
 		
1335 1335
             	
1336
-            	if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
1337
-            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
1338
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
1339
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
1336
+				if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
1337
+				if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
1338
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
1339
+				if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
1340 1340
 		
1341 1341
 		$query = '';
1342 1342
 		if ($globalArchive) {
@@ -1357,10 +1357,10 @@  discard block
 block discarded – undo
1357 1357
 			return "error : ".$e->getMessage();
1358 1358
 		}
1359 1359
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
1360
-		    if ($globalDebug) echo '(Add to Spotter archive : ';
1361
-		    $SpotterArchive = new SpotterArchive($this->db);
1362
-		    $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);
1363
-		    if ($globalDebug) echo $result.')';
1360
+			if ($globalDebug) echo '(Add to Spotter archive : ';
1361
+			$SpotterArchive = new SpotterArchive($this->db);
1362
+			$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);
1363
+			if ($globalDebug) echo $result.')';
1364 1364
 		} elseif ($globalDebug && $putinarchive !== true) {
1365 1365
 			echo '(Not adding to archive)';
1366 1366
 		} elseif ($globalDebug && $noarchive === true) {
Please login to merge, or discard this patch.
require/class.SpotterArchive.php 1 patch
Indentation   +266 added lines, -266 removed lines patch added patch discarded remove patch
@@ -9,13 +9,13 @@  discard block
 block discarded – undo
9 9
 		if ($this->db === null) die('Error: No DB connection. (SpotterArchive)');
10 10
 	}
11 11
 
12
-    /**
13
-     * Get SQL query part for filter used
14
-     * @param array $filter the filter
15
-     * @param bool $where
16
-     * @param bool $and
17
-     * @return string the SQL part
18
-     */
12
+	/**
13
+	 * Get SQL query part for filter used
14
+	 * @param array $filter the filter
15
+	 * @param bool $where
16
+	 * @param bool $and
17
+	 * @return string the SQL part
18
+	 */
19 19
 	public function getFilter($filter = array(),$where = false,$and = false) {
20 20
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
21 21
 		$filters = array();
@@ -160,12 +160,12 @@  discard block
 block discarded – undo
160 160
 	}
161 161
 
162 162
 
163
-    /**
164
-     * Gets all the spotter information based on a particular callsign
165
-     *
166
-     * @param $ident
167
-     * @return array the spotter information
168
-     */
163
+	/**
164
+	 * Gets all the spotter information based on a particular callsign
165
+	 *
166
+	 * @param $ident
167
+	 * @return array the spotter information
168
+	 */
169 169
 	public function getLastArchiveSpotterDataByIdent($ident) {
170 170
 		$Spotter = new Spotter($this->db);
171 171
 		date_default_timezone_set('UTC');
@@ -180,12 +180,12 @@  discard block
 block discarded – undo
180 180
 	}
181 181
 
182 182
 
183
-    /**
184
-     * Gets last the spotter information based on a particular id
185
-     *
186
-     * @param $id
187
-     * @return array the spotter information
188
-     */
183
+	/**
184
+	 * Gets last the spotter information based on a particular id
185
+	 *
186
+	 * @param $id
187
+	 * @return array the spotter information
188
+	 */
189 189
 	public function getLastArchiveSpotterDataById($id) {
190 190
 		$Spotter = new Spotter($this->db);
191 191
 		date_default_timezone_set('UTC');
@@ -210,12 +210,12 @@  discard block
 block discarded – undo
210 210
 		return $spotter_array;
211 211
 	}
212 212
 
213
-    /**
214
-     * Gets all the spotter information based on a particular id
215
-     *
216
-     * @param $id
217
-     * @return array the spotter information
218
-     */
213
+	/**
214
+	 * Gets all the spotter information based on a particular id
215
+	 *
216
+	 * @param $id
217
+	 * @return array the spotter information
218
+	 */
219 219
 	public function getAllArchiveSpotterDataById($id) {
220 220
 		date_default_timezone_set('UTC');
221 221
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
@@ -235,12 +235,12 @@  discard block
 block discarded – undo
235 235
 		return $spotter_array;
236 236
 	}
237 237
 
238
-    /**
239
-     * Gets coordinate & time spotter information based on a particular id
240
-     *
241
-     * @param $id
242
-     * @return array the spotter information
243
-     */
238
+	/**
239
+	 * Gets coordinate & time spotter information based on a particular id
240
+	 *
241
+	 * @param $id
242
+	 * @return array the spotter information
243
+	 */
244 244
 	public function getCoordArchiveSpotterDataById($id) {
245 245
 		date_default_timezone_set('UTC');
246 246
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
@@ -256,14 +256,14 @@  discard block
 block discarded – undo
256 256
 		return $spotter_array;
257 257
 	}
258 258
 
259
-    /**
260
-     * Gets coordinate & time spotter information based on a particular id
261
-     *
262
-     * @param $id
263
-     * @param $begindate
264
-     * @param $enddate
265
-     * @return array the spotter information
266
-     */
259
+	/**
260
+	 * Gets coordinate & time spotter information based on a particular id
261
+	 *
262
+	 * @param $id
263
+	 * @param $begindate
264
+	 * @param $enddate
265
+	 * @return array the spotter information
266
+	 */
267 267
 	public function getCoordArchiveSpotterDataByIdDate($id,$begindate,$enddate) {
268 268
 		date_default_timezone_set('UTC');
269 269
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
@@ -280,12 +280,12 @@  discard block
 block discarded – undo
280 280
 	}
281 281
 
282 282
 
283
-    /**
284
-     * Gets altitude information based on a particular callsign
285
-     *
286
-     * @param $ident
287
-     * @return array the spotter information
288
-     */
283
+	/**
284
+	 * Gets altitude information based on a particular callsign
285
+	 *
286
+	 * @param $ident
287
+	 * @return array the spotter information
288
+	 */
289 289
 	public function getAltitudeArchiveSpotterDataByIdent($ident) {
290 290
 
291 291
 		date_default_timezone_set('UTC');
@@ -305,12 +305,12 @@  discard block
 block discarded – undo
305 305
 		return $spotter_array;
306 306
 	}
307 307
 
308
-    /**
309
-     * Gets altitude information based on a particular id
310
-     *
311
-     * @param $id
312
-     * @return array the spotter information
313
-     */
308
+	/**
309
+	 * Gets altitude information based on a particular id
310
+	 *
311
+	 * @param $id
312
+	 * @return array the spotter information
313
+	 */
314 314
 	public function getAltitudeArchiveSpotterDataById($id) {
315 315
 
316 316
 		date_default_timezone_set('UTC');
@@ -330,12 +330,12 @@  discard block
 block discarded – undo
330 330
 		return $spotter_array;
331 331
 	}
332 332
 
333
-    /**
334
-     * Gets altitude & speed information based on a particular id
335
-     *
336
-     * @param $id
337
-     * @return array the spotter information
338
-     */
333
+	/**
334
+	 * Gets altitude & speed information based on a particular id
335
+	 *
336
+	 * @param $id
337
+	 * @return array the spotter information
338
+	 */
339 339
 	public function getAltitudeSpeedArchiveSpotterDataById($id) {
340 340
 		date_default_timezone_set('UTC');
341 341
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
@@ -351,12 +351,12 @@  discard block
 block discarded – undo
351 351
 		return $spotter_array;
352 352
 	}
353 353
 
354
-    /**
355
-     * Gets altitude information based on a particular callsign
356
-     *
357
-     * @param $ident
358
-     * @return array the spotter information
359
-     */
354
+	/**
355
+	 * Gets altitude information based on a particular callsign
356
+	 *
357
+	 * @param $ident
358
+	 * @return array the spotter information
359
+	 */
360 360
 	public function getLastAltitudeArchiveSpotterDataByIdent($ident) {
361 361
 		date_default_timezone_set('UTC');
362 362
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
@@ -374,14 +374,14 @@  discard block
 block discarded – undo
374 374
 	}
375 375
 
376 376
 
377
-    /**
378
-     * Gets all the archive spotter information
379
-     *
380
-     * @param $ident
381
-     * @param $flightaware_id
382
-     * @param $date
383
-     * @return array the spotter information
384
-     */
377
+	/**
378
+	 * Gets all the archive spotter information
379
+	 *
380
+	 * @param $ident
381
+	 * @param $flightaware_id
382
+	 * @param $date
383
+	 * @return array the spotter information
384
+	 */
385 385
 	public function getSpotterArchiveData($ident,$flightaware_id,$date) {
386 386
 		$Spotter = new Spotter($this->db);
387 387
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
@@ -406,11 +406,11 @@  discard block
 block discarded – undo
406 406
 		}
407 407
 	}
408 408
 
409
-    /**
410
-     * Delete row in spotter_archive table based on flightaware_id
411
-     * @param $id flightaware_id
412
-     */
413
-    public function deleteSpotterArchiveTrackDataByID($id) {
409
+	/**
410
+	 * Delete row in spotter_archive table based on flightaware_id
411
+	 * @param $id flightaware_id
412
+	 */
413
+	public function deleteSpotterArchiveTrackDataByID($id) {
414 414
 		global $globalArchiveKeepTrackMonths, $globalDBdriver;
415 415
 		$query = 'DELETE FROM spotter_archive WHERE spotter_archive.flightaware_id = :id';
416 416
 		try {
@@ -422,15 +422,15 @@  discard block
 block discarded – undo
422 422
 		}
423 423
 	}
424 424
 
425
-    /**
426
-     * Gets Minimal Live Spotter data
427
-     *
428
-     * @param $begindate
429
-     * @param $enddate
430
-     * @param array $filter
431
-     * @param int $part
432
-     * @return array the spotter information
433
-     */
425
+	/**
426
+	 * Gets Minimal Live Spotter data
427
+	 *
428
+	 * @param $begindate
429
+	 * @param $enddate
430
+	 * @param array $filter
431
+	 * @param int $part
432
+	 * @return array the spotter information
433
+	 */
434 434
 	public function getMinLiveSpotterData($begindate,$enddate,$filter = array(),$part = 0) {
435 435
 		global $globalDBdriver;
436 436
 		date_default_timezone_set('UTC');
@@ -481,14 +481,14 @@  discard block
 block discarded – undo
481 481
 		return $spotter_array;
482 482
 	}
483 483
 
484
-    /**
485
-     * Gets Minimal Live Spotter data
486
-     *
487
-     * @param $begindate
488
-     * @param $enddate
489
-     * @param array $filter
490
-     * @return array the spotter information
491
-     */
484
+	/**
485
+	 * Gets Minimal Live Spotter data
486
+	 *
487
+	 * @param $begindate
488
+	 * @param $enddate
489
+	 * @param array $filter
490
+	 * @return array the spotter information
491
+	 */
492 492
 	public function getMinLiveSpotterDataPlayback($begindate,$enddate,$filter = array()) {
493 493
 		global $globalDBdriver;
494 494
 		date_default_timezone_set('UTC');
@@ -554,14 +554,14 @@  discard block
 block discarded – undo
554 554
 		return $spotter_array;
555 555
 	}
556 556
 
557
-    /**
558
-     * Gets count Live Spotter data
559
-     *
560
-     * @param $begindate
561
-     * @param $enddate
562
-     * @param array $filter
563
-     * @return array the spotter information
564
-     */
557
+	/**
558
+	 * Gets count Live Spotter data
559
+	 *
560
+	 * @param $begindate
561
+	 * @param $enddate
562
+	 * @param array $filter
563
+	 * @return array the spotter information
564
+	 */
565 565
 	public function getLiveSpotterCount($begindate,$enddate,$filter = array()) {
566 566
 		global $globalDBdriver, $globalLiveInterval;
567 567
 		date_default_timezone_set('UTC');
@@ -606,36 +606,36 @@  discard block
 block discarded – undo
606 606
 
607 607
 	// Spotter_Archive_output
608 608
 
609
-    /**
610
-     * Gets all the spotter information
611
-     *
612
-     * @param string $q
613
-     * @param string $registration
614
-     * @param string $aircraft_icao
615
-     * @param string $aircraft_manufacturer
616
-     * @param string $highlights
617
-     * @param string $airline_icao
618
-     * @param string $airline_country
619
-     * @param string $airline_type
620
-     * @param string $airport
621
-     * @param string $airport_country
622
-     * @param string $callsign
623
-     * @param string $departure_airport_route
624
-     * @param string $arrival_airport_route
625
-     * @param string $owner
626
-     * @param string $pilot_id
627
-     * @param string $pilot_name
628
-     * @param string $altitude
629
-     * @param string $date_posted
630
-     * @param string $limit
631
-     * @param string $sort
632
-     * @param string $includegeodata
633
-     * @param string $origLat
634
-     * @param string $origLon
635
-     * @param string $dist
636
-     * @param array $filters
637
-     * @return array the spotter information
638
-     */
609
+	/**
610
+	 * Gets all the spotter information
611
+	 *
612
+	 * @param string $q
613
+	 * @param string $registration
614
+	 * @param string $aircraft_icao
615
+	 * @param string $aircraft_manufacturer
616
+	 * @param string $highlights
617
+	 * @param string $airline_icao
618
+	 * @param string $airline_country
619
+	 * @param string $airline_type
620
+	 * @param string $airport
621
+	 * @param string $airport_country
622
+	 * @param string $callsign
623
+	 * @param string $departure_airport_route
624
+	 * @param string $arrival_airport_route
625
+	 * @param string $owner
626
+	 * @param string $pilot_id
627
+	 * @param string $pilot_name
628
+	 * @param string $altitude
629
+	 * @param string $date_posted
630
+	 * @param string $limit
631
+	 * @param string $sort
632
+	 * @param string $includegeodata
633
+	 * @param string $origLat
634
+	 * @param string $origLon
635
+	 * @param string $dist
636
+	 * @param array $filters
637
+	 * @return array the spotter information
638
+	 */
639 639
 	public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '', $filters=array()) {
640 640
 		global $globalTimezone, $globalDBdriver;
641 641
 		require_once(dirname(__FILE__).'/class.Translation.php');
@@ -927,14 +927,14 @@  discard block
 block discarded – undo
927 927
 		}
928 928
 	}
929 929
 
930
-    /**
931
-     * Gets all the spotter information based on the callsign
932
-     *
933
-     * @param string $ident
934
-     * @param string $limit
935
-     * @param string $sort
936
-     * @return array the spotter information
937
-     */
930
+	/**
931
+	 * Gets all the spotter information based on the callsign
932
+	 *
933
+	 * @param string $ident
934
+	 * @param string $limit
935
+	 * @param string $sort
936
+	 * @return array the spotter information
937
+	 */
938 938
 	public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '') {
939 939
 		$global_query = "SELECT spotter_archive_output.* FROM spotter_archive_output";
940 940
 
@@ -981,15 +981,15 @@  discard block
 block discarded – undo
981 981
 	}
982 982
 
983 983
 
984
-    /**
985
-     * Gets all the spotter information based on the owner
986
-     *
987
-     * @param string $owner
988
-     * @param string $limit
989
-     * @param string $sort
990
-     * @param array $filter
991
-     * @return array the spotter information
992
-     */
984
+	/**
985
+	 * Gets all the spotter information based on the owner
986
+	 *
987
+	 * @param string $owner
988
+	 * @param string $limit
989
+	 * @param string $sort
990
+	 * @param array $filter
991
+	 * @return array the spotter information
992
+	 */
993 993
 	public function getSpotterDataByOwner($owner = '', $limit = '', $sort = '', $filter = array()) {
994 994
 		$global_query = "SELECT spotter_archive_output.* FROM spotter_archive_output";
995 995
 
@@ -1036,15 +1036,15 @@  discard block
 block discarded – undo
1036 1036
 		return $spotter_array;
1037 1037
 	}
1038 1038
 
1039
-    /**
1040
-     * Gets all the spotter information based on the pilot
1041
-     *
1042
-     * @param string $pilot
1043
-     * @param string $limit
1044
-     * @param string $sort
1045
-     * @param array $filter
1046
-     * @return array the spotter information
1047
-     */
1039
+	/**
1040
+	 * Gets all the spotter information based on the pilot
1041
+	 *
1042
+	 * @param string $pilot
1043
+	 * @param string $limit
1044
+	 * @param string $sort
1045
+	 * @param array $filter
1046
+	 * @return array the spotter information
1047
+	 */
1048 1048
 	public function getSpotterDataByPilot($pilot = '', $limit = '', $sort = '', $filter = array()) {
1049 1049
 		$global_query = "SELECT spotter_archive_output.* FROM spotter_archive_output";
1050 1050
 
@@ -1087,14 +1087,14 @@  discard block
 block discarded – undo
1087 1087
 		return $spotter_array;
1088 1088
 	}
1089 1089
 
1090
-    /**
1091
-     * Gets all number of flight over countries
1092
-     *
1093
-     * @param bool $limit
1094
-     * @param int $olderthanmonths
1095
-     * @param string $sincedate
1096
-     * @return array the airline country list
1097
-     */
1090
+	/**
1091
+	 * Gets all number of flight over countries
1092
+	 *
1093
+	 * @param bool $limit
1094
+	 * @param int $olderthanmonths
1095
+	 * @param string $sincedate
1096
+	 * @return array the airline country list
1097
+	 */
1098 1098
 	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '') {
1099 1099
 		global $globalDBdriver;
1100 1100
 		/*
@@ -1133,14 +1133,14 @@  discard block
 block discarded – undo
1133 1133
 		return $flight_array;
1134 1134
 	}
1135 1135
 
1136
-    /**
1137
-     * Gets all number of flight over countries
1138
-     *
1139
-     * @param bool $limit
1140
-     * @param int $olderthanmonths
1141
-     * @param string $sincedate
1142
-     * @return array the airline country list
1143
-     */
1136
+	/**
1137
+	 * Gets all number of flight over countries
1138
+	 *
1139
+	 * @param bool $limit
1140
+	 * @param int $olderthanmonths
1141
+	 * @param string $sincedate
1142
+	 * @return array the airline country list
1143
+	 */
1144 1144
 	public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '') {
1145 1145
 		global $globalDBdriver;
1146 1146
 		/*
@@ -1180,13 +1180,13 @@  discard block
 block discarded – undo
1180 1180
 		return $flight_array;
1181 1181
 	}
1182 1182
 
1183
-    /**
1184
-     * Gets all aircraft types that have flown over by owner
1185
-     *
1186
-     * @param $owner
1187
-     * @param array $filters
1188
-     * @return array the aircraft list
1189
-     */
1183
+	/**
1184
+	 * Gets all aircraft types that have flown over by owner
1185
+	 *
1186
+	 * @param $owner
1187
+	 * @param array $filters
1188
+	 * @return array the aircraft list
1189
+	 */
1190 1190
 	public function countAllAircraftTypesByOwner($owner,$filters = array())
1191 1191
 	{
1192 1192
 		$filter_query = $this->getFilter($filters,true,true);
@@ -1202,13 +1202,13 @@  discard block
 block discarded – undo
1202 1202
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
1203 1203
 	}
1204 1204
 
1205
-    /**
1206
-     * Gets all airlines by owner
1207
-     *
1208
-     * @param $owner
1209
-     * @param array $filters
1210
-     * @return array the airline list
1211
-     */
1205
+	/**
1206
+	 * Gets all airlines by owner
1207
+	 *
1208
+	 * @param $owner
1209
+	 * @param array $filters
1210
+	 * @return array the airline list
1211
+	 */
1212 1212
 	public function countAllAirlinesByOwner($owner,$filters = array())
1213 1213
 	{
1214 1214
 		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
@@ -1223,13 +1223,13 @@  discard block
 block discarded – undo
1223 1223
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
1224 1224
 	}
1225 1225
 
1226
-    /**
1227
-     * Gets all arrival airports by country of the airplanes that have flown over based on a owner
1228
-     *
1229
-     * @param $owner
1230
-     * @param array $filters
1231
-     * @return array the airport list
1232
-     */
1226
+	/**
1227
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a owner
1228
+	 *
1229
+	 * @param $owner
1230
+	 * @param array $filters
1231
+	 * @return array the airport list
1232
+	 */
1233 1233
 	public function countAllArrivalAirportCountriesByOwner($owner, $filters = array())
1234 1234
 	{
1235 1235
 		$filter_query = $this->getFilter($filters,true,true);
@@ -1243,13 +1243,13 @@  discard block
 block discarded – undo
1243 1243
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
1244 1244
 	}
1245 1245
 
1246
-    /**
1247
-     * Gets all arrival airports of the airplanes that have flown over based on a owner
1248
-     *
1249
-     * @param $owner
1250
-     * @param array $filters
1251
-     * @return array the airport list
1252
-     */
1246
+	/**
1247
+	 * Gets all arrival airports of the airplanes that have flown over based on a owner
1248
+	 *
1249
+	 * @param $owner
1250
+	 * @param array $filters
1251
+	 * @return array the airport list
1252
+	 */
1253 1253
 	public function countAllArrivalAirportsByOwner($owner,$filters = array())
1254 1254
 	{
1255 1255
 		$filter_query = $this->getFilter($filters,true,true);
@@ -1274,13 +1274,13 @@  discard block
 block discarded – undo
1274 1274
 		return $airport_array;
1275 1275
 	}
1276 1276
 
1277
-    /**
1278
-     * Gets all departure airports by country of the airplanes that have flown over based on owner
1279
-     *
1280
-     * @param $owner
1281
-     * @param array $filters
1282
-     * @return array the airport list
1283
-     */
1277
+	/**
1278
+	 * Gets all departure airports by country of the airplanes that have flown over based on owner
1279
+	 *
1280
+	 * @param $owner
1281
+	 * @param array $filters
1282
+	 * @return array the airport list
1283
+	 */
1284 1284
 	public function countAllDepartureAirportCountriesByOwner($owner,$filters = array())
1285 1285
 	{
1286 1286
 		$filter_query = $this->getFilter($filters,true,true);
@@ -1294,13 +1294,13 @@  discard block
 block discarded – undo
1294 1294
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
1295 1295
 	}
1296 1296
 
1297
-    /**
1298
-     * Gets all departure airports of the airplanes that have flown over based on a owner
1299
-     *
1300
-     * @param $owner
1301
-     * @param array $filters
1302
-     * @return array the airport list
1303
-     */
1297
+	/**
1298
+	 * Gets all departure airports of the airplanes that have flown over based on a owner
1299
+	 *
1300
+	 * @param $owner
1301
+	 * @param array $filters
1302
+	 * @return array the airport list
1303
+	 */
1304 1304
 	public function countAllDepartureAirportsByOwner($owner,$filters = array())
1305 1305
 	{
1306 1306
 		$filter_query = $this->getFilter($filters,true,true);
@@ -1327,13 +1327,13 @@  discard block
 block discarded – undo
1327 1327
 		return $airport_array;
1328 1328
 	}
1329 1329
 
1330
-    /**
1331
-     * Gets all aircraft manufacturer that have flown over by owner
1332
-     *
1333
-     * @param $owner
1334
-     * @param array $filters
1335
-     * @return array the aircraft manufacturer list
1336
-     */
1330
+	/**
1331
+	 * Gets all aircraft manufacturer that have flown over by owner
1332
+	 *
1333
+	 * @param $owner
1334
+	 * @param array $filters
1335
+	 * @return array the aircraft manufacturer list
1336
+	 */
1337 1337
 	public function countAllAircraftManufacturerByOwner($owner,$filters = array())
1338 1338
 	{
1339 1339
 		$filter_query = $this->getFilter($filters,true,true);
@@ -1349,13 +1349,13 @@  discard block
 block discarded – undo
1349 1349
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
1350 1350
 	}
1351 1351
 
1352
-    /**
1353
-     * Gets all aircraft registration that have flown over by owner
1354
-     *
1355
-     * @param $owner
1356
-     * @param array $filters
1357
-     * @return array the aircraft list
1358
-     */
1352
+	/**
1353
+	 * Gets all aircraft registration that have flown over by owner
1354
+	 *
1355
+	 * @param $owner
1356
+	 * @param array $filters
1357
+	 * @return array the aircraft list
1358
+	 */
1359 1359
 	public function countAllAircraftRegistrationByOwner($owner,$filters = array())
1360 1360
 	{
1361 1361
 		$filter_query = $this->getFilter($filters,true,true);
@@ -1391,13 +1391,13 @@  discard block
 block discarded – undo
1391 1391
 		return $aircraft_array;
1392 1392
 	}
1393 1393
 
1394
-    /**
1395
-     * Gets all route combinations based on an owner
1396
-     *
1397
-     * @param $owner
1398
-     * @param array $filters
1399
-     * @return array the route list
1400
-     */
1394
+	/**
1395
+	 * Gets all route combinations based on an owner
1396
+	 *
1397
+	 * @param $owner
1398
+	 * @param array $filters
1399
+	 * @return array the route list
1400
+	 */
1401 1401
 	public function countAllRoutesByOwner($owner,$filters = array())
1402 1402
 	{
1403 1403
 		$filter_query = $this->getFilter($filters,true,true);
@@ -1426,13 +1426,13 @@  discard block
 block discarded – undo
1426 1426
 		return $routes_array;
1427 1427
 	}
1428 1428
 
1429
-    /**
1430
-     * Counts all hours by a owner
1431
-     *
1432
-     * @param $owner
1433
-     * @param array $filters
1434
-     * @return array the hour list
1435
-     */
1429
+	/**
1430
+	 * Counts all hours by a owner
1431
+	 *
1432
+	 * @param $owner
1433
+	 * @param array $filters
1434
+	 * @return array the hour list
1435
+	 */
1436 1436
 	public function countAllHoursByOwner($owner, $filters = array())
1437 1437
 	{
1438 1438
 		global $globalTimezone, $globalDBdriver;
@@ -1467,13 +1467,13 @@  discard block
 block discarded – undo
1467 1467
 		return $hour_array;
1468 1468
 	}
1469 1469
 
1470
-    /**
1471
-     * Gets last spotter information based on a particular callsign
1472
-     *
1473
-     * @param $id
1474
-     * @param $date
1475
-     * @return array the spotter information
1476
-     */
1470
+	/**
1471
+	 * Gets last spotter information based on a particular callsign
1472
+	 *
1473
+	 * @param $id
1474
+	 * @param $date
1475
+	 * @return array the spotter information
1476
+	 */
1477 1477
 	public function getDateArchiveSpotterDataById($id,$date) {
1478 1478
 		$Spotter = new Spotter($this->db);
1479 1479
 		date_default_timezone_set('UTC');
@@ -1484,13 +1484,13 @@  discard block
 block discarded – undo
1484 1484
 		return $spotter_array;
1485 1485
 	}
1486 1486
 
1487
-    /**
1488
-     * Gets all the spotter information based on a particular callsign
1489
-     *
1490
-     * @param $ident
1491
-     * @param $date
1492
-     * @return array the spotter information
1493
-     */
1487
+	/**
1488
+	 * Gets all the spotter information based on a particular callsign
1489
+	 *
1490
+	 * @param $ident
1491
+	 * @param $date
1492
+	 * @return array the spotter information
1493
+	 */
1494 1494
 	public function getDateArchiveSpotterDataByIdent($ident,$date) {
1495 1495
 		$Spotter = new Spotter($this->db);
1496 1496
 		date_default_timezone_set('UTC');
@@ -1501,15 +1501,15 @@  discard block
 block discarded – undo
1501 1501
 		return $spotter_array;
1502 1502
 	}
1503 1503
 
1504
-    /**
1505
-     * Gets all the spotter information based on the airport
1506
-     *
1507
-     * @param string $airport
1508
-     * @param string $limit
1509
-     * @param string $sort
1510
-     * @param array $filters
1511
-     * @return array the spotter information
1512
-     */
1504
+	/**
1505
+	 * Gets all the spotter information based on the airport
1506
+	 *
1507
+	 * @param string $airport
1508
+	 * @param string $limit
1509
+	 * @param string $sort
1510
+	 * @param array $filters
1511
+	 * @return array the spotter information
1512
+	 */
1513 1513
 	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array()) {
1514 1514
 		global $global_query;
1515 1515
 		$Spotter = new Spotter($this->db);
Please login to merge, or discard this patch.
require/class.Common.php 1 patch
Indentation   +160 added lines, -160 removed lines patch added patch discarded remove patch
@@ -14,13 +14,13 @@  discard block
 block discarded – undo
14 14
 	//protected $cookies = array();
15 15
 	
16 16
 	/**
17
-	* Get data from form result
18
-	* @param String $url form URL
19
-	* @param String $type type of submit form method (get or post)
20
-	* @param String|array $data values form post method
21
-	* @param array $headers header to submit with the form
22
-	* @return String the result
23
-	*/
17
+	 * Get data from form result
18
+	 * @param String $url form URL
19
+	 * @param String $type type of submit form method (get or post)
20
+	 * @param String|array $data values form post method
21
+	 * @param array $headers header to submit with the form
22
+	 * @return String the result
23
+	 */
24 24
 	public function getData($url, $type = 'get', $data = '', $headers = '',$cookie = '',$referer = '',$timeout = '',$useragent = '', $sizelimit = false, $async = false, $getheaders = false) {
25 25
 		global $globalProxy, $globalForceIPv4;
26 26
 		$ch = curl_init();
@@ -175,10 +175,10 @@  discard block
 block discarded – undo
175 175
 	}
176 176
 
177 177
 	/**
178
-	* Convert a HTML table to an array
179
-	* @param String $data HTML page
180
-	* @return array array of the tables in HTML page
181
-	*/
178
+	 * Convert a HTML table to an array
179
+	 * @param String $data HTML page
180
+	 * @return array array of the tables in HTML page
181
+	 */
182 182
 	public function table2array($data) {
183 183
 		if (!is_string($data)) return array();
184 184
 		if ($data == '') return array();
@@ -212,10 +212,10 @@  discard block
 block discarded – undo
212 212
 	}
213 213
 	
214 214
 	/**
215
-	* Convert <p> part of a HTML page to an array
216
-	* @param String $data HTML page
217
-	* @return array array of the <p> in HTML page
218
-	*/
215
+	 * Convert <p> part of a HTML page to an array
216
+	 * @param String $data HTML page
217
+	 * @return array array of the <p> in HTML page
218
+	 */
219 219
 	public function text2array($data) {
220 220
 		$html = str_get_html($data);
221 221
 		if ($html === false) return array();
@@ -230,14 +230,14 @@  discard block
 block discarded – undo
230 230
 	}
231 231
 
232 232
 	/**
233
-	* Give distance between 2 coordonnates
234
-	* @param Float $lat latitude of first point
235
-	* @param Float $lon longitude of first point
236
-	* @param Float $latc latitude of second point
237
-	* @param Float $lonc longitude of second point
238
-	* @param String $unit km else no unit used
239
-	* @return Float Distance in $unit
240
-	*/
233
+	 * Give distance between 2 coordonnates
234
+	 * @param Float $lat latitude of first point
235
+	 * @param Float $lon longitude of first point
236
+	 * @param Float $latc latitude of second point
237
+	 * @param Float $lonc longitude of second point
238
+	 * @param String $unit km else no unit used
239
+	 * @return Float Distance in $unit
240
+	 */
241 241
 	public function distance($lat, $lon, $latc, $lonc, $unit = 'km') {
242 242
 		if ($lat == $latc && $lon == $lonc) return 0;
243 243
 		$dist = rad2deg(acos(sin(deg2rad(floatval($lat)))*sin(deg2rad(floatval($latc)))+ cos(deg2rad(floatval($lat)))*cos(deg2rad(floatval($latc)))*cos(deg2rad(floatval($lon)-floatval($lonc)))))*60*1.1515;
@@ -255,12 +255,12 @@  discard block
 block discarded – undo
255 255
 	}
256 256
 
257 257
 	/**
258
-	* Give plunge between 2 altitudes and distance
259
-	* @param Float $initial_altitude altitude of first point in m
260
-	* @param Float $final_altitude altitude of second point in m
261
-	* @param String $distance distance between two points in m
262
-	* @return Float plunge
263
-	*/
258
+	 * Give plunge between 2 altitudes and distance
259
+	 * @param Float $initial_altitude altitude of first point in m
260
+	 * @param Float $final_altitude altitude of second point in m
261
+	 * @param String $distance distance between two points in m
262
+	 * @return Float plunge
263
+	 */
264 264
 	public function plunge($initial_altitude,$final_altitude,$distance) {
265 265
 		$plunge = rad2deg(asin(($final_altitude-$initial_altitude)/$distance));
266 266
 		/*
@@ -274,13 +274,13 @@  discard block
 block discarded – undo
274 274
 	}
275 275
 
276 276
 	/**
277
-	* Give azimuth between 2 coordonnates
278
-	* @param Float $lat latitude of first point
279
-	* @param Float $lon longitude of first point
280
-	* @param Float $latc latitude of second point
281
-	* @param Float $lonc longitude of second point
282
-	* @return Float Azimuth
283
-	*/
277
+	 * Give azimuth between 2 coordonnates
278
+	 * @param Float $lat latitude of first point
279
+	 * @param Float $lon longitude of first point
280
+	 * @param Float $latc latitude of second point
281
+	 * @param Float $lonc longitude of second point
282
+	 * @return Float Azimuth
283
+	 */
284 284
 	public function azimuth($lat, $lon, $latc, $lonc) {
285 285
 		$dX = $latc - $lat;
286 286
 		$dY = $lonc - $lon;
@@ -291,11 +291,11 @@  discard block
 block discarded – undo
291 291
 	
292 292
 	
293 293
 	/**
294
-	* Check is distance realistic
295
-	* @param int $timeDifference the time between the reception of both messages
296
-	* @param float $distance distance covered
297
-	* @return bool whether distance is realistic
298
-	*/
294
+	 * Check is distance realistic
295
+	 * @param int $timeDifference the time between the reception of both messages
296
+	 * @param float $distance distance covered
297
+	 * @return bool whether distance is realistic
298
+	 */
299 299
 	public function withinThreshold ($timeDifference, $distance) {
300 300
 		$x = abs($timeDifference);
301 301
 		$d = abs($distance);
@@ -383,11 +383,11 @@  discard block
 block discarded – undo
383 383
 	}
384 384
 	
385 385
 	/**
386
-	* Copy folder contents
387
-	* @param       string   $source    Source path
388
-	* @param       string   $dest      Destination path
389
-	* @return      bool     Returns true on success, false on failure
390
-	*/
386
+	 * Copy folder contents
387
+	 * @param       string   $source    Source path
388
+	 * @param       string   $dest      Destination path
389
+	 * @return      bool     Returns true on success, false on failure
390
+	 */
391 391
 	public function xcopy($source, $dest)
392 392
 	{
393 393
 		$files = glob($source.'*.*');
@@ -399,20 +399,20 @@  discard block
 block discarded – undo
399 399
 	}
400 400
 	
401 401
 	/**
402
-	* Check if an url exist
403
-	* @param	String $url url to check
404
-	* @return	bool Return true on succes false on failure
405
-	*/
402
+	 * Check if an url exist
403
+	 * @param	String $url url to check
404
+	 * @return	bool Return true on succes false on failure
405
+	 */
406 406
 	public function urlexist($url){
407 407
 		$headers=get_headers($url);
408 408
 		return stripos($headers[0],"200 OK")?true:false;
409 409
 	}
410 410
 	
411 411
 	/**
412
-	* Convert hexa to string
413
-	* @param	String $hex data in hexa
414
-	* @return	String Return result
415
-	*/
412
+	 * Convert hexa to string
413
+	 * @param	String $hex data in hexa
414
+	 * @return	String Return result
415
+	 */
416 416
 	public function hex2str($hex) {
417 417
 		$str = '';
418 418
 		$hexln = strlen($hex);
@@ -421,10 +421,10 @@  discard block
 block discarded – undo
421 421
 	}
422 422
 	
423 423
 	/**
424
-	* Convert hexa color to rgb
425
-	* @param	String $hex data in hexa
426
-	* @return	String Return result
427
-	*/
424
+	 * Convert hexa color to rgb
425
+	 * @param	String $hex data in hexa
426
+	 * @return	String Return result
427
+	 */
428 428
 	public function hex2rgb($hex) {
429 429
 		$hex = str_replace('#','',$hex);
430 430
 		return sscanf($hex, "%02x%02x%02x"); 
@@ -502,9 +502,9 @@  discard block
 block discarded – undo
502 502
 	}
503 503
 	
504 504
 	/**
505
-	* Returns list of available locales
506
-	*
507
-	* @return array
505
+	 * Returns list of available locales
506
+	 *
507
+	 * @return array
508 508
 	 */
509 509
 	public function listLocaleDir()
510 510
 	{
@@ -603,100 +603,100 @@  discard block
 block discarded – undo
603 603
 	public function remove_accents($string) {
604 604
 		if ( !preg_match('/[\x80-\xff]/', $string) ) return $string;
605 605
 		$chars = array(
606
-		    // Decompositions for Latin-1 Supplement
607
-		    chr(195).chr(128) => 'A', chr(195).chr(129) => 'A',
608
-		    chr(195).chr(130) => 'A', chr(195).chr(131) => 'A',
609
-		    chr(195).chr(132) => 'A', chr(195).chr(133) => 'A',
610
-		    chr(195).chr(135) => 'C', chr(195).chr(136) => 'E',
611
-		    chr(195).chr(137) => 'E', chr(195).chr(138) => 'E',
612
-		    chr(195).chr(139) => 'E', chr(195).chr(140) => 'I',
613
-		    chr(195).chr(141) => 'I', chr(195).chr(142) => 'I',
614
-		    chr(195).chr(143) => 'I', chr(195).chr(145) => 'N',
615
-		    chr(195).chr(146) => 'O', chr(195).chr(147) => 'O',
616
-		    chr(195).chr(148) => 'O', chr(195).chr(149) => 'O',
617
-		    chr(195).chr(150) => 'O', chr(195).chr(153) => 'U',
618
-		    chr(195).chr(154) => 'U', chr(195).chr(155) => 'U',
619
-		    chr(195).chr(156) => 'U', chr(195).chr(157) => 'Y',
620
-		    chr(195).chr(159) => 's', chr(195).chr(160) => 'a',
621
-		    chr(195).chr(161) => 'a', chr(195).chr(162) => 'a',
622
-		    chr(195).chr(163) => 'a', chr(195).chr(164) => 'a',
623
-		    chr(195).chr(165) => 'a', chr(195).chr(167) => 'c',
624
-		    chr(195).chr(168) => 'e', chr(195).chr(169) => 'e',
625
-		    chr(195).chr(170) => 'e', chr(195).chr(171) => 'e',
626
-		    chr(195).chr(172) => 'i', chr(195).chr(173) => 'i',
627
-		    chr(195).chr(174) => 'i', chr(195).chr(175) => 'i',
628
-		    chr(195).chr(177) => 'n', chr(195).chr(178) => 'o',
629
-		    chr(195).chr(179) => 'o', chr(195).chr(180) => 'o',
630
-		    chr(195).chr(181) => 'o', chr(195).chr(182) => 'o',
631
-		    chr(195).chr(182) => 'o', chr(195).chr(185) => 'u',
632
-		    chr(195).chr(186) => 'u', chr(195).chr(187) => 'u',
633
-		    chr(195).chr(188) => 'u', chr(195).chr(189) => 'y',
634
-		    chr(195).chr(191) => 'y',
635
-		    // Decompositions for Latin Extended-A
636
-		    chr(196).chr(128) => 'A', chr(196).chr(129) => 'a',
637
-		    chr(196).chr(130) => 'A', chr(196).chr(131) => 'a',
638
-		    chr(196).chr(132) => 'A', chr(196).chr(133) => 'a',
639
-		    chr(196).chr(134) => 'C', chr(196).chr(135) => 'c',
640
-		    chr(196).chr(136) => 'C', chr(196).chr(137) => 'c',
641
-		    chr(196).chr(138) => 'C', chr(196).chr(139) => 'c',
642
-		    chr(196).chr(140) => 'C', chr(196).chr(141) => 'c',
643
-		    chr(196).chr(142) => 'D', chr(196).chr(143) => 'd',
644
-		    chr(196).chr(144) => 'D', chr(196).chr(145) => 'd',
645
-		    chr(196).chr(146) => 'E', chr(196).chr(147) => 'e',
646
-		    chr(196).chr(148) => 'E', chr(196).chr(149) => 'e',
647
-		    chr(196).chr(150) => 'E', chr(196).chr(151) => 'e',
648
-		    chr(196).chr(152) => 'E', chr(196).chr(153) => 'e',
649
-		    chr(196).chr(154) => 'E', chr(196).chr(155) => 'e',
650
-		    chr(196).chr(156) => 'G', chr(196).chr(157) => 'g',
651
-		    chr(196).chr(158) => 'G', chr(196).chr(159) => 'g',
652
-		    chr(196).chr(160) => 'G', chr(196).chr(161) => 'g',
653
-		    chr(196).chr(162) => 'G', chr(196).chr(163) => 'g',
654
-		    chr(196).chr(164) => 'H', chr(196).chr(165) => 'h',
655
-		    chr(196).chr(166) => 'H', chr(196).chr(167) => 'h',
656
-		    chr(196).chr(168) => 'I', chr(196).chr(169) => 'i',
657
-		    chr(196).chr(170) => 'I', chr(196).chr(171) => 'i',
658
-		    chr(196).chr(172) => 'I', chr(196).chr(173) => 'i',
659
-		    chr(196).chr(174) => 'I', chr(196).chr(175) => 'i',
660
-		    chr(196).chr(176) => 'I', chr(196).chr(177) => 'i',
661
-		    chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij',
662
-		    chr(196).chr(180) => 'J', chr(196).chr(181) => 'j',
663
-		    chr(196).chr(182) => 'K', chr(196).chr(183) => 'k',
664
-		    chr(196).chr(184) => 'k', chr(196).chr(185) => 'L',
665
-		    chr(196).chr(186) => 'l', chr(196).chr(187) => 'L',
666
-		    chr(196).chr(188) => 'l', chr(196).chr(189) => 'L',
667
-		    chr(196).chr(190) => 'l', chr(196).chr(191) => 'L',
668
-		    chr(197).chr(128) => 'l', chr(197).chr(129) => 'L',
669
-		    chr(197).chr(130) => 'l', chr(197).chr(131) => 'N',
670
-		    chr(197).chr(132) => 'n', chr(197).chr(133) => 'N',
671
-		    chr(197).chr(134) => 'n', chr(197).chr(135) => 'N',
672
-		    chr(197).chr(136) => 'n', chr(197).chr(137) => 'N',
673
-		    chr(197).chr(138) => 'n', chr(197).chr(139) => 'N',
674
-		    chr(197).chr(140) => 'O', chr(197).chr(141) => 'o',
675
-		    chr(197).chr(142) => 'O', chr(197).chr(143) => 'o',
676
-		    chr(197).chr(144) => 'O', chr(197).chr(145) => 'o',
677
-		    chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe',
678
-		    chr(197).chr(148) => 'R',chr(197).chr(149) => 'r',
679
-		    chr(197).chr(150) => 'R',chr(197).chr(151) => 'r',
680
-		    chr(197).chr(152) => 'R',chr(197).chr(153) => 'r',
681
-		    chr(197).chr(154) => 'S',chr(197).chr(155) => 's',
682
-		    chr(197).chr(156) => 'S',chr(197).chr(157) => 's',
683
-		    chr(197).chr(158) => 'S',chr(197).chr(159) => 's',
684
-		    chr(197).chr(160) => 'S', chr(197).chr(161) => 's',
685
-		    chr(197).chr(162) => 'T', chr(197).chr(163) => 't',
686
-		    chr(197).chr(164) => 'T', chr(197).chr(165) => 't',
687
-		    chr(197).chr(166) => 'T', chr(197).chr(167) => 't',
688
-		    chr(197).chr(168) => 'U', chr(197).chr(169) => 'u',
689
-		    chr(197).chr(170) => 'U', chr(197).chr(171) => 'u',
690
-		    chr(197).chr(172) => 'U', chr(197).chr(173) => 'u',
691
-		    chr(197).chr(174) => 'U', chr(197).chr(175) => 'u',
692
-		    chr(197).chr(176) => 'U', chr(197).chr(177) => 'u',
693
-		    chr(197).chr(178) => 'U', chr(197).chr(179) => 'u',
694
-		    chr(197).chr(180) => 'W', chr(197).chr(181) => 'w',
695
-		    chr(197).chr(182) => 'Y', chr(197).chr(183) => 'y',
696
-		    chr(197).chr(184) => 'Y', chr(197).chr(185) => 'Z',
697
-		    chr(197).chr(186) => 'z', chr(197).chr(187) => 'Z',
698
-		    chr(197).chr(188) => 'z', chr(197).chr(189) => 'Z',
699
-		    chr(197).chr(190) => 'z', chr(197).chr(191) => 's'
606
+			// Decompositions for Latin-1 Supplement
607
+			chr(195).chr(128) => 'A', chr(195).chr(129) => 'A',
608
+			chr(195).chr(130) => 'A', chr(195).chr(131) => 'A',
609
+			chr(195).chr(132) => 'A', chr(195).chr(133) => 'A',
610
+			chr(195).chr(135) => 'C', chr(195).chr(136) => 'E',
611
+			chr(195).chr(137) => 'E', chr(195).chr(138) => 'E',
612
+			chr(195).chr(139) => 'E', chr(195).chr(140) => 'I',
613
+			chr(195).chr(141) => 'I', chr(195).chr(142) => 'I',
614
+			chr(195).chr(143) => 'I', chr(195).chr(145) => 'N',
615
+			chr(195).chr(146) => 'O', chr(195).chr(147) => 'O',
616
+			chr(195).chr(148) => 'O', chr(195).chr(149) => 'O',
617
+			chr(195).chr(150) => 'O', chr(195).chr(153) => 'U',
618
+			chr(195).chr(154) => 'U', chr(195).chr(155) => 'U',
619
+			chr(195).chr(156) => 'U', chr(195).chr(157) => 'Y',
620
+			chr(195).chr(159) => 's', chr(195).chr(160) => 'a',
621
+			chr(195).chr(161) => 'a', chr(195).chr(162) => 'a',
622
+			chr(195).chr(163) => 'a', chr(195).chr(164) => 'a',
623
+			chr(195).chr(165) => 'a', chr(195).chr(167) => 'c',
624
+			chr(195).chr(168) => 'e', chr(195).chr(169) => 'e',
625
+			chr(195).chr(170) => 'e', chr(195).chr(171) => 'e',
626
+			chr(195).chr(172) => 'i', chr(195).chr(173) => 'i',
627
+			chr(195).chr(174) => 'i', chr(195).chr(175) => 'i',
628
+			chr(195).chr(177) => 'n', chr(195).chr(178) => 'o',
629
+			chr(195).chr(179) => 'o', chr(195).chr(180) => 'o',
630
+			chr(195).chr(181) => 'o', chr(195).chr(182) => 'o',
631
+			chr(195).chr(182) => 'o', chr(195).chr(185) => 'u',
632
+			chr(195).chr(186) => 'u', chr(195).chr(187) => 'u',
633
+			chr(195).chr(188) => 'u', chr(195).chr(189) => 'y',
634
+			chr(195).chr(191) => 'y',
635
+			// Decompositions for Latin Extended-A
636
+			chr(196).chr(128) => 'A', chr(196).chr(129) => 'a',
637
+			chr(196).chr(130) => 'A', chr(196).chr(131) => 'a',
638
+			chr(196).chr(132) => 'A', chr(196).chr(133) => 'a',
639
+			chr(196).chr(134) => 'C', chr(196).chr(135) => 'c',
640
+			chr(196).chr(136) => 'C', chr(196).chr(137) => 'c',
641
+			chr(196).chr(138) => 'C', chr(196).chr(139) => 'c',
642
+			chr(196).chr(140) => 'C', chr(196).chr(141) => 'c',
643
+			chr(196).chr(142) => 'D', chr(196).chr(143) => 'd',
644
+			chr(196).chr(144) => 'D', chr(196).chr(145) => 'd',
645
+			chr(196).chr(146) => 'E', chr(196).chr(147) => 'e',
646
+			chr(196).chr(148) => 'E', chr(196).chr(149) => 'e',
647
+			chr(196).chr(150) => 'E', chr(196).chr(151) => 'e',
648
+			chr(196).chr(152) => 'E', chr(196).chr(153) => 'e',
649
+			chr(196).chr(154) => 'E', chr(196).chr(155) => 'e',
650
+			chr(196).chr(156) => 'G', chr(196).chr(157) => 'g',
651
+			chr(196).chr(158) => 'G', chr(196).chr(159) => 'g',
652
+			chr(196).chr(160) => 'G', chr(196).chr(161) => 'g',
653
+			chr(196).chr(162) => 'G', chr(196).chr(163) => 'g',
654
+			chr(196).chr(164) => 'H', chr(196).chr(165) => 'h',
655
+			chr(196).chr(166) => 'H', chr(196).chr(167) => 'h',
656
+			chr(196).chr(168) => 'I', chr(196).chr(169) => 'i',
657
+			chr(196).chr(170) => 'I', chr(196).chr(171) => 'i',
658
+			chr(196).chr(172) => 'I', chr(196).chr(173) => 'i',
659
+			chr(196).chr(174) => 'I', chr(196).chr(175) => 'i',
660
+			chr(196).chr(176) => 'I', chr(196).chr(177) => 'i',
661
+			chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij',
662
+			chr(196).chr(180) => 'J', chr(196).chr(181) => 'j',
663
+			chr(196).chr(182) => 'K', chr(196).chr(183) => 'k',
664
+			chr(196).chr(184) => 'k', chr(196).chr(185) => 'L',
665
+			chr(196).chr(186) => 'l', chr(196).chr(187) => 'L',
666
+			chr(196).chr(188) => 'l', chr(196).chr(189) => 'L',
667
+			chr(196).chr(190) => 'l', chr(196).chr(191) => 'L',
668
+			chr(197).chr(128) => 'l', chr(197).chr(129) => 'L',
669
+			chr(197).chr(130) => 'l', chr(197).chr(131) => 'N',
670
+			chr(197).chr(132) => 'n', chr(197).chr(133) => 'N',
671
+			chr(197).chr(134) => 'n', chr(197).chr(135) => 'N',
672
+			chr(197).chr(136) => 'n', chr(197).chr(137) => 'N',
673
+			chr(197).chr(138) => 'n', chr(197).chr(139) => 'N',
674
+			chr(197).chr(140) => 'O', chr(197).chr(141) => 'o',
675
+			chr(197).chr(142) => 'O', chr(197).chr(143) => 'o',
676
+			chr(197).chr(144) => 'O', chr(197).chr(145) => 'o',
677
+			chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe',
678
+			chr(197).chr(148) => 'R',chr(197).chr(149) => 'r',
679
+			chr(197).chr(150) => 'R',chr(197).chr(151) => 'r',
680
+			chr(197).chr(152) => 'R',chr(197).chr(153) => 'r',
681
+			chr(197).chr(154) => 'S',chr(197).chr(155) => 's',
682
+			chr(197).chr(156) => 'S',chr(197).chr(157) => 's',
683
+			chr(197).chr(158) => 'S',chr(197).chr(159) => 's',
684
+			chr(197).chr(160) => 'S', chr(197).chr(161) => 's',
685
+			chr(197).chr(162) => 'T', chr(197).chr(163) => 't',
686
+			chr(197).chr(164) => 'T', chr(197).chr(165) => 't',
687
+			chr(197).chr(166) => 'T', chr(197).chr(167) => 't',
688
+			chr(197).chr(168) => 'U', chr(197).chr(169) => 'u',
689
+			chr(197).chr(170) => 'U', chr(197).chr(171) => 'u',
690
+			chr(197).chr(172) => 'U', chr(197).chr(173) => 'u',
691
+			chr(197).chr(174) => 'U', chr(197).chr(175) => 'u',
692
+			chr(197).chr(176) => 'U', chr(197).chr(177) => 'u',
693
+			chr(197).chr(178) => 'U', chr(197).chr(179) => 'u',
694
+			chr(197).chr(180) => 'W', chr(197).chr(181) => 'w',
695
+			chr(197).chr(182) => 'Y', chr(197).chr(183) => 'y',
696
+			chr(197).chr(184) => 'Y', chr(197).chr(185) => 'Z',
697
+			chr(197).chr(186) => 'z', chr(197).chr(187) => 'Z',
698
+			chr(197).chr(188) => 'z', chr(197).chr(189) => 'Z',
699
+			chr(197).chr(190) => 'z', chr(197).chr(191) => 's'
700 700
 		);
701 701
 		$string = strtr($string, $chars);
702 702
 		return $string;
@@ -837,7 +837,7 @@  discard block
 block discarded – undo
837 837
 			$dfX = $first_pass[$j][0];
838 838
 			$dfDiffLong = abs($dfX - $dfPrevX);
839 839
 			if ($dfDiffLong > $dfDiffSpace &&
840
-			    (($dfX > $dfLeftBorderX && $dfPrevX < $dfRightBorderX) || ($dfPrevX > $dfLeftBorderX && $dfX < $dfRightBorderX))) 
840
+				(($dfX > $dfLeftBorderX && $dfPrevX < $dfRightBorderX) || ($dfPrevX > $dfLeftBorderX && $dfX < $dfRightBorderX))) 
841 841
 			{
842 842
 				$bHasBigDiff = true;
843 843
 			} else if ($dfDiffLong > $dfMaxSmallDiffLong) {
@@ -857,8 +857,8 @@  discard block
 block discarded – undo
857 857
 					$dfX2 = floatval($first_pass[$k][0]);
858 858
 					$dfY2 = floatval($first_pass[$k][1]);
859 859
 					if ($dfX1 > -180 && $dfX1 < $dfRightBorderX && $dfX2 == 180 &&
860
-					    $k+1 < count($first_pass) &&
861
-					    $first_pass[$k-1][0] > -180 && $first_pass[$k-1][0] < $dfRightBorderX)
860
+						$k+1 < count($first_pass) &&
861
+						$first_pass[$k-1][0] > -180 && $first_pass[$k-1][0] < $dfRightBorderX)
862 862
 					{
863 863
 						$poNewLS[] = array(-180, $first_pass[$k][1]);
864 864
 						$k++;
@@ -866,8 +866,8 @@  discard block
 block discarded – undo
866 866
 						$poNewLS[] = array($first_pass[$k][0], $first_pass[$k][1]);
867 867
 						continue;
868 868
 					} else if ($dfX1 > $dfLeftBorderX && $dfX1 < 180 && $dfX2 == -180 &&
869
-					    $k+1 < $first_pass_ln &&
870
-					    $first_pass[$k-1][0] > $dfLeftBorderX && $first_pass[$k-1][0] < 180)
869
+						$k+1 < $first_pass_ln &&
870
+						$first_pass[$k-1][0] > $dfLeftBorderX && $first_pass[$k-1][0] < 180)
871 871
 					{
872 872
 						$poNewLS[] = array(180, $first_pass[$k][1]);
873 873
 						$k++;
Please login to merge, or discard this patch.
require/class.ATC.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -21,13 +21,13 @@  discard block
 block discarded – undo
21 21
 		if ($this->db === null) die('Error: No DB connection. (ATC)');
22 22
 	}
23 23
 
24
-    /**
25
-     * Get SQL query part for filter used
26
-     * @param array $filter the filter
27
-     * @param bool $where
28
-     * @param bool $and
29
-     * @return String the SQL part
30
-     */
24
+	/**
25
+	 * Get SQL query part for filter used
26
+	 * @param array $filter the filter
27
+	 * @param bool $where
28
+	 * @param bool $and
29
+	 * @return String the SQL part
30
+	 */
31 31
 	public function getFilter($filter = array(),$where = false,$and = false) {
32 32
 		global $globalFilter, $globalStatsFilters, $globalFilterName;
33 33
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	 * Get all ATC from atc table
56 56
 	 * @return array Return all ATC
57 57
      */
58
-    public function getAll() {
58
+	public function getAll() {
59 59
 		$filter_query = $this->getFilter(array());
60 60
 		$query = "SELECT * FROM atc".$filter_query;
61 61
 		$query_values = array();
Please login to merge, or discard this patch.
require/class.Source.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -60,11 +60,11 @@
 block discarded – undo
60 60
 		return $all;
61 61
 	}
62 62
 
63
-    /**
64
-     * @param $name
65
-     * @return array
66
-     */
67
-    public function getLocationInfobySourceName($name) {
63
+	/**
64
+	 * @param $name
65
+	 * @return array
66
+	 */
67
+	public function getLocationInfobySourceName($name) {
68 68
 		$query = "SELECT * FROM source_location WHERE source = :name";
69 69
 		$query_values = array(':name' => $name);
70 70
 		try {
Please login to merge, or discard this patch.
require/class.SpotterImport.php 1 patch
Indentation   +433 added lines, -433 removed lines patch added patch discarded remove patch
@@ -16,20 +16,20 @@  discard block
 block discarded – undo
16 16
 require_once(dirname(__FILE__).'/class.Source.php');
17 17
 require_once(dirname(__FILE__).'/class.GeoidHeight.php');
18 18
 if (isset($globalServerAPRS) && $globalServerAPRS) {
19
-    require_once(dirname(__FILE__).'/class.APRS.php');
19
+	require_once(dirname(__FILE__).'/class.APRS.php');
20 20
 }
21 21
 
22 22
 class SpotterImport {
23
-    private $all_flights = array();
24
-    private $last_delete_hourly = 0;
25
-    private $last_delete = 0;
26
-    private $stats = array();
27
-    private $tmd = 0;
28
-    private $source_location = array();
29
-    public $db = null;
30
-    public $nb = 0;
23
+	private $all_flights = array();
24
+	private $last_delete_hourly = 0;
25
+	private $last_delete = 0;
26
+	private $stats = array();
27
+	private $tmd = 0;
28
+	private $source_location = array();
29
+	public $db = null;
30
+	public $nb = 0;
31 31
 
32
-    public function __construct($dbc = null) {
32
+	public function __construct($dbc = null) {
33 33
 	global $globalBeta, $globalServerAPRS, $APRSSpotter, $globalNoDB, $GeoidClass, $globalDebug, $globalGeoid;
34 34
 	if (!(isset($globalNoDB) && $globalNoDB)) {
35 35
 		$Connection = new Connection($dbc);
@@ -41,14 +41,14 @@  discard block
 block discarded – undo
41 41
 		$currentdate = date('Y-m-d');
42 42
 		$sourcestat = $Stats->getStatsSource($currentdate);
43 43
 		if (!empty($sourcestat)) {
44
-		    foreach($sourcestat as $srcst) {
45
-		    	$type = $srcst['stats_type'];
44
+			foreach($sourcestat as $srcst) {
45
+				$type = $srcst['stats_type'];
46 46
 			if ($type == 'polar' || $type == 'hist') {
47
-			    $source = $srcst['source_name'];
48
-			    $data = $srcst['source_data'];
49
-			    $this->stats[$currentdate][$source][$type] = json_decode($data,true);
50
-	    		}
51
-		    }
47
+				$source = $srcst['source_name'];
48
+				$data = $srcst['source_data'];
49
+				$this->stats[$currentdate][$source][$type] = json_decode($data,true);
50
+				}
51
+			}
52 52
 		}
53 53
 	}
54 54
 	if (isset($globalServerAPRS) && $globalServerAPRS) {
@@ -63,9 +63,9 @@  discard block
 block discarded – undo
63 63
 			$GeoidClass = FALSE;
64 64
 		}
65 65
 	}
66
-    }
66
+	}
67 67
 
68
-    public function get_Schedule($id,$ident) {
68
+	public function get_Schedule($id,$ident) {
69 69
 	global $globalDebug, $globalFork, $globalSchedulesFetch;
70 70
 	// Get schedule here, so it's done only one time
71 71
 	
@@ -85,43 +85,43 @@  discard block
 block discarded – undo
85 85
 	$operator = $Spotter->getOperator($ident);
86 86
 	$scheduleexist = false;
87 87
 	if ($Schedule->checkSchedule($operator) == 0) {
88
-	    $operator = $Translation->checkTranslation($ident);
89
-	    if ($Schedule->checkSchedule($operator) == 0) {
88
+		$operator = $Translation->checkTranslation($ident);
89
+		if ($Schedule->checkSchedule($operator) == 0) {
90 90
 		$schedule = $Schedule->fetchSchedule($operator);
91 91
 		if (count($schedule) > 0 && isset($schedule['DepartureTime']) && isset($schedule['ArrivalTime'])) {
92
-		    if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n";
93
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime']));
94
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime']));
95
-		    // Should also check if route schedule = route from DB
96
-		    if ($schedule['DepartureAirportIATA'] != '') {
92
+			if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n";
93
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime']));
94
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime']));
95
+			// Should also check if route schedule = route from DB
96
+			if ($schedule['DepartureAirportIATA'] != '') {
97 97
 			if ($this->all_flights[$id]['departure_airport'] != $Spotter->getAirportIcao($schedule['DepartureAirportIATA'])) {
98
-			    $airport_icao = $Spotter->getAirportIcao($schedule['DepartureAirportIATA']);
99
-			    if (trim($airport_icao) != '') {
98
+				$airport_icao = $Spotter->getAirportIcao($schedule['DepartureAirportIATA']);
99
+				if (trim($airport_icao) != '') {
100 100
 				$this->all_flights[$id]['departure_airport'] = $airport_icao;
101 101
 				if ($globalDebug) echo "-> Change departure airport to ".$airport_icao." for ".$ident."\n";
102
-			    }
102
+				}
103
+			}
103 104
 			}
104
-		    }
105
-		    if ($schedule['ArrivalAirportIATA'] != '') {
105
+			if ($schedule['ArrivalAirportIATA'] != '') {
106 106
 			if ($this->all_flights[$id]['arrival_airport'] != $Spotter->getAirportIcao($schedule['ArrivalAirportIATA'])) {
107
-			    $airport_icao = $Spotter->getAirportIcao($schedule['ArrivalAirportIATA']);
108
-			    if (trim($airport_icao) != '') {
107
+				$airport_icao = $Spotter->getAirportIcao($schedule['ArrivalAirportIATA']);
108
+				if (trim($airport_icao) != '') {
109 109
 				$this->all_flights[$id]['arrival_airport'] = $airport_icao;
110 110
 				if ($globalDebug) echo "-> Change arrival airport to ".$airport_icao." for ".$ident."\n";
111
-			    }
111
+				}
112 112
 			}
113
-		    }
114
-		    $Schedule->addSchedule($operator,$this->all_flights[$id]['departure_airport'],$this->all_flights[$id]['departure_airport_time'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time'],$schedule['Source']);
113
+			}
114
+			$Schedule->addSchedule($operator,$this->all_flights[$id]['departure_airport'],$this->all_flights[$id]['departure_airport_time'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time'],$schedule['Source']);
115 115
 		}
116
-	    } else $scheduleexist = true;
116
+		} else $scheduleexist = true;
117 117
 	} else $scheduleexist = true;
118 118
 	// close connection, at least one way will work ?
119
-       if ($scheduleexist) {
119
+	   if ($scheduleexist) {
120 120
 		if ($globalDebug) echo "-> get arrival/departure airport info for ".$ident."\n";
121
-    		$sch = $Schedule->getSchedule($operator);
121
+			$sch = $Schedule->getSchedule($operator);
122 122
 		$this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport' => $sch['arrival_airport_icao'],'departure_airport' => $sch['departure_airport_icao'],'departure_airport_time' => $sch['departure_airport_time'],'arrival_airport_time' => $sch['arrival_airport_time']));
123 123
 		if ($this->all_flights[$id]['addedSpotter'] == 1) $Spotter->updateLatestScheduleSpotterData($this->all_flights[$id]['id'],$sch['departure_airport_icao'],$sch['departure_airport_time'],$sch['arrival_airport_icao'],$sch['arrival_airport_time']);
124
-       }
124
+	   }
125 125
 	$Spotter->db = null;
126 126
 	$Schedule->db = null;
127 127
 	$Translation->db = null;
@@ -136,65 +136,65 @@  discard block
 block discarded – undo
136 136
 	}
137 137
 	  */
138 138
 	}
139
-    }
139
+	}
140 140
 
141
-    public function checkAll() {
141
+	public function checkAll() {
142 142
 	global $globalDebug, $globalNoImport;
143 143
 	if ($globalDebug) echo "Update last seen flights data...\n";
144 144
 	if (!isset($globalNoImport) || $globalNoImport === FALSE) {
145
-	    foreach ($this->all_flights as $key => $flight) {
145
+		foreach ($this->all_flights as $key => $flight) {
146 146
 		if (isset($this->all_flights[$key]['id'])) {
147
-		    //echo $this->all_flights[$key]['id'].' - '.$this->all_flights[$key]['latitude'].'  '.$this->all_flights[$key]['longitude']."\n";
148
-    		    $Spotter = new Spotter($this->db);
149
-        	    $real_arrival = $this->arrival($key);
150
-        	    if (isset($this->all_flights[$key]['altitude']) && isset($this->all_flights[$key]['datetime'])) $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']);
151
-        	}
152
-	    }
147
+			//echo $this->all_flights[$key]['id'].' - '.$this->all_flights[$key]['latitude'].'  '.$this->all_flights[$key]['longitude']."\n";
148
+				$Spotter = new Spotter($this->db);
149
+				$real_arrival = $this->arrival($key);
150
+				if (isset($this->all_flights[$key]['altitude']) && isset($this->all_flights[$key]['datetime'])) $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']);
151
+			}
152
+		}
153
+	}
153 154
 	}
154
-    }
155 155
 
156
-    public function arrival($key) {
156
+	public function arrival($key) {
157 157
 	global $globalClosestMinDist, $globalDebug;
158 158
 	if ($globalDebug) echo 'Update arrival...'."\n";
159 159
 	$Spotter = new Spotter($this->db);
160
-        $airport_icao = '';
161
-        $airport_time = '';
162
-        if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50;
160
+		$airport_icao = '';
161
+		$airport_time = '';
162
+		if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50;
163 163
 	if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') {
164
-	    $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist);
165
-    	    if (isset($closestAirports[0])) {
166
-        	if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) {
167
-        	    $airport_icao = $closestAirports[0]['icao'];
168
-        	    $airport_time = $this->all_flights[$key]['datetime'];
169
-        	    if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
170
-        	} elseif (count($closestAirports) > 1 && isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] != '') {
171
-        	    foreach ($closestAirports as $airport) {
172
-        		if ($this->all_flights[$key]['arrival_airport'] == $airport['icao']) {
173
-        		    $airport_icao = $airport['icao'];
174
-        		    $airport_time = $this->all_flights[$key]['datetime'];
175
-        		    if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
176
-        		    break;
177
-        		}
178
-        	    }
179
-        	} elseif ($this->all_flights[$key]['altitude'] == 0 || ($this->all_flights[$key]['altitude_real'] != '' && ($closestAirports[0]['altitude'] < $this->all_flights[$key]['altitude_real'] && $this->all_flights[$key]['altitude_real'] < $closestAirports[0]['altitude']+5000))) {
180
-        		$airport_icao = $closestAirports[0]['icao'];
181
-        		$airport_time = $this->all_flights[$key]['datetime'];
182
-        	} else {
183
-        		if ($globalDebug) echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n";
184
-        	}
185
-    	    } else {
186
-    		    if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n";
187
-    	    }
164
+		$closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist);
165
+			if (isset($closestAirports[0])) {
166
+			if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) {
167
+				$airport_icao = $closestAirports[0]['icao'];
168
+				$airport_time = $this->all_flights[$key]['datetime'];
169
+				if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
170
+			} elseif (count($closestAirports) > 1 && isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] != '') {
171
+				foreach ($closestAirports as $airport) {
172
+				if ($this->all_flights[$key]['arrival_airport'] == $airport['icao']) {
173
+					$airport_icao = $airport['icao'];
174
+					$airport_time = $this->all_flights[$key]['datetime'];
175
+					if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
176
+					break;
177
+				}
178
+				}
179
+			} elseif ($this->all_flights[$key]['altitude'] == 0 || ($this->all_flights[$key]['altitude_real'] != '' && ($closestAirports[0]['altitude'] < $this->all_flights[$key]['altitude_real'] && $this->all_flights[$key]['altitude_real'] < $closestAirports[0]['altitude']+5000))) {
180
+				$airport_icao = $closestAirports[0]['icao'];
181
+				$airport_time = $this->all_flights[$key]['datetime'];
182
+			} else {
183
+				if ($globalDebug) echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n";
184
+			}
185
+			} else {
186
+				if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n";
187
+			}
188 188
 
189
-        } else {
190
-        	if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n";
191
-        }
192
-        return array('airport_icao' => $airport_icao,'airport_time' => $airport_time);
193
-    }
189
+		} else {
190
+			if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n";
191
+		}
192
+		return array('airport_icao' => $airport_icao,'airport_time' => $airport_time);
193
+	}
194 194
 
195 195
 
196 196
 
197
-    public function del() {
197
+	public function del() {
198 198
 	global $globalDebug, $globalNoImport, $globalNoDB;
199 199
 	// Delete old infos
200 200
 	if ($globalDebug) echo 'Delete old values and update latest data...'."\n";
@@ -206,9 +206,9 @@  discard block
 block discarded – undo
206 206
 			}
207 207
 		}
208 208
 	}
209
-    }
209
+	}
210 210
 
211
-    public function delKey($key) {
211
+	public function delKey($key) {
212 212
 	global $globalDebug, $globalNoImport, $globalNoDB;
213 213
 	// Delete old infos
214 214
 	if (isset($this->all_flights[$key]['id'])) {
@@ -230,9 +230,9 @@  discard block
 block discarded – undo
230 230
 		if ($globalDebug) echo "\n";
231 231
 	}
232 232
 	unset($this->all_flights[$key]);
233
-    }
233
+	}
234 234
 
235
-    public function add($line) {
235
+	public function add($line) {
236 236
 	global $globalPilotIdAccept, $globalAirportAccept, $globalAirlineAccept, $globalAirlineIgnore, $globalAirportIgnore, $globalFork, $globalDistanceIgnore, $globalDaemon, $globalSBS1update, $globalDebug, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAirlinesSource, $globalVAM, $globalAllFlights, $globalServerAPRS, $APRSSpotter, $globalNoImport, $globalNoDB, $globalVA, $globalAircraftMaxUpdate, $globalAircraftMinUpdate, $globalLiveInterval, $GeoidClass, $globalArchive;
237 237
 	//if (!isset($globalDebugTimeElapsed) || $globalDebugTimeElapsed == '') $globalDebugTimeElapsed = FALSE;
238 238
 	if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.01';
@@ -258,20 +258,20 @@  discard block
 block discarded – undo
258 258
 	
259 259
 	// SBS format is CSV format
260 260
 	if(is_array($line) && (isset($line['hex']) || isset($line['id']))) {
261
-	    //print_r($line);
262
-	    if (isset($line['hex'])) $line['hex'] = strtoupper($line['hex']);
263
-  	    if (isset($line['id']) || (isset($line['hex']) && $line['hex'] != '' && substr($line['hex'],0,1) != '~' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6)) {
261
+		//print_r($line);
262
+		if (isset($line['hex'])) $line['hex'] = strtoupper($line['hex']);
263
+  		if (isset($line['id']) || (isset($line['hex']) && $line['hex'] != '' && substr($line['hex'],0,1) != '~' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6)) {
264 264
 
265 265
 		// Increment message number
266 266
 		if (isset($line['sourcestats']) && $line['sourcestats'] === TRUE) {
267
-		    $current_date = date('Y-m-d');
268
-		    if (isset($line['source_name'])) $source = $line['source_name'];
269
-		    else $source = '';
270
-		    if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source'];
271
-		    if (!isset($this->stats[$current_date][$source]['msg'])) {
272
-		    	$this->stats[$current_date][$source]['msg']['date'] = time();
273
-		    	$this->stats[$current_date][$source]['msg']['nb'] = 1;
274
-		    } else $this->stats[$current_date][$source]['msg']['nb'] += 1;
267
+			$current_date = date('Y-m-d');
268
+			if (isset($line['source_name'])) $source = $line['source_name'];
269
+			else $source = '';
270
+			if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source'];
271
+			if (!isset($this->stats[$current_date][$source]['msg'])) {
272
+				$this->stats[$current_date][$source]['msg']['date'] = time();
273
+				$this->stats[$current_date][$source]['msg']['nb'] = 1;
274
+			} else $this->stats[$current_date][$source]['msg']['nb'] += 1;
275 275
 		}
276 276
 		
277 277
 		/*
@@ -287,54 +287,54 @@  discard block
 block discarded – undo
287 287
 		//$this->db = $dbc;
288 288
 
289 289
 		//$hex = trim($line['hex']);
290
-	        if (!isset($line['id'])) $id = trim($line['hex']);
291
-	        else $id = trim($line['id']);
290
+			if (!isset($line['id'])) $id = trim($line['hex']);
291
+			else $id = trim($line['id']);
292 292
 		
293 293
 		if (!isset($this->all_flights[$id])) {
294
-		    if ($globalDebug) echo 'New flight...'."\n";
295
-		    $this->all_flights[$id] = array();
296
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0));
297
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => '','departure_airport' => '', 'arrival_airport' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '','altitude_real' => '','altitude_previous' => '', 'heading' => '','departure_airport_time' => '','arrival_airport_time' => '','squawk' => '','route_stop' => '','registration' => '','pilot_id' => '','pilot_name' => '','waypoints' => '','ground' => '0', 'format_source' => '','source_name' => '','over_country' => '','verticalrate' => '','noarchive' => false,'putinarchive' => true,'source_type' => '','coordinates' => 0));
298
-		    if (isset($globalDaemon) && $globalDaemon === FALSE) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time()));
299
-		    if (!isset($line['id'])) {
294
+			if ($globalDebug) echo 'New flight...'."\n";
295
+			$this->all_flights[$id] = array();
296
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0));
297
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => '','departure_airport' => '', 'arrival_airport' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '','altitude_real' => '','altitude_previous' => '', 'heading' => '','departure_airport_time' => '','arrival_airport_time' => '','squawk' => '','route_stop' => '','registration' => '','pilot_id' => '','pilot_name' => '','waypoints' => '','ground' => '0', 'format_source' => '','source_name' => '','over_country' => '','verticalrate' => '','noarchive' => false,'putinarchive' => true,'source_type' => '','coordinates' => 0));
298
+			if (isset($globalDaemon) && $globalDaemon === FALSE) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time()));
299
+			if (!isset($line['id'])) {
300 300
 			if (!isset($globalDaemon)) $globalDaemon = TRUE;
301 301
 //			if (isset($line['format_source']) && ($line['format_source'] == 'sbs' || $line['format_source'] == 'tsv' || $line['format_source'] == 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'].'-'.date('YmdGi')));
302 302
 //			if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi')));
303 303
 			if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi')));
304
-		        //else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
305
-		     } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
306
-		    if ($globalAllFlights !== FALSE) $dataFound = true;
304
+				//else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
305
+			 } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
306
+			if ($globalAllFlights !== FALSE) $dataFound = true;
307 307
 		}
308 308
 		if (isset($line['source_type']) && $line['source_type'] != '') {
309
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_type' => $line['source_type']));
309
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_type' => $line['source_type']));
310 310
 		}
311 311
 		
312 312
 		//print_r($this->all_flights);
313 313
 		if (isset($line['hex']) && !isset($this->all_flights[$id]['hex']) && ctype_xdigit($line['hex'])) {
314
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => trim($line['hex'])));
315
-		    //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) {
314
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => trim($line['hex'])));
315
+			//if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) {
316 316
 			//$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime']));
317
-		    //} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s')));
318
-		    if (!isset($line['aircraft_name']) && (!isset($line['aircraft_icao']) || $line['aircraft_icao'] == '????') && $line['format_source'] != 'whazzup' && $line['format_source'] != 'vatsimtxt' && $line['format_source'] != 'pireps' && $line['format_source'] != 'phpvmacars' && $line['format_source'] != 'vam' && $line['format_source'] != 'flightgearsp' && $line['format_source'] != 'flightgearmp') {
317
+			//} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s')));
318
+			if (!isset($line['aircraft_name']) && (!isset($line['aircraft_icao']) || $line['aircraft_icao'] == '????') && $line['format_source'] != 'whazzup' && $line['format_source'] != 'vatsimtxt' && $line['format_source'] != 'pireps' && $line['format_source'] != 'phpvmacars' && $line['format_source'] != 'vam' && $line['format_source'] != 'flightgearsp' && $line['format_source'] != 'flightgearmp') {
319 319
 			$timeelapsed = microtime(true);
320 320
 			if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
321
-			    $Spotter = new Spotter($this->db);
322
-			    if (isset($this->all_flights[$id]['source_type'])) {
321
+				$Spotter = new Spotter($this->db);
322
+				if (isset($this->all_flights[$id]['source_type'])) {
323 323
 				$aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex']),$this->all_flights[$id]['source_type']);
324
-			    } else {
324
+				} else {
325 325
 				$aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex']));
326
-			    }
327
-			    $Spotter->db = null;
328
-			    if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
329
-			    if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao));
326
+				}
327
+				$Spotter->db = null;
328
+				if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
329
+				if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao));
330 330
 			}
331
-		    }
332
-		    if ($globalAllFlights !== FALSE) $dataFound = true;
333
-		    if ($globalDebug) echo "*********** New aircraft hex : ".$line['hex']." ***********\n";
331
+			}
332
+			if ($globalAllFlights !== FALSE) $dataFound = true;
333
+			if ($globalDebug) echo "*********** New aircraft hex : ".$line['hex']." ***********\n";
334 334
 		}
335
-	        if (isset($line['id']) && !isset($line['hex'])) {
336
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => ''));
337
-	        }
335
+			if (isset($line['id']) && !isset($line['hex'])) {
336
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => ''));
337
+			}
338 338
 		if (isset($line['aircraft_icao']) && $line['aircraft_icao'] != '') {
339 339
 			$icao = $line['aircraft_icao'];
340 340
 			if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
@@ -364,9 +364,9 @@  discard block
 block discarded – undo
364 364
 		}
365 365
 		//if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) {
366 366
 		if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) {
367
-		    if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) {
367
+			if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) {
368 368
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime']));
369
-		    } else {
369
+			} else {
370 370
 				if (strtotime($line['datetime']) == strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n";
371 371
 				elseif (strtotime($line['datetime']) > strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_flights[$id]['datetime'].") !!! for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n";
372 372
 				/*
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 				print_r($line);
376 376
 				*/
377 377
 				return '';
378
-		    }
378
+			}
379 379
 		} elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) {
380 380
 			if ($globalDebug) echo "!!! Date is too old ".$line['datetime']." for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!\n";
381 381
 			return '';
@@ -391,21 +391,21 @@  discard block
 block discarded – undo
391 391
 		}
392 392
 
393 393
 		if (isset($line['registration']) && $line['registration'] != '' && $line['registration'] != 'z.NO-REG' && $line['registration'] != 'NA') {
394
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('registration' => $line['registration']));
394
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('registration' => $line['registration']));
395 395
 		}
396 396
 		if (isset($line['waypoints']) && $line['waypoints'] != '') {
397
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('waypoints' => $line['waypoints']));
397
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('waypoints' => $line['waypoints']));
398 398
 		}
399 399
 		if (isset($line['pilot_id']) && $line['pilot_id'] != '') {
400
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_id' => trim($line['pilot_id'])));
400
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_id' => trim($line['pilot_id'])));
401 401
 		}
402 402
 		if (isset($line['pilot_name']) && $line['pilot_name'] != '') {
403
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_name' => trim($line['pilot_name'])));
403
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_name' => trim($line['pilot_name'])));
404 404
 		}
405 405
  
406 406
 		if (isset($line['ident']) && trim($line['ident']) != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_flights[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9]+$/', $line['ident'])) {
407 407
 
408
-		    if ($this->all_flights[$id]['addedSpotter'] == 1) {
408
+			if ($this->all_flights[$id]['addedSpotter'] == 1) {
409 409
 			if ($globalVA !== TRUE && $globalIVAO !== TRUE && $globalVATSIM !== TRUE && $globalphpVMS !== TRUE && $globalVAM !== TRUE && $this->all_flights[$id]['lastupdate'] < time() - 1600) {
410 410
 				if ($globalDebug) echo '---!!!! New ident, reset aircraft data...'."\n";
411 411
 				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0));
@@ -414,23 +414,23 @@  discard block
 block discarded – undo
414 414
 				elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
415 415
 				elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
416 416
 			} else {
417
-			    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident'])));
418
-			    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
417
+				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident'])));
418
+				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
419 419
 				$timeelapsed = microtime(true);
420
-            			$Spotter = new Spotter($this->db);
421
-            			$fromsource = NULL;
422
-            			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
423
-            			elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
420
+						$Spotter = new Spotter($this->db);
421
+						$fromsource = NULL;
422
+						if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
423
+						elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
424 424
 				elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') $fromsource = 'ivao';
425 425
 				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
426 426
 				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
427
-            			$result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource,$this->all_flights[$id]['source_type']);
427
+						$result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource,$this->all_flights[$id]['source_type']);
428 428
 				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
429 429
 				$Spotter->db = null;
430 430
 				if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
431
-			    }
431
+				}
432 432
 			}
433
-		    } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident'])));
433
+			} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident'])));
434 434
 		    
435 435
 /*
436 436
 		    if (!isset($line['id'])) {
@@ -440,63 +440,63 @@  discard block
 block discarded – undo
440 440
 		        else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
441 441
 		     } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
442 442
   */
443
-		    if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
443
+			if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
444 444
 
445
-		    //$putinarchive = true;
446
-		    if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) {
445
+			//$putinarchive = true;
446
+			if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) {
447 447
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $line['departure_airport_time']));
448
-		    }
449
-		    if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) {
448
+			}
449
+			if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) {
450 450
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $line['arrival_airport_time']));
451
-		    }
452
-		    if (isset($line['departure_airport_icao']) && isset($line['arrival_airport_icao'])) {
453
-		    		$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => ''));
454
-		    } elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) {
451
+			}
452
+			if (isset($line['departure_airport_icao']) && isset($line['arrival_airport_icao'])) {
453
+					$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => ''));
454
+			} elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) {
455 455
 			$timeelapsed = microtime(true);
456 456
 			if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
457 457
 				$Spotter = new Spotter($this->db);
458 458
 				$line['departure_airport_icao'] = $Spotter->getAirportIcao($line['departure_airport_iata']);
459 459
 				$line['arrival_airport_icao'] = $Spotter->getAirportIcao($line['arrival_airport_iata']);
460
-		    		$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => ''));
460
+					$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => ''));
461 461
 				if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
462
-                        }
463
-		    } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') {
462
+						}
463
+			} elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') {
464 464
 			$timeelapsed = microtime(true);
465 465
 			if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
466
-			    $Spotter = new Spotter($this->db);
467
-			    $route = $Spotter->getRouteInfo(trim($line['ident']));
468
-			    if (!isset($route['fromairport_icao']) && !isset($route['toairport_icao'])) {
466
+				$Spotter = new Spotter($this->db);
467
+				$route = $Spotter->getRouteInfo(trim($line['ident']));
468
+				if (!isset($route['fromairport_icao']) && !isset($route['toairport_icao'])) {
469 469
 				$Translation = new Translation($this->db);
470 470
 				$ident = $Translation->checkTranslation(trim($line['ident']));
471 471
 				$route = $Spotter->getRouteInfo($ident);
472 472
 				$Translation->db = null;
473
-			    }
474
-			    $Spotter->db = null;
475
-			    if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
476
-                    	}
473
+				}
474
+				$Spotter->db = null;
475
+				if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
476
+						}
477 477
 			if (isset($route['fromairport_icao']) && isset($route['toairport_icao'])) {
478
-			    //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) {
479
-			    if ($route['fromairport_icao'] != $route['toairport_icao']) {
478
+				//if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) {
479
+				if ($route['fromairport_icao'] != $route['toairport_icao']) {
480 480
 				//    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['FromAirport_ICAO'],'arrival_airport' => $route['ToAirport_ICAO'],'route_stop' => $route['RouteStop']));
481
-		    		$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['fromairport_icao'],'arrival_airport' => $route['toairport_icao'],'route_stop' => $route['routestop']));
482
-		    	    }
481
+					$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['fromairport_icao'],'arrival_airport' => $route['toairport_icao'],'route_stop' => $route['routestop']));
482
+					}
483 483
 			}
484 484
 			if (!isset($globalFork)) $globalFork = TRUE;
485 485
 			if (!$globalVA && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && (!isset($line['format_source']) || $line['format_source'] != 'aprs')) {
486 486
 				if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id,trim($line['ident']));
487 487
 			}
488
-		    }
488
+			}
489 489
 		}
490 490
 
491 491
 		if (isset($line['speed']) && $line['speed'] != '' && $line['speed'] != 0) {
492 492
 		//    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => $line[12]));
493
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($line['speed'])));
494
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed_fromsrc' => true));
495
-		    //$dataFound = true;
493
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($line['speed'])));
494
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed_fromsrc' => true));
495
+			//$dataFound = true;
496 496
 		} else if (!isset($this->all_flights[$id]['speed_fromsrc']) && isset($this->all_flights[$id]['time_last_coord']) && $this->all_flights[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) {
497
-		    $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m');
498
-		    if ($distance > 1000 && $distance < 10000) {
499
-		    // use datetime
497
+			$distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m');
498
+			if ($distance > 1000 && $distance < 10000) {
499
+			// use datetime
500 500
 			$speed = $distance/(time() - $this->all_flights[$id]['time_last_coord']);
501 501
 			$speed = $speed*3.6;
502 502
 			if ($speed < 1000) {
@@ -505,49 +505,49 @@  discard block
 block discarded – undo
505 505
 	  		} else {
506 506
 	  			if ($globalDebug) echo "ø IGNORED : Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n";
507 507
 	  		}
508
-		    }
508
+			}
509 509
 		}
510 510
 
511 511
 
512 512
 
513
-	        if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) {
514
-	    	    if (ctype_digit(strval($line['latitude'])) || ctype_digit(strval($line['longitude']))) {
515
-	    	    	if ($globalDebug) echo "/!\ Invalid latitude or/and longitude data : lat: ".$line['latitude']." - lng: ".$line['longitude']."\n";
516
-	    	    	return false;
517
-	    	    }
518
-	    	    if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']);
519
-	    	    else unset($timediff);
520
-	    	    if (isset($this->all_flights[$id]['time_last_archive_coord'])) $timediff_archive = round(time()-$this->all_flights[$id]['time_last_archive_coord']);
521
-	    	    else unset($timediff_archive);
522
-	    	    if ($this->tmd > 5
523
-	    	        || (isset($line['format_source']) 
524
-	    	    	    && $line['format_source'] == 'airwhere' 
525
-	    	    	    && ((!isset($this->all_flights[$id]['latitude']) 
526
-	    	    		|| !isset($this->all_flights[$id]['longitude'])) 
527
-	    	    		|| (isset($this->all_flights[$id]['latitude']) 
528
-	    	    		    && isset($this->all_flights[$id]['longitude']) 
529
-	    	    		    && $this->all_flights[$id]['latitude'] != $line['latitude'] 
530
-	    	    		    && $this->all_flights[$id]['longitude'] != $line['longitude']
531
-	    	    		)
532
-	    	    	    )
533
-	    	    	)
534
-	    		|| (isset($globalVA) && $globalVA) 
535
-	    	    	|| (isset($globalIVAO) && $globalIVAO)
536
-	    	    	|| (isset($globalVATSIM) && $globalVATSIM)
537
-	    	    	|| (isset($globalphpVMS) && $globalphpVMS)
538
-	    	    	|| (isset($globalVAM) && $globalVAM)
539
-	    	    	|| !isset($timediff)
540
-	    	    	|| (isset($timediff) && $timediff > $globalLiveInterval)
541
-	    	    	|| $globalArchive
542
-	    	    	|| (isset($timediff) && $timediff > 30
543
-	    	    	    && isset($this->all_flights[$id]['latitude']) 
544
-	    	    	    && isset($this->all_flights[$id]['longitude']) 
545
-	    	    	    && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m'))
546
-	    	    	    )
547
-	    	    	) {
513
+			if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) {
514
+				if (ctype_digit(strval($line['latitude'])) || ctype_digit(strval($line['longitude']))) {
515
+					if ($globalDebug) echo "/!\ Invalid latitude or/and longitude data : lat: ".$line['latitude']." - lng: ".$line['longitude']."\n";
516
+					return false;
517
+				}
518
+				if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']);
519
+				else unset($timediff);
520
+				if (isset($this->all_flights[$id]['time_last_archive_coord'])) $timediff_archive = round(time()-$this->all_flights[$id]['time_last_archive_coord']);
521
+				else unset($timediff_archive);
522
+				if ($this->tmd > 5
523
+					|| (isset($line['format_source']) 
524
+						&& $line['format_source'] == 'airwhere' 
525
+						&& ((!isset($this->all_flights[$id]['latitude']) 
526
+						|| !isset($this->all_flights[$id]['longitude'])) 
527
+						|| (isset($this->all_flights[$id]['latitude']) 
528
+							&& isset($this->all_flights[$id]['longitude']) 
529
+							&& $this->all_flights[$id]['latitude'] != $line['latitude'] 
530
+							&& $this->all_flights[$id]['longitude'] != $line['longitude']
531
+						)
532
+						)
533
+					)
534
+				|| (isset($globalVA) && $globalVA) 
535
+					|| (isset($globalIVAO) && $globalIVAO)
536
+					|| (isset($globalVATSIM) && $globalVATSIM)
537
+					|| (isset($globalphpVMS) && $globalphpVMS)
538
+					|| (isset($globalVAM) && $globalVAM)
539
+					|| !isset($timediff)
540
+					|| (isset($timediff) && $timediff > $globalLiveInterval)
541
+					|| $globalArchive
542
+					|| (isset($timediff) && $timediff > 30
543
+						&& isset($this->all_flights[$id]['latitude']) 
544
+						&& isset($this->all_flights[$id]['longitude']) 
545
+						&& $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m'))
546
+						)
547
+					) {
548 548
 
549 549
 			if ((isset($timediff) && !isset($timediff_archive)) || (isset($this->all_flights[$id]['archive_latitude']) && isset($this->all_flights[$id]['archive_longitude']) && isset($this->all_flights[$id]['livedb_latitude']) && isset($this->all_flights[$id]['livedb_longitude']))) {
550
-			    if ((isset($timediff_archive) && $timediff_archive > $globalAircraftMaxUpdate)
550
+				if ((isset($timediff_archive) && $timediff_archive > $globalAircraftMaxUpdate)
551 551
 				|| (isset($line['format_source']) && $line['format_source'] == 'airwhere') 
552 552
 				|| !$Common->checkLine($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['livedb_latitude'],$this->all_flights[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) {
553 553
 				$this->all_flights[$id]['archive_latitude'] = $line['latitude'];
@@ -559,9 +559,9 @@  discard block
 block discarded – undo
559 559
 				}
560 560
 				$this->tmd = 0;
561 561
 				if (!isset($globalNoImport) || $globalNoImport === FALSE) {
562
-				    if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_flights[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... ';
563
-				    $timeelapsed = microtime(true);
564
-				    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
562
+					if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_flights[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... ';
563
+					$timeelapsed = microtime(true);
564
+					if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
565 565
 					$Spotter = new Spotter($this->db);
566 566
 					$all_country = $Spotter->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']);
567 567
 					if (!empty($all_country)) $this->all_flights[$id]['over_country'] = $all_country['iso2'];
@@ -569,11 +569,11 @@  discard block
 block discarded – undo
569 569
 					$Spotter->db = null;
570 570
 					if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
571 571
 					if ($globalDebug) echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n";
572
-				    }
572
+					}
573 573
 				}
574 574
 				$this->all_flights[$id]['time_last_archive_coord'] = time();
575
-			    } 
576
-			    /*
575
+				} 
576
+				/*
577 577
 			    else {
578 578
 				if (!isset($timediff)) echo 'NO TIMEDIFF';
579 579
 				else {
@@ -587,16 +587,16 @@  discard block
 block discarded – undo
587 587
 			}
588 588
 
589 589
 			if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) {
590
-			    //if (!isset($this->all_flights[$id]['latitude']) || $this->all_flights[$id]['latitude'] == '' || abs($this->all_flights[$id]['latitude']-$line['latitude']) < 3 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) {
590
+				//if (!isset($this->all_flights[$id]['latitude']) || $this->all_flights[$id]['latitude'] == '' || abs($this->all_flights[$id]['latitude']-$line['latitude']) < 3 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) {
591 591
 				if (!isset($this->all_flights[$id]['archive_latitude'])) {
592 592
 					$this->all_flights[$id]['archive_latitude'] = $line['latitude'];
593 593
 					$this->all_flights[$id]['time_last_coord'] = time();
594 594
 				}
595 595
 				//if (!isset($this->all_flights[$id]['livedb_latitude']) || abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs' || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > 0.0001)) {
596 596
 				if (!isset($this->all_flights[$id]['livedb_latitude']) || abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > 0.0001)) {
597
-				    $this->all_flights[$id]['livedb_latitude'] = $line['latitude'];
598
-				    $dataFound = true;
599
-				    $this->all_flights[$id]['time_last_coord'] = time();
597
+					$this->all_flights[$id]['livedb_latitude'] = $line['latitude'];
598
+					$dataFound = true;
599
+					$this->all_flights[$id]['time_last_coord'] = time();
600 600
 				}
601 601
 				// elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n";
602 602
 				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('latitude' => $line['latitude']));
@@ -607,25 +607,25 @@  discard block
 block discarded – undo
607 607
 				    //$putinarchive = true;
608 608
 				}
609 609
 				*/
610
-			    /*
610
+				/*
611 611
 			    } elseif (isset($this->all_flights[$id]['latitude'])) {
612 612
 				if ($globalDebug) echo '!!! Strange latitude value - diff : '.abs($this->all_flights[$id]['latitude']-$line['latitude']).'- previous lat : '.$this->all_flights[$id]['latitude'].'- new lat : '.$line['latitude']."\n";
613 613
 			    }
614 614
 			    */
615 615
 			}
616 616
 			if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) {
617
-			    if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
618
-			    //if (!isset($this->all_flights[$id]['longitude']) || $this->all_flights[$id]['longitude'] == ''  || abs($this->all_flights[$id]['longitude']-$line['longitude']) < 2 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) {
617
+				if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
618
+				//if (!isset($this->all_flights[$id]['longitude']) || $this->all_flights[$id]['longitude'] == ''  || abs($this->all_flights[$id]['longitude']-$line['longitude']) < 2 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) {
619 619
 				if (!isset($this->all_flights[$id]['archive_longitude'])) {
620 620
 					$this->all_flights[$id]['archive_longitude'] = $line['longitude'];
621 621
 					$this->all_flights[$id]['time_last_coord'] = time();
622 622
 				}
623 623
 				//if (!isset($this->all_flights[$id]['livedb_longitude']) || abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs' || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > 0.0001)) {
624 624
 				if (!isset($this->all_flights[$id]['livedb_longitude']) || abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > 0.0001)) {
625
-				    $this->all_flights[$id]['livedb_longitude'] = $line['longitude'];
626
-				    $dataFound = true;
627
-				    $this->all_flights[$id]['coordinates'] += 1;
628
-				    $this->all_flights[$id]['time_last_coord'] = time();
625
+					$this->all_flights[$id]['livedb_longitude'] = $line['longitude'];
626
+					$dataFound = true;
627
+					$this->all_flights[$id]['coordinates'] += 1;
628
+					$this->all_flights[$id]['time_last_coord'] = time();
629 629
 				}
630 630
 				// elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n";
631 631
 				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('longitude' => $line['longitude']));
@@ -643,76 +643,76 @@  discard block
 block discarded – undo
643 643
 			    */
644 644
 			}
645 645
 			if ($globalDaemon === TRUE && isset($updateinitial) && $updateinitial && $this->all_flights[$id]['addedSpotter'] == 1) {
646
-			    if ($globalDebug) echo "\n".'>>> Update initial data !'."\n";
647
-			    unset($updateinitial);
648
-			    $SpotterArchive = new SpotterArchive();
649
-			    $SpotterArchive->deleteSpotterArchiveTrackDataByID($this->all_flights[$id]['id']);
650
-			    $SpotterArchive->db = null;
651
-			    $Spotter = new Spotter();
652
-			    $Spotter->updateInitialSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime']);
653
-			    $Spotter->db = null;
646
+				if ($globalDebug) echo "\n".'>>> Update initial data !'."\n";
647
+				unset($updateinitial);
648
+				$SpotterArchive = new SpotterArchive();
649
+				$SpotterArchive->deleteSpotterArchiveTrackDataByID($this->all_flights[$id]['id']);
650
+				$SpotterArchive->db = null;
651
+				$Spotter = new Spotter();
652
+				$Spotter->updateInitialSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime']);
653
+				$Spotter->db = null;
654 654
 			}
655
-		    } else if ($globalDebug && $timediff > 30) {
655
+			} else if ($globalDebug && $timediff > 30) {
656 656
 			$this->tmd = $this->tmd + 1;
657 657
 			echo '!!! Too much distance in short time... for '.$this->all_flights[$id]['ident']."\n";
658 658
 			echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')."m -";
659 659
 			echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')/$timediff)*3.6)." km/h - ";
660 660
 			echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_flights[$id]['latitude'].' - prev long : '.$this->all_flights[$id]['longitude']." \n";
661
-		    }
661
+			}
662 662
 		}
663 663
 		if (isset($line['last_update']) && $line['last_update'] != '') {
664
-		    if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true;
665
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update']));
664
+			if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true;
665
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update']));
666 666
 		}
667 667
 		if (isset($line['verticalrate']) && $line['verticalrate'] != '') {
668
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('verticalrate' => $line['verticalrate']));
669
-		    //$dataFound = true;
668
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('verticalrate' => $line['verticalrate']));
669
+			//$dataFound = true;
670 670
 		}
671 671
 		if (isset($line['format_source']) && $line['format_source'] != '') {
672
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('format_source' => $line['format_source']));
672
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('format_source' => $line['format_source']));
673 673
 		}
674 674
 		if (isset($line['source_name']) && $line['source_name'] != '') {
675
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_name' => $line['source_name']));
675
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_name' => $line['source_name']));
676 676
 		}
677 677
 		if (isset($line['emergency']) && $line['emergency'] != '') {
678
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('emergency' => $line['emergency']));
679
-		    //$dataFound = true;
678
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('emergency' => $line['emergency']));
679
+			//$dataFound = true;
680 680
 		}
681 681
 		if (isset($line['ground']) && $line['ground'] != '') {
682
-		    if (isset($this->all_flights[$id]['ground']) && $this->all_flights[$id]['ground'] == 1 && $line['ground'] == 0) {
682
+			if (isset($this->all_flights[$id]['ground']) && $this->all_flights[$id]['ground'] == 1 && $line['ground'] == 0) {
683 683
 			// Here we force archive of flight because after ground it's a new one (or should be)
684 684
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0));
685 685
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1));
686 686
 			if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi')));
687
-		        elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
687
+				elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
688 688
 			elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
689
-		    }
690
-		    if ($line['ground'] != 1) $line['ground'] = 0;
691
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground']));
692
-		    //$dataFound = true;
689
+			}
690
+			if ($line['ground'] != 1) $line['ground'] = 0;
691
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground']));
692
+			//$dataFound = true;
693 693
 		}
694 694
 		if (isset($line['squawk']) && $line['squawk'] != '') {
695
-		    if (isset($this->all_flights[$id]['squawk']) && $this->all_flights[$id]['squawk'] != '7500' && $this->all_flights[$id]['squawk'] != '7600' && $this->all_flights[$id]['squawk'] != '7700' && isset($this->all_flights[$id]['id'])) {
696
-			    if ($this->all_flights[$id]['squawk'] != $line['squawk']) $this->all_flights[$id]['putinarchive'] = true;
697
-			    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk']));
698
-			    $highlight = '';
699
-			    if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC';
700
-			    if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC';
701
-			    if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC';
702
-			    if ($highlight != '') {
695
+			if (isset($this->all_flights[$id]['squawk']) && $this->all_flights[$id]['squawk'] != '7500' && $this->all_flights[$id]['squawk'] != '7600' && $this->all_flights[$id]['squawk'] != '7700' && isset($this->all_flights[$id]['id'])) {
696
+				if ($this->all_flights[$id]['squawk'] != $line['squawk']) $this->all_flights[$id]['putinarchive'] = true;
697
+				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk']));
698
+				$highlight = '';
699
+				if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC';
700
+				if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC';
701
+				if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC';
702
+				if ($highlight != '') {
703 703
 				$timeelapsed = microtime(true);
704 704
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
705
-				    $Spotter = new Spotter($this->db);
706
-				    $Spotter->setHighlightFlight($this->all_flights[$id]['id'],$highlight);
707
-				    $Spotter->db = null;
708
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
705
+					$Spotter = new Spotter($this->db);
706
+					$Spotter->setHighlightFlight($this->all_flights[$id]['id'],$highlight);
707
+					$Spotter->db = null;
708
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
709 709
 				}
710 710
 				//$putinarchive = true;
711 711
 				//$highlight = '';
712
-			    }
712
+				}
713 713
 			    
714
-		    } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk']));
715
-		    //$dataFound = true;
714
+			} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk']));
715
+			//$dataFound = true;
716 716
 		}
717 717
 
718 718
 		if (isset($line['altitude']) && $line['altitude'] != '') {
@@ -723,13 +723,13 @@  discard block
 block discarded – undo
723 723
 					$line['altitude'] = $line['altitude'] - $geoid;
724 724
 				}
725 725
 			}
726
-		    //if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) {
726
+			//if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) {
727 727
 			if (is_int($this->all_flights[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_flights[$id]['altitude']) > 3) $this->all_flights[$id]['putinarchive'] = true;
728 728
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude' => round($line['altitude']/100)));
729 729
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_real' => $line['altitude']));
730 730
 			//$dataFound = true;
731
-		    //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n";
732
-		    if ($globalVA !== TRUE && $globalIVAO !== TRUE && $globalVATSIM !== TRUE && $globalphpVMS !== TRUE && $globalVAM !== TRUE) {
731
+			//} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n";
732
+			if ($globalVA !== TRUE && $globalIVAO !== TRUE && $globalVATSIM !== TRUE && $globalphpVMS !== TRUE && $globalVAM !== TRUE) {
733 733
 			if (isset($this->all_flights[$id]['over_country']) && $this->all_flights[$id]['over_country'] != '' && isset($this->all_flights[$id]['altitude_previous']) && $this->all_flights[$id]['altitude_previous'] != '' && $this->all_flights[$id]['altitude_previous'] < $this->all_flights[$id]['altitude_real'] && isset($this->all_flights[$id]['lastupdate']) && $this->all_flights[$id]['lastupdate'] < time() - 1600) {
734 734
 				if ($globalDebug) echo '--- Reset because of altitude'."\n";
735 735
 				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0));
@@ -738,27 +738,27 @@  discard block
 block discarded – undo
738 738
 				elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
739 739
 				elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
740 740
 			}
741
-		    }
742
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_previous' => $line['altitude']));
741
+			}
742
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_previous' => $line['altitude']));
743 743
 		}
744 744
 
745 745
 		if (isset($line['noarchive']) && $line['noarchive'] === true) {
746
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('noarchive' => true));
746
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('noarchive' => true));
747 747
 		}
748 748
 		
749 749
 		if (isset($line['heading']) && $line['heading'] != '') {
750
-		    if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 10) $this->all_flights[$id]['putinarchive'] = true;
751
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading'])));
752
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true));
753
-		    //$dataFound = true;
750
+			if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 10) $this->all_flights[$id]['putinarchive'] = true;
751
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading'])));
752
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true));
753
+			//$dataFound = true;
754 754
   		} elseif (!isset($this->all_flights[$id]['heading_fromsrc']) && isset($this->all_flights[$id]['archive_latitude']) && $this->all_flights[$id]['archive_latitude'] != $this->all_flights[$id]['latitude'] && isset($this->all_flights[$id]['archive_longitude']) && $this->all_flights[$id]['archive_longitude'] != $this->all_flights[$id]['longitude']) {
755
-  		    $heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']);
756
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading)));
757
-		    if (abs($this->all_flights[$id]['heading']-round($heading)) > 10) $this->all_flights[$id]['putinarchive'] = true;
758
-  		    if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n";
755
+  			$heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']);
756
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading)));
757
+			if (abs($this->all_flights[$id]['heading']-round($heading)) > 10) $this->all_flights[$id]['putinarchive'] = true;
758
+  			if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n";
759 759
   		} elseif (isset($this->all_flights[$id]['format_source']) && $this->all_flights[$id]['format_source'] == 'ACARS') {
760
-  		    // If not enough messages and ACARS set heading to 0
761
-  		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0));
760
+  			// If not enough messages and ACARS set heading to 0
761
+  			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0));
762 762
   		}
763 763
 		if ($globalDaemon === TRUE && isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false;
764 764
 		elseif ($globalDaemon === TRUE && isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false;
@@ -771,133 +771,133 @@  discard block
 block discarded – undo
771 771
 		//if ($dataFound === true && isset($this->all_flights[$id]['hex']) && $this->all_flights[$id]['heading'] != '' && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') {
772 772
 		//if ($dataFound === true && isset($this->all_flights[$id]['hex'])) {
773 773
 		if ($dataFound === true && isset($this->all_flights[$id]['id'])) {
774
-		    $this->all_flights[$id]['lastupdate'] = time();
775
-		    if ((!isset($globalNoImport) || $globalNoImport === FALSE) && $this->all_flights[$id]['addedSpotter'] == 0) {
776
-		        if (!isset($globalDistanceIgnore['latitude']) || $this->all_flights[$id]['longitude'] == ''  || $this->all_flights[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
777
-			    //print_r($this->all_flights);
778
-			    //echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n";
779
-			    //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']);
780
-			    if (!isset($this->all_flights[$id]['forcenew']) || $this->all_flights[$id]['forcenew'] == 0) {
774
+			$this->all_flights[$id]['lastupdate'] = time();
775
+			if ((!isset($globalNoImport) || $globalNoImport === FALSE) && $this->all_flights[$id]['addedSpotter'] == 0) {
776
+				if (!isset($globalDistanceIgnore['latitude']) || $this->all_flights[$id]['longitude'] == ''  || $this->all_flights[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
777
+				//print_r($this->all_flights);
778
+				//echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n";
779
+				//$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']);
780
+				if (!isset($this->all_flights[$id]['forcenew']) || $this->all_flights[$id]['forcenew'] == 0) {
781 781
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
782
-				    if ($globalDebug) echo "Check if aircraft is already in DB...";
783
-				    $timeelapsed = microtime(true);
784
-				    $SpotterLive = new SpotterLive($this->db);
785
-				    if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) {
782
+					if ($globalDebug) echo "Check if aircraft is already in DB...";
783
+					$timeelapsed = microtime(true);
784
+					$SpotterLive = new SpotterLive($this->db);
785
+					if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) {
786 786
 					$recent_ident = $SpotterLive->checkModeSRecent($this->all_flights[$id]['hex']);
787 787
 					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
788
-				    } elseif (isset($line['id'])) {
788
+					} elseif (isset($line['id'])) {
789 789
 					$recent_ident = $SpotterLive->checkIdRecent($line['id']);
790 790
 					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
791
-				    } elseif (isset($this->all_flights[$id]['ident']) && $this->all_flights[$id]['ident'] != '') {
791
+					} elseif (isset($this->all_flights[$id]['ident']) && $this->all_flights[$id]['ident'] != '') {
792 792
 					$recent_ident = $SpotterLive->checkIdentRecent($this->all_flights[$id]['ident']);
793 793
 					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
794
-				    } else $recent_ident = '';
795
-				    $SpotterLive->db=null;
796
-				    if ($globalDebug && $recent_ident == '') echo " Not in DB.\n";
797
-				    elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n";
794
+					} else $recent_ident = '';
795
+					$SpotterLive->db=null;
796
+					if ($globalDebug && $recent_ident == '') echo " Not in DB.\n";
797
+					elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n";
798 798
 				} else $recent_ident = '';
799
-			    } else {
799
+				} else {
800 800
 				$recent_ident = '';
801 801
 				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 0));
802
-			    }
803
-			    //if there was no aircraft with the same callsign within the last hour and go post it into the archive
804
-			    if($recent_ident == "")
805
-			    {
802
+				}
803
+				//if there was no aircraft with the same callsign within the last hour and go post it into the archive
804
+				if($recent_ident == "")
805
+				{
806 806
 				if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." in archive DB : ";
807 807
 				if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; }
808 808
 				if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; }
809 809
 				//adds the spotter data for the archive
810 810
 				$ignoreImport = false;
811 811
 				foreach($globalAirportIgnore as $airportIgnore) {
812
-				    if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
812
+					if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
813 813
 					$ignoreImport = true;
814
-				    }
814
+					}
815 815
 				}
816 816
 				if (count($globalAirportAccept) > 0) {
817
-				    $ignoreImport = true;
818
-				    foreach($globalAirportIgnore as $airportIgnore) {
817
+					$ignoreImport = true;
818
+					foreach($globalAirportIgnore as $airportIgnore) {
819 819
 					if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
820
-					    $ignoreImport = false;
820
+						$ignoreImport = false;
821
+					}
821 822
 					}
822
-				    }
823 823
 				}
824 824
 				if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) {
825
-				    foreach($globalAirlineIgnore as $airlineIgnore) {
825
+					foreach($globalAirlineIgnore as $airlineIgnore) {
826 826
 					if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) {
827
-					    $ignoreImport = true;
827
+						$ignoreImport = true;
828
+					}
828 829
 					}
829
-				    }
830 830
 				}
831 831
 				if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) {
832
-				    $ignoreImport = true;
833
-				    foreach($globalAirlineAccept as $airlineAccept) {
832
+					$ignoreImport = true;
833
+					foreach($globalAirlineAccept as $airlineAccept) {
834 834
 					if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) {
835
-					    $ignoreImport = false;
835
+						$ignoreImport = false;
836
+					}
836 837
 					}
837
-				    }
838 838
 				}
839 839
 				if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) {
840
-				    $ignoreImport = true;
841
-				    foreach($globalPilotIdAccept as $pilotIdAccept) {
840
+					$ignoreImport = true;
841
+					foreach($globalPilotIdAccept as $pilotIdAccept) {
842 842
 					if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) {
843
-					    $ignoreImport = false;
843
+						$ignoreImport = false;
844
+					}
844 845
 					}
845
-				    }
846 846
 				}
847 847
 				
848 848
 				if (!$ignoreImport) {
849
-				    $highlight = '';
850
-				    if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack';
851
-				    if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)';
852
-				    if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency';
853
-				    if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi')));
854
-				    $timeelapsed = microtime(true);
855
-				    if (!isset($globalNoImport) || $globalNoImport === FALSE) {
849
+					$highlight = '';
850
+					if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack';
851
+					if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)';
852
+					if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency';
853
+					if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi')));
854
+					$timeelapsed = microtime(true);
855
+					if (!isset($globalNoImport) || $globalNoImport === FALSE) {
856 856
 					if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
857
-					    $Spotter = new Spotter($this->db);
858
-					    $result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'],$this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$highlight,$this->all_flights[$id]['hex'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'],$this->all_flights[$id]['verticalrate'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['source_type']);
859
-					    $Spotter->db = null;
860
-					    if ($globalDebug) {
857
+						$Spotter = new Spotter($this->db);
858
+						$result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'],$this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$highlight,$this->all_flights[$id]['hex'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'],$this->all_flights[$id]['verticalrate'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['source_type']);
859
+						$Spotter->db = null;
860
+						if ($globalDebug) {
861 861
 						if (isset($result['error'])) echo 'Error: '.$result['error']."\n";
862 862
 						else echo 'Success';
863
-					    }
864
-					    if (count($result) > 1) {
865
-					    // ':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,
863
+						}
864
+						if (count($result) > 1) {
865
+						// ':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,
866 866
 						if ($this->all_flights[$id]['aircraft_icao'] == '') $this->all_flights[$id]['aircraft_icao'] = $result[':aircraft_icao'];
867 867
 						if ($this->all_flights[$id]['registration'] == '') $this->all_flights[$id]['registration'] = $result[':registration'];
868
-					    }
868
+						}
869 869
 					}
870
-				    }
871
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
872
-				    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
870
+					}
871
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
872
+					if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
873 873
 
874
-				    // Add source stat in DB
875
-				    $Stats = new Stats($this->db);
876
-				    if (!empty($this->stats)) {
874
+					// Add source stat in DB
875
+					$Stats = new Stats($this->db);
876
+					if (!empty($this->stats)) {
877 877
 					if ($globalDebug) echo 'Add source stats : ';
878
-				        foreach($this->stats as $date => $data) {
879
-					    foreach($data as $source => $sourced) {
880
-					        //print_r($sourced);
881
-				    	        if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date);
882
-				    	        if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date);
883
-				    		if (isset($sourced['msg'])) {
884
-				    		    if (time() - $sourced['msg']['date'] > 10) {
885
-				    		        $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date']));
886
-				    		        echo $Stats->addStatSource($nbmsg,$source,'msg',$date);
887
-			    			        unset($this->stats[$date][$source]['msg']);
888
-			    			    }
889
-			    			}
890
-			    		    }
891
-			    		    if ($date != date('Y-m-d')) {
892
-			    			unset($this->stats[$date]);
893
-			    		    }
894
-				    	}
895
-				    	if ($globalDebug) echo 'Done'."\n";
878
+						foreach($this->stats as $date => $data) {
879
+						foreach($data as $source => $sourced) {
880
+							//print_r($sourced);
881
+								if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date);
882
+								if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date);
883
+							if (isset($sourced['msg'])) {
884
+								if (time() - $sourced['msg']['date'] > 10) {
885
+									$nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date']));
886
+									echo $Stats->addStatSource($nbmsg,$source,'msg',$date);
887
+									unset($this->stats[$date][$source]['msg']);
888
+								}
889
+							}
890
+							}
891
+							if ($date != date('Y-m-d')) {
892
+							unset($this->stats[$date]);
893
+							}
894
+						}
895
+						if ($globalDebug) echo 'Done'."\n";
896 896
 
897
-				    }
898
-				    $Stats->db = null;
899
-				    }
900
-				    $this->del();
897
+					}
898
+					$Stats->db = null;
899
+					}
900
+					$this->del();
901 901
 				} elseif ($globalDebug) echo 'Ignore data'."\n";
902 902
 				//$ignoreImport = false;
903 903
 				$this->all_flights[$id]['addedSpotter'] = 1;
@@ -915,41 +915,41 @@  discard block
 block discarded – undo
915 915
 			*/
916 916
 			//SpotterLive->deleteLiveSpotterDataByIdent($this->all_flights[$id]['ident']);
917 917
 				if ($this->last_delete == 0 || time() - $this->last_delete > 1800) {
918
-				    if ($globalDebug) echo "---- Deleting Live Spotter data older than 9 hours...";
919
-				    //SpotterLive->deleteLiveSpotterDataNotUpdated();
920
-				    if (!isset($globalNoImport) || $globalNoImport === FALSE) {
918
+					if ($globalDebug) echo "---- Deleting Live Spotter data older than 9 hours...";
919
+					//SpotterLive->deleteLiveSpotterDataNotUpdated();
920
+					if (!isset($globalNoImport) || $globalNoImport === FALSE) {
921 921
 					if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
922
-					    $SpotterLive = new SpotterLive($this->db);
923
-					    $SpotterLive->deleteLiveSpotterData();
924
-					    $SpotterLive->db=null;
922
+						$SpotterLive = new SpotterLive($this->db);
923
+						$SpotterLive->deleteLiveSpotterData();
924
+						$SpotterLive->db=null;
925 925
 					}
926
-				    }
927
-				    if ($globalDebug) echo " Done\n";
928
-				    $this->last_delete = time();
926
+					}
927
+					if ($globalDebug) echo " Done\n";
928
+					$this->last_delete = time();
929 929
 				}
930
-			    } else {
930
+				} else {
931 931
 				if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt'|| $line['format_source'] === 'planeupdatefaa'  || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'famaprs' || $line['format_source'] === 'airwhere')) {
932
-				    $this->all_flights[$id]['id'] = $recent_ident;
933
-				    $this->all_flights[$id]['addedSpotter'] = 1;
932
+					$this->all_flights[$id]['id'] = $recent_ident;
933
+					$this->all_flights[$id]['addedSpotter'] = 1;
934 934
 				}
935 935
 				if (isset($globalDaemon) && !$globalDaemon) {
936
-				    if (!isset($globalNoImport) || $globalNoImport === FALSE) {
936
+					if (!isset($globalNoImport) || $globalNoImport === FALSE) {
937 937
 					if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
938
-					    $Spotter = new Spotter($this->db);
939
-					    $Spotter->updateLatestSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time']);
940
-					    $Spotter->db = null;
938
+						$Spotter = new Spotter($this->db);
939
+						$Spotter->updateLatestSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time']);
940
+						$Spotter->db = null;
941
+					}
941 942
 					}
942
-				    }
943 943
 				}
944 944
 				
945
-			    }
945
+				}
946 946
 			}
947
-		    }
948
-		    //adds the spotter LIVE data
949
-		    //SpotterLive->addLiveSpotterData($flightaware_id, $ident, $aircraft_type, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed);
950
-		    //echo "\nAdd in Live !! \n";
951
-		    //echo "{$line[8]} {$line[7]} - MODES:{$line[4]}  CALLSIGN:{$line[10]}   ALT:{$line[11]}   VEL:{$line[12]}   HDG:{$line[13]}   LAT:{$line[14]}   LON:{$line[15]}   VR:{$line[16]}   SQUAWK:{$line[17]}\n";
952
-		    if ($globalDebug) {
947
+			}
948
+			//adds the spotter LIVE data
949
+			//SpotterLive->addLiveSpotterData($flightaware_id, $ident, $aircraft_type, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed);
950
+			//echo "\nAdd in Live !! \n";
951
+			//echo "{$line[8]} {$line[7]} - MODES:{$line[4]}  CALLSIGN:{$line[10]}   ALT:{$line[11]}   VEL:{$line[12]}   HDG:{$line[13]}   LAT:{$line[14]}   LON:{$line[15]}   VR:{$line[16]}   SQUAWK:{$line[17]}\n";
952
+			if ($globalDebug) {
953 953
 			if ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM)) {
954 954
 				if (isset($this->all_flights[$id]['source_name'])) echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name'].' - Source name : '.$this->all_flights[$id]['source_name']."\n";
955 955
 				else echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name']."\n";
@@ -957,61 +957,61 @@  discard block
 block discarded – undo
957 957
 				if (isset($this->all_flights[$id]['source_name'])) echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Source Name : '.$this->all_flights[$id]['source_name']."\n";
958 958
 				else echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time']."\n";
959 959
 			}
960
-		    }
961
-		    $ignoreImport = false;
962
-		    if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; }
963
-		    if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; }
960
+			}
961
+			$ignoreImport = false;
962
+			if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; }
963
+			if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; }
964 964
 
965
-		    foreach($globalAirportIgnore as $airportIgnore) {
966
-		        if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
967
-			    $ignoreImport = true;
965
+			foreach($globalAirportIgnore as $airportIgnore) {
966
+				if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
967
+				$ignoreImport = true;
968
+			}
968 969
 			}
969
-		    }
970
-		    if (count($globalAirportAccept) > 0) {
971
-		        $ignoreImport = true;
972
-		        foreach($globalAirportIgnore as $airportIgnore) {
973
-			    if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
970
+			if (count($globalAirportAccept) > 0) {
971
+				$ignoreImport = true;
972
+				foreach($globalAirportIgnore as $airportIgnore) {
973
+				if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
974 974
 				$ignoreImport = false;
975
-			    }
975
+				}
976 976
 			}
977
-		    }
978
-		    if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) {
977
+			}
978
+			if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) {
979 979
 			foreach($globalAirlineIgnore as $airlineIgnore) {
980
-			    if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) {
980
+				if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) {
981 981
 				$ignoreImport = true;
982
-			    }
982
+				}
983 983
 			}
984
-		    }
985
-		    if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) {
984
+			}
985
+			if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) {
986 986
 			$ignoreImport = true;
987 987
 			foreach($globalAirlineAccept as $airlineAccept) {
988
-			    if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) {
988
+				if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) {
989 989
 				$ignoreImport = false;
990
-			    }
990
+				}
991
+			}
991 992
 			}
992
-		    }
993
-		    if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) {
993
+			if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) {
994 994
 			$ignoreImport = true;
995 995
 			foreach($globalPilotIdAccept as $pilotIdAccept) {
996
-			    if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) {
997
-			        $ignoreImport = false;
998
-			    }
996
+				if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) {
997
+					$ignoreImport = false;
998
+				}
999
+			}
999 1000
 			}
1000
-		    }
1001 1001
 
1002
-		    if (!$ignoreImport) {
1002
+			if (!$ignoreImport) {
1003 1003
 			if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
1004 1004
 				if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi')));
1005 1005
 				$timeelapsed = microtime(true);
1006 1006
 				if (!isset($globalNoImport) || $globalNoImport === FALSE) {
1007
-				    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
1007
+					if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
1008 1008
 					if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." from ".$this->all_flights[$id]['format_source']." in Live DB : ";
1009 1009
 					$SpotterLive = new SpotterLive($this->db);
1010 1010
 					//var_dump($this->all_flights[$id]);
1011 1011
 					$result = $SpotterLive->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$this->all_flights[$id]['hex'],$this->all_flights[$id]['putinarchive'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['over_country']);
1012 1012
 					$SpotterLive->db = null;
1013 1013
 					if ($globalDebug) echo $result."\n";
1014
-				    }
1014
+					}
1015 1015
 				}
1016 1016
 				if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_flights[$id]['putinarchive']) {
1017 1017
 					$APRSSpotter->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$this->all_flights[$id]['hex'],$this->all_flights[$id]['putinarchive'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['over_country']);
@@ -1023,7 +1023,7 @@  discard block
 block discarded – undo
1023 1023
 				//if ($line['format_source'] != 'aprs') {
1024 1024
 				//if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt')) {
1025 1025
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
1026
-				    if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') {
1026
+					if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') {
1027 1027
 					$source = $this->all_flights[$id]['source_name'];
1028 1028
 					if ($source == '') $source = $this->all_flights[$id]['format_source'];
1029 1029
 					if (!isset($this->source_location[$source])) {
@@ -1049,7 +1049,7 @@  discard block
 block discarded – undo
1049 1049
 					if ($stats_heading == 16) $stats_heading = 0;
1050 1050
 					if (!isset($this->stats[$current_date][$source]['polar'][1])) {
1051 1051
 						for ($i=0;$i<=15;$i++) {
1052
-						    $this->stats[$current_date][$source]['polar'][$i] = 0;
1052
+							$this->stats[$current_date][$source]['polar'][$i] = 0;
1053 1053
 						}
1054 1054
 						$this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance;
1055 1055
 					} else {
@@ -1062,17 +1062,17 @@  discard block
 block discarded – undo
1062 1062
 					//var_dump($this->stats);
1063 1063
 					if (!isset($this->stats[$current_date][$source]['hist'][$distance])) {
1064 1064
 						if (isset($this->stats[$current_date][$source]['hist'][0])) {
1065
-						    end($this->stats[$current_date][$source]['hist']);
1066
-						    $mini = key($this->stats[$current_date][$source]['hist'])+10;
1065
+							end($this->stats[$current_date][$source]['hist']);
1066
+							$mini = key($this->stats[$current_date][$source]['hist'])+10;
1067 1067
 						} else $mini = 0;
1068 1068
 						for ($i=$mini;$i<=$distance;$i+=10) {
1069
-						    $this->stats[$current_date][$source]['hist'][$i] = 0;
1069
+							$this->stats[$current_date][$source]['hist'][$i] = 0;
1070 1070
 						}
1071 1071
 						$this->stats[$current_date][$source]['hist'][$distance] = 1;
1072 1072
 					} else {
1073 1073
 						$this->stats[$current_date][$source]['hist'][$distance] += 1;
1074 1074
 					}
1075
-				    }
1075
+					}
1076 1076
 				}
1077 1077
 
1078 1078
 				$this->all_flights[$id]['lastupdate'] = time();
@@ -1082,7 +1082,7 @@  discard block
 block discarded – undo
1082 1082
 			//$this->del();
1083 1083
 			
1084 1084
 			if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) {
1085
-			    if ((!isset($globalNoImport) || $globalNoImport === FALSE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) {
1085
+				if ((!isset($globalNoImport) || $globalNoImport === FALSE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) {
1086 1086
 				if ($globalDebug) echo "---- Deleting Live Spotter data Not updated since 2 hour...";
1087 1087
 				$SpotterLive = new SpotterLive($this->db);
1088 1088
 				$SpotterLive->deleteLiveSpotterDataNotUpdated();
@@ -1090,19 +1090,19 @@  discard block
 block discarded – undo
1090 1090
 				//SpotterLive->deleteLiveSpotterData();
1091 1091
 				if ($globalDebug) echo " Done\n";
1092 1092
 				$this->last_delete_hourly = time();
1093
-			    } else {
1093
+				} else {
1094 1094
 				$this->del();
1095 1095
 				$this->last_delete_hourly = time();
1096
-			    }
1096
+				}
1097 1097
 			}
1098 1098
 			
1099
-		    }
1100
-		    //$ignoreImport = false;
1099
+			}
1100
+			//$ignoreImport = false;
1101 1101
 		}
1102 1102
 		//if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN);
1103 1103
 		if ($send) return $this->all_flights[$id];
1104
-	    }
1104
+		}
1105
+	}
1105 1106
 	}
1106
-    }
1107 1107
 }
1108 1108
 ?>
Please login to merge, or discard this patch.
require/class.Image.php 1 patch
Indentation   +127 added lines, -127 removed lines patch added patch discarded remove patch
@@ -22,14 +22,14 @@  discard block
 block discarded – undo
22 22
 		if ($this->db === null) die('Error: No DB connection. (Image)');
23 23
 	}
24 24
 
25
-    /**
26
-     * Gets the images based on the aircraft registration
27
-     *
28
-     * @param $registration
29
-     * @param string $aircraft_icao
30
-     * @param string $airline_icao
31
-     * @return array the images list
32
-     */
25
+	/**
26
+	 * Gets the images based on the aircraft registration
27
+	 *
28
+	 * @param $registration
29
+	 * @param string $aircraft_icao
30
+	 * @param string $airline_icao
31
+	 * @return array the images list
32
+	 */
33 33
 	public function getSpotterImage($registration,$aircraft_icao = '', $airline_icao = '')
34 34
 	{
35 35
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -49,15 +49,15 @@  discard block
 block discarded – undo
49 49
 		else return array();
50 50
 	}
51 51
 
52
-    /**
53
-     * Gets the images based on the ship name
54
-     *
55
-     * @param $mmsi
56
-     * @param string $imo
57
-     * @param string $name
58
-     * @param string $type_name
59
-     * @return array the images list
60
-     */
52
+	/**
53
+	 * Gets the images based on the ship name
54
+	 *
55
+	 * @param $mmsi
56
+	 * @param string $imo
57
+	 * @param string $name
58
+	 * @param string $type_name
59
+	 * @return array the images list
60
+	 */
61 61
 	public function getMarineImage($mmsi,$imo = '',$name = '',$type_name = '')
62 62
 	{
63 63
 		global $globalMarineImagePics;
@@ -94,12 +94,12 @@  discard block
 block discarded – undo
94 94
 		return $result;
95 95
 	}
96 96
 
97
-    /**
98
-     * Gets the image copyright based on the Exif data
99
-     *
100
-     * @param $url
101
-     * @return String image copyright
102
-     */
97
+	/**
98
+	 * Gets the image copyright based on the Exif data
99
+	 *
100
+	 * @param $url
101
+	 * @return String image copyright
102
+	 */
103 103
 	public function getExifCopyright($url) {
104 104
 		$exif = exif_read_data($url);
105 105
 		$copyright = '';
@@ -113,14 +113,14 @@  discard block
 block discarded – undo
113 113
 		return $copyright;
114 114
 	}
115 115
 
116
-    /**
117
-     * Adds the images based on the aircraft registration
118
-     *
119
-     * @param $registration
120
-     * @param string $aircraft_icao
121
-     * @param string $airline_icao
122
-     * @return String either success or error
123
-     */
116
+	/**
117
+	 * Adds the images based on the aircraft registration
118
+	 *
119
+	 * @param $registration
120
+	 * @param string $aircraft_icao
121
+	 * @param string $airline_icao
122
+	 * @return String either success or error
123
+	 */
124 124
 	public function addSpotterImage($registration,$aircraft_icao = '', $airline_icao = '')
125 125
 	{
126 126
 		global $globalDebug,$globalAircraftImageFetch, $globalOffline;
@@ -147,14 +147,14 @@  discard block
 block discarded – undo
147 147
 		return "success";
148 148
 	}
149 149
 
150
-    /**
151
-     * Adds the images based on the marine name
152
-     *
153
-     * @param $mmsi
154
-     * @param string $imo
155
-     * @param string $name
156
-     * @return String either success or error
157
-     */
150
+	/**
151
+	 * Adds the images based on the marine name
152
+	 *
153
+	 * @param $mmsi
154
+	 * @param string $imo
155
+	 * @param string $name
156
+	 * @return String either success or error
157
+	 */
158 158
 	public function addMarineImage($mmsi,$imo = '',$name = '')
159 159
 	{
160 160
 		global $globalDebug,$globalMarineImageFetch, $globalOffline;
@@ -190,14 +190,14 @@  discard block
 block discarded – undo
190 190
 		return "success";
191 191
 	}
192 192
 
193
-    /**
194
-     * Gets the aircraft image
195
-     *
196
-     * @param String $aircraft_registration the registration of the aircraft
197
-     * @param string $aircraft_icao
198
-     * @param string $airline_icao
199
-     * @return array the aircraft thumbnail, orignal url and copyright
200
-     */
193
+	/**
194
+	 * Gets the aircraft image
195
+	 *
196
+	 * @param String $aircraft_registration the registration of the aircraft
197
+	 * @param string $aircraft_icao
198
+	 * @param string $airline_icao
199
+	 * @return array the aircraft thumbnail, orignal url and copyright
200
+	 */
201 201
 	public function findAircraftImage($aircraft_registration, $aircraft_icao = '', $airline_icao = '')
202 202
 	{
203 203
 		global $globalAircraftImageSources, $globalIVAO, $globalAircraftImageCheckICAO, $globalVA;
@@ -241,14 +241,14 @@  discard block
 block discarded – undo
241 241
 	}
242 242
 
243 243
 	/**
244
-	* Gets the vessel image
245
-	*
246
-	* @param String $mmsi the vessel mmsi
247
-	* @param String $imo the vessel imo
248
-	* @param String $name the vessel name
249
-	* @return array the aircraft thumbnail, orignal url and copyright
250
-	*
251
-	*/
244
+	 * Gets the vessel image
245
+	 *
246
+	 * @param String $mmsi the vessel mmsi
247
+	 * @param String $imo the vessel imo
248
+	 * @param String $name the vessel name
249
+	 * @return array the aircraft thumbnail, orignal url and copyright
250
+	 *
251
+	 */
252 252
 	public function findMarineImage($mmsi,$imo = '',$name = '')
253 253
 	{
254 254
 		global $globalMarineImageSources;
@@ -282,13 +282,13 @@  discard block
 block discarded – undo
282 282
 	}
283 283
 
284 284
 	/**
285
-	* Gets the aircraft image from Planespotters
286
-	*
287
-	* @param String $aircraft_registration the registration of the aircraft
288
-	* @param String $aircraft_name type of the aircraft
289
-	* @return array the aircraft thumbnail, orignal url and copyright
290
-	*
291
-	*/
285
+	 * Gets the aircraft image from Planespotters
286
+	 *
287
+	 * @param String $aircraft_registration the registration of the aircraft
288
+	 * @param String $aircraft_name type of the aircraft
289
+	 * @return array the aircraft thumbnail, orignal url and copyright
290
+	 *
291
+	 */
292 292
 	public function fromPlanespotters($type,$aircraft_registration, $aircraft_name='') {
293 293
 		$Common = new Common();
294 294
 		// If aircraft registration is only number, also check with aircraft model
@@ -315,14 +315,14 @@  discard block
 block discarded – undo
315 315
 		return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => '');
316 316
 	}
317 317
 
318
-    /**
319
-     * Gets the aircraft image from Deviantart
320
-     *
321
-     * @param $type
322
-     * @param String $registration the registration of the aircraft
323
-     * @param String $name type of the aircraft
324
-     * @return array the aircraft thumbnail, orignal url and copyright
325
-     */
318
+	/**
319
+	 * Gets the aircraft image from Deviantart
320
+	 *
321
+	 * @param $type
322
+	 * @param String $registration the registration of the aircraft
323
+	 * @param String $name type of the aircraft
324
+	 * @return array the aircraft thumbnail, orignal url and copyright
325
+	 */
326 326
 	public function fromDeviantart($type,$registration, $name='') {
327 327
 		$Common = new Common();
328 328
 		if ($type == 'aircraft') {
@@ -356,13 +356,13 @@  discard block
 block discarded – undo
356 356
 	}
357 357
 
358 358
 	/**
359
-	* Gets the aircraft image from JetPhotos
360
-	*
361
-	* @param String $aircraft_registration the registration of the aircraft
362
-	* @param String $aircraft_name type of the aircraft
363
-	* @return array the aircraft thumbnail, orignal url and copyright
364
-	*
365
-	*/
359
+	 * Gets the aircraft image from JetPhotos
360
+	 *
361
+	 * @param String $aircraft_registration the registration of the aircraft
362
+	 * @param String $aircraft_name type of the aircraft
363
+	 * @return array the aircraft thumbnail, orignal url and copyright
364
+	 *
365
+	 */
366 366
 	public function fromJetPhotos($type,$aircraft_registration, $aircraft_name='') {
367 367
 		$Common = new Common();
368 368
 		$url= 'http://jetphotos.net/showphotos.php?displaymode=2&regsearch='.$aircraft_registration;
@@ -398,13 +398,13 @@  discard block
 block discarded – undo
398 398
 	}
399 399
 
400 400
 	/**
401
-	* Gets the aircraft image from PlanePictures
402
-	*
403
-	* @param String $aircraft_registration the registration of the aircraft
404
-	* @param String $aircraft_name type of the aircraft
405
-	* @return array the aircraft thumbnail, orignal url and copyright
406
-	*
407
-	*/
401
+	 * Gets the aircraft image from PlanePictures
402
+	 *
403
+	 * @param String $aircraft_registration the registration of the aircraft
404
+	 * @param String $aircraft_name type of the aircraft
405
+	 * @return array the aircraft thumbnail, orignal url and copyright
406
+	 *
407
+	 */
408 408
 	public function fromPlanePictures($type,$aircraft_registration, $aircraft_name='') {
409 409
 		$Common = new Common();
410 410
 		$url= 'http://www.planepictures.net/netsearch4.cgi?srch='.$aircraft_registration.'&stype=reg&srng=2';
@@ -432,13 +432,13 @@  discard block
 block discarded – undo
432 432
 	}
433 433
 
434 434
 	/**
435
-	* Gets the aircraft image from Flickr
436
-	*
437
-	* @param String $registration the registration of the aircraft
438
-	* @param String $name type of the aircraft
439
-	* @return array the aircraft thumbnail, orignal url and copyright
440
-	*
441
-	*/
435
+	 * Gets the aircraft image from Flickr
436
+	 *
437
+	 * @param String $registration the registration of the aircraft
438
+	 * @param String $name type of the aircraft
439
+	 * @return array the aircraft thumbnail, orignal url and copyright
440
+	 *
441
+	 */
442 442
 	public function fromFlickr($type,$registration,$name='') {
443 443
 		$Common = new Common();
444 444
 		if ($type == 'aircraft') {
@@ -465,13 +465,13 @@  discard block
 block discarded – undo
465 465
 		return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => '');
466 466
 	}
467 467
 
468
-    /**
469
-     * @param $type
470
-     * @param $aircraft_icao
471
-     * @param $airline_icao
472
-     * @return array
473
-     */
474
-    public function fromIvaoMtl($type, $aircraft_icao, $airline_icao) {
468
+	/**
469
+	 * @param $type
470
+	 * @param $aircraft_icao
471
+	 * @param $airline_icao
472
+	 * @return array
473
+	 */
474
+	public function fromIvaoMtl($type, $aircraft_icao, $airline_icao) {
475 475
 		$Common = new Common();
476 476
 		//echo "\n".'SEARCH IMAGE : http://mtlcatalog.ivao.aero/images/aircraft/'.$aircraft_icao.$airline_icao.'.jpg';
477 477
 		if ($Common->urlexist('http://mtlcatalog.ivao.aero/images/aircraft/'.$aircraft_icao.$airline_icao.'.jpg')) {
@@ -487,14 +487,14 @@  discard block
 block discarded – undo
487 487
 		}
488 488
 	}
489 489
 
490
-    /**
491
-     * Gets the aircraft image from Bing
492
-     *
493
-     * @param $type
494
-     * @param String $aircraft_registration the registration of the aircraft
495
-     * @param String $aircraft_name type of the aircraft
496
-     * @return array the aircraft thumbnail, orignal url and copyright
497
-     */
490
+	/**
491
+	 * Gets the aircraft image from Bing
492
+	 *
493
+	 * @param $type
494
+	 * @param String $aircraft_registration the registration of the aircraft
495
+	 * @param String $aircraft_name type of the aircraft
496
+	 * @return array the aircraft thumbnail, orignal url and copyright
497
+	 */
498 498
 	public function fromBing($type,$aircraft_registration,$aircraft_name='') {
499 499
 		global $globalImageBingKey;
500 500
 		$Common = new Common();
@@ -525,13 +525,13 @@  discard block
 block discarded – undo
525 525
 	}
526 526
 
527 527
 	/**
528
-	* Gets the aircraft image from airport-data
529
-	*
530
-	* @param String $aircraft_registration the registration of the aircraft
531
-	* @param String $aircraft_name type of the aircraft
532
-	* @return array the aircraft thumbnail, orignal url and copyright
533
-	*
534
-	*/
528
+	 * Gets the aircraft image from airport-data
529
+	 *
530
+	 * @param String $aircraft_registration the registration of the aircraft
531
+	 * @param String $aircraft_name type of the aircraft
532
+	 * @return array the aircraft thumbnail, orignal url and copyright
533
+	 *
534
+	 */
535 535
 	public function fromAirportData($type,$aircraft_registration,$aircraft_name='') {
536 536
 		$Common = new Common();
537 537
 		$url = 'http://www.airport-data.com/api/ac_thumb.json?&n=1&r='.$aircraft_registration;
@@ -550,13 +550,13 @@  discard block
 block discarded – undo
550 550
 	}
551 551
 
552 552
 	/**
553
-	* Gets image from WikiMedia
554
-	*
555
-	* @param String $registration the registration of the aircraft/mmsi
556
-	* @param String $name name
557
-	* @return array the aircraft thumbnail, orignal url and copyright
558
-	*
559
-	*/
553
+	 * Gets image from WikiMedia
554
+	 *
555
+	 * @param String $registration the registration of the aircraft/mmsi
556
+	 * @param String $name name
557
+	 * @return array the aircraft thumbnail, orignal url and copyright
558
+	 *
559
+	 */
560 560
 	public function fromWikimedia($type,$registration,$name='') {
561 561
 		$Common = new Common();
562 562
 		if ($type == 'aircraft') {
@@ -611,13 +611,13 @@  discard block
 block discarded – undo
611 611
 	}
612 612
 
613 613
 	/**
614
-	* Gets the aircraft image from custom url
615
-	*
616
-	* @param String $registration the registration of the aircraft
617
-	* @param String $name type of the aircraft
618
-	* @return array the aircraft thumbnail, orignal url and copyright
619
-	*
620
-	*/
614
+	 * Gets the aircraft image from custom url
615
+	 *
616
+	 * @param String $registration the registration of the aircraft
617
+	 * @param String $name type of the aircraft
618
+	 * @return array the aircraft thumbnail, orignal url and copyright
619
+	 *
620
+	 */
621 621
 	public function fromCustomSource($type,$registration,$name='') {
622 622
 		global $globalAircraftImageCustomSources, $globalMarineImageCustomSources, $globalDebug;
623 623
 		//$globalAircraftImageCustomSource[] = array('thumbnail' => '','original' => '', 'copyright' => '', 'source_website' => '', 'source' => '','exif' => true);
Please login to merge, or discard this patch.