Completed
Push — master ( e14a40...cfb98e )
by Yannick
54:46 queued 27:34
created
require/class.APRS.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -176,8 +176,8 @@
 block discarded – undo
176 176
 
177 177
 	private function urshift($n, $s) {
178 178
 		return ($n >= 0) ? ($n >> $s) :
179
-		    (($n & 0x7fffffff) >> $s) | 
180
-		    (0x40000000 >> ($s - 1));
179
+			(($n & 0x7fffffff) >> $s) | 
180
+			(0x40000000 >> ($s - 1));
181 181
 	}
182 182
 
183 183
 	/*
Please login to merge, or discard this patch.
require/class.ACARS.php 1 patch
Indentation   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -32,11 +32,11 @@  discard block
 block discarded – undo
32 32
 	}
33 33
 
34 34
 	/**
35
-	* Change IATA to ICAO value for ident
36
-	*
37
-	* @param String $ident ident
38
-	* @return String the icao
39
-	*/
35
+	 * Change IATA to ICAO value for ident
36
+	 *
37
+	 * @param String $ident ident
38
+	 * @return String the icao
39
+	 */
40 40
 	public function ident2icao($ident) {
41 41
 		if (substr($ident,0,2) == 'AF') {
42 42
 			if (filter_var(substr($ident,2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $ident;
@@ -52,11 +52,11 @@  discard block
 block discarded – undo
52 52
 	}
53 53
 
54 54
 	/**
55
-	* Deletes all info in the live table
56
-	*
57
-	* @return String success or false
58
-	*
59
-	*/
55
+	 * Deletes all info in the live table
56
+	 *
57
+	 * @return String success or false
58
+	 *
59
+	 */
60 60
 	public function deleteLiveAcarsData()
61 61
 	{
62 62
 		global $globalDBdriver;
@@ -76,11 +76,11 @@  discard block
 block discarded – undo
76 76
 	}
77 77
 
78 78
 	/**
79
-	* Deletes all info in the archive table
80
-	*
81
-	* @return String success or false
82
-	*
83
-	*/
79
+	 * Deletes all info in the archive table
80
+	 *
81
+	 * @return String success or false
82
+	 *
83
+	 */
84 84
 	public function deleteArchiveAcarsData()
85 85
 	{
86 86
 		global $globalACARSArchiveKeepMonths, $globalDBdriver;
@@ -101,11 +101,11 @@  discard block
 block discarded – undo
101 101
 
102 102
 
103 103
 	/**
104
-	* Parse ACARS data
105
-	*
106
-	* @param String ACARS data in acarsdec data
107
-	*
108
-	*/
104
+	 * Parse ACARS data
105
+	 *
106
+	 * @param String ACARS data in acarsdec data
107
+	 *
108
+	 */
109 109
 	public function parse($data) {
110 110
 		global $globalDebug, $globalACARSArchive;
111 111
 		//$Image = new Image($this->db);
@@ -735,11 +735,11 @@  discard block
 block discarded – undo
735 735
 	}
736 736
 
737 737
 	/**
738
-	* Add ACARS data
739
-	*
740
-	* @param String ACARS data in acarsdec data
741
-	*
742
-	*/
738
+	 * Add ACARS data
739
+	 *
740
+	 * @param String ACARS data in acarsdec data
741
+	 *
742
+	 */
743 743
 	function add($data) {
744 744
 		global $globalDebug, $globalACARSArchive;
745 745
 		$Image = new Image($this->db);
@@ -786,15 +786,15 @@  discard block
 block discarded – undo
786 786
 	}
787 787
 
788 788
 	/**
789
-	* Add Live ACARS data in DB
790
-	*
791
-	* @param String $ident ident
792
-	* @param String $registration Registration of the aircraft
793
-	* @param String $label Label of the ACARS message
794
-	* @param String $block_id Block id of the ACARS message
795
-	* @param String $msg_no Number of the ACARS message
796
-	* @param String $message ACARS message
797
-	*/
789
+	 * Add Live ACARS data in DB
790
+	 *
791
+	 * @param String $ident ident
792
+	 * @param String $registration Registration of the aircraft
793
+	 * @param String $label Label of the ACARS message
794
+	 * @param String $block_id Block id of the ACARS message
795
+	 * @param String $msg_no Number of the ACARS message
796
+	 * @param String $message ACARS message
797
+	 */
798 798
 	public function addLiveAcarsData($ident,$registration,$label,$block_id,$msg_no,$message,$decode = '') {
799 799
 		global $globalDebug;
800 800
 		date_default_timezone_set('UTC');
@@ -830,15 +830,15 @@  discard block
 block discarded – undo
830 830
 	}
831 831
 
832 832
 	/**
833
-	* Add Archive ACARS data in DB
834
-	*
835
-	* @param String $ident ident
836
-	* @param String $registration Registration of the aircraft
837
-	* @param String $label Label of the ACARS message
838
-	* @param String $block_id Block id of the ACARS message
839
-	* @param String $msg_no Number of the ACARS message
840
-	* @param String $message ACARS message
841
-	*/
833
+	 * Add Archive ACARS data in DB
834
+	 *
835
+	 * @param String $ident ident
836
+	 * @param String $registration Registration of the aircraft
837
+	 * @param String $label Label of the ACARS message
838
+	 * @param String $block_id Block id of the ACARS message
839
+	 * @param String $msg_no Number of the ACARS message
840
+	 * @param String $message ACARS message
841
+	 */
842 842
 	public function addArchiveAcarsData($ident,$registration,$label,$block_id,$msg_no,$message,$decode = '') {
843 843
 		global $globalDebug;
844 844
 		date_default_timezone_set('UTC');
@@ -869,11 +869,11 @@  discard block
 block discarded – undo
869 869
 	}
870 870
 
871 871
 	/**
872
-	* Get Message title from label from DB
873
-	*
874
-	* @param String $label
875
-	* @return String Return ACARS title
876
-	*/
872
+	 * Get Message title from label from DB
873
+	 *
874
+	 * @param String $label
875
+	 * @return String Return ACARS title
876
+	 */
877 877
 	public function getTitlefromLabel($label) {
878 878
 		$Connection = new Connection($this->db);
879 879
 		$this->db = $Connection->db;
@@ -892,10 +892,10 @@  discard block
 block discarded – undo
892 892
 	}
893 893
 
894 894
 	/**
895
-	* List all Message title & label from DB
896
-	*
897
-	* @return Array Return ACARS data in array
898
-	*/
895
+	 * List all Message title & label from DB
896
+	 *
897
+	 * @return Array Return ACARS data in array
898
+	 */
899 899
 	public function getAllTitleLabel() {
900 900
 		$query = "SELECT * FROM acars_label ORDER BY title";
901 901
 		$query_values = array();
@@ -912,11 +912,11 @@  discard block
 block discarded – undo
912 912
 	}
913 913
 
914 914
 	/**
915
-	* Get Live ACARS data from DB
916
-	*
917
-	* @param String $ident
918
-	* @return Array Return ACARS data in array
919
-	*/
915
+	 * Get Live ACARS data from DB
916
+	 *
917
+	 * @param String $ident
918
+	 * @return Array Return ACARS data in array
919
+	 */
920 920
 	public function getLiveAcarsData($ident) {
921 921
 		$query = "SELECT * FROM acars_live WHERE ident = :ident ORDER BY acars_live_id DESC";
922 922
 		$query_values = array(':ident' => $ident);
@@ -933,10 +933,10 @@  discard block
 block discarded – undo
933 933
 	}
934 934
 
935 935
 	/**
936
-	* Get Latest ACARS data from DB
937
-	*
938
-	* @return Array Return ACARS data in array
939
-	*/
936
+	 * Get Latest ACARS data from DB
937
+	 *
938
+	 * @return Array Return ACARS data in array
939
+	 */
940 940
 	public function getLatestAcarsData($limit = '',$label = '') {
941 941
 		global $globalURL, $globalDBdriver;
942 942
 		$Image = new Image($this->db);
@@ -1024,10 +1024,10 @@  discard block
 block discarded – undo
1024 1024
 	}
1025 1025
 
1026 1026
 	/**
1027
-	* Get Archive ACARS data from DB
1028
-	*
1029
-	* @return Array Return ACARS data in array
1030
-	*/
1027
+	 * Get Archive ACARS data from DB
1028
+	 *
1029
+	 * @return Array Return ACARS data in array
1030
+	 */
1031 1031
 	public function getArchiveAcarsData($limit = '',$label = '') {
1032 1032
 		global $globalURL, $globalDBdriver;
1033 1033
 		$Image = new Image($this->db);
@@ -1115,13 +1115,13 @@  discard block
 block discarded – undo
1115 1115
 	}
1116 1116
 
1117 1117
 	/**
1118
-	* Add ModeS data to DB
1119
-	*
1120
-	* @param String $ident ident
1121
-	* @param String $registration Registration of the aircraft
1122
-	* @param String $icao
1123
-	* @param String $ICAOTypeCode
1124
-	*/
1118
+	 * Add ModeS data to DB
1119
+	 *
1120
+	 * @param String $ident ident
1121
+	 * @param String $registration Registration of the aircraft
1122
+	 * @param String $icao
1123
+	 * @param String $ICAOTypeCode
1124
+	 */
1125 1125
 	public function addModeSData($ident,$registration,$icao = '',$ICAOTypeCode = '',$latitude = '', $longitude = '') {
1126 1126
 		global $globalDebug, $globalDBdriver;
1127 1127
 		$ident = trim($ident);
Please login to merge, or discard this patch.
require/class.Translation.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -25,11 +25,11 @@
 block discarded – undo
25 25
 	}
26 26
 
27 27
 	/**
28
-	* Change IATA to ICAO value for ident
29
-	* 
30
-	* @param String $ident ident
31
-	* @return String the icao
32
-	*/
28
+	 * Change IATA to ICAO value for ident
29
+	 * 
30
+	 * @param String $ident ident
31
+	 * @return String the icao
32
+	 */
33 33
 	public function ident2icao($ident) {
34 34
 		$Spotter = new Spotter();
35 35
 		if (!is_numeric(substr($ident, 0, 3))) {
Please login to merge, or discard this patch.
require/class.Scheduler.php 1 patch
Indentation   +146 added lines, -146 removed lines patch added patch discarded remove patch
@@ -27,14 +27,14 @@  discard block
 block discarded – undo
27 27
 	}
28 28
 
29 29
 	/**
30
-	* Add schedule data to database
31
-	* @param String $ident aircraft ident
32
-	* @param String $departure_airport_icao departure airport icao
33
-	* @param String $departure_airport_time departure airport time
34
-	* @param String $arrival_airport_icao arrival airport icao
35
-	* @param String $arrival_airport_time arrival airport time
30
+	 * Add schedule data to database
31
+	 * @param String $ident aircraft ident
32
+	 * @param String $departure_airport_icao departure airport icao
33
+	 * @param String $departure_airport_time departure airport time
34
+	 * @param String $arrival_airport_icao arrival airport icao
35
+	 * @param String $arrival_airport_time arrival airport time
36 36
 	/ @param String $source source of data
37
-	*/
37
+	 */
38 38
 	public function addSchedule($ident,$departure_airport_icao,$departure_airport_time,$arrival_airport_icao,$arrival_airport_time,$source = 'website') {
39 39
 		date_default_timezone_set('UTC');
40 40
 		$date = date("Y-m-d H:i:s",time());
@@ -50,18 +50,18 @@  discard block
 block discarded – undo
50 50
 		}
51 51
 		if ($sth->fetchColumn() > 0) {
52 52
 			if ($departure_airport_time == '' && $arrival_airport_time == '') {
53
-			    $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND ToAirport_ICAO = :arrival_airport_icao";
54
-			    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao);
53
+				$query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND ToAirport_ICAO = :arrival_airport_icao";
54
+				$query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao);
55 55
 			} elseif ($arrival_airport_time == '') {
56
-			    $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND FromAirport_Time = :departure_airport_time AND ToAirport_ICAO = :arrival_airport_icao";
57
-			    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao);
56
+				$query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND FromAirport_Time = :departure_airport_time AND ToAirport_ICAO = :arrival_airport_icao";
57
+				$query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao);
58 58
 			} elseif ($departure_airport_time == '') {
59
-			    $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND ToAirport_ICAO = :arrival_airport_icao AND ToAirport_Time = :arrival_airport_time";
60
-			    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time);
59
+				$query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND ToAirport_ICAO = :arrival_airport_icao AND ToAirport_Time = :arrival_airport_time";
60
+				$query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time);
61 61
 			} else {
62
-			    //$query = "SELECT COUNT(*) FROM schedule WHERE ident = :ident AND departure_airport_icao = :departure_airport_icao AND departure_airport_time = :departure_airport_time AND arrival_airport_icao = :arrival_airport_icao AND arrival_airport_time = :arrival_airport_time";
63
-			    $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND FromAirport_Time = :departure_airport_time AND ToAirport_ICAO = :arrival_airport_icao AND ToAirport_Time = :arrival_airport_time";
64
-			    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time);
62
+				//$query = "SELECT COUNT(*) FROM schedule WHERE ident = :ident AND departure_airport_icao = :departure_airport_icao AND departure_airport_time = :departure_airport_time AND arrival_airport_icao = :arrival_airport_icao AND arrival_airport_time = :arrival_airport_time";
63
+				$query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND FromAirport_Time = :departure_airport_time AND ToAirport_ICAO = :arrival_airport_icao AND ToAirport_Time = :arrival_airport_time";
64
+				$query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time);
65 65
 			}
66 66
 			try {
67 67
 				$sth = $this->db->prepare($query);
@@ -148,15 +148,15 @@  discard block
 block discarded – undo
148 148
 	*/
149 149
 	public function checkSchedule($ident) {
150 150
 		global $globalDBdriver;
151
-	        //$query = "SELECT COUNT(*) as nb FROM schedule WHERE ident = :ident AND date_added > DATE_SUB(CURDATE(), INTERVAL 8 DAY) - 8 LIMIT 1";
152
-	        if ($globalDBdriver == 'mysql') {
151
+			//$query = "SELECT COUNT(*) as nb FROM schedule WHERE ident = :ident AND date_added > DATE_SUB(CURDATE(), INTERVAL 8 DAY) - 8 LIMIT 1";
152
+			if ($globalDBdriver == 'mysql') {
153 153
 			$query = "SELECT COUNT(*) as nb FROM routes WHERE FromAirport_ICAO <> '' AND ToAirport_ICAO <> '' AND CallSign = :ident AND ((date_added BETWEEN DATE(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND DATE(NOW()) and date_modified IS NULL) OR (date_modified BETWEEN DATE(DATE_SUB(CURDATE(), INTERVAL 15 DAY)) AND DATE(NOW()))) LIMIT 1";
154 154
 		} else {
155 155
 			$query = "SELECT COUNT(*) as nb FROM routes WHERE FromAirport_ICAO <> '' AND ToAirport_ICAO <> '' AND CallSign = :ident 
156 156
 			AND ((date_added::timestamp BETWEEN CURRENT_TIMESTAMP - INTERVAL '1 MONTH' AND CURRENT_TIMESTAMP) and date_modified::timestamp IS NULL)
157 157
 			     OR (date_modified::timestamp BETWEEN CURRENT_TIMESTAMP - INTERVAL '1 MONTH' AND CURRENT_TIMESTAMP) LIMIT 1";
158 158
 		}
159
-	        $query_values = array(':ident' => $ident);
159
+			$query_values = array(':ident' => $ident);
160 160
 		 try {
161 161
 			$sth = $this->db->prepare($query);
162 162
 			$sth->execute($query_values);
@@ -169,12 +169,12 @@  discard block
 block discarded – undo
169 169
 	}
170 170
 
171 171
 	/**
172
-	* Get flight info from Air France
173
-	* @param String $callsign The callsign
174
-	* @param String $date date we want flight number info
175
-	* @param String $carrier IATA code
176
-	* @return Flight departure and arrival airports and time
177
-	*/
172
+	 * Get flight info from Air France
173
+	 * @param String $callsign The callsign
174
+	 * @param String $date date we want flight number info
175
+	 * @param String $carrier IATA code
176
+	 * @return Flight departure and arrival airports and time
177
+	 */
178 178
 	private function getAirFrance($callsign, $date = 'NOW',$carrier = 'AF') {
179 179
 		$Common = new Common();
180 180
 		$check_date = new Datetime($date);
@@ -210,11 +210,11 @@  discard block
 block discarded – undo
210 210
 	}
211 211
 
212 212
 	/**
213
-	* Get flight info from EasyJet
214
-	* @param String $callsign The callsign
215
-	* @param String $date date we want flight number info
216
-	* @return Flight departure and arrival airports and time
217
-	*/
213
+	 * Get flight info from EasyJet
214
+	 * @param String $callsign The callsign
215
+	 * @param String $date date we want flight number info
216
+	 * @return Flight departure and arrival airports and time
217
+	 */
218 218
 	private function getEasyJet($callsign, $date = 'NOW') {
219 219
 		global $globalTimezone;
220 220
 		$Common = new Common();
@@ -238,10 +238,10 @@  discard block
 block discarded – undo
238 238
 	}
239 239
 
240 240
 	/**
241
-	* Get flight info from Ryanair
242
-	* @param String $callsign The callsign
243
-	* @return Flight departure and arrival airports and time
244
-	*/
241
+	 * Get flight info from Ryanair
242
+	 * @param String $callsign The callsign
243
+	 * @return Flight departure and arrival airports and time
244
+	 */
245 245
 	private function getRyanair($callsign) {
246 246
 		$Common = new Common();
247 247
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -264,10 +264,10 @@  discard block
 block discarded – undo
264 264
 	}
265 265
 
266 266
 	/**
267
-	* Get flight info from Swiss
268
-	* @param String $callsign The callsign
269
-	* @return Flight departure and arrival airports and time
270
-	*/
267
+	 * Get flight info from Swiss
268
+	 * @param String $callsign The callsign
269
+	 * @return Flight departure and arrival airports and time
270
+	 */
271 271
 	private function getSwiss($callsign) {
272 272
 		$Common = new Common();
273 273
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -296,11 +296,11 @@  discard block
 block discarded – undo
296 296
 	}
297 297
 	
298 298
 	/**
299
-	* Get flight info from British Airways API
300
-	* @param String $callsign The callsign
301
-	* @param String $date date we want flight number info
302
-	* @return Flight departure and arrival airports and time
303
-	*/
299
+	 * Get flight info from British Airways API
300
+	 * @param String $callsign The callsign
301
+	 * @param String $date date we want flight number info
302
+	 * @return Flight departure and arrival airports and time
303
+	 */
304 304
 	public function getBritishAirways($callsign, $date = 'NOW') {
305 305
 		global $globalBritishAirwaysKey;
306 306
 		$Common = new Common();
@@ -324,11 +324,11 @@  discard block
 block discarded – undo
324 324
 	}
325 325
 
326 326
 	/**
327
-	* Get flight info from Lutfhansa API
328
-	* @param String $callsign The callsign
329
-	* @param String $date date we want flight number info
330
-	* @return Flight departure and arrival airports and time
331
-	*/
327
+	 * Get flight info from Lutfhansa API
328
+	 * @param String $callsign The callsign
329
+	 * @param String $date date we want flight number info
330
+	 * @return Flight departure and arrival airports and time
331
+	 */
332 332
 	public function getLufthansa($callsign, $date = 'NOW') {
333 333
 		global $globalLufthansaKey;
334 334
 		$Common = new Common();
@@ -358,11 +358,11 @@  discard block
 block discarded – undo
358 358
 	}
359 359
 
360 360
 	/**
361
-	* Get flight info from Transavia API
362
-	* @param String $callsign The callsign
363
-	* @param String $date date we want flight number info
364
-	* @return Flight departure and arrival airports and time
365
-	*/
361
+	 * Get flight info from Transavia API
362
+	 * @param String $callsign The callsign
363
+	 * @param String $date date we want flight number info
364
+	 * @return Flight departure and arrival airports and time
365
+	 */
366 366
 	public function getTransavia($callsign, $date = 'NOW') {
367 367
 		global $globalTransaviaKey;
368 368
 		$Common = new Common();
@@ -388,10 +388,10 @@  discard block
 block discarded – undo
388 388
 	}
389 389
 
390 390
 	/**
391
-	* Get flight info from Tunisair
392
-	* @param String $callsign The callsign
393
-	* @return Flight departure and arrival airports and time
394
-	*/
391
+	 * Get flight info from Tunisair
392
+	 * @param String $callsign The callsign
393
+	 * @return Flight departure and arrival airports and time
394
+	 */
395 395
 	public function getTunisair($callsign) {
396 396
 		$Common = new Common();
397 397
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -408,10 +408,10 @@  discard block
 block discarded – undo
408 408
 	}
409 409
 
410 410
 	/**
411
-	* Get flight info from Vueling
412
-	* @param String $callsign The callsign
413
-	* @return Flight departure and arrival airports and time
414
-	*/
411
+	 * Get flight info from Vueling
412
+	 * @param String $callsign The callsign
413
+	 * @return Flight departure and arrival airports and time
414
+	 */
415 415
 	public function getVueling($callsign,$date = 'NOW') {
416 416
 		$Common = new Common();
417 417
 		$check_date = new Datetime($date);
@@ -433,11 +433,11 @@  discard block
 block discarded – undo
433 433
 	}
434 434
 
435 435
 	/**
436
-	* Get flight info from Iberia
437
-	* @param String $callsign The callsign
438
-	* @param String $date date we want flight number info
439
-	* @return Flight departure and arrival airports and time
440
-	*/
436
+	 * Get flight info from Iberia
437
+	 * @param String $callsign The callsign
438
+	 * @param String $date date we want flight number info
439
+	 * @return Flight departure and arrival airports and time
440
+	 */
441 441
 	public function getIberia($callsign, $date = 'NOW') {
442 442
 		$Common = new Common();
443 443
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -467,11 +467,11 @@  discard block
 block discarded – undo
467 467
 	}
468 468
 
469 469
 	/**
470
-	* Get flight info from Star Alliance
471
-	* @param String $callsign The callsign
472
-	* @param String $date date we want flight number info
473
-	* @return Flight departure and arrival airports and time
474
-	*/
470
+	 * Get flight info from Star Alliance
471
+	 * @param String $callsign The callsign
472
+	 * @param String $date date we want flight number info
473
+	 * @return Flight departure and arrival airports and time
474
+	 */
475 475
 
476 476
 	private function getStarAlliance($callsign, $date = 'NOW',$carrier = '') {
477 477
 		$Common = new Common();
@@ -503,11 +503,11 @@  discard block
 block discarded – undo
503 503
 
504 504
 
505 505
 	/**
506
-	* Get flight info from Alitalia
507
-	* @param String $callsign The callsign
508
-	* @param String $date date we want flight number info
509
-	* @return Flight departure and arrival airports and time
510
-	*/
506
+	 * Get flight info from Alitalia
507
+	 * @param String $callsign The callsign
508
+	 * @param String $date date we want flight number info
509
+	 * @return Flight departure and arrival airports and time
510
+	 */
511 511
 	private function getAlitalia($callsign, $date = 'NOW') {
512 512
 		$Common = new Common();
513 513
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -526,11 +526,11 @@  discard block
 block discarded – undo
526 526
 	}
527 527
 
528 528
 	/**
529
-	* Get flight info from Brussels airlines
530
-	* @param String $callsign The callsign
531
-	* @param String $date date we want flight number info
532
-	* @return Flight departure and arrival airports and time
533
-	*/
529
+	 * Get flight info from Brussels airlines
530
+	 * @param String $callsign The callsign
531
+	 * @param String $date date we want flight number info
532
+	 * @return Flight departure and arrival airports and time
533
+	 */
534 534
 	private function getBrussels($callsign, $date = 'NOW') {
535 535
 		$Common = new Common();
536 536
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -540,24 +540,24 @@  discard block
 block discarded – undo
540 540
 		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
541 541
 		$data = $Common->getData($url);
542 542
 		if ($data != '') {
543
-		    //echo $data;
544
-		    $parsed_json = json_decode($data,true);
545
-		    if (isset($parsed_json[0]['FromAirportCode'])) {
543
+			//echo $data;
544
+			$parsed_json = json_decode($data,true);
545
+			if (isset($parsed_json[0]['FromAirportCode'])) {
546 546
 			$DepartureAirportIata = $parsed_json[0]['FromAirportCode'];
547 547
 			$ArrivalAirportIata = $parsed_json[0]['ToAirportCode'];
548 548
 			$departureTime = date('H:i',strtotime($parsed_json[0]['ScheduledDepatureDate']));
549 549
 			$arrivalTime = date('H:i',strtotime($parsed_json[0]['ScheduledArrivalDate']));
550 550
 			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_brussels');
551
-		    }
551
+			}
552 552
 		}
553 553
 	}
554 554
 
555 555
 	/**
556
-	* Get flight info from FlightRadar24
557
-	* @param String $callsign The callsign
558
-	* @param String $date date we want flight number info
559
-	* @return Flight departure and arrival airports and time
560
-	*/
556
+	 * Get flight info from FlightRadar24
557
+	 * @param String $callsign The callsign
558
+	 * @param String $date date we want flight number info
559
+	 * @return Flight departure and arrival airports and time
560
+	 */
561 561
 /*
562 562
 	public function getFlightRadar24($callsign, $date = 'NOW') {
563 563
 		$Common = new Common();
@@ -586,11 +586,11 @@  discard block
 block discarded – undo
586 586
 	}
587 587
   */
588 588
 	/**
589
-	* Get flight info from Lufthansa
590
-	* @param String $callsign The callsign
591
-	* @param String $date date we want flight number info
592
-	* @return Flight departure and arrival airports and time
593
-	*/
589
+	 * Get flight info from Lufthansa
590
+	 * @param String $callsign The callsign
591
+	 * @param String $date date we want flight number info
592
+	 * @return Flight departure and arrival airports and time
593
+	 */
594 594
 
595 595
 /*	private function getLufthansa($callsign, $date = 'NOW') {
596 596
 		$Common = new Common();
@@ -618,10 +618,10 @@  discard block
 block discarded – undo
618 618
 	}
619 619
   */
620 620
 	/**
621
-	* Get flight info from flytap
622
-	* @param String $callsign The callsign
623
-	* @return Flight departure and arrival airports and time
624
-	*/
621
+	 * Get flight info from flytap
622
+	 * @param String $callsign The callsign
623
+	 * @return Flight departure and arrival airports and time
624
+	 */
625 625
 	private function getFlyTap($callsign) {
626 626
 		$Common = new Common();
627 627
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -644,10 +644,10 @@  discard block
 block discarded – undo
644 644
 	}
645 645
 
646 646
 	/**
647
-	* Get flight info from flightmapper
648
-	* @param String $callsign The callsign
649
-	* @return Flight departure and arrival airports and time
650
-	*/
647
+	 * Get flight info from flightmapper
648
+	 * @param String $callsign The callsign
649
+	 * @return Flight departure and arrival airports and time
650
+	 */
651 651
 	public function getFlightMapper($callsign) {
652 652
 		$Common = new Common();
653 653
 		$airline_icao = '';
@@ -675,11 +675,11 @@  discard block
 block discarded – undo
675 675
 				$aarr = '';
676 676
 				$n = sscanf($sched,'%*s %5[0-9:] %*[^()] (%3[A-Z]) %5[0-9:] %*[^()] (%3[A-Z])',$dhour,$darr,$ahour,$aarr);
677 677
 				if ($n == 7) {
678
-				    $departureTime = $dhour;
679
-				    $arrivalTime = $ahour;
680
-				    $DepartureAirportIata = str_replace(array('(',')'),'',$darr);
681
-				    $ArrivalAirportIata = str_replace(array('(',')'),'',$aarr);
682
-				    return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_flightmapper');
678
+					$departureTime = $dhour;
679
+					$arrivalTime = $ahour;
680
+					$DepartureAirportIata = str_replace(array('(',')'),'',$darr);
681
+					$ArrivalAirportIata = str_replace(array('(',')'),'',$aarr);
682
+					return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_flightmapper');
683 683
 				}
684 684
 			}
685 685
 		}
@@ -687,10 +687,10 @@  discard block
 block discarded – undo
687 687
 	}
688 688
 
689 689
 	/**
690
-	* Get flight info from flightaware
691
-	* @param String $callsign The callsign
692
-	* @return Flight departure and arrival airports and time
693
-	*/
690
+	 * Get flight info from flightaware
691
+	 * @param String $callsign The callsign
692
+	 * @return Flight departure and arrival airports and time
693
+	 */
694 694
 	public function getFlightAware($callsign) {
695 695
 		global $globalFlightAwareUsername, $globalFlightAwarePassword;
696 696
 		date_default_timezone_set('UTC');
@@ -715,11 +715,11 @@  discard block
 block discarded – undo
715 715
 				$flight = $result['FlightInfoStatusResult']['flights'][0];
716 716
 				if (isset($flight['origin'])) {
717 717
 					return array(
718
-					    'DepartureAirportIATA' => $flight['origin']['alternate_ident'],
719
-					    'DepartureTime' => $flight['filed_departure_time']['time'],
720
-					    'ArrivalAirportIATA' => $flight['destination']['alternate_ident'],
721
-					    'ArrivalTime' => $flight['filed_arrival_time']['time'],
722
-					    'Source' => 'website_flightaware');
718
+						'DepartureAirportIATA' => $flight['origin']['alternate_ident'],
719
+						'DepartureTime' => $flight['filed_departure_time']['time'],
720
+						'ArrivalAirportIATA' => $flight['destination']['alternate_ident'],
721
+						'ArrivalTime' => $flight['filed_arrival_time']['time'],
722
+						'Source' => 'website_flightaware');
723 723
 				}
724 724
 			}
725 725
 		}
@@ -732,21 +732,21 @@  discard block
 block discarded – undo
732 732
 			$flight = reset($flights['flights']);
733 733
 			if (isset($flight['activityLog']['flights'][0]['origin'])) {
734 734
 				return array(
735
-				    'DepartureAirportIATA' => $flight['activityLog']['flights'][0]['origin']['iata'],
736
-				    'DepartureTime' => date('H:i',$flight['activityLog']['flights'][0]['takeoffTimes']['scheduled']),
737
-				    'ArrivalAirportIATA' => $flight['activityLog']['flights'][0]['destination']['iata'],
738
-				    'ArrivalTime' => date('H:i',$flight['activityLog']['flights'][0]['landingTimes']['scheduled']),
739
-				    'Source' => 'website_flightaware');
735
+					'DepartureAirportIATA' => $flight['activityLog']['flights'][0]['origin']['iata'],
736
+					'DepartureTime' => date('H:i',$flight['activityLog']['flights'][0]['takeoffTimes']['scheduled']),
737
+					'ArrivalAirportIATA' => $flight['activityLog']['flights'][0]['destination']['iata'],
738
+					'ArrivalTime' => date('H:i',$flight['activityLog']['flights'][0]['landingTimes']['scheduled']),
739
+					'Source' => 'website_flightaware');
740 740
 			}
741 741
 		}
742 742
 		return array();
743 743
 	}
744 744
 
745 745
 	/**
746
-	* Get flight info from CostToTravel
747
-	* @param String $callsign The callsign
748
-	* @return Flight departure and arrival airports and time
749
-	*/
746
+	 * Get flight info from CostToTravel
747
+	 * @param String $callsign The callsign
748
+	 * @return Flight departure and arrival airports and time
749
+	 */
750 750
 	public function getCostToTravel($callsign) {
751 751
 		$Common = new Common();
752 752
 		$url= "http://www.costtotravel.com/flight-number/".$callsign;
@@ -769,11 +769,11 @@  discard block
 block discarded – undo
769 769
 	}
770 770
 
771 771
 	/**
772
-	* Get flight info from Air Canada
773
-	* @param String $callsign The callsign
774
-	* @param String $date date we want flight number info
775
-	* @return Flight departure and arrival airports and time
776
-	*/
772
+	 * Get flight info from Air Canada
773
+	 * @param String $callsign The callsign
774
+	 * @param String $date date we want flight number info
775
+	 * @return Flight departure and arrival airports and time
776
+	 */
777 777
 	private function getAirCanada($callsign,$date = 'NOW') {
778 778
 		$Common = new Common();
779 779
 		if (class_exists("DomDocument") === FALSE) return array();
@@ -798,11 +798,11 @@  discard block
 block discarded – undo
798 798
 	}
799 799
 
800 800
 	/**
801
-	* Get flight info from Vietnam Airlines
802
-	* @param String $callsign The callsign
803
-	* @param String $date date we want flight number info
804
-	* @return Flight departure and arrival airports and time
805
-	*/
801
+	 * Get flight info from Vietnam Airlines
802
+	 * @param String $callsign The callsign
803
+	 * @param String $date date we want flight number info
804
+	 * @return Flight departure and arrival airports and time
805
+	 */
806 806
 	private function getVietnamAirlines($callsign, $date = 'NOW') {
807 807
 		$Common = new Common();
808 808
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -824,12 +824,12 @@  discard block
 block discarded – undo
824 824
 	}
825 825
 
826 826
 	/**
827
-	* Get flight info from Air Berlin
828
-	* @param String $callsign The callsign
829
-	* @param String $date date we want flight number info
830
-	* @param String $carrier airline code
831
-	* @return Flight departure and arrival airports and time
832
-	*/
827
+	 * Get flight info from Air Berlin
828
+	 * @param String $callsign The callsign
829
+	 * @param String $date date we want flight number info
830
+	 * @param String $carrier airline code
831
+	 * @return Flight departure and arrival airports and time
832
+	 */
833 833
 	private function getAirBerlin($callsign, $date = 'NOW',$carrier = 'AB') {
834 834
 		$Common = new Common();
835 835
 		date_default_timezone_set('UTC');
@@ -858,11 +858,11 @@  discard block
 block discarded – undo
858 858
 			$table = $Common->table2array($data);
859 859
 			$flight = $table;
860 860
 			if (isset($flight[5][4])) {
861
-			    $arrivalTime = $flight[5][4];
862
-			    $arrivalAirport = $flight[5][3];
861
+				$arrivalTime = $flight[5][4];
862
+				$arrivalAirport = $flight[5][3];
863 863
 			} else {
864
-			    $arrivalTime = '';
865
-			    $arrivalAirport = '';
864
+				$arrivalTime = '';
865
+				$arrivalAirport = '';
866 866
 			}
867 867
 		} else return array();
868 868
 		$url = 'http://www.airberlin.com/en-US/site/json/suggestAirport.php?searchfor=departures&searchflightid=0&departures%5B%5D=&suggestsource%5B0%5D=activeairports&withcountries=0&withoutroutings=0&promotion%5Bid%5D=&promotion%5Btype%5D=&routesource%5B0%5D=airberlin&routesource%5B1%5D=partner';
Please login to merge, or discard this patch.
require/class.SBS.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -198,20 +198,20 @@
 block discarded – undo
198 198
 
199 199
 	private function parityCheck($msg, $bin) {
200 200
 		$modes_checksum_table = array(
201
-		    0x3935ea, 0x1c9af5, 0xf1b77e, 0x78dbbf, 0xc397db, 0x9e31e9, 0xb0e2f0, 0x587178,
202
-		    0x2c38bc, 0x161c5e, 0x0b0e2f, 0xfa7d13, 0x82c48d, 0xbe9842, 0x5f4c21, 0xd05c14,
203
-		    0x682e0a, 0x341705, 0xe5f186, 0x72f8c3, 0xc68665, 0x9cb936, 0x4e5c9b, 0xd8d449,
204
-		    0x939020, 0x49c810, 0x24e408, 0x127204, 0x093902, 0x049c81, 0xfdb444, 0x7eda22,
205
-		    0x3f6d11, 0xe04c8c, 0x702646, 0x381323, 0xe3f395, 0x8e03ce, 0x4701e7, 0xdc7af7,
206
-		    0x91c77f, 0xb719bb, 0xa476d9, 0xadc168, 0x56e0b4, 0x2b705a, 0x15b82d, 0xf52612,
207
-		    0x7a9309, 0xc2b380, 0x6159c0, 0x30ace0, 0x185670, 0x0c2b38, 0x06159c, 0x030ace,
208
-		    0x018567, 0xff38b7, 0x80665f, 0xbfc92b, 0xa01e91, 0xaff54c, 0x57faa6, 0x2bfd53,
209
-		    0xea04ad, 0x8af852, 0x457c29, 0xdd4410, 0x6ea208, 0x375104, 0x1ba882, 0x0dd441,
210
-		    0xf91024, 0x7c8812, 0x3e4409, 0xe0d800, 0x706c00, 0x383600, 0x1c1b00, 0x0e0d80,
211
-		    0x0706c0, 0x038360, 0x01c1b0, 0x00e0d8, 0x00706c, 0x003836, 0x001c1b, 0xfff409,
212
-		    0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
213
-		    0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
214
-		    0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000
201
+			0x3935ea, 0x1c9af5, 0xf1b77e, 0x78dbbf, 0xc397db, 0x9e31e9, 0xb0e2f0, 0x587178,
202
+			0x2c38bc, 0x161c5e, 0x0b0e2f, 0xfa7d13, 0x82c48d, 0xbe9842, 0x5f4c21, 0xd05c14,
203
+			0x682e0a, 0x341705, 0xe5f186, 0x72f8c3, 0xc68665, 0x9cb936, 0x4e5c9b, 0xd8d449,
204
+			0x939020, 0x49c810, 0x24e408, 0x127204, 0x093902, 0x049c81, 0xfdb444, 0x7eda22,
205
+			0x3f6d11, 0xe04c8c, 0x702646, 0x381323, 0xe3f395, 0x8e03ce, 0x4701e7, 0xdc7af7,
206
+			0x91c77f, 0xb719bb, 0xa476d9, 0xadc168, 0x56e0b4, 0x2b705a, 0x15b82d, 0xf52612,
207
+			0x7a9309, 0xc2b380, 0x6159c0, 0x30ace0, 0x185670, 0x0c2b38, 0x06159c, 0x030ace,
208
+			0x018567, 0xff38b7, 0x80665f, 0xbfc92b, 0xa01e91, 0xaff54c, 0x57faa6, 0x2bfd53,
209
+			0xea04ad, 0x8af852, 0x457c29, 0xdd4410, 0x6ea208, 0x375104, 0x1ba882, 0x0dd441,
210
+			0xf91024, 0x7c8812, 0x3e4409, 0xe0d800, 0x706c00, 0x383600, 0x1c1b00, 0x0e0d80,
211
+			0x0706c0, 0x038360, 0x01c1b0, 0x00e0d8, 0x00706c, 0x003836, 0x001c1b, 0xfff409,
212
+			0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
213
+			0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
214
+			0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000
215 215
 		);
216 216
 		$crc = 0;
217 217
 		$checksum = intval(substr($msg,22,6),16);
Please login to merge, or discard this patch.
header.php 1 patch
Indentation   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 // When button "Remove all filters" is clicked
39 39
 if (isset($_POST['removefilters'])) {
40 40
 	$allfilters = array_filter(array_keys($_COOKIE),function($key) {
41
-	    return strpos($key,'filter_') === 0;
41
+		return strpos($key,'filter_') === 0;
42 42
 	});
43 43
 	foreach ($allfilters as $filt) {
44 44
 		unset($_COOKIE[$filt]);
@@ -188,17 +188,17 @@  discard block
 block discarded – undo
188 188
 	}
189 189
 ?>
190 190
 <?php 
191
-    if (isset($_POST['archive'])) {
191
+	if (isset($_POST['archive'])) {
192 192
 ?>
193 193
 <script src="<?php print $globalURL; ?>/js/map.common.js"></script>
194 194
 <?php 
195
-	    if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
195
+		if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
196 196
 ?>
197 197
 
198 198
 <script src="<?php print $globalURL; ?>/js/map.js.php?<?php print time(); ?>&archive&begindate=<?php print strtotime($_POST['start_date']); ?>&enddate=<?php print strtotime($_POST['end_date']); ?>&archivespeed=<?php print $_POST['archivespeed']; ?>"></script>
199 199
 <?php    
200
-	    }
201
-    } else {
200
+		}
201
+	} else {
202 202
 ?>
203 203
 <?php
204 204
 /*	if (isset($globalBeta) && $globalBeta) {
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 */
211 211
 ?>
212 212
 <?php 
213
-	    if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
213
+		if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
214 214
 ?>
215 215
 <?php
216 216
 //		if (isset($globalBeta) && $globalBeta) {
@@ -241,13 +241,13 @@  discard block
 block discarded – undo
241 241
 <script src="<?php print $globalURL; ?>/js/map-satellite.2d.js.php?<?php print time(); ?>"></script>
242 242
 <?php
243 243
 		}
244
-	    }
244
+		}
245 245
 ?>
246 246
 <?php
247 247
 //	}
248 248
 ?>
249 249
 <?php
250
-    }
250
+	}
251 251
 }
252 252
 ?>
253 253
 <?php
@@ -424,34 +424,34 @@  discard block
 block discarded – undo
424 424
 
425 425
       <ul class="nav navbar-nav">
426 426
 <?php
427
-    if (isset($globalNewsFeeds['global']) && !empty($globalNewsFeeds['global'])) {
427
+	if (isset($globalNewsFeeds['global']) && !empty($globalNewsFeeds['global'])) {
428 428
 ?>
429 429
     <li><a href="<?php print $globalURL; ?>/news"><?php echo _("News"); ?></a></li>
430 430
 <?php
431
-    }
431
+	}
432 432
 ?>
433 433
 
434 434
 <?php 
435
-    $sub = false;
436
-    if (
435
+	$sub = false;
436
+	if (
437 437
 	(
438
-	    (!isset($globalAircraft) || (isset($globalAircraft) && $globalAircraft === TRUE)) && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalTracker) && $globalTracker === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE))
438
+		(!isset($globalAircraft) || (isset($globalAircraft) && $globalAircraft === TRUE)) && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalTracker) && $globalTracker === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE))
439 439
 	) || 
440 440
 	(
441
-	    isset($globalMarine) && $globalMarine === TRUE && ((isset($globalTracker) && $globalTracker === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE))
441
+		isset($globalMarine) && $globalMarine === TRUE && ((isset($globalTracker) && $globalTracker === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE))
442 442
 	) || 
443 443
 	(
444
-	    isset($globalTracker) && $globalTracker === TRUE && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE))
444
+		isset($globalTracker) && $globalTracker === TRUE && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE))
445 445
 	) || 
446 446
 	(
447
-	    isset($globalSatellite) && $globalSatellite === TRUE && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalTracker) && $globalTracker === TRUE))
447
+		isset($globalSatellite) && $globalSatellite === TRUE && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalTracker) && $globalTracker === TRUE))
448 448
 	)
449
-    ) {
449
+	) {
450 450
 	$sub = true;
451
-    }
451
+	}
452 452
 ?>
453 453
 <?php
454
-    if (!isset($globalAircraft) || $globalAircraft === TRUE) {
454
+	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
455 455
 ?>
456 456
     <li class="dropdown">
457 457
 <?php
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
 	<ul class="dropdown-menu multi-level">
463 463
       	<li class="dropdown-submenu">
464 464
 <?php
465
-        }
465
+		}
466 466
 ?>
467 467
 <?php
468 468
 	if (isset($globalNewsFeeds['aircraft']) && !empty($globalNewsFeeds['aircraft'])) {
@@ -477,25 +477,25 @@  discard block
 block discarded – undo
477 477
           <ul class="dropdown-menu">
478 478
           	<li><a href="<?php print $globalURL; ?>/aircraft"><?php echo _("Aircrafts Types"); ?></a></li>
479 479
 <?php
480
-    if (!isset($globalNoAirlines) || $globalNoAirlines === FALSE) {
480
+	if (!isset($globalNoAirlines) || $globalNoAirlines === FALSE) {
481 481
 ?>
482 482
 			<li><a href="<?php print $globalURL; ?>/airline"><?php echo _("Airlines"); ?></a></li>
483 483
 <?php
484
-    }
484
+	}
485 485
 ?>
486 486
 			<li><a href="<?php print $globalURL; ?>/airport"><?php echo _("Airports"); ?></a></li>
487 487
 <?php
488
-    if ((isset($globalUseOwner) && $globalUseOwner) || (!isset($globalUseOwner) && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM))) {
488
+	if ((isset($globalUseOwner) && $globalUseOwner) || (!isset($globalUseOwner) && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM))) {
489 489
 ?>
490 490
 			<li><a href="<?php print $globalURL; ?>/owner"><?php echo _("Owners"); ?></a></li>
491 491
 <?php
492
-    } 
493
-    if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) {
492
+	} 
493
+	if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) {
494 494
 
495 495
 ?>
496 496
 			<li><a href="<?php print $globalURL; ?>/pilot"><?php echo _("Pilots"); ?></a></li>
497 497
 <?php
498
-    }
498
+	}
499 499
 ?>
500 500
 			<li><hr /></li>
501 501
             <li><a href="<?php print $globalURL; ?>/currently"><?php echo _("Current Activity"); ?></a></li>
@@ -503,43 +503,43 @@  discard block
 block discarded – undo
503 503
             <li><a href="<?php print $globalURL; ?>/date/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Activity"); ?></a></li>
504 504
             <li><a href="<?php print $globalURL; ?>/newest"><?php echo _("Newest by Category"); ?></a></li>
505 505
             <?php
506
-        	if ($globalACARS) {
507
-        	    if (isset($globalDemo) && $globalDemo) {
508
-    	    ?>
506
+			if ($globalACARS) {
507
+				if (isset($globalDemo) && $globalDemo) {
508
+			?>
509 509
             <li><hr /></li>
510 510
             <li><i><?php echo _('ACARS data not available publicly'); ?></i></li>
511 511
             <li><a href=""><?php echo _('Latest ACARS messages'); ?></a></li>
512 512
             <li><a href=""><?php echo _('Archive ACARS messages'); ?></a></li>
513 513
             <?php
514
-        	    } else {
515
-    	    ?>
514
+				} else {
515
+			?>
516 516
             <li><hr /></li>
517 517
             <li><a href="<?php print $globalURL; ?>/acars-latest"><?php echo _("Latest ACARS messages"); ?></a></li>
518 518
             <li><a href="<?php print $globalURL; ?>/acars-archive"><?php echo _("Archive ACARS messages"); ?></a></li>
519 519
             <?php
520
-        	    }
521
-        	}
522
-    	    ?>
520
+				}
521
+			}
522
+			?>
523 523
     	    <?php
524
-    	        if (isset($globalAccidents) && $globalAccidents) {
525
-    	    ?>
524
+				if (isset($globalAccidents) && $globalAccidents) {
525
+			?>
526 526
             <li><hr /></li>
527 527
             <li><a href="<?php print $globalURL; ?>/accident-latest"><?php echo _("Latest accident"); ?></a></li>
528 528
             <li><a href="<?php print $globalURL; ?>/accident/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Accident"); ?></a></li>
529 529
             <li><a href="<?php print $globalURL; ?>/incident-latest"><?php echo _("Latest incident"); ?></a></li>
530 530
             <li><a href="<?php print $globalURL; ?>/incident/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Incident"); ?></a></li>
531 531
             <?php
532
-        	}
533
-    	    ?>
532
+			}
533
+			?>
534 534
             <li><hr /></li>
535 535
             <li><a href="<?php print $globalURL; ?>/highlights/table"><?php echo _("Special Highlights"); ?></a></li>
536 536
             <?php
537 537
 		if (!isset($globalNoUpcoming) || $globalNoUpcoming === FALSE) {
538
-	    ?>
538
+		?>
539 539
             <li><a href="<?php print $globalURL; ?>/upcoming"><?php echo _("Upcoming Flights"); ?></a></li>
540 540
 	    <?php
541 541
 		}
542
-	    ?>
542
+		?>
543 543
           </ul>
544 544
         </li>
545 545
       	<li><a href="<?php print $globalURL; ?>/search"><?php echo _("Search"); ?></a></li>
@@ -566,14 +566,14 @@  discard block
 block discarded – undo
566 566
     </ul>
567 567
 <?php
568 568
 	}
569
-    }
569
+	}
570 570
 ?>
571 571
 <?php
572
-    if (isset($globalMarine) && $globalMarine) {
572
+	if (isset($globalMarine) && $globalMarine) {
573 573
 ?>
574 574
     <li class="dropdown">
575 575
 <?php
576
-        if ($sub) {
576
+		if ($sub) {
577 577
 ?>
578 578
     <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Marines"); ?> <b class="caret"></b></a>
579 579
 	<ul class="dropdown-menu multi-level">
@@ -607,14 +607,14 @@  discard block
 block discarded – undo
607 607
 	}
608 608
 ?>
609 609
 <?php
610
-    }
610
+	}
611 611
 ?>
612 612
 <?php
613
-    if (isset($globalTracker) && $globalTracker) {
613
+	if (isset($globalTracker) && $globalTracker) {
614 614
 ?>
615 615
     <li class="dropdown">
616 616
 <?php
617
-        if ($sub) {
617
+		if ($sub) {
618 618
 ?>
619 619
     <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Trackers"); ?> <b class="caret"></b></a>
620 620
 	<ul class="dropdown-menu multi-level">
@@ -648,14 +648,14 @@  discard block
 block discarded – undo
648 648
 	}
649 649
 ?>
650 650
 <?php
651
-    }
651
+	}
652 652
 ?>
653 653
 <?php
654
-    if (isset($globalSatellite) && $globalSatellite) {
654
+	if (isset($globalSatellite) && $globalSatellite) {
655 655
 ?>
656 656
     <li class="dropdown">
657 657
 <?php
658
-        if ($sub) {
658
+		if ($sub) {
659 659
 ?>
660 660
     <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Satellites"); ?> <b class="caret"></b></a>
661 661
 	<ul class="dropdown-menu multi-level">
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
 	}
692 692
 ?>
693 693
 <?php
694
-    }
694
+	}
695 695
 ?>
696 696
 
697 697
         <li class="dropdown">
@@ -700,12 +700,12 @@  discard block
 block discarded – undo
700 700
           	<li><a href="<?php print $globalURL; ?>/about"><?php echo _("About The Project"); ?></a></li>
701 701
           	<li><a href="<?php print $globalURL; ?>/about/export"><?php echo _("Exporting Data"); ?></a></li>
702 702
 <?php
703
-    if (!isset($globalAircraft) || $globalAircraft === TRUE) {
703
+	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
704 704
 ?>
705 705
 		<li><hr /></li>
706 706
 		<li><a href="<?php print $globalURL; ?>/about/tv"><?php echo _("Spotter TV"); ?></a></li>
707 707
 <?php
708
-    }
708
+	}
709 709
 ?>
710 710
 	    <?php if (isset($globalContribute) && $globalContribute) { ?>
711 711
                 <li><hr /></li>
@@ -726,14 +726,14 @@  discard block
 block discarded – undo
726 726
   	    <form>
727 727
   		<select class="selectpicker" data-width="120px" onchange="language(this);">
728 728
   		    <?php
729
-  		        $Language = new Language();
730
-  		        $alllang = $Language->getLanguages();
731
-  		        foreach ($alllang as $key => $lang) {
732
-  		            print '<option value="'.$key.'"';
733
-  		            if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected ';
734
-  		            print '>'.$lang[0].'</option>';
735
-  		        }
736
-  		    ?>
729
+  				$Language = new Language();
730
+  				$alllang = $Language->getLanguages();
731
+  				foreach ($alllang as $key => $lang) {
732
+  					print '<option value="'.$key.'"';
733
+  					if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected ';
734
+  					print '>'.$lang[0].'</option>';
735
+  				}
736
+  			?>
737 737
   		</select>
738 738
   	    </form>
739 739
   	</div>
@@ -765,18 +765,18 @@  discard block
 block discarded – undo
765 765
 ?>
766 766
     <div class="top-header clear" role="main">
767 767
 <?php
768
-    if (isset($longitude) && isset($latitude) && $longitude != 0 && $latitude != 0) {
768
+	if (isset($longitude) && isset($latitude) && $longitude != 0 && $latitude != 0) {
769 769
 ?>
770 770
     <div id="archive-map"></div>
771 771
 <?php
772
-    }
772
+	}
773 773
 ?>
774 774
     </div>
775 775
 <?php
776 776
 }
777 777
 if ((strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) || (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false))
778 778
 {
779
-    ?>
779
+	?>
780 780
     <div class="top-header clear" role="main">
781 781
         <div id="map"></div>
782 782
 	<link rel="stylesheet" href="<?php print $globalURL; ?>/css/leaflet.css" />
@@ -787,15 +787,15 @@  discard block
 block discarded – undo
787 787
         var zoom = 13;
788 788
 //create the map
789 789
 <?php
790
-    if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) {
790
+	if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) {
791 791
 ?>
792 792
   map = L.map('map', { zoomControl:true }).setView([<?php print $airport_array[0]['latitude']; ?>,<?php print $airport_array[0]['longitude']; ?>], zoom);
793 793
 <?php
794
-    } elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) {
794
+	} elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) {
795 795
 ?>
796 796
   map = L.map('map', { zoomControl:true });
797 797
 <?php
798
-    } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) {
798
+	} elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) {
799 799
 ?>
800 800
   map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['departure_airport_latitude']; ?>,<?php print $spotter_array[0]['arrival_airport_longitude']; ?>]);
801 801
     var line = L.polyline([[<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>],[<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>]]).addTo(map);
@@ -803,22 +803,22 @@  discard block
 block discarded – undo
803 803
     var departure_airport = L.marker([<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/departure_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map);
804 804
     var arrival_airport = L.marker([<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/arrival_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map);
805 805
 <?php
806
-    } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude']) && isset($spotter_array[0]['latitude'])) {
806
+	} elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude']) && isset($spotter_array[0]['latitude'])) {
807 807
 ?>
808 808
   map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['latitude']; ?>,<?php print $spotter_array[0]['longitude']; ?>]);
809 809
 <?php
810
-    } elseif (!isset($spotter_array[0]['latitude']) && !isset($spotter_array[0]['longitude'])) {
810
+	} elseif (!isset($spotter_array[0]['latitude']) && !isset($spotter_array[0]['longitude'])) {
811 811
 ?>
812 812
   map = L.map('map', { zoomControl:true });
813 813
 <?php
814
-    }
814
+	}
815 815
 ?>
816 816
   //initialize the layer group for the aircrft markers
817 817
   var layer_data = L.layerGroup();
818 818
 
819 819
   //a few title layers
820 820
 <?php
821
-    if ($globalMapProvider == 'Mapbox') {
821
+	if ($globalMapProvider == 'Mapbox') {
822 822
 ?>
823 823
   L.tileLayer('https://{s}.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={token}', {
824 824
     maxZoom: 18,
@@ -829,14 +829,14 @@  discard block
 block discarded – undo
829 829
     token : '<?php print $globalMapboxToken; ?>'
830 830
   }).addTo(map);
831 831
 <?php
832
-    } elseif ($globalMapProvider == 'Mapbox-GL') {
832
+	} elseif ($globalMapProvider == 'Mapbox-GL') {
833 833
 ?>
834 834
     L.mapboxGL({
835 835
 	accessToken: '<?php print $globalMapboxToken; ?>',
836 836
 	style: 'mapbox://styles/mapbox/bright-v8'
837 837
   }).addTo(map);
838 838
 <?php
839
-    } elseif ($globalMapProvider == 'MapQuest-OSM') {
839
+	} elseif ($globalMapProvider == 'MapQuest-OSM') {
840 840
 ?>
841 841
   L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.png', {
842 842
     maxZoom: 18,
@@ -845,7 +845,7 @@  discard block
 block discarded – undo
845 845
       'Tiles Courtesy of <a href="http://www.mapquest.com">MapQuest</a>'
846 846
   }).addTo(map);
847 847
 <?php
848
-    } elseif ($globalMapProvider == 'MapQuest-Aerial') {
848
+	} elseif ($globalMapProvider == 'MapQuest-Aerial') {
849 849
 ?>
850 850
   L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.png', {
851 851
     maxZoom: 18,
@@ -854,27 +854,27 @@  discard block
 block discarded – undo
854 854
       'Tiles Courtesy of <a href="http://www.mapquest.com">MapQuest</a>, Portions Courtesy NASA/JPL-Caltech and U.S. Depart. of Agriculture, Farm Service Agency"'
855 855
   }).addTo(map);
856 856
 <?php
857
-    } elseif ($globalMapProvider == 'Google-Roadmap') {
857
+	} elseif ($globalMapProvider == 'Google-Roadmap') {
858 858
 ?>
859 859
     var googleLayer = new L.Google('ROADMAP');
860 860
     map.addLayer(googleLayer);
861 861
 <?php
862
-    } elseif ($globalMapProvider == 'Google-Satellite') {
862
+	} elseif ($globalMapProvider == 'Google-Satellite') {
863 863
 ?>
864 864
     var googleLayer = new L.Google('SATELLITE');
865 865
     map.addLayer(googleLayer);
866 866
 <?php
867
-    } elseif ($globalMapProvider == 'Google-Hybrid') {
867
+	} elseif ($globalMapProvider == 'Google-Hybrid') {
868 868
 ?>
869 869
     var googleLayer = new L.Google('HYBRID');
870 870
     map.addLayer(googleLayer);
871 871
 <?php
872
-    } elseif ($globalMapProvider == 'Google-Terrain') {
872
+	} elseif ($globalMapProvider == 'Google-Terrain') {
873 873
 ?>
874 874
     var googleLayer = new L.Google('Terrain');
875 875
     map.addLayer(googleLayer);
876 876
 <?php
877
-    } elseif (isset($globalMapCustomLayer[$globalMapProvider])) {
877
+	} elseif (isset($globalMapCustomLayer[$globalMapProvider])) {
878 878
 	$customid = $globalMapProvider;
879 879
 ?>
880 880
     L.tileLayer('<?php print $globalMapCustomLayer[$customid]['url']; ?>/{z}/{x}/{y}.png', {
@@ -884,7 +884,7 @@  discard block
 block discarded – undo
884 884
         attribution: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>'
885 885
     }).addTo(map);
886 886
 <?php
887
-    } elseif ($globalMapProvider == 'offline' || (isset($globalMapOffline) && $globalMapOffline === TRUE)) {
887
+	} elseif ($globalMapProvider == 'offline' || (isset($globalMapOffline) && $globalMapOffline === TRUE)) {
888 888
 ?>
889 889
     var center = map.getCenter();
890 890
     map.options.crs = L.CRS.EPSG4326;
@@ -899,8 +899,8 @@  discard block
 block discarded – undo
899 899
         attribution: 'Natural Earth'
900 900
     }).addTo(map);
901 901
 <?php
902
-    //} elseif ($globalMapProvider == 'OpenStreetMap') {
903
-    } else {
902
+	//} elseif ($globalMapProvider == 'OpenStreetMap') {
903
+	} else {
904 904
 ?>
905 905
   L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
906 906
     maxZoom: 18,
@@ -909,7 +909,7 @@  discard block
 block discarded – undo
909 909
   }).addTo(map);
910 910
 
911 911
 <?php
912
-    }
912
+	}
913 913
 ?>
914 914
         </script>
915 915
     </div>
Please login to merge, or discard this patch.
getImages.php 1 patch
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -4,31 +4,31 @@  discard block
 block discarded – undo
4 4
 	$hex = str_replace("#", "", $hex);
5 5
 	$color = array();
6 6
 	if (strlen($hex) == 3) {
7
-	    $color['r'] = hexdec(substr($hex, 0, 1) . substr($hex,0,1));
8
-	    $color['g'] = hexdec(substr($hex, 1, 1) . substr($hex,1,1));
9
-	    $color['b'] = hexdec(substr($hex, 2, 1) . substr($hex,2,1));
7
+		$color['r'] = hexdec(substr($hex, 0, 1) . substr($hex,0,1));
8
+		$color['g'] = hexdec(substr($hex, 1, 1) . substr($hex,1,1));
9
+		$color['b'] = hexdec(substr($hex, 2, 1) . substr($hex,2,1));
10 10
 	} else if (strlen($hex) == 6) {
11
-	    $color['r'] = hexdec(substr($hex, 0, 2));
12
-	    $color['g'] = hexdec(substr($hex, 2, 2));
13
-	    $color['b'] = hexdec(substr($hex, 4, 2));
11
+		$color['r'] = hexdec(substr($hex, 0, 2));
12
+		$color['g'] = hexdec(substr($hex, 2, 2));
13
+		$color['b'] = hexdec(substr($hex, 4, 2));
14 14
 	}
15 15
 	return $color;
16 16
 }
17 17
 
18 18
 
19 19
 if (!isset($_GET['color']) || $_GET['color'] == '' || !preg_match('/^([a-fA-F0-9]){3}(([a-fA-F0-9]){3})?\b/',$_GET['color'])) { 
20
-    exit(0);
20
+	exit(0);
21 21
 }
22 22
 $color = $_GET['color'];
23 23
 if (!isset($_GET['filename']) || !preg_match('/^[a-z0-9-_]+\.png$/', strtolower($_GET['filename']))) {
24
-    echo "Incorrect filename";
25
-    exit(0);
24
+	echo "Incorrect filename";
25
+	exit(0);
26 26
 }
27 27
 $filename = $_GET['filename'];
28 28
 if (file_exists(dirname(__FILE__).'/cache/'.$color.'-'.$filename) && is_readable(dirname(__FILE__).'/cache/'.$color.'-'.$filename)) {
29
-    header('Content-type: image/png');
30
-    readfile(dirname(__FILE__).'/cache/'.$color.'-'.$filename);
31
-    exit(0);
29
+	header('Content-type: image/png');
30
+	readfile(dirname(__FILE__).'/cache/'.$color.'-'.$filename);
31
+	exit(0);
32 32
 }
33 33
 if (isset($_GET['tracker'])) {
34 34
 	$original = dirname(__FILE__).'/images/vehicules/color/'.$filename;
@@ -45,68 +45,68 @@  discard block
 block discarded – undo
45 45
 	$original = dirname(__FILE__).'/images/aircrafts/new/'.$filename;
46 46
 }
47 47
 if (!file_exists($original)) {
48
-    echo "File not found";
48
+	echo "File not found";
49 49
 }
50 50
 
51 51
 if (extension_loaded('gd') && function_exists('gd_info')) {
52
-    $image = imagecreatefrompng($original);
53
-    $index = imagecolorexact($image,26,49,81);
54
-    if ($index < 0) {
52
+	$image = imagecreatefrompng($original);
53
+	$index = imagecolorexact($image,26,49,81);
54
+	if ($index < 0) {
55 55
 	$index = imagecolorexact($image,25,49,79);
56
-    }
57
-    if ($index < 0) {
56
+	}
57
+	if ($index < 0) {
58 58
 	$index = imagecolorexact($image,0,0,0);
59
-    }
60
-    $c = hexToRGB($color);
61
-    imagecolorset($image,$index,$c['r'],$c['g'],$c['b']);
59
+	}
60
+	$c = hexToRGB($color);
61
+	imagecolorset($image,$index,$c['r'],$c['g'],$c['b']);
62 62
  /*
63 63
     $ig = imagecolorat($image, 0, 0);
64 64
     imagecolortransparent($image, $ig);
65 65
    */
66 66
 
67
-    header('Content-type: image/png');
68
-    if (isset($_GET['resize']) && function_exists('imagecopyresampled')) {
67
+	header('Content-type: image/png');
68
+	if (isset($_GET['resize']) && function_exists('imagecopyresampled')) {
69 69
 	$resize = filter_input(INPUT_GET,'resize',FILTER_SANITIZE_NUMBER_INT);
70 70
 	$newimg = imagecreatetruecolor($resize,$resize);
71
-        imagealphablending($newimg, false);
71
+		imagealphablending($newimg, false);
72 72
 	imagesavealpha($newimg, true);
73 73
 	imagecopyresampled($newimg,$image,0,0,0,0,15,15,imagesx($image),imagesy($image));
74 74
 	if (isset($_GET['heading'])) {
75
-    	    $heading = filter_input(INPUT_GET,'heading',FILTER_SANITIZE_NUMBER_INT);
76
-    	    $rotation = imagerotate($newimg,$heading,imageColorAllocateAlpha($newimg,0,0,0,127));
77
-    	    imagealphablending($rotation, false);
78
-	    imagesavealpha($rotation, true);
79
-    	    imagepng($rotation);
80
-    	    imagedestroy($newimg);
81
-    	    imagedestroy($image);
82
-    	    imagedestroy($rotation);
75
+			$heading = filter_input(INPUT_GET,'heading',FILTER_SANITIZE_NUMBER_INT);
76
+			$rotation = imagerotate($newimg,$heading,imageColorAllocateAlpha($newimg,0,0,0,127));
77
+			imagealphablending($rotation, false);
78
+		imagesavealpha($rotation, true);
79
+			imagepng($rotation);
80
+			imagedestroy($newimg);
81
+			imagedestroy($image);
82
+			imagedestroy($rotation);
83 83
 	
84 84
 	} else {
85
-    	    imagepng($newimg);
86
-    	    imagedestroy($newimg);
87
-    	    imagedestroy($image);
88
-        }
89
-    } else {
85
+			imagepng($newimg);
86
+			imagedestroy($newimg);
87
+			imagedestroy($image);
88
+		}
89
+	} else {
90 90
 	imagealphablending($image, false);
91
-        imagesavealpha($image, true);
91
+		imagesavealpha($image, true);
92 92
 	imagepng($image);
93 93
 	imagepng($image);
94 94
 	if (is_writable(dirname(__FILE__).'/cache')) {
95
-    	    imagepng($image,dirname(__FILE__).'/cache/'.$color.'-'.$filename);
95
+			imagepng($image,dirname(__FILE__).'/cache/'.$color.'-'.$filename);
96
+	}
97
+		imagedestroy($image);
96 98
 	}
97
-        imagedestroy($image);
98
-    }
99 99
 } else {
100
-    header('Content-type: image/png');
101
-    if (isset($_GET['tracker'])) {
102
-        readfile(dirname(__FILE__).'/images/vehicules/'.$filename);
103
-    } elseif (isset($_GET['marine'])) {
104
-        readfile(dirname(__FILE__).'/images/vehicules/'.$filename);
105
-    } elseif (isset($_GET['satellite'])) {
106
-        readfile(dirname(__FILE__).'/images/satellites/'.$filename);
107
-    } else {
108
-        if ($color == 'FF0000') readfile(dirname(__FILE__).'/images/aircrafts/selected/'.$filename);
100
+	header('Content-type: image/png');
101
+	if (isset($_GET['tracker'])) {
102
+		readfile(dirname(__FILE__).'/images/vehicules/'.$filename);
103
+	} elseif (isset($_GET['marine'])) {
104
+		readfile(dirname(__FILE__).'/images/vehicules/'.$filename);
105
+	} elseif (isset($_GET['satellite'])) {
106
+		readfile(dirname(__FILE__).'/images/satellites/'.$filename);
107
+	} else {
108
+		if ($color == 'FF0000') readfile(dirname(__FILE__).'/images/aircrafts/selected/'.$filename);
109 109
 	else readfile(dirname(__FILE__).'/images/aircrafts/'.$filename);
110
-    }
110
+	}
111 111
 }
112 112
 ?>
113 113
\ No newline at end of file
Please login to merge, or discard this patch.
install/install-action.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -86,9 +86,9 @@  discard block
 block discarded – undo
86 86
 	if ($check_version == '0') {
87 87
 		
88 88
 		if ($globalDBdriver == 'mysql') {
89
-		    $error .= create_db::import_all_db('../db/');
89
+			$error .= create_db::import_all_db('../db/');
90 90
 		} elseif ($globalDBdriver == 'pgsql') {
91
-		    $error .= create_db::import_all_db('../db/pgsql/');
91
+			$error .= create_db::import_all_db('../db/pgsql/');
92 92
 		}
93 93
 		if ($error != '') {
94 94
 			$_SESSION['error'] = $error;
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
 			$_SESSION['install'] = 'populate';
99 99
 			$_SESSION['next'] = 'Populate aircraft_modes table with externals data for ADS-B';
100 100
 		} else {
101
-		    $_SESSION['install'] = 'sources';
102
-		    $_SESSION['next'] = 'Insert data in source table';
101
+			$_SESSION['install'] = 'sources';
102
+			$_SESSION['next'] = 'Insert data in source table';
103 103
 		}
104 104
 		$result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
105 105
 		print json_encode($result);
@@ -156,10 +156,10 @@  discard block
 block discarded – undo
156 156
 		$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate countries database'));
157 157
 	} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate countries database'));
158 158
 	if (isset($globalNOTAM) && $globalNOTAM && isset($globalNOTAMSource) && $globalNOTAMSource != '') {
159
-	    $_SESSION['install'] = 'notam';
160
-	    $_SESSION['next'] = 'Populate NOTAM table with externals data';
161
-	    $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
162
-	    print json_encode($result);
159
+		$_SESSION['install'] = 'notam';
160
+		$_SESSION['next'] = 'Populate NOTAM table with externals data';
161
+		$result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
162
+		print json_encode($result);
163 163
 	/*
164 164
 	} elseif (isset($_SESSION['owner']) && $_SESSION['owner'] == 1) {
165 165
 	    $_SESSION['install'] = 'owner';
@@ -169,10 +169,10 @@  discard block
 block discarded – undo
169 169
 	    print json_encode($result);
170 170
 	*/
171 171
 	} else {
172
-	    $_SESSION['install'] = 'sources';
173
-	    $_SESSION['next'] = 'Insert data in source table';
174
-	    $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
175
-	    print json_encode($result);
172
+		$_SESSION['install'] = 'sources';
173
+		$_SESSION['next'] = 'Insert data in source table';
174
+		$result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
175
+		print json_encode($result);
176 176
 	}
177 177
 } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'populate') {
178 178
 	if (!is_writable('tmp')) {
Please login to merge, or discard this patch.
require/class.SpotterImport.php 1 patch
Indentation   +423 added lines, -423 removed lines patch added patch discarded remove patch
@@ -9,20 +9,20 @@  discard block
 block discarded – undo
9 9
 require_once(dirname(__FILE__).'/class.Source.php');
10 10
 require_once(dirname(__FILE__).'/class.GeoidHeight.php');
11 11
 if (isset($globalServerAPRS) && $globalServerAPRS) {
12
-    require_once(dirname(__FILE__).'/class.APRS.php');
12
+	require_once(dirname(__FILE__).'/class.APRS.php');
13 13
 }
14 14
 
15 15
 class SpotterImport {
16
-    private $all_flights = array();
17
-    private $last_delete_hourly = 0;
18
-    private $last_delete = 0;
19
-    private $stats = array();
20
-    private $tmd = 0;
21
-    private $source_location = array();
22
-    public $db = null;
23
-    public $nb = 0;
16
+	private $all_flights = array();
17
+	private $last_delete_hourly = 0;
18
+	private $last_delete = 0;
19
+	private $stats = array();
20
+	private $tmd = 0;
21
+	private $source_location = array();
22
+	public $db = null;
23
+	public $nb = 0;
24 24
 
25
-    public function __construct($dbc = null) {
25
+	public function __construct($dbc = null) {
26 26
 	global $globalBeta, $globalServerAPRS, $APRSSpotter, $globalNoDB, $GeoidClass, $globalDebug, $globalGeoid;
27 27
 	if (!(isset($globalNoDB) && $globalNoDB)) {
28 28
 		$Connection = new Connection($dbc);
@@ -34,14 +34,14 @@  discard block
 block discarded – undo
34 34
 		$currentdate = date('Y-m-d');
35 35
 		$sourcestat = $Stats->getStatsSource($currentdate);
36 36
 		if (!empty($sourcestat)) {
37
-		    foreach($sourcestat as $srcst) {
38
-		    	$type = $srcst['stats_type'];
37
+			foreach($sourcestat as $srcst) {
38
+				$type = $srcst['stats_type'];
39 39
 			if ($type == 'polar' || $type == 'hist') {
40
-			    $source = $srcst['source_name'];
41
-			    $data = $srcst['source_data'];
42
-			    $this->stats[$currentdate][$source][$type] = json_decode($data,true);
43
-	    		}
44
-		    }
40
+				$source = $srcst['source_name'];
41
+				$data = $srcst['source_data'];
42
+				$this->stats[$currentdate][$source][$type] = json_decode($data,true);
43
+				}
44
+			}
45 45
 		}
46 46
 	}
47 47
 	if (isset($globalServerAPRS) && $globalServerAPRS) {
@@ -56,9 +56,9 @@  discard block
 block discarded – undo
56 56
 			$GeoidClass = FALSE;
57 57
 		}
58 58
 	}
59
-    }
59
+	}
60 60
 
61
-    public function get_Schedule($id,$ident) {
61
+	public function get_Schedule($id,$ident) {
62 62
 	global $globalDebug, $globalFork, $globalSchedulesFetch;
63 63
 	// Get schedule here, so it's done only one time
64 64
 	
@@ -78,42 +78,42 @@  discard block
 block discarded – undo
78 78
 	$operator = $Spotter->getOperator($ident);
79 79
 	$scheduleexist = false;
80 80
 	if ($Schedule->checkSchedule($operator) == 0) {
81
-	    $operator = $Translation->checkTranslation($ident);
82
-	    if ($Schedule->checkSchedule($operator) == 0) {
81
+		$operator = $Translation->checkTranslation($ident);
82
+		if ($Schedule->checkSchedule($operator) == 0) {
83 83
 		$schedule = $Schedule->fetchSchedule($operator);
84 84
 		if (count($schedule) > 0 && isset($schedule['DepartureTime']) && isset($schedule['ArrivalTime'])) {
85
-		    if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n";
86
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime']));
87
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime']));
88
-		    // Should also check if route schedule = route from DB
89
-		    if ($schedule['DepartureAirportIATA'] != '') {
85
+			if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n";
86
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime']));
87
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime']));
88
+			// Should also check if route schedule = route from DB
89
+			if ($schedule['DepartureAirportIATA'] != '') {
90 90
 			if ($this->all_flights[$id]['departure_airport'] != $Spotter->getAirportIcao($schedule['DepartureAirportIATA'])) {
91
-			    $airport_icao = $Spotter->getAirportIcao($schedule['DepartureAirportIATA']);
92
-			    if (trim($airport_icao) != '') {
91
+				$airport_icao = $Spotter->getAirportIcao($schedule['DepartureAirportIATA']);
92
+				if (trim($airport_icao) != '') {
93 93
 				$this->all_flights[$id]['departure_airport'] = $airport_icao;
94 94
 				if ($globalDebug) echo "-> Change departure airport to ".$airport_icao." for ".$ident."\n";
95
-			    }
95
+				}
96
+			}
96 97
 			}
97
-		    }
98
-		    if ($schedule['ArrivalAirportIATA'] != '') {
98
+			if ($schedule['ArrivalAirportIATA'] != '') {
99 99
 			if ($this->all_flights[$id]['arrival_airport'] != $Spotter->getAirportIcao($schedule['ArrivalAirportIATA'])) {
100
-			    $airport_icao = $Spotter->getAirportIcao($schedule['ArrivalAirportIATA']);
101
-			    if (trim($airport_icao) != '') {
100
+				$airport_icao = $Spotter->getAirportIcao($schedule['ArrivalAirportIATA']);
101
+				if (trim($airport_icao) != '') {
102 102
 				$this->all_flights[$id]['arrival_airport'] = $airport_icao;
103 103
 				if ($globalDebug) echo "-> Change arrival airport to ".$airport_icao." for ".$ident."\n";
104
-			    }
104
+				}
105 105
 			}
106
-		    }
107
-		    $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']);
106
+			}
107
+			$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']);
108 108
 		}
109
-	    } else $scheduleexist = true;
109
+		} else $scheduleexist = true;
110 110
 	} else $scheduleexist = true;
111 111
 	// close connection, at least one way will work ?
112
-       if ($scheduleexist) {
112
+	   if ($scheduleexist) {
113 113
 		if ($globalDebug) echo "-> get arrival/departure airport info for ".$ident."\n";
114
-    		$sch = $Schedule->getSchedule($operator);
114
+			$sch = $Schedule->getSchedule($operator);
115 115
 		$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']));
116
-       }
116
+	   }
117 117
 	$Spotter->db = null;
118 118
 	$Schedule->db = null;
119 119
 	$Translation->db = null;
@@ -128,78 +128,78 @@  discard block
 block discarded – undo
128 128
 	}
129 129
 	  */
130 130
 	}
131
-    }
131
+	}
132 132
 
133
-    public function checkAll() {
133
+	public function checkAll() {
134 134
 	global $globalDebug, $globalNoImport;
135 135
 	if ($globalDebug) echo "Update last seen flights data...\n";
136 136
 	if (!isset($globalNoImport) || $globalNoImport === FALSE) {
137
-	    foreach ($this->all_flights as $key => $flight) {
137
+		foreach ($this->all_flights as $key => $flight) {
138 138
 		if (isset($this->all_flights[$key]['id'])) {
139
-		    //echo $this->all_flights[$key]['id'].' - '.$this->all_flights[$key]['latitude'].'  '.$this->all_flights[$key]['longitude']."\n";
140
-    		    $Spotter = new Spotter($this->db);
141
-        	    $real_arrival = $this->arrival($key);
142
-        	    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']);
143
-        	}
144
-	    }
139
+			//echo $this->all_flights[$key]['id'].' - '.$this->all_flights[$key]['latitude'].'  '.$this->all_flights[$key]['longitude']."\n";
140
+				$Spotter = new Spotter($this->db);
141
+				$real_arrival = $this->arrival($key);
142
+				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']);
143
+			}
144
+		}
145
+	}
145 146
 	}
146
-    }
147 147
 
148
-    public function arrival($key) {
148
+	public function arrival($key) {
149 149
 	global $globalClosestMinDist, $globalDebug;
150 150
 	if ($globalDebug) echo 'Update arrival...'."\n";
151 151
 	$Spotter = new Spotter($this->db);
152
-        $airport_icao = '';
153
-        $airport_time = '';
154
-        if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50;
152
+		$airport_icao = '';
153
+		$airport_time = '';
154
+		if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50;
155 155
 	if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') {
156
-	    $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist);
157
-    	    if (isset($closestAirports[0])) {
158
-        	if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) {
159
-        	    $airport_icao = $closestAirports[0]['icao'];
160
-        	    $airport_time = $this->all_flights[$key]['datetime'];
161
-        	    if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
162
-        	} elseif (count($closestAirports > 1) && isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] != '') {
163
-        	    foreach ($closestAirports as $airport) {
164
-        		if ($this->all_flights[$key]['arrival_airport'] == $airport['icao']) {
165
-        		    $airport_icao = $airport['icao'];
166
-        		    $airport_time = $this->all_flights[$key]['datetime'];
167
-        		    if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
168
-        		    break;
169
-        		}
170
-        	    }
171
-        	} 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))) {
172
-        		$airport_icao = $closestAirports[0]['icao'];
173
-        		$airport_time = $this->all_flights[$key]['datetime'];
174
-        	} else {
175
-        		if ($globalDebug) echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n";
176
-        	}
177
-    	    } else {
178
-    		    if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n";
179
-    	    }
156
+		$closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist);
157
+			if (isset($closestAirports[0])) {
158
+			if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) {
159
+				$airport_icao = $closestAirports[0]['icao'];
160
+				$airport_time = $this->all_flights[$key]['datetime'];
161
+				if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
162
+			} elseif (count($closestAirports > 1) && isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] != '') {
163
+				foreach ($closestAirports as $airport) {
164
+				if ($this->all_flights[$key]['arrival_airport'] == $airport['icao']) {
165
+					$airport_icao = $airport['icao'];
166
+					$airport_time = $this->all_flights[$key]['datetime'];
167
+					if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
168
+					break;
169
+				}
170
+				}
171
+			} 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))) {
172
+				$airport_icao = $closestAirports[0]['icao'];
173
+				$airport_time = $this->all_flights[$key]['datetime'];
174
+			} else {
175
+				if ($globalDebug) echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n";
176
+			}
177
+			} else {
178
+				if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n";
179
+			}
180 180
 
181
-        } else {
182
-        	if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n";
183
-        }
184
-        return array('airport_icao' => $airport_icao,'airport_time' => $airport_time);
185
-    }
181
+		} else {
182
+			if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n";
183
+		}
184
+		return array('airport_icao' => $airport_icao,'airport_time' => $airport_time);
185
+	}
186 186
 
187 187
 
188 188
 
189
-    public function del() {
189
+	public function del() {
190 190
 	global $globalDebug, $globalNoImport, $globalNoDB;
191 191
 	// Delete old infos
192 192
 	if ($globalDebug) echo 'Delete old values and update latest data...'."\n";
193 193
 	foreach ($this->all_flights as $key => $flight) {
194
-	    if (isset($flight['lastupdate'])) {
194
+		if (isset($flight['lastupdate'])) {
195 195
 		if ($flight['lastupdate'] < (time()-1800)) {
196
-		    $this->delKey($key);
196
+			$this->delKey($key);
197 197
 		}
198
-	    }
198
+		}
199
+	}
199 200
 	}
200
-    }
201 201
 
202
-    public function delKey($key) {
202
+	public function delKey($key) {
203 203
 	global $globalDebug, $globalNoImport, $globalNoDB;
204 204
 	// Delete old infos
205 205
 	if (isset($this->all_flights[$key]['id'])) {
@@ -214,9 +214,9 @@  discard block
 block discarded – undo
214 214
 		}
215 215
 	}
216 216
 	unset($this->all_flights[$key]);
217
-    }
217
+	}
218 218
 
219
-    public function add($line) {
219
+	public function add($line) {
220 220
 	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;
221 221
 	//if (!isset($globalDebugTimeElapsed) || $globalDebugTimeElapsed == '') $globalDebugTimeElapsed = FALSE;
222 222
 	if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.01';
@@ -242,20 +242,20 @@  discard block
 block discarded – undo
242 242
 	
243 243
 	// SBS format is CSV format
244 244
 	if(is_array($line) && (isset($line['hex']) || isset($line['id']))) {
245
-	    //print_r($line);
246
-	    if (isset($line['hex'])) $line['hex'] = strtoupper($line['hex']);
247
-  	    if (isset($line['id']) || (isset($line['hex']) && $line['hex'] != '' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6)) {
245
+		//print_r($line);
246
+		if (isset($line['hex'])) $line['hex'] = strtoupper($line['hex']);
247
+  		if (isset($line['id']) || (isset($line['hex']) && $line['hex'] != '' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6)) {
248 248
 
249 249
 		// Increment message number
250 250
 		if (isset($line['sourcestats']) && $line['sourcestats'] === TRUE) {
251
-		    $current_date = date('Y-m-d');
252
-		    if (isset($line['source_name'])) $source = $line['source_name'];
253
-		    else $source = '';
254
-		    if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source'];
255
-		    if (!isset($this->stats[$current_date][$source]['msg'])) {
256
-		    	$this->stats[$current_date][$source]['msg']['date'] = time();
257
-		    	$this->stats[$current_date][$source]['msg']['nb'] = 1;
258
-		    } else $this->stats[$current_date][$source]['msg']['nb'] += 1;
251
+			$current_date = date('Y-m-d');
252
+			if (isset($line['source_name'])) $source = $line['source_name'];
253
+			else $source = '';
254
+			if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source'];
255
+			if (!isset($this->stats[$current_date][$source]['msg'])) {
256
+				$this->stats[$current_date][$source]['msg']['date'] = time();
257
+				$this->stats[$current_date][$source]['msg']['nb'] = 1;
258
+			} else $this->stats[$current_date][$source]['msg']['nb'] += 1;
259 259
 		}
260 260
 		
261 261
 		/*
@@ -271,54 +271,54 @@  discard block
 block discarded – undo
271 271
 		//$this->db = $dbc;
272 272
 
273 273
 		//$hex = trim($line['hex']);
274
-	        if (!isset($line['id'])) $id = trim($line['hex']);
275
-	        else $id = trim($line['id']);
274
+			if (!isset($line['id'])) $id = trim($line['hex']);
275
+			else $id = trim($line['id']);
276 276
 		
277 277
 		if (!isset($this->all_flights[$id])) {
278
-		    if ($globalDebug) echo 'New flight...'."\n";
279
-		    $this->all_flights[$id] = array();
280
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0));
281
-		    $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' => ''));
282
-		    if (isset($globalDaemon) && $globalDaemon === FALSE) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time()));
283
-		    if (!isset($line['id'])) {
278
+			if ($globalDebug) echo 'New flight...'."\n";
279
+			$this->all_flights[$id] = array();
280
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0));
281
+			$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' => ''));
282
+			if (isset($globalDaemon) && $globalDaemon === FALSE) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time()));
283
+			if (!isset($line['id'])) {
284 284
 			if (!isset($globalDaemon)) $globalDaemon = TRUE;
285 285
 //			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')));
286 286
 //			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')));
287 287
 			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')));
288
-		        //else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
289
-		     } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
290
-		    if ($globalAllFlights !== FALSE) $dataFound = true;
288
+				//else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
289
+			 } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
290
+			if ($globalAllFlights !== FALSE) $dataFound = true;
291 291
 		}
292 292
 		if (isset($line['source_type']) && $line['source_type'] != '') {
293
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_type' => $line['source_type']));
293
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_type' => $line['source_type']));
294 294
 		}
295 295
 		
296 296
 		//print_r($this->all_flights);
297 297
 		if (isset($line['hex']) && !isset($this->all_flights[$id]['hex']) && ctype_xdigit($line['hex'])) {
298
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => trim($line['hex'])));
299
-		    //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) {
298
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => trim($line['hex'])));
299
+			//if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) {
300 300
 			//$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime']));
301
-		    //} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s')));
302
-		    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') {
301
+			//} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s')));
302
+			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') {
303 303
 			$timeelapsed = microtime(true);
304 304
 			if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
305
-			    $Spotter = new Spotter($this->db);
306
-			    if (isset($this->all_flights[$id]['source_type'])) {
305
+				$Spotter = new Spotter($this->db);
306
+				if (isset($this->all_flights[$id]['source_type'])) {
307 307
 				$aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex']),$this->all_flights[$id]['source_type']);
308
-			    } else {
308
+				} else {
309 309
 				$aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex']));
310
-			    }
311
-			    $Spotter->db = null;
312
-			    if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
313
-			    if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao));
310
+				}
311
+				$Spotter->db = null;
312
+				if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
313
+				if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao));
314 314
 			}
315
-		    }
316
-		    if ($globalAllFlights !== FALSE) $dataFound = true;
317
-		    if ($globalDebug) echo "*********** New aircraft hex : ".$line['hex']." ***********\n";
315
+			}
316
+			if ($globalAllFlights !== FALSE) $dataFound = true;
317
+			if ($globalDebug) echo "*********** New aircraft hex : ".$line['hex']." ***********\n";
318 318
 		}
319
-	        if (isset($line['id']) && !isset($line['hex'])) {
320
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => ''));
321
-	        }
319
+			if (isset($line['id']) && !isset($line['hex'])) {
320
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => ''));
321
+			}
322 322
 		if (isset($line['aircraft_icao']) && $line['aircraft_icao'] != '') {
323 323
 			$icao = $line['aircraft_icao'];
324 324
 			if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
@@ -348,9 +348,9 @@  discard block
 block discarded – undo
348 348
 		}
349 349
 		//if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) {
350 350
 		if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) {
351
-		    if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) {
351
+			if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) {
352 352
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime']));
353
-		    } else {
353
+			} else {
354 354
 				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";
355 355
 				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";
356 356
 				/*
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 				print_r($line);
360 360
 				*/
361 361
 				return '';
362
-		    }
362
+			}
363 363
 		} elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) {
364 364
 			if ($globalDebug) echo "!!! Date is too old ".$line['datetime']." for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!\n";
365 365
 			return '';
@@ -375,21 +375,21 @@  discard block
 block discarded – undo
375 375
 		}
376 376
 
377 377
 		if (isset($line['registration']) && $line['registration'] != '' && $line['registration'] != 'z.NO-REG' && $line['registration'] != 'NA') {
378
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('registration' => $line['registration']));
378
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('registration' => $line['registration']));
379 379
 		}
380 380
 		if (isset($line['waypoints']) && $line['waypoints'] != '') {
381
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('waypoints' => $line['waypoints']));
381
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('waypoints' => $line['waypoints']));
382 382
 		}
383 383
 		if (isset($line['pilot_id']) && $line['pilot_id'] != '') {
384
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_id' => trim($line['pilot_id'])));
384
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_id' => trim($line['pilot_id'])));
385 385
 		}
386 386
 		if (isset($line['pilot_name']) && $line['pilot_name'] != '') {
387
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_name' => trim($line['pilot_name'])));
387
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_name' => trim($line['pilot_name'])));
388 388
 		}
389 389
  
390 390
 		if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_flights[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9]+$/', $line['ident'])) {
391 391
 
392
-		    if ($this->all_flights[$id]['addedSpotter'] == 1) {
392
+			if ($this->all_flights[$id]['addedSpotter'] == 1) {
393 393
 			if ($globalVA !== TRUE && $globalIVAO !== TRUE && $globalVATSIM !== TRUE && $globalphpVMS !== TRUE && $globalVAM !== TRUE && $this->all_flights[$id]['lastupdate'] < time() - 1600) {
394 394
 				if ($globalDebug) echo '---!!!! New ident, reset aircraft data...'."\n";
395 395
 				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0));
@@ -398,23 +398,23 @@  discard block
 block discarded – undo
398 398
 				elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
399 399
 				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']));
400 400
 			} else {
401
-			    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident'])));
402
-			    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
401
+				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident'])));
402
+				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
403 403
 				$timeelapsed = microtime(true);
404
-            			$Spotter = new Spotter($this->db);
405
-            			$fromsource = NULL;
406
-            			if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
407
-            			elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
404
+						$Spotter = new Spotter($this->db);
405
+						$fromsource = NULL;
406
+						if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
407
+						elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
408 408
 				elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') $fromsource = 'ivao';
409 409
 				elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
410 410
 				elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
411
-            			$result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource);
411
+						$result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource);
412 412
 				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
413 413
 				$Spotter->db = null;
414 414
 				if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
415
-			    }
415
+				}
416 416
 			}
417
-		    } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident'])));
417
+			} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident'])));
418 418
 		    
419 419
 /*
420 420
 		    if (!isset($line['id'])) {
@@ -424,63 +424,63 @@  discard block
 block discarded – undo
424 424
 		        else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
425 425
 		     } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
426 426
   */
427
-		    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']));
427
+			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']));
428 428
 
429
-		    //$putinarchive = true;
430
-		    if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) {
429
+			//$putinarchive = true;
430
+			if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) {
431 431
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $line['departure_airport_time']));
432
-		    }
433
-		    if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) {
432
+			}
433
+			if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) {
434 434
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $line['arrival_airport_time']));
435
-		    }
436
-		    if (isset($line['departure_airport_icao']) && isset($line['arrival_airport_icao'])) {
437
-		    		$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' => ''));
438
-		    } elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) {
435
+			}
436
+			if (isset($line['departure_airport_icao']) && isset($line['arrival_airport_icao'])) {
437
+					$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' => ''));
438
+			} elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) {
439 439
 			$timeelapsed = microtime(true);
440 440
 			if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
441 441
 				$Spotter = new Spotter($this->db);
442 442
 				$line['departure_airport_icao'] = $Spotter->getAirportIcao($line['departure_airport_iata']);
443 443
 				$line['arrival_airport_icao'] = $Spotter->getAirportIcao($line['arrival_airport_iata']);
444
-		    		$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' => ''));
444
+					$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' => ''));
445 445
 				if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
446
-                        }
447
-		    } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') {
446
+						}
447
+			} elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') {
448 448
 			$timeelapsed = microtime(true);
449 449
 			if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
450
-			    $Spotter = new Spotter($this->db);
451
-			    $route = $Spotter->getRouteInfo(trim($line['ident']));
452
-			    if (!isset($route['fromairport_icao']) && !isset($route['toairport_icao'])) {
450
+				$Spotter = new Spotter($this->db);
451
+				$route = $Spotter->getRouteInfo(trim($line['ident']));
452
+				if (!isset($route['fromairport_icao']) && !isset($route['toairport_icao'])) {
453 453
 				$Translation = new Translation($this->db);
454 454
 				$ident = $Translation->checkTranslation(trim($line['ident']));
455 455
 				$route = $Spotter->getRouteInfo($ident);
456 456
 				$Translation->db = null;
457
-			    }
458
-			    $Spotter->db = null;
459
-			    if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
460
-                    	}
457
+				}
458
+				$Spotter->db = null;
459
+				if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
460
+						}
461 461
 			if (isset($route['fromairport_icao']) && isset($route['toairport_icao'])) {
462
-			    //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) {
463
-			    if ($route['fromairport_icao'] != $route['toairport_icao']) {
462
+				//if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) {
463
+				if ($route['fromairport_icao'] != $route['toairport_icao']) {
464 464
 				//    $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']));
465
-		    		$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']));
466
-		    	    }
465
+					$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']));
466
+					}
467 467
 			}
468 468
 			if (!isset($globalFork)) $globalFork = TRUE;
469 469
 			if (!$globalVA && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && (!isset($line['format_source']) || $line['format_source'] != 'aprs')) {
470 470
 				if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id,trim($line['ident']));
471 471
 			}
472
-		    }
472
+			}
473 473
 		}
474 474
 
475 475
 		if (isset($line['speed']) && $line['speed'] != '' && $line['speed'] != 0) {
476 476
 		//    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => $line[12]));
477
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($line['speed'])));
478
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed_fromsrc' => true));
479
-		    //$dataFound = true;
477
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($line['speed'])));
478
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed_fromsrc' => true));
479
+			//$dataFound = true;
480 480
 		} 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'])) {
481
-		    $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m');
482
-		    if ($distance > 1000 && $distance < 10000) {
483
-		    // use datetime
481
+			$distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m');
482
+			if ($distance > 1000 && $distance < 10000) {
483
+			// use datetime
484 484
 			$speed = $distance/(time() - $this->all_flights[$id]['time_last_coord']);
485 485
 			$speed = $speed*3.6;
486 486
 			if ($speed < 1000) {
@@ -489,49 +489,49 @@  discard block
 block discarded – undo
489 489
 	  		} else {
490 490
 	  			if ($globalDebug) echo "ø IGNORED : Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n";
491 491
 	  		}
492
-		    }
492
+			}
493 493
 		}
494 494
 
495 495
 
496 496
 
497
-	        if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) {
498
-	    	    if (ctype_digit(strval($line['latitude'])) || ctype_digit(strval($line['longitude']))) {
499
-	    	    	if ($globalDebug) echo "/!\ Invalid latitude or/and longitude data : lat: ".$line['latitude']." - lng: ".$line['longitude']."\n";
500
-	    	    	return false;
501
-	    	    }
502
-	    	    if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']);
503
-	    	    else unset($timediff);
504
-	    	    if (isset($this->all_flights[$id]['time_last_archive_coord'])) $timediff_archive = round(time()-$this->all_flights[$id]['time_last_archive_coord']);
505
-	    	    else unset($timediff_archive);
506
-	    	    if ($this->tmd > 5
507
-	    	        || (isset($line['format_source']) 
508
-	    	    	    && $line['format_source'] == 'airwhere' 
509
-	    	    	    && ((!isset($this->all_flights[$id]['latitude']) 
510
-	    	    		|| !isset($this->all_flights[$id]['longitude'])) 
511
-	    	    		|| (isset($this->all_flights[$id]['latitude']) 
512
-	    	    		    && isset($this->all_flights[$id]['longitude']) 
513
-	    	    		    && $this->all_flights[$id]['latitude'] != $line['latitude'] 
514
-	    	    		    && $this->all_flights[$id]['longitude'] != $line['longitude']
515
-	    	    		)
516
-	    	    	    )
517
-	    	    	)
518
-	    		|| (isset($globalVA) && $globalVA) 
519
-	    	    	|| (isset($globalIVAO) && $globalIVAO)
520
-	    	    	|| (isset($globalVATSIM) && $globalVATSIM)
521
-	    	    	|| (isset($globalphpVMS) && $globalphpVMS)
522
-	    	    	|| (isset($globalVAM) && $globalVAM)
523
-	    	    	|| !isset($timediff)
524
-	    	    	|| $timediff > $globalLiveInterval
525
-	    	    	|| $globalArchive
526
-	    	    	|| ($timediff > 30 
527
-	    	    	    && isset($this->all_flights[$id]['latitude']) 
528
-	    	    	    && isset($this->all_flights[$id]['longitude']) 
529
-	    	    	    && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m'))
530
-	    	    	    )
531
-	    	    	) {
497
+			if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) {
498
+				if (ctype_digit(strval($line['latitude'])) || ctype_digit(strval($line['longitude']))) {
499
+					if ($globalDebug) echo "/!\ Invalid latitude or/and longitude data : lat: ".$line['latitude']." - lng: ".$line['longitude']."\n";
500
+					return false;
501
+				}
502
+				if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']);
503
+				else unset($timediff);
504
+				if (isset($this->all_flights[$id]['time_last_archive_coord'])) $timediff_archive = round(time()-$this->all_flights[$id]['time_last_archive_coord']);
505
+				else unset($timediff_archive);
506
+				if ($this->tmd > 5
507
+					|| (isset($line['format_source']) 
508
+						&& $line['format_source'] == 'airwhere' 
509
+						&& ((!isset($this->all_flights[$id]['latitude']) 
510
+						|| !isset($this->all_flights[$id]['longitude'])) 
511
+						|| (isset($this->all_flights[$id]['latitude']) 
512
+							&& isset($this->all_flights[$id]['longitude']) 
513
+							&& $this->all_flights[$id]['latitude'] != $line['latitude'] 
514
+							&& $this->all_flights[$id]['longitude'] != $line['longitude']
515
+						)
516
+						)
517
+					)
518
+				|| (isset($globalVA) && $globalVA) 
519
+					|| (isset($globalIVAO) && $globalIVAO)
520
+					|| (isset($globalVATSIM) && $globalVATSIM)
521
+					|| (isset($globalphpVMS) && $globalphpVMS)
522
+					|| (isset($globalVAM) && $globalVAM)
523
+					|| !isset($timediff)
524
+					|| $timediff > $globalLiveInterval
525
+					|| $globalArchive
526
+					|| ($timediff > 30 
527
+						&& isset($this->all_flights[$id]['latitude']) 
528
+						&& isset($this->all_flights[$id]['longitude']) 
529
+						&& $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m'))
530
+						)
531
+					) {
532 532
 
533 533
 			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']))) {
534
-			    if ((isset($timediff_archive) && $timediff_archive > $globalAircraftMaxUpdate)
534
+				if ((isset($timediff_archive) && $timediff_archive > $globalAircraftMaxUpdate)
535 535
 				|| (isset($line['format_source']) && $line['format_source'] == 'airwhere') 
536 536
 				|| !$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'])) {
537 537
 				$this->all_flights[$id]['archive_latitude'] = $line['latitude'];
@@ -539,9 +539,9 @@  discard block
 block discarded – undo
539 539
 				$this->all_flights[$id]['putinarchive'] = true;
540 540
 				$this->tmd = 0;
541 541
 				if (!isset($globalNoImport) || $globalNoImport === FALSE) {
542
-				    if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_flights[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... ';
543
-				    $timeelapsed = microtime(true);
544
-				    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
542
+					if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_flights[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... ';
543
+					$timeelapsed = microtime(true);
544
+					if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
545 545
 					$Spotter = new Spotter($this->db);
546 546
 					$all_country = $Spotter->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']);
547 547
 					if (!empty($all_country)) $this->all_flights[$id]['over_country'] = $all_country['iso2'];
@@ -549,11 +549,11 @@  discard block
 block discarded – undo
549 549
 					$Spotter->db = null;
550 550
 					if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
551 551
 					if ($globalDebug) echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n";
552
-				    }
552
+					}
553 553
 				}
554 554
 				$this->all_flights[$id]['time_last_archive_coord'] = time();
555
-			    } 
556
-			    /*
555
+				} 
556
+				/*
557 557
 			    else {
558 558
 				if (!isset($timediff)) echo 'NO TIMEDIFF';
559 559
 				else {
@@ -567,16 +567,16 @@  discard block
 block discarded – undo
567 567
 			}
568 568
 
569 569
 			if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) {
570
-			    //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) {
570
+				//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) {
571 571
 				if (!isset($this->all_flights[$id]['archive_latitude'])) {
572 572
 					$this->all_flights[$id]['archive_latitude'] = $line['latitude'];
573 573
 					$this->all_flights[$id]['time_last_coord'] = time();
574 574
 				}
575 575
 				//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)) {
576 576
 				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)) {
577
-				    $this->all_flights[$id]['livedb_latitude'] = $line['latitude'];
578
-				    $dataFound = true;
579
-				    $this->all_flights[$id]['time_last_coord'] = time();
577
+					$this->all_flights[$id]['livedb_latitude'] = $line['latitude'];
578
+					$dataFound = true;
579
+					$this->all_flights[$id]['time_last_coord'] = time();
580 580
 				}
581 581
 				// elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n";
582 582
 				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('latitude' => $line['latitude']));
@@ -587,24 +587,24 @@  discard block
 block discarded – undo
587 587
 				    //$putinarchive = true;
588 588
 				}
589 589
 				*/
590
-			    /*
590
+				/*
591 591
 			    } elseif (isset($this->all_flights[$id]['latitude'])) {
592 592
 				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";
593 593
 			    }
594 594
 			    */
595 595
 			}
596 596
 			if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) {
597
-			    if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
598
-			    //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) {
597
+				if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
598
+				//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) {
599 599
 				if (!isset($this->all_flights[$id]['archive_longitude'])) {
600 600
 					$this->all_flights[$id]['archive_longitude'] = $line['longitude'];
601 601
 					$this->all_flights[$id]['time_last_coord'] = time();
602 602
 				}
603 603
 				//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)) {
604 604
 				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)) {
605
-				    $this->all_flights[$id]['livedb_longitude'] = $line['longitude'];
606
-				    $dataFound = true;
607
-				    $this->all_flights[$id]['time_last_coord'] = time();
605
+					$this->all_flights[$id]['livedb_longitude'] = $line['longitude'];
606
+					$dataFound = true;
607
+					$this->all_flights[$id]['time_last_coord'] = time();
608 608
 				}
609 609
 				// elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n";
610 610
 				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('longitude' => $line['longitude']));
@@ -622,67 +622,67 @@  discard block
 block discarded – undo
622 622
 			    */
623 623
 			}
624 624
 
625
-		    } else if ($globalDebug && $timediff > 30) {
625
+			} else if ($globalDebug && $timediff > 30) {
626 626
 			$this->tmd = $this->tmd + 1;
627 627
 			echo '!!! Too much distance in short time... for '.$this->all_flights[$id]['ident']."\n";
628 628
 			echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')."m -";
629 629
 			echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')/$timediff)*3.6)." km/h - ";
630 630
 			echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_flights[$id]['latitude'].' - prev long : '.$this->all_flights[$id]['longitude']." \n";
631
-		    }
631
+			}
632 632
 		}
633 633
 		if (isset($line['last_update']) && $line['last_update'] != '') {
634
-		    if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true;
635
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update']));
634
+			if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true;
635
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update']));
636 636
 		}
637 637
 		if (isset($line['verticalrate']) && $line['verticalrate'] != '') {
638
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('verticalrate' => $line['verticalrate']));
639
-		    //$dataFound = true;
638
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('verticalrate' => $line['verticalrate']));
639
+			//$dataFound = true;
640 640
 		}
641 641
 		if (isset($line['format_source']) && $line['format_source'] != '') {
642
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('format_source' => $line['format_source']));
642
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('format_source' => $line['format_source']));
643 643
 		}
644 644
 		if (isset($line['source_name']) && $line['source_name'] != '') {
645
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_name' => $line['source_name']));
645
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_name' => $line['source_name']));
646 646
 		}
647 647
 		if (isset($line['emergency']) && $line['emergency'] != '') {
648
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('emergency' => $line['emergency']));
649
-		    //$dataFound = true;
648
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('emergency' => $line['emergency']));
649
+			//$dataFound = true;
650 650
 		}
651 651
 		if (isset($line['ground']) && $line['ground'] != '') {
652
-		    if (isset($this->all_flights[$id]['ground']) && $this->all_flights[$id]['ground'] == 1 && $line['ground'] == 0) {
652
+			if (isset($this->all_flights[$id]['ground']) && $this->all_flights[$id]['ground'] == 1 && $line['ground'] == 0) {
653 653
 			// Here we force archive of flight because after ground it's a new one (or should be)
654 654
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0));
655 655
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1));
656 656
 			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')));
657
-		        elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
657
+				elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
658 658
 			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']));
659
-		    }
660
-		    if ($line['ground'] != 1) $line['ground'] = 0;
661
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground']));
662
-		    //$dataFound = true;
659
+			}
660
+			if ($line['ground'] != 1) $line['ground'] = 0;
661
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground']));
662
+			//$dataFound = true;
663 663
 		}
664 664
 		if (isset($line['squawk']) && $line['squawk'] != '') {
665
-		    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'])) {
666
-			    if ($this->all_flights[$id]['squawk'] != $line['squawk']) $this->all_flights[$id]['putinarchive'] = true;
667
-			    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk']));
668
-			    $highlight = '';
669
-			    if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC';
670
-			    if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC';
671
-			    if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC';
672
-			    if ($highlight != '') {
665
+			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'])) {
666
+				if ($this->all_flights[$id]['squawk'] != $line['squawk']) $this->all_flights[$id]['putinarchive'] = true;
667
+				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk']));
668
+				$highlight = '';
669
+				if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC';
670
+				if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC';
671
+				if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC';
672
+				if ($highlight != '') {
673 673
 				$timeelapsed = microtime(true);
674 674
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
675
-				    $Spotter = new Spotter($this->db);
676
-				    $Spotter->setHighlightFlight($this->all_flights[$id]['id'],$highlight);
677
-				    $Spotter->db = null;
678
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
675
+					$Spotter = new Spotter($this->db);
676
+					$Spotter->setHighlightFlight($this->all_flights[$id]['id'],$highlight);
677
+					$Spotter->db = null;
678
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
679 679
 				}
680 680
 				//$putinarchive = true;
681 681
 				//$highlight = '';
682
-			    }
682
+				}
683 683
 			    
684
-		    } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk']));
685
-		    //$dataFound = true;
684
+			} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk']));
685
+			//$dataFound = true;
686 686
 		}
687 687
 
688 688
 		if (isset($line['altitude']) && $line['altitude'] != '') {
@@ -693,13 +693,13 @@  discard block
 block discarded – undo
693 693
 					$line['altitude'] = $line['altitude'] - $geoid;
694 694
 				}
695 695
 			}
696
-		    //if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) {
696
+			//if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) {
697 697
 			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;
698 698
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude' => round($line['altitude']/100)));
699 699
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_real' => $line['altitude']));
700 700
 			//$dataFound = true;
701
-		    //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n";
702
-		    if ($globalVA !== TRUE && $globalIVAO !== TRUE && $globalVATSIM !== TRUE && $globalphpVMS !== TRUE && $globalVAM !== TRUE) {
701
+			//} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n";
702
+			if ($globalVA !== TRUE && $globalIVAO !== TRUE && $globalVATSIM !== TRUE && $globalphpVMS !== TRUE && $globalVAM !== TRUE) {
703 703
 			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) {
704 704
 				if ($globalDebug) echo '--- Reset because of altitude'."\n";
705 705
 				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0));
@@ -708,27 +708,27 @@  discard block
 block discarded – undo
708 708
 				elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
709 709
 				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']));
710 710
 			}
711
-		    }
712
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_previous' => $line['altitude']));
711
+			}
712
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_previous' => $line['altitude']));
713 713
 		}
714 714
 
715 715
 		if (isset($line['noarchive']) && $line['noarchive'] === true) {
716
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('noarchive' => true));
716
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('noarchive' => true));
717 717
 		}
718 718
 		
719 719
 		if (isset($line['heading']) && $line['heading'] != '') {
720
-		    if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 10) $this->all_flights[$id]['putinarchive'] = true;
721
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading'])));
722
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true));
723
-		    //$dataFound = true;
720
+			if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 10) $this->all_flights[$id]['putinarchive'] = true;
721
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading'])));
722
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true));
723
+			//$dataFound = true;
724 724
   		} 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']) {
725
-  		    $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']);
726
-		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading)));
727
-		    if (abs($this->all_flights[$id]['heading']-round($heading)) > 10) $this->all_flights[$id]['putinarchive'] = true;
728
-  		    if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n";
725
+  			$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']);
726
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading)));
727
+			if (abs($this->all_flights[$id]['heading']-round($heading)) > 10) $this->all_flights[$id]['putinarchive'] = true;
728
+  			if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n";
729 729
   		} elseif (isset($this->all_flights[$id]['format_source']) && $this->all_flights[$id]['format_source'] == 'ACARS') {
730
-  		    // If not enough messages and ACARS set heading to 0
731
-  		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0));
730
+  			// If not enough messages and ACARS set heading to 0
731
+  			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0));
732 732
   		}
733 733
 		if ($globalDaemon === TRUE && isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false;
734 734
 		elseif ($globalDaemon === TRUE && isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false;
@@ -741,125 +741,125 @@  discard block
 block discarded – undo
741 741
 		//if ($dataFound === true && isset($this->all_flights[$id]['hex']) && $this->all_flights[$id]['heading'] != '' && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') {
742 742
 		//if ($dataFound === true && isset($this->all_flights[$id]['hex'])) {
743 743
 		if ($dataFound === true && isset($this->all_flights[$id]['id'])) {
744
-		    $this->all_flights[$id]['lastupdate'] = time();
745
-		    if ((!isset($globalNoImport) || $globalNoImport === FALSE) && $this->all_flights[$id]['addedSpotter'] == 0) {
746
-		        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'])) {
747
-			    //print_r($this->all_flights);
748
-			    //echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n";
749
-			    //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']);
750
-			    if (!isset($this->all_flights[$id]['forcenew']) || $this->all_flights[$id]['forcenew'] == 0) {
744
+			$this->all_flights[$id]['lastupdate'] = time();
745
+			if ((!isset($globalNoImport) || $globalNoImport === FALSE) && $this->all_flights[$id]['addedSpotter'] == 0) {
746
+				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'])) {
747
+				//print_r($this->all_flights);
748
+				//echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n";
749
+				//$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']);
750
+				if (!isset($this->all_flights[$id]['forcenew']) || $this->all_flights[$id]['forcenew'] == 0) {
751 751
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
752
-				    if ($globalDebug) echo "Check if aircraft is already in DB...";
753
-				    $timeelapsed = microtime(true);
754
-				    $SpotterLive = new SpotterLive($this->db);
755
-				    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')) {
752
+					if ($globalDebug) echo "Check if aircraft is already in DB...";
753
+					$timeelapsed = microtime(true);
754
+					$SpotterLive = new SpotterLive($this->db);
755
+					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')) {
756 756
 					$recent_ident = $SpotterLive->checkModeSRecent($this->all_flights[$id]['hex']);
757 757
 					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
758
-				    } elseif (isset($line['id'])) {
758
+					} elseif (isset($line['id'])) {
759 759
 					$recent_ident = $SpotterLive->checkIdRecent($line['id']);
760 760
 					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
761
-				    } elseif (isset($this->all_flights[$id]['ident']) && $this->all_flights[$id]['ident'] != '') {
761
+					} elseif (isset($this->all_flights[$id]['ident']) && $this->all_flights[$id]['ident'] != '') {
762 762
 					$recent_ident = $SpotterLive->checkIdentRecent($this->all_flights[$id]['ident']);
763 763
 					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
764
-				    } else $recent_ident = '';
765
-				    $SpotterLive->db=null;
766
-				    if ($globalDebug && $recent_ident == '') echo " Not in DB.\n";
767
-				    elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n";
764
+					} else $recent_ident = '';
765
+					$SpotterLive->db=null;
766
+					if ($globalDebug && $recent_ident == '') echo " Not in DB.\n";
767
+					elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n";
768 768
 				} else $recent_ident = '';
769
-			    } else {
769
+				} else {
770 770
 				$recent_ident = '';
771 771
 				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 0));
772
-			    }
773
-			    //if there was no aircraft with the same callsign within the last hour and go post it into the archive
774
-			    if($recent_ident == "")
775
-			    {
772
+				}
773
+				//if there was no aircraft with the same callsign within the last hour and go post it into the archive
774
+				if($recent_ident == "")
775
+				{
776 776
 				if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." in archive DB : ";
777 777
 				if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; }
778 778
 				if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; }
779 779
 				//adds the spotter data for the archive
780 780
 				$ignoreImport = false;
781 781
 				foreach($globalAirportIgnore as $airportIgnore) {
782
-				    if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
782
+					if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
783 783
 					$ignoreImport = true;
784
-				    }
784
+					}
785 785
 				}
786 786
 				if (count($globalAirportAccept) > 0) {
787
-				    $ignoreImport = true;
788
-				    foreach($globalAirportIgnore as $airportIgnore) {
787
+					$ignoreImport = true;
788
+					foreach($globalAirportIgnore as $airportIgnore) {
789 789
 					if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
790
-					    $ignoreImport = false;
790
+						$ignoreImport = false;
791
+					}
791 792
 					}
792
-				    }
793 793
 				}
794 794
 				if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) {
795
-				    foreach($globalAirlineIgnore as $airlineIgnore) {
795
+					foreach($globalAirlineIgnore as $airlineIgnore) {
796 796
 					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)) {
797
-					    $ignoreImport = true;
797
+						$ignoreImport = true;
798
+					}
798 799
 					}
799
-				    }
800 800
 				}
801 801
 				if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) {
802
-				    $ignoreImport = true;
803
-				    foreach($globalAirlineAccept as $airlineAccept) {
802
+					$ignoreImport = true;
803
+					foreach($globalAirlineAccept as $airlineAccept) {
804 804
 					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)) {
805
-					    $ignoreImport = false;
805
+						$ignoreImport = false;
806
+					}
806 807
 					}
807
-				    }
808 808
 				}
809 809
 				if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) {
810
-				    $ignoreImport = true;
811
-				    foreach($globalPilotIdAccept as $pilotIdAccept) {
810
+					$ignoreImport = true;
811
+					foreach($globalPilotIdAccept as $pilotIdAccept) {
812 812
 					if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) {
813
-					    $ignoreImport = false;
813
+						$ignoreImport = false;
814
+					}
814 815
 					}
815
-				    }
816 816
 				}
817 817
 				
818 818
 				if (!$ignoreImport) {
819
-				    $highlight = '';
820
-				    if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack';
821
-				    if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)';
822
-				    if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency';
823
-				    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')));
824
-				    $timeelapsed = microtime(true);
825
-				    if (!isset($globalNoImport) || $globalNoImport === FALSE) {
819
+					$highlight = '';
820
+					if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack';
821
+					if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)';
822
+					if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency';
823
+					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')));
824
+					$timeelapsed = microtime(true);
825
+					if (!isset($globalNoImport) || $globalNoImport === FALSE) {
826 826
 					if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
827
-					    $Spotter = new Spotter($this->db);
828
-					    $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']);
829
-					    $Spotter->db = null;
830
-					    if ($globalDebug && isset($result)) echo $result."\n";
827
+						$Spotter = new Spotter($this->db);
828
+						$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']);
829
+						$Spotter->db = null;
830
+						if ($globalDebug && isset($result)) echo $result."\n";
831 831
 					}
832
-				    }
833
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
834
-				    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
832
+					}
833
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
834
+					if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
835 835
 
836
-				    // Add source stat in DB
837
-				    $Stats = new Stats($this->db);
838
-				    if (!empty($this->stats)) {
836
+					// Add source stat in DB
837
+					$Stats = new Stats($this->db);
838
+					if (!empty($this->stats)) {
839 839
 					if ($globalDebug) echo 'Add source stats : ';
840
-				        foreach($this->stats as $date => $data) {
841
-					    foreach($data as $source => $sourced) {
842
-					        //print_r($sourced);
843
-				    	        if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date);
844
-				    	        if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date);
845
-				    		if (isset($sourced['msg'])) {
846
-				    		    if (time() - $sourced['msg']['date'] > 10) {
847
-				    		        $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date']));
848
-				    		        echo $Stats->addStatSource($nbmsg,$source,'msg',$date);
849
-			    			        unset($this->stats[$date][$source]['msg']);
850
-			    			    }
851
-			    			}
852
-			    		    }
853
-			    		    if ($date != date('Y-m-d')) {
854
-			    			unset($this->stats[$date]);
855
-			    		    }
856
-				    	}
857
-				    	if ($globalDebug) echo 'Done'."\n";
840
+						foreach($this->stats as $date => $data) {
841
+						foreach($data as $source => $sourced) {
842
+							//print_r($sourced);
843
+								if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date);
844
+								if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date);
845
+							if (isset($sourced['msg'])) {
846
+								if (time() - $sourced['msg']['date'] > 10) {
847
+									$nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date']));
848
+									echo $Stats->addStatSource($nbmsg,$source,'msg',$date);
849
+									unset($this->stats[$date][$source]['msg']);
850
+								}
851
+							}
852
+							}
853
+							if ($date != date('Y-m-d')) {
854
+							unset($this->stats[$date]);
855
+							}
856
+						}
857
+						if ($globalDebug) echo 'Done'."\n";
858 858
 
859
-				    }
860
-				    $Stats->db = null;
861
-				    }
862
-				    $this->del();
859
+					}
860
+					$Stats->db = null;
861
+					}
862
+					$this->del();
863 863
 				} elseif ($globalDebug) echo 'Ignore data'."\n";
864 864
 				//$ignoreImport = false;
865 865
 				$this->all_flights[$id]['addedSpotter'] = 1;
@@ -877,41 +877,41 @@  discard block
 block discarded – undo
877 877
 			*/
878 878
 			//SpotterLive->deleteLiveSpotterDataByIdent($this->all_flights[$id]['ident']);
879 879
 				if ($this->last_delete == 0 || time() - $this->last_delete > 1800) {
880
-				    if ($globalDebug) echo "---- Deleting Live Spotter data older than 9 hours...";
881
-				    //SpotterLive->deleteLiveSpotterDataNotUpdated();
882
-				    if (!isset($globalNoImport) || $globalNoImport === FALSE) {
880
+					if ($globalDebug) echo "---- Deleting Live Spotter data older than 9 hours...";
881
+					//SpotterLive->deleteLiveSpotterDataNotUpdated();
882
+					if (!isset($globalNoImport) || $globalNoImport === FALSE) {
883 883
 					if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
884
-					    $SpotterLive = new SpotterLive($this->db);
885
-					    $SpotterLive->deleteLiveSpotterData();
886
-					    $SpotterLive->db=null;
884
+						$SpotterLive = new SpotterLive($this->db);
885
+						$SpotterLive->deleteLiveSpotterData();
886
+						$SpotterLive->db=null;
887 887
 					}
888
-				    }
889
-				    if ($globalDebug) echo " Done\n";
890
-				    $this->last_delete = time();
888
+					}
889
+					if ($globalDebug) echo " Done\n";
890
+					$this->last_delete = time();
891 891
 				}
892
-			    } else {
892
+				} else {
893 893
 				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')) {
894
-				    $this->all_flights[$id]['id'] = $recent_ident;
895
-				    $this->all_flights[$id]['addedSpotter'] = 1;
894
+					$this->all_flights[$id]['id'] = $recent_ident;
895
+					$this->all_flights[$id]['addedSpotter'] = 1;
896 896
 				}
897 897
 				if (isset($globalDaemon) && !$globalDaemon) {
898
-				    if (!isset($globalNoImport) || $globalNoImport === FALSE) {
898
+					if (!isset($globalNoImport) || $globalNoImport === FALSE) {
899 899
 					if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
900
-					    $Spotter = new Spotter($this->db);
901
-					    $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']);
902
-					    $Spotter->db = null;
900
+						$Spotter = new Spotter($this->db);
901
+						$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']);
902
+						$Spotter->db = null;
903
+					}
903 904
 					}
904
-				    }
905 905
 				}
906 906
 				
907
-			    }
907
+				}
908 908
 			}
909
-		    }
910
-		    //adds the spotter LIVE data
911
-		    //SpotterLive->addLiveSpotterData($flightaware_id, $ident, $aircraft_type, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed);
912
-		    //echo "\nAdd in Live !! \n";
913
-		    //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";
914
-		    if ($globalDebug) {
909
+			}
910
+			//adds the spotter LIVE data
911
+			//SpotterLive->addLiveSpotterData($flightaware_id, $ident, $aircraft_type, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed);
912
+			//echo "\nAdd in Live !! \n";
913
+			//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";
914
+			if ($globalDebug) {
915 915
 			if ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM)) {
916 916
 				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";
917 917
 				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";
@@ -919,60 +919,60 @@  discard block
 block discarded – undo
919 919
 				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";
920 920
 				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";
921 921
 			}
922
-		    }
923
-		    $ignoreImport = false;
924
-		    if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; }
925
-		    if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; }
922
+			}
923
+			$ignoreImport = false;
924
+			if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; }
925
+			if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; }
926 926
 
927
-		    foreach($globalAirportIgnore as $airportIgnore) {
928
-		        if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
929
-			    $ignoreImport = true;
927
+			foreach($globalAirportIgnore as $airportIgnore) {
928
+				if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
929
+				$ignoreImport = true;
930
+			}
930 931
 			}
931
-		    }
932
-		    if (count($globalAirportAccept) > 0) {
933
-		        $ignoreImport = true;
934
-		        foreach($globalAirportIgnore as $airportIgnore) {
935
-			    if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
932
+			if (count($globalAirportAccept) > 0) {
933
+				$ignoreImport = true;
934
+				foreach($globalAirportIgnore as $airportIgnore) {
935
+				if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) {
936 936
 				$ignoreImport = false;
937
-			    }
937
+				}
938 938
 			}
939
-		    }
940
-		    if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) {
939
+			}
940
+			if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) {
941 941
 			foreach($globalAirlineIgnore as $airlineIgnore) {
942
-			    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)) {
942
+				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)) {
943 943
 				$ignoreImport = true;
944
-			    }
944
+				}
945 945
 			}
946
-		    }
947
-		    if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) {
946
+			}
947
+			if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) {
948 948
 			$ignoreImport = true;
949 949
 			foreach($globalAirlineAccept as $airlineAccept) {
950
-			    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)) {
950
+				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)) {
951 951
 				$ignoreImport = false;
952
-			    }
952
+				}
953
+			}
953 954
 			}
954
-		    }
955
-		    if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) {
955
+			if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) {
956 956
 			$ignoreImport = true;
957 957
 			foreach($globalPilotIdAccept as $pilotIdAccept) {
958
-			    if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) {
959
-			        $ignoreImport = false;
960
-			    }
958
+				if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) {
959
+					$ignoreImport = false;
960
+				}
961
+			}
961 962
 			}
962
-		    }
963 963
 
964
-		    if (!$ignoreImport) {
964
+			if (!$ignoreImport) {
965 965
 			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'])) {
966 966
 				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')));
967 967
 				$timeelapsed = microtime(true);
968 968
 				if (!isset($globalNoImport) || $globalNoImport === FALSE) {
969
-				    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
969
+					if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
970 970
 					if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." from ".$this->all_flights[$id]['format_source']." in Live DB : ";
971 971
 					$SpotterLive = new SpotterLive($this->db);
972 972
 					$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']);
973 973
 					$SpotterLive->db = null;
974 974
 					if ($globalDebug) echo $result."\n";
975
-				    }
975
+					}
976 976
 				}
977 977
 				if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_flights[$id]['putinarchive']) {
978 978
 					$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']);
@@ -984,7 +984,7 @@  discard block
 block discarded – undo
984 984
 				//if ($line['format_source'] != 'aprs') {
985 985
 				//if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt')) {
986 986
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
987
-				    if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') {
987
+					if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') {
988 988
 					$source = $this->all_flights[$id]['source_name'];
989 989
 					if ($source == '') $source = $this->all_flights[$id]['format_source'];
990 990
 					if (!isset($this->source_location[$source])) {
@@ -1010,7 +1010,7 @@  discard block
 block discarded – undo
1010 1010
 					if ($stats_heading == 16) $stats_heading = 0;
1011 1011
 					if (!isset($this->stats[$current_date][$source]['polar'][1])) {
1012 1012
 						for ($i=0;$i<=15;$i++) {
1013
-						    $this->stats[$current_date][$source]['polar'][$i] = 0;
1013
+							$this->stats[$current_date][$source]['polar'][$i] = 0;
1014 1014
 						}
1015 1015
 						$this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance;
1016 1016
 					} else {
@@ -1023,17 +1023,17 @@  discard block
 block discarded – undo
1023 1023
 					//var_dump($this->stats);
1024 1024
 					if (!isset($this->stats[$current_date][$source]['hist'][$distance])) {
1025 1025
 						if (isset($this->stats[$current_date][$source]['hist'][0])) {
1026
-						    end($this->stats[$current_date][$source]['hist']);
1027
-						    $mini = key($this->stats[$current_date][$source]['hist'])+10;
1026
+							end($this->stats[$current_date][$source]['hist']);
1027
+							$mini = key($this->stats[$current_date][$source]['hist'])+10;
1028 1028
 						} else $mini = 0;
1029 1029
 						for ($i=$mini;$i<=$distance;$i+=10) {
1030
-						    $this->stats[$current_date][$source]['hist'][$i] = 0;
1030
+							$this->stats[$current_date][$source]['hist'][$i] = 0;
1031 1031
 						}
1032 1032
 						$this->stats[$current_date][$source]['hist'][$distance] = 1;
1033 1033
 					} else {
1034 1034
 						$this->stats[$current_date][$source]['hist'][$distance] += 1;
1035 1035
 					}
1036
-				    }
1036
+					}
1037 1037
 				}
1038 1038
 
1039 1039
 				$this->all_flights[$id]['lastupdate'] = time();
@@ -1043,7 +1043,7 @@  discard block
 block discarded – undo
1043 1043
 			//$this->del();
1044 1044
 			
1045 1045
 			if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) {
1046
-			    if ((!isset($globalNoImport) || $globalNoImport === FALSE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) {
1046
+				if ((!isset($globalNoImport) || $globalNoImport === FALSE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) {
1047 1047
 				if ($globalDebug) echo "---- Deleting Live Spotter data Not updated since 2 hour...";
1048 1048
 				$SpotterLive = new SpotterLive($this->db);
1049 1049
 				$SpotterLive->deleteLiveSpotterDataNotUpdated();
@@ -1051,19 +1051,19 @@  discard block
 block discarded – undo
1051 1051
 				//SpotterLive->deleteLiveSpotterData();
1052 1052
 				if ($globalDebug) echo " Done\n";
1053 1053
 				$this->last_delete_hourly = time();
1054
-			    } else {
1054
+				} else {
1055 1055
 				$this->del();
1056 1056
 				$this->last_delete_hourly = time();
1057
-			    }
1057
+				}
1058 1058
 			}
1059 1059
 			
1060
-		    }
1061
-		    //$ignoreImport = false;
1060
+			}
1061
+			//$ignoreImport = false;
1062 1062
 		}
1063 1063
 		//if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN);
1064 1064
 		if ($send) return $this->all_flights[$id];
1065
-	    }
1065
+		}
1066
+	}
1066 1067
 	}
1067
-    }
1068 1068
 }
1069 1069
 ?>
Please login to merge, or discard this patch.