Completed
Push — master ( 30b860...f1043a )
by Yannick
32:05
created
require/class.Scheduler.php 3 patches
Indentation   +146 added lines, -146 removed lines patch added patch discarded remove patch
@@ -28,14 +28,14 @@  discard block
 block discarded – undo
28 28
 	}
29 29
 
30 30
 	/**
31
-	* Add schedule data to database
32
-	* @param String $ident aircraft ident
33
-	* @param String $departure_airport_icao departure airport icao
34
-	* @param String $departure_airport_time departure airport time
35
-	* @param String $arrival_airport_icao arrival airport icao
36
-	* @param String $arrival_airport_time arrival airport time
31
+	 * Add schedule data to database
32
+	 * @param String $ident aircraft ident
33
+	 * @param String $departure_airport_icao departure airport icao
34
+	 * @param String $departure_airport_time departure airport time
35
+	 * @param String $arrival_airport_icao arrival airport icao
36
+	 * @param String $arrival_airport_time arrival airport time
37 37
 	/ @param String $source source of data
38
-	*/
38
+	 */
39 39
 	public function addSchedule($ident,$departure_airport_icao,$departure_airport_time,$arrival_airport_icao,$arrival_airport_time,$source = 'website') {
40 40
 		date_default_timezone_set('UTC');
41 41
 		$date = date("Y-m-d H:i:s",time());
@@ -51,18 +51,18 @@  discard block
 block discarded – undo
51 51
 		}
52 52
 		if ($sth->fetchColumn() > 0) {
53 53
 			if ($departure_airport_time == '' && $arrival_airport_time == '') {
54
-			    $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND ToAirport_ICAO = :arrival_airport_icao";
55
-			    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao);
54
+				$query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND ToAirport_ICAO = :arrival_airport_icao";
55
+				$query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao);
56 56
 			} elseif ($arrival_airport_time == '') {
57
-			    $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";
58
-			    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao);
57
+				$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";
58
+				$query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao);
59 59
 			} elseif ($departure_airport_time == '') {
60
-			    $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";
61
-			    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time);
60
+				$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";
61
+				$query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time);
62 62
 			} else {
63
-			    //$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";
64
-			    $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";
65
-			    $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);
63
+				//$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";
64
+				$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";
65
+				$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);
66 66
 			}
67 67
 			try {
68 68
 				$sth = $this->db->prepare($query);
@@ -149,15 +149,15 @@  discard block
 block discarded – undo
149 149
 	*/
150 150
 	public function checkSchedule($ident) {
151 151
 		global $globalDBdriver;
152
-	        //$query = "SELECT COUNT(*) as nb FROM schedule WHERE ident = :ident AND date_added > DATE_SUB(CURDATE(), INTERVAL 8 DAY) - 8 LIMIT 1";
153
-	        if ($globalDBdriver == 'mysql') {
152
+			//$query = "SELECT COUNT(*) as nb FROM schedule WHERE ident = :ident AND date_added > DATE_SUB(CURDATE(), INTERVAL 8 DAY) - 8 LIMIT 1";
153
+			if ($globalDBdriver == 'mysql') {
154 154
 			$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";
155 155
 		} else {
156 156
 			$query = "SELECT COUNT(*) as nb FROM routes WHERE FromAirport_ICAO <> '' AND ToAirport_ICAO <> '' AND CallSign = :ident 
157 157
 			AND ((date_added::timestamp BETWEEN CURRENT_TIMESTAMP - INTERVAL '1 MONTH' AND CURRENT_TIMESTAMP) and date_modified::timestamp IS NULL)
158 158
 			     OR (date_modified::timestamp BETWEEN CURRENT_TIMESTAMP - INTERVAL '1 MONTH' AND CURRENT_TIMESTAMP) LIMIT 1";
159 159
 		}
160
-	        $query_values = array(':ident' => $ident);
160
+			$query_values = array(':ident' => $ident);
161 161
 		 try {
162 162
 			$sth = $this->db->prepare($query);
163 163
 			$sth->execute($query_values);
@@ -170,12 +170,12 @@  discard block
 block discarded – undo
170 170
 	}
171 171
 
172 172
 	/**
173
-	* Get flight info from Air France
174
-	* @param String $callsign The callsign
175
-	* @param String $date date we want flight number info
176
-	* @param String $carrier IATA code
177
-	* @return Flight departure and arrival airports and time
178
-	*/
173
+	 * Get flight info from Air France
174
+	 * @param String $callsign The callsign
175
+	 * @param String $date date we want flight number info
176
+	 * @param String $carrier IATA code
177
+	 * @return Flight departure and arrival airports and time
178
+	 */
179 179
 	public function getAirFrance($callsign, $date = 'NOW',$carrier = 'AF') {
180 180
 		$Common = new Common();
181 181
 		$check_date = new Datetime($date);
@@ -211,11 +211,11 @@  discard block
 block discarded – undo
211 211
 	}
212 212
 
213 213
 	/**
214
-	* Get flight info from EasyJet
215
-	* @param String $callsign The callsign
216
-	* @param String $date date we want flight number info
217
-	* @return Flight departure and arrival airports and time
218
-	*/
214
+	 * Get flight info from EasyJet
215
+	 * @param String $callsign The callsign
216
+	 * @param String $date date we want flight number info
217
+	 * @return Flight departure and arrival airports and time
218
+	 */
219 219
 	private function getEasyJet($callsign, $date = 'NOW') {
220 220
 		global $globalTimezone;
221 221
 		$Common = new Common();
@@ -239,10 +239,10 @@  discard block
 block discarded – undo
239 239
 	}
240 240
 
241 241
 	/**
242
-	* Get flight info from Ryanair
243
-	* @param String $callsign The callsign
244
-	* @return Flight departure and arrival airports and time
245
-	*/
242
+	 * Get flight info from Ryanair
243
+	 * @param String $callsign The callsign
244
+	 * @return Flight departure and arrival airports and time
245
+	 */
246 246
 	private function getRyanair($callsign) {
247 247
 		$Common = new Common();
248 248
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -265,10 +265,10 @@  discard block
 block discarded – undo
265 265
 	}
266 266
 
267 267
 	/**
268
-	* Get flight info from Swiss
269
-	* @param String $callsign The callsign
270
-	* @return Flight departure and arrival airports and time
271
-	*/
268
+	 * Get flight info from Swiss
269
+	 * @param String $callsign The callsign
270
+	 * @return Flight departure and arrival airports and time
271
+	 */
272 272
 	private function getSwiss($callsign) {
273 273
 		$Common = new Common();
274 274
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -297,11 +297,11 @@  discard block
 block discarded – undo
297 297
 	}
298 298
 	
299 299
 	/**
300
-	* Get flight info from British Airways API
301
-	* @param String $callsign The callsign
302
-	* @param String $date date we want flight number info
303
-	* @return Flight departure and arrival airports and time
304
-	*/
300
+	 * Get flight info from British Airways API
301
+	 * @param String $callsign The callsign
302
+	 * @param String $date date we want flight number info
303
+	 * @return Flight departure and arrival airports and time
304
+	 */
305 305
 	public function getBritishAirways($callsign, $date = 'NOW') {
306 306
 		global $globalBritishAirwaysKey;
307 307
 		$Common = new Common();
@@ -325,11 +325,11 @@  discard block
 block discarded – undo
325 325
 	}
326 326
 
327 327
 	/**
328
-	* Get flight info from Lutfhansa API
329
-	* @param String $callsign The callsign
330
-	* @param String $date date we want flight number info
331
-	* @return Flight departure and arrival airports and time
332
-	*/
328
+	 * Get flight info from Lutfhansa API
329
+	 * @param String $callsign The callsign
330
+	 * @param String $date date we want flight number info
331
+	 * @return Flight departure and arrival airports and time
332
+	 */
333 333
 	public function getLufthansa($callsign, $date = 'NOW') {
334 334
 		global $globalLufthansaKey;
335 335
 		$Common = new Common();
@@ -359,11 +359,11 @@  discard block
 block discarded – undo
359 359
 	}
360 360
 
361 361
 	/**
362
-	* Get flight info from Transavia API
363
-	* @param String $callsign The callsign
364
-	* @param String $date date we want flight number info
365
-	* @return Flight departure and arrival airports and time
366
-	*/
362
+	 * Get flight info from Transavia API
363
+	 * @param String $callsign The callsign
364
+	 * @param String $date date we want flight number info
365
+	 * @return Flight departure and arrival airports and time
366
+	 */
367 367
 	public function getTransavia($callsign, $date = 'NOW') {
368 368
 		global $globalTransaviaKey;
369 369
 		$Common = new Common();
@@ -389,10 +389,10 @@  discard block
 block discarded – undo
389 389
 	}
390 390
 
391 391
 	/**
392
-	* Get flight info from Tunisair
393
-	* @param String $callsign The callsign
394
-	* @return Flight departure and arrival airports and time
395
-	*/
392
+	 * Get flight info from Tunisair
393
+	 * @param String $callsign The callsign
394
+	 * @return Flight departure and arrival airports and time
395
+	 */
396 396
 	public function getTunisair($callsign) {
397 397
 		$Common = new Common();
398 398
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -409,10 +409,10 @@  discard block
 block discarded – undo
409 409
 	}
410 410
 
411 411
 	/**
412
-	* Get flight info from Vueling
413
-	* @param String $callsign The callsign
414
-	* @return Flight departure and arrival airports and time
415
-	*/
412
+	 * Get flight info from Vueling
413
+	 * @param String $callsign The callsign
414
+	 * @return Flight departure and arrival airports and time
415
+	 */
416 416
 	public function getVueling($callsign,$date = 'NOW') {
417 417
 		$Common = new Common();
418 418
 		$check_date = new Datetime($date);
@@ -434,11 +434,11 @@  discard block
 block discarded – undo
434 434
 	}
435 435
 
436 436
 	/**
437
-	* Get flight info from Iberia
438
-	* @param String $callsign The callsign
439
-	* @param String $date date we want flight number info
440
-	* @return Flight departure and arrival airports and time
441
-	*/
437
+	 * Get flight info from Iberia
438
+	 * @param String $callsign The callsign
439
+	 * @param String $date date we want flight number info
440
+	 * @return Flight departure and arrival airports and time
441
+	 */
442 442
 	public function getIberia($callsign, $date = 'NOW') {
443 443
 		$Common = new Common();
444 444
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -468,11 +468,11 @@  discard block
 block discarded – undo
468 468
 	}
469 469
 
470 470
 	/**
471
-	* Get flight info from Star Alliance
472
-	* @param String $callsign The callsign
473
-	* @param String $date date we want flight number info
474
-	* @return Flight departure and arrival airports and time
475
-	*/
471
+	 * Get flight info from Star Alliance
472
+	 * @param String $callsign The callsign
473
+	 * @param String $date date we want flight number info
474
+	 * @return Flight departure and arrival airports and time
475
+	 */
476 476
 
477 477
 	private function getStarAlliance($callsign, $date = 'NOW',$carrier = '') {
478 478
 		$Common = new Common();
@@ -504,11 +504,11 @@  discard block
 block discarded – undo
504 504
 
505 505
 
506 506
 	/**
507
-	* Get flight info from Alitalia
508
-	* @param String $callsign The callsign
509
-	* @param String $date date we want flight number info
510
-	* @return Flight departure and arrival airports and time
511
-	*/
507
+	 * Get flight info from Alitalia
508
+	 * @param String $callsign The callsign
509
+	 * @param String $date date we want flight number info
510
+	 * @return Flight departure and arrival airports and time
511
+	 */
512 512
 	private function getAlitalia($callsign, $date = 'NOW') {
513 513
 		$Common = new Common();
514 514
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -527,11 +527,11 @@  discard block
 block discarded – undo
527 527
 	}
528 528
 
529 529
 	/**
530
-	* Get flight info from Brussels airlines
531
-	* @param String $callsign The callsign
532
-	* @param String $date date we want flight number info
533
-	* @return Flight departure and arrival airports and time
534
-	*/
530
+	 * Get flight info from Brussels airlines
531
+	 * @param String $callsign The callsign
532
+	 * @param String $date date we want flight number info
533
+	 * @return Flight departure and arrival airports and time
534
+	 */
535 535
 	private function getBrussels($callsign, $date = 'NOW') {
536 536
 		$Common = new Common();
537 537
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -541,24 +541,24 @@  discard block
 block discarded – undo
541 541
 		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
542 542
 		$data = $Common->getData($url);
543 543
 		if ($data != '') {
544
-		    //echo $data;
545
-		    $parsed_json = json_decode($data,true);
546
-		    if (isset($parsed_json[0]['FromAirportCode'])) {
544
+			//echo $data;
545
+			$parsed_json = json_decode($data,true);
546
+			if (isset($parsed_json[0]['FromAirportCode'])) {
547 547
 			$DepartureAirportIata = $parsed_json[0]['FromAirportCode'];
548 548
 			$ArrivalAirportIata = $parsed_json[0]['ToAirportCode'];
549 549
 			$departureTime = date('H:i',strtotime($parsed_json[0]['ScheduledDepatureDate']));
550 550
 			$arrivalTime = date('H:i',strtotime($parsed_json[0]['ScheduledArrivalDate']));
551 551
 			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_brussels');
552
-		    }
552
+			}
553 553
 		}
554 554
 	}
555 555
 
556 556
 	/**
557
-	* Get flight info from FlightRadar24
558
-	* @param String $callsign The callsign
559
-	* @param String $date date we want flight number info
560
-	* @return Flight departure and arrival airports and time
561
-	*/
557
+	 * Get flight info from FlightRadar24
558
+	 * @param String $callsign The callsign
559
+	 * @param String $date date we want flight number info
560
+	 * @return Flight departure and arrival airports and time
561
+	 */
562 562
 /*
563 563
 	public function getFlightRadar24($callsign, $date = 'NOW') {
564 564
 		$Common = new Common();
@@ -587,11 +587,11 @@  discard block
 block discarded – undo
587 587
 	}
588 588
   */
589 589
 	/**
590
-	* Get flight info from Lufthansa
591
-	* @param String $callsign The callsign
592
-	* @param String $date date we want flight number info
593
-	* @return Flight departure and arrival airports and time
594
-	*/
590
+	 * Get flight info from Lufthansa
591
+	 * @param String $callsign The callsign
592
+	 * @param String $date date we want flight number info
593
+	 * @return Flight departure and arrival airports and time
594
+	 */
595 595
 
596 596
 /*	private function getLufthansa($callsign, $date = 'NOW') {
597 597
 		$Common = new Common();
@@ -619,10 +619,10 @@  discard block
 block discarded – undo
619 619
 	}
620 620
   */
621 621
 	/**
622
-	* Get flight info from flytap
623
-	* @param String $callsign The callsign
624
-	* @return Flight departure and arrival airports and time
625
-	*/
622
+	 * Get flight info from flytap
623
+	 * @param String $callsign The callsign
624
+	 * @return Flight departure and arrival airports and time
625
+	 */
626 626
 	private function getFlyTap($callsign) {
627 627
 		$Common = new Common();
628 628
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -645,10 +645,10 @@  discard block
 block discarded – undo
645 645
 	}
646 646
 
647 647
 	/**
648
-	* Get flight info from flightmapper
649
-	* @param String $callsign The callsign
650
-	* @return Flight departure and arrival airports and time
651
-	*/
648
+	 * Get flight info from flightmapper
649
+	 * @param String $callsign The callsign
650
+	 * @return Flight departure and arrival airports and time
651
+	 */
652 652
 	public function getFlightMapper($callsign) {
653 653
 		$Common = new Common();
654 654
 		$airline_icao = '';
@@ -676,11 +676,11 @@  discard block
 block discarded – undo
676 676
 				$aarr = '';
677 677
 				$n = sscanf($sched,'%*s %5[0-9:] %*[^()] (%3[A-Z]) %5[0-9:] %*[^()] (%3[A-Z])',$dhour,$darr,$ahour,$aarr);
678 678
 				if ($n == 7) {
679
-				    $departureTime = $dhour;
680
-				    $arrivalTime = $ahour;
681
-				    $DepartureAirportIata = str_replace(array('(',')'),'',$darr);
682
-				    $ArrivalAirportIata = str_replace(array('(',')'),'',$aarr);
683
-				    return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_flightmapper');
679
+					$departureTime = $dhour;
680
+					$arrivalTime = $ahour;
681
+					$DepartureAirportIata = str_replace(array('(',')'),'',$darr);
682
+					$ArrivalAirportIata = str_replace(array('(',')'),'',$aarr);
683
+					return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_flightmapper');
684 684
 				}
685 685
 			}
686 686
 		}
@@ -688,10 +688,10 @@  discard block
 block discarded – undo
688 688
 	}
689 689
 
690 690
 	/**
691
-	* Get flight info from flightaware
692
-	* @param String $callsign The callsign
693
-	* @return Flight departure and arrival airports and time
694
-	*/
691
+	 * Get flight info from flightaware
692
+	 * @param String $callsign The callsign
693
+	 * @return Flight departure and arrival airports and time
694
+	 */
695 695
 	public function getFlightAware($callsign) {
696 696
 		global $globalFlightAwareUsername, $globalFlightAwarePassword;
697 697
 		date_default_timezone_set('UTC');
@@ -716,11 +716,11 @@  discard block
 block discarded – undo
716 716
 				$flight = $result['FlightInfoStatusResult']['flights'][0];
717 717
 				if (isset($flight['origin'])) {
718 718
 					return array(
719
-					    'DepartureAirportIATA' => $flight['origin']['alternate_ident'],
720
-					    'DepartureTime' => $flight['filed_departure_time']['time'],
721
-					    'ArrivalAirportIATA' => $flight['destination']['alternate_ident'],
722
-					    'ArrivalTime' => $flight['filed_arrival_time']['time'],
723
-					    'Source' => 'website_flightaware');
719
+						'DepartureAirportIATA' => $flight['origin']['alternate_ident'],
720
+						'DepartureTime' => $flight['filed_departure_time']['time'],
721
+						'ArrivalAirportIATA' => $flight['destination']['alternate_ident'],
722
+						'ArrivalTime' => $flight['filed_arrival_time']['time'],
723
+						'Source' => 'website_flightaware');
724 724
 				}
725 725
 			}
726 726
 		}
@@ -733,21 +733,21 @@  discard block
 block discarded – undo
733 733
 			$flight = reset($flights['flights']);
734 734
 			if (isset($flight['activityLog']['flights'][0]['origin'])) {
735 735
 				return array(
736
-				    'DepartureAirportIATA' => $flight['activityLog']['flights'][0]['origin']['iata'],
737
-				    'DepartureTime' => date('H:i',$flight['activityLog']['flights'][0]['takeoffTimes']['scheduled']),
738
-				    'ArrivalAirportIATA' => $flight['activityLog']['flights'][0]['destination']['iata'],
739
-				    'ArrivalTime' => date('H:i',$flight['activityLog']['flights'][0]['landingTimes']['scheduled']),
740
-				    'Source' => 'website_flightaware');
736
+					'DepartureAirportIATA' => $flight['activityLog']['flights'][0]['origin']['iata'],
737
+					'DepartureTime' => date('H:i',$flight['activityLog']['flights'][0]['takeoffTimes']['scheduled']),
738
+					'ArrivalAirportIATA' => $flight['activityLog']['flights'][0]['destination']['iata'],
739
+					'ArrivalTime' => date('H:i',$flight['activityLog']['flights'][0]['landingTimes']['scheduled']),
740
+					'Source' => 'website_flightaware');
741 741
 			}
742 742
 		}
743 743
 		return array();
744 744
 	}
745 745
 
746 746
 	/**
747
-	* Get flight info from CostToTravel
748
-	* @param String $callsign The callsign
749
-	* @return Flight departure and arrival airports and time
750
-	*/
747
+	 * Get flight info from CostToTravel
748
+	 * @param String $callsign The callsign
749
+	 * @return Flight departure and arrival airports and time
750
+	 */
751 751
 	public function getCostToTravel($callsign) {
752 752
 		$Common = new Common();
753 753
 		$url= "http://www.costtotravel.com/flight-number/".$callsign;
@@ -770,11 +770,11 @@  discard block
 block discarded – undo
770 770
 	}
771 771
 
772 772
 	/**
773
-	* Get flight info from Air Canada
774
-	* @param String $callsign The callsign
775
-	* @param String $date date we want flight number info
776
-	* @return Flight departure and arrival airports and time
777
-	*/
773
+	 * Get flight info from Air Canada
774
+	 * @param String $callsign The callsign
775
+	 * @param String $date date we want flight number info
776
+	 * @return Flight departure and arrival airports and time
777
+	 */
778 778
 	private function getAirCanada($callsign,$date = 'NOW') {
779 779
 		$Common = new Common();
780 780
 		if (class_exists("DomDocument") === FALSE) return array();
@@ -799,11 +799,11 @@  discard block
 block discarded – undo
799 799
 	}
800 800
 
801 801
 	/**
802
-	* Get flight info from Vietnam Airlines
803
-	* @param String $callsign The callsign
804
-	* @param String $date date we want flight number info
805
-	* @return Flight departure and arrival airports and time
806
-	*/
802
+	 * Get flight info from Vietnam Airlines
803
+	 * @param String $callsign The callsign
804
+	 * @param String $date date we want flight number info
805
+	 * @return Flight departure and arrival airports and time
806
+	 */
807 807
 	private function getVietnamAirlines($callsign, $date = 'NOW') {
808 808
 		$Common = new Common();
809 809
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -825,12 +825,12 @@  discard block
 block discarded – undo
825 825
 	}
826 826
 
827 827
 	/**
828
-	* Get flight info from Air Berlin
829
-	* @param String $callsign The callsign
830
-	* @param String $date date we want flight number info
831
-	* @param String $carrier airline code
832
-	* @return Flight departure and arrival airports and time
833
-	*/
828
+	 * Get flight info from Air Berlin
829
+	 * @param String $callsign The callsign
830
+	 * @param String $date date we want flight number info
831
+	 * @param String $carrier airline code
832
+	 * @return Flight departure and arrival airports and time
833
+	 */
834 834
 	private function getAirBerlin($callsign, $date = 'NOW',$carrier = 'AB') {
835 835
 		$Common = new Common();
836 836
 		date_default_timezone_set('UTC');
@@ -859,11 +859,11 @@  discard block
 block discarded – undo
859 859
 			$table = $Common->table2array($data);
860 860
 			$flight = $table;
861 861
 			if (isset($flight[5][4])) {
862
-			    $arrivalTime = $flight[5][4];
863
-			    $arrivalAirport = $flight[5][3];
862
+				$arrivalTime = $flight[5][4];
863
+				$arrivalAirport = $flight[5][3];
864 864
 			} else {
865
-			    $arrivalTime = '';
866
-			    $arrivalAirport = '';
865
+				$arrivalTime = '';
866
+				$arrivalAirport = '';
867 867
 			}
868 868
 		} else return array();
869 869
 		$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.
Spacing   +166 added lines, -166 removed lines patch added patch discarded remove patch
@@ -36,9 +36,9 @@  discard block
 block discarded – undo
36 36
 	* @param String $arrival_airport_time arrival airport time
37 37
 	/ @param String $source source of data
38 38
 	*/
39
-	public function addSchedule($ident,$departure_airport_icao,$departure_airport_time,$arrival_airport_icao,$arrival_airport_time,$source = 'website') {
39
+	public function addSchedule($ident, $departure_airport_icao, $departure_airport_time, $arrival_airport_icao, $arrival_airport_time, $source = 'website') {
40 40
 		date_default_timezone_set('UTC');
41
-		$date = date("Y-m-d H:i:s",time());
41
+		$date = date("Y-m-d H:i:s", time());
42 42
 		//if ($departure_airport_time == '' && $arrival_airport_time == '') exit;
43 43
 		//$query = "SELECT COUNT(*) FROM schedule WHERE ident = :ident";
44 44
 		$query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident";
@@ -46,69 +46,69 @@  discard block
 block discarded – undo
46 46
 		 try {
47 47
 			$sth = $this->db->prepare($query);
48 48
 			$sth->execute($query_values);
49
-		} catch(PDOException $e) {
49
+		} catch (PDOException $e) {
50 50
 			return "error : ".$e->getMessage();
51 51
 		}
52 52
 		if ($sth->fetchColumn() > 0) {
53 53
 			if ($departure_airport_time == '' && $arrival_airport_time == '') {
54 54
 			    $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND ToAirport_ICAO = :arrival_airport_icao";
55
-			    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao);
55
+			    $query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao);
56 56
 			} elseif ($arrival_airport_time == '') {
57 57
 			    $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";
58
-			    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao);
58
+			    $query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_icao' => $arrival_airport_icao);
59 59
 			} elseif ($departure_airport_time == '') {
60 60
 			    $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";
61
-			    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time);
61
+			    $query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_time' => $arrival_airport_time);
62 62
 			} else {
63 63
 			    //$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";
64 64
 			    $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";
65
-			    $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
+			    $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);
66 66
 			}
67 67
 			try {
68 68
 				$sth = $this->db->prepare($query);
69 69
 				$sth->execute($query_values);
70
-			} catch(PDOException $e) {
70
+			} catch (PDOException $e) {
71 71
 				return "error : ".$e->getMessage();
72 72
 			}
73 73
 			if ($sth->fetchColumn() == 0) {
74 74
 				//$query = 'UPDATE schedule SET departure_airport_icao = :departure_airport_icao, departure_airport_time = :departure_airport_time, arrival_airport_icao = :arrival_airport_icao, arrival_airport_time = :arrival_airport_time, date_modified = :date, source = :source WHERE ident = :ident';
75 75
 				if ($departure_airport_time == '' && $arrival_airport_time == '') {
76 76
 					$query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, ToAirport_ICAO = :arrival_airport_icao, date_modified = :date, Source = :source WHERE CallSign = :ident';
77
-					$query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao, ':date' => $date, ':source' => $source);
77
+					$query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':date' => $date, ':source' => $source);
78 78
 				} elseif ($arrival_airport_time == '') {
79 79
 					$query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, FromAiport_Time = :departure_airport_time, ToAirport_ICAO = :arrival_airport_icao, date_modified = :date, Source = :source WHERE CallSign = :ident';
80
-					$query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao, ':date' => $date, ':source' => $source);
80
+					$query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_icao' => $arrival_airport_icao, ':date' => $date, ':source' => $source);
81 81
 				} elseif ($departure_airport_time == '') {
82 82
 					$query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, ToAirport_ICAO = :arrival_airport_icao, ToAirport_Time = :arrival_airport_time, date_modified = :date, Source = :source WHERE CallSign = :ident';
83
-					$query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time, ':date' => $date, ':source' => $source);
83
+					$query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_time' => $arrival_airport_time, ':date' => $date, ':source' => $source);
84 84
 				} else {
85 85
 					$query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, FromAiport_Time = :departure_airport_time, ToAirport_ICAO = :arrival_airport_icao, ToAirport_Time = :arrival_airport_time, date_modified = :date, Source = :source WHERE CallSign = :ident';
86
-					$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, ':date' => $date, ':source' => $source);
86
+					$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, ':date' => $date, ':source' => $source);
87 87
 				}
88 88
 				try {
89 89
 					$sth = $this->db->prepare($query);
90 90
 					$sth->execute($query_values);
91
-				} catch(PDOException $e) {
91
+				} catch (PDOException $e) {
92 92
 					return "error : ".$e->getMessage();
93 93
 				}
94 94
 			} else {
95 95
 				//$query = 'UPDATE schedule SET date_lastseen = :date WHERE ident = :ident';
96 96
 				$query = 'UPDATE routes SET date_lastseen = :date WHERE CallSign = :ident';
97
-				$query_values = array(':ident' => $ident,':date' => $date);
97
+				$query_values = array(':ident' => $ident, ':date' => $date);
98 98
 				try {
99 99
 					$sth = $this->db->prepare($query);
100 100
 					$sth->execute($query_values);
101
-				} catch(PDOException $e) {
101
+				} catch (PDOException $e) {
102 102
 					return "error : ".$e->getMessage();
103 103
 				}
104 104
 			}
105 105
 		} else {
106 106
 			$query = 'INSERT INTO  routes (CallSign,FromAirport_ICAO, FromAirport_Time, ToAirport_ICAO, ToAirport_Time,date_added,source)  VALUES (:ident,:departure_airport_icao,:departure_airport_time,:arrival_airport_icao,:arrival_airport_time,:date,:source)';
107
-			$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, ':date' => $date, ':source' => $source);
107
+			$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, ':date' => $date, ':source' => $source);
108 108
 			 try {
109 109
 				$sth = $this->db->prepare($query);
110 110
 				$sth->execute($query_values);
111
-			} catch(PDOException $e) {
111
+			} catch (PDOException $e) {
112 112
 				return "error : ".$e->getMessage();
113 113
 			}
114 114
 		}
@@ -121,10 +121,10 @@  discard block
 block discarded – undo
121 121
 	*/
122 122
 	public function getSchedule($ident) {
123 123
 		$Translation = new Translation($this->db);
124
-		$operator = $Translation->checkTranslation($ident,false);
124
+		$operator = $Translation->checkTranslation($ident, false);
125 125
 		if ($ident != $operator) {
126 126
 			$query = "SELECT FromAirport_ICAO as departure_airport_icao, ToAirport_ICAO as arrival_airport_icao, FromAirport_Time as departure_airport_time, ToAirport_Time as arrival_airport_time FROM routes WHERE FromAirport_ICAO <> '' AND ToAirport_ICAO <> '' AND CallSign = :operator OR CallSign = :ident LIMIT 1";
127
-			$query_values = array(':ident' => $ident,'operator' => $operator);
127
+			$query_values = array(':ident' => $ident, 'operator' => $operator);
128 128
 		} else {
129 129
 			$query = "SELECT FromAirport_ICAO as departure_airport_icao, ToAirport_ICAO as arrival_airport_icao, FromAirport_Time as departure_airport_time, ToAirport_Time as arrival_airport_time FROM routes WHERE FromAirport_ICAO <> '' AND ToAirport_ICAO <> '' AND CallSign = :ident LIMIT 1";
130 130
 			$query_values = array(':ident' => $ident);
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 		 try {
133 133
 			$sth = $this->db->prepare($query);
134 134
 			$sth->execute($query_values);
135
-		} catch(PDOException $e) {
135
+		} catch (PDOException $e) {
136 136
 			return "error : ".$e->getMessage();
137 137
 		}
138 138
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 		 try {
162 162
 			$sth = $this->db->prepare($query);
163 163
 			$sth->execute($query_values);
164
-		} catch(PDOException $e) {
164
+		} catch (PDOException $e) {
165 165
 			return "error : ".$e->getMessage();
166 166
 		}
167 167
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -176,16 +176,16 @@  discard block
 block discarded – undo
176 176
 	* @param String $carrier IATA code
177 177
 	* @return Flight departure and arrival airports and time
178 178
 	*/
179
-	public function getAirFrance($callsign, $date = 'NOW',$carrier = 'AF') {
179
+	public function getAirFrance($callsign, $date = 'NOW', $carrier = 'AF') {
180 180
 		$Common = new Common();
181 181
 		$check_date = new Datetime($date);
182
-		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
183
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
182
+		$numvol = preg_replace('/^[A-Z]*/', '', $callsign);
183
+		if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array();
184 184
 		$url = "http://www.airfrance.fr/cgi-bin/AF/FR/fr/local/resainfovol/infovols/detailsVolJson.do?codeCompagnie[0]=".$carrier."&numeroVol[0]=".$numvol."&dayFlightDate=".$check_date->format('d')."&yearMonthFlightDate=".$check_date->format('Ym');
185 185
 		$json = $Common->getData($url);
186 186
 		var_dump($json);
187 187
 		$parsed_json = json_decode($json);
188
-		if (property_exists($parsed_json,'errors') === false) {
188
+		if (property_exists($parsed_json, 'errors') === false) {
189 189
 			//$originLong = $parsed_json->{'flightsList'}[0]->{'segmentsList'}[0]->{'originLong'};
190 190
 			$originShort = $parsed_json->{'flightsList'}[0]->{'segmentsList'}[0]->{'originShort'};
191 191
 			//$departureDateMedium = $parsed_json->{'flightsList'}[0]->{'segmentsList'}[0]->{'departureDateMedium'};
@@ -195,9 +195,9 @@  discard block
 block discarded – undo
195 195
 			//$arrivalDateMedium = $parsed_json->{'flightsList'}[0]->{'segmentsList'}[0]->{'arrivalDateMedium'};
196 196
 			$arrivalTime = $parsed_json->{'flightsList'}[0]->{'segmentsList'}[0]->{'arrivalTime'};
197 197
 
198
-			preg_match('/\((.*?)\)/',$originShort,$originiata);
198
+			preg_match('/\((.*?)\)/', $originShort, $originiata);
199 199
 			$DepartureAirportIata = $originiata[1];
200
-			preg_match('/\((.*?)\)/',$destinationShort,$destinationiata);
200
+			preg_match('/\((.*?)\)/', $destinationShort, $destinationiata);
201 201
 			$ArrivalAirportIata = $destinationiata[1];
202 202
 
203 203
 			/*
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 			$arrivalTime = gmdate('H:i',strtotime($arrivalTime));
207 207
 			*/
208 208
 		
209
-			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_airfrance');
209
+			return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_airfrance');
210 210
 		} else return array();
211 211
 	}
212 212
 
@@ -221,8 +221,8 @@  discard block
 block discarded – undo
221 221
 		$Common = new Common();
222 222
 		date_default_timezone_set($globalTimezone);
223 223
 		$check_date = new Datetime($date);
224
-		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
225
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
224
+		$numvol = preg_replace('/^[A-Z]*/', '', $callsign);
225
+		if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array();
226 226
 		$url = "http://www.easyjet.com/ft/api/flights?date=".$check_date->format('Y-m-d')."&fn=".$callsign;
227 227
 		$json = $Common->getData($url);
228 228
 		$parsed_json = json_decode($json);
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 			$departureTime = $parsed_json->{'flights'}[0]->{'dates'}->{'fstd'};
235 235
 			$arrivalTime = $parsed_json->{'flights'}[0]->{'dates'}->{'fsta'};
236 236
 
237
-			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_easyjet');
237
+			return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_easyjet');
238 238
 		} else return array();
239 239
 	}
240 240
 
@@ -245,12 +245,12 @@  discard block
 block discarded – undo
245 245
 	*/
246 246
 	private function getRyanair($callsign) {
247 247
 		$Common = new Common();
248
-		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
249
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
248
+		$numvol = preg_replace('/^[A-Z]*/', '', $callsign);
249
+		if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array();
250 250
 		$url = "http://www.ryanair.com/fr/api/2/flight-info/0/50/";
251 251
 		$post = '{"flight":"'.$numvol.'","minDepartureTime":"00:00","maxDepartureTime":"23:59"}';
252
-		$headers = array('Content-Type: application/json','Content-Length: ' . strlen($post));
253
-		$json = $Common->getData($url,'post',$post,$headers);
252
+		$headers = array('Content-Type: application/json', 'Content-Length: '.strlen($post));
253
+		$json = $Common->getData($url, 'post', $post, $headers);
254 254
 		$parsed_json = json_decode($json);
255 255
 		if (isset($parsed_json->{'flightInfo'})) {
256 256
 			$flights = $parsed_json->{'flightInfo'};
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 				$ArrivalAirportIata = $parsed_json->{'flightInfo'}[0]->{'arrivalAirport'}->{'iata'}; //name
260 260
 				$departureTime = $parsed_json->{'flightInfo'}[0]->{'departureTime'};
261 261
 				$arrivalTime = $parsed_json->{'flightInfo'}[0]->{'arrivalTime'};
262
-				return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime, 'Source' => 'website_ryanair');
262
+				return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_ryanair');
263 263
 			} else return array();
264 264
 		} else return array();
265 265
 	}
@@ -271,8 +271,8 @@  discard block
 block discarded – undo
271 271
 	*/
272 272
 	private function getSwiss($callsign) {
273 273
 		$Common = new Common();
274
-		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
275
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
274
+		$numvol = preg_replace('/^[A-Z]*/', '', $callsign);
275
+		if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array();
276 276
 		$url = "http://www.world-of-swiss.com/fr/routenetwork.json";
277 277
 		$json = $Common->getData($url);
278 278
 		$parsed_json = json_decode($json);
@@ -286,12 +286,12 @@  discard block
 block discarded – undo
286 286
 				if ($flight->{'no'} == "Vol LX ".$numvol) {
287 287
 					$DepartureAirportIata = $flight->{'from'}->{'code'}; //city
288 288
 					$ArrivalAirportIata = $flight->{'to'}->{'code'}; //city
289
-					$departureTime = substr($flight->{'from'}->{'hour'},0,5);
290
-					$arrivalTime = substr($flight->{'to'}->{'hour'},0,5);
289
+					$departureTime = substr($flight->{'from'}->{'hour'},0, 5);
290
+					$arrivalTime = substr($flight->{'to'}->{'hour'},0, 5);
291 291
 				}
292 292
 			}
293 293
 			if (isset($DepartureAirportIata) && isset($ArrivalAirportIata)) {
294
-				return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_swiss');
294
+				return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_swiss');
295 295
 			} else return array();
296 296
 		} else return array();
297 297
 	}
@@ -306,21 +306,21 @@  discard block
 block discarded – undo
306 306
 		global $globalBritishAirwaysKey;
307 307
 		$Common = new Common();
308 308
 		$check_date = new Datetime($date);
309
-		$numvol = sprintf('%04d',preg_replace('/^[A-Z]*/','',$callsign));
310
-		if (!filter_var(preg_replace('/^[A-Z]*/','',$callsign),FILTER_VALIDATE_INT)) return array();
309
+		$numvol = sprintf('%04d', preg_replace('/^[A-Z]*/', '', $callsign));
310
+		if (!filter_var(preg_replace('/^[A-Z]*/', '', $callsign), FILTER_VALIDATE_INT)) return array();
311 311
 		if ($globalBritishAirwaysKey == '') return array();
312 312
 		$url = "https://api.ba.com/rest-v1/v1/flights;flightNumber=".$numvol.";scheduledDepartureDate=".$check_date->format('Y-m-d').".json";
313 313
 		$headers = array('Client-Key: '.$globalBritishAirwaysKey);
314
-		$json = $Common->getData($url,'get','',$headers);
314
+		$json = $Common->getData($url, 'get', '', $headers);
315 315
 		if ($json == '') return array();
316 316
 		$parsed_json = json_decode($json);
317 317
 		$flights = $parsed_json->{'FlightsResponse'};
318 318
 		if (count($flights) > 0) {
319 319
 			$DepartureAirportIata = $parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'DepartureAirport'};
320 320
 			$ArrivalAirportIata = $parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'ArrivalAirport'};
321
-			$departureTime = date('H:i',strtotime($parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'ScheduledDepartureDateTime'}));
322
-			$arrivalTime = date('H:i',strtotime($parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'ScheduledArrivalDateTime'}));
323
-			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_britishairways');
321
+			$departureTime = date('H:i', strtotime($parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'ScheduledDepartureDateTime'}));
322
+			$arrivalTime = date('H:i', strtotime($parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'ScheduledArrivalDateTime'}));
323
+			return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_britishairways');
324 324
 		} else return array();
325 325
 	}
326 326
 
@@ -334,27 +334,27 @@  discard block
 block discarded – undo
334 334
 		global $globalLufthansaKey;
335 335
 		$Common = new Common();
336 336
 		$check_date = new Datetime($date);
337
-		$numvol = sprintf('%04d',preg_replace('/^[A-Z]*/','',$callsign));
338
-		if (!filter_var(preg_replace('/^[A-Z]*/','',$callsign),FILTER_VALIDATE_INT)) return array();
337
+		$numvol = sprintf('%04d', preg_replace('/^[A-Z]*/', '', $callsign));
338
+		if (!filter_var(preg_replace('/^[A-Z]*/', '', $callsign), FILTER_VALIDATE_INT)) return array();
339 339
 		if (!isset($globalLufthansaKey) || $globalLufthansaKey == '' || !isset($globalLufthansaKey['key']) || $globalLufthansaKey['key'] == '') return array();
340 340
 		$url = "https://api.lufthansa.com/v1/oauth/token";
341
-		$post = array('client_id' => $globalLufthansaKey['key'],'client_secret' => $globalLufthansaKey['secret'],'grant_type' => 'client_credentials');
342
-		$data = $Common->getData($url,'post',$post);
341
+		$post = array('client_id' => $globalLufthansaKey['key'], 'client_secret' => $globalLufthansaKey['secret'], 'grant_type' => 'client_credentials');
342
+		$data = $Common->getData($url, 'post', $post);
343 343
 		$parsed_data = json_decode($data);
344 344
 		if (!isset($parsed_data->{'access_token'})) return array();
345 345
 		$token = $parsed_data->{'access_token'};
346 346
 		
347 347
 		$url = "https://api.lufthansa.com/v1/operations/flightstatus/LH".$numvol."/".$check_date->format('Y-m-d');
348
-		$headers = array('Authorization: Bearer '.$token,'Accept: application/json');
349
-		$json = $Common->getData($url,'get','',$headers);
348
+		$headers = array('Authorization: Bearer '.$token, 'Accept: application/json');
349
+		$json = $Common->getData($url, 'get', '', $headers);
350 350
 		if ($json == '') return array();
351 351
 		$parsed_json = json_decode($json);
352 352
 		if (isset($parsed_json->{'FlightStatusResource'}) && count($parsed_json->{'FlightStatusResource'}) > 0) {
353 353
 			$DepartureAirportIata = $parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Departure'}->{'AirportCode'};
354
-			$departureTime = date('H:i',strtotime($parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Departure'}->{'ScheduledTimeLocal'}->{'DateTime'}));
354
+			$departureTime = date('H:i', strtotime($parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Departure'}->{'ScheduledTimeLocal'}->{'DateTime'}));
355 355
 			$ArrivalAirportIata = $parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Arrival'}->{'AirportCode'};
356
-			$arrivalTime = date('H:i',strtotime($parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Arrival'}->{'ScheduledTimeLocal'}->{'DateTime'}));
357
-			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_lufthansa');
356
+			$arrivalTime = date('H:i', strtotime($parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Arrival'}->{'ScheduledTimeLocal'}->{'DateTime'}));
357
+			return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_lufthansa');
358 358
 		} else return array();
359 359
 	}
360 360
 
@@ -368,23 +368,23 @@  discard block
 block discarded – undo
368 368
 		global $globalTransaviaKey;
369 369
 		$Common = new Common();
370 370
 		$check_date = new Datetime($date);
371
-		$numvol = sprintf('%04d',preg_replace('/^[A-Z]*/','',$callsign));
372
-		if (!filter_var(preg_replace('/^[A-Z]*/','',$callsign),FILTER_VALIDATE_INT)) return array();
371
+		$numvol = sprintf('%04d', preg_replace('/^[A-Z]*/', '', $callsign));
372
+		if (!filter_var(preg_replace('/^[A-Z]*/', '', $callsign), FILTER_VALIDATE_INT)) return array();
373 373
 		if ($globalTransaviaKey == '') return array();
374 374
 		$url = "https://tst.api.transavia.com/v1/flightstatus/departuredate/".$check_date->format('Ymd').'/flightnumber/HV'.$numvol;
375 375
 		//$url = "https://api.transavia.com/v1/flightstatus/departuredate/".$check_date->format('Ymd').'/flightnumber/HV'.$numvol;
376 376
 		$headers = array('apikey: '.$globalTransaviaKey);
377
-		$json = $Common->getData($url,'get','',$headers);
377
+		$json = $Common->getData($url, 'get', '', $headers);
378 378
 		//echo 'result : '.$json;
379 379
 		if ($json == '') return array();
380 380
 		$parsed_json = json_decode($json);
381 381
 		
382 382
 		if (isset($parsed_json->{'data'}[0])) {
383 383
 			$DepartureAirportIata = $parsed_json->{'data'}[0]->{'flight'}->{'departureAirport'}->{'locationCode'};
384
-			$departureTime = date('H:i',strtotime($parsed_json->{'data'}[0]->{'flight'}->{'departureDateTime'}));
384
+			$departureTime = date('H:i', strtotime($parsed_json->{'data'}[0]->{'flight'}->{'departureDateTime'}));
385 385
 			$ArrivalAirportIata = $parsed_json->{'data'}[0]->{'flight'}->{'arrivalAirport'}->{'locationCode'};
386
-			$arrivalTime = date('H:i',strtotime($parsed_json->{'data'}[0]->{'flight'}->{'arrivalDateTime'}));
387
-			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_transavia');
386
+			$arrivalTime = date('H:i', strtotime($parsed_json->{'data'}[0]->{'flight'}->{'arrivalDateTime'}));
387
+			return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_transavia');
388 388
 		} else return array();
389 389
 	}
390 390
 
@@ -395,14 +395,14 @@  discard block
 block discarded – undo
395 395
 	*/
396 396
 	public function getTunisair($callsign) {
397 397
 		$Common = new Common();
398
-		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
399
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
398
+		$numvol = preg_replace('/^[A-Z]*/', '', $callsign);
399
+		if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array();
400 400
 		$url = "http://www.tunisair.com/site/publish/module/Volj/fr/Flight_List.asp";
401 401
 		$data = $Common->getData($url);
402 402
 		$table = $Common->table2array($data);
403 403
 		foreach ($table as $flight) {
404
-			if (isset($flight[1]) && $flight[1] == "TU ".sprintf('%04d',$numvol)) {
405
-				return array('DepartureAirportIATA' => $flight[2],'DepartureTime' => str_replace('.',':',$flight[5]),'ArrivalAirportIATA' => $flight[3],'ArrivalTime' => str_replace('.',':',$flight[6]),'Source' => 'website_tunisair');
404
+			if (isset($flight[1]) && $flight[1] == "TU ".sprintf('%04d', $numvol)) {
405
+				return array('DepartureAirportIATA' => $flight[2], 'DepartureTime' => str_replace('.', ':', $flight[5]), 'ArrivalAirportIATA' => $flight[3], 'ArrivalTime' => str_replace('.', ':', $flight[6]), 'Source' => 'website_tunisair');
406 406
 			}
407 407
 		}
408 408
 		return array();
@@ -413,21 +413,21 @@  discard block
 block discarded – undo
413 413
 	* @param String $callsign The callsign
414 414
 	* @return Flight departure and arrival airports and time
415 415
 	*/
416
-	public function getVueling($callsign,$date = 'NOW') {
416
+	public function getVueling($callsign, $date = 'NOW') {
417 417
 		$Common = new Common();
418 418
 		$check_date = new Datetime($date);
419
-		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
420
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
421
-		$final_date = str_replace('/','%2F',$check_date->format('d/m/Y'));
419
+		$numvol = preg_replace('/^[A-Z]*/', '', $callsign);
420
+		if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array();
421
+		$final_date = str_replace('/', '%2F', $check_date->format('d/m/Y'));
422 422
 		$url = "http://www.vueling.com/Base/BaseProxy/RenderMacro/?macroalias=FlightStatusResult&searchBy=bycode&date=".$final_date."&flightNumber=".$numvol."&idioma=en-GB";
423 423
 		$data = $Common->getData($url);
424
-		$data=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$data));
424
+		$data = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $data));
425 425
 		if ($data != '') {
426
-			preg_match('/flightOri=[A-Z]{3}/',$data,$result);
427
-			$DepartureAirportIata = str_replace('flightOri=','',$result[0]);
428
-			preg_match('/flightDest=[A-Z]{3}/',$data,$result);
429
-			$ArrivalAirportIata = str_replace('flightDest=','',$result[0]);
430
-			if ($DepartureAirportIata != '' && $ArrivalAirportIata != '') return array('DepartureAirportIATA' => $DepartureAirportIata,'ArrivalAirportIATA' => $ArrivalAirportIata,'Source' => 'website_vueling');
426
+			preg_match('/flightOri=[A-Z]{3}/', $data, $result);
427
+			$DepartureAirportIata = str_replace('flightOri=', '', $result[0]);
428
+			preg_match('/flightDest=[A-Z]{3}/', $data, $result);
429
+			$ArrivalAirportIata = str_replace('flightDest=', '', $result[0]);
430
+			if ($DepartureAirportIata != '' && $ArrivalAirportIata != '') return array('DepartureAirportIATA' => $DepartureAirportIata, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'Source' => 'website_vueling');
431 431
 			else return array();
432 432
 		}
433 433
 		return array();
@@ -441,27 +441,27 @@  discard block
 block discarded – undo
441 441
 	*/
442 442
 	public function getIberia($callsign, $date = 'NOW') {
443 443
 		$Common = new Common();
444
-		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
444
+		$numvol = preg_replace('/^[A-Z]*/', '', $callsign);
445 445
 		$check_date = new Datetime($date);
446
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
446
+		if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array();
447 447
 		$url = "https://www.iberia.com/web/flightDetail.do";
448
-		$post = array('numvuelo' => $numvol,'fecha' => $check_date->format('Ymd'),'airlineID' => 'IB');
449
-		$data = $Common->getData($url,'post',$post);
448
+		$post = array('numvuelo' => $numvol, 'fecha' => $check_date->format('Ymd'), 'airlineID' => 'IB');
449
+		$data = $Common->getData($url, 'post', $post);
450 450
 		if ($data != '') {
451 451
 			$table = $Common->table2array($data);
452 452
 			//print_r($table);
453 453
 			if (count($table) > 0) {
454 454
 				$flight = $table;
455
-				preg_match('/([A-Z]{3})/',$flight[3][0],$DepartureAirportIataMatch);
456
-				preg_match('/([A-Z]{3})/',$flight[5][0],$ArrivalAirportIataMatch);
455
+				preg_match('/([A-Z]{3})/', $flight[3][0], $DepartureAirportIataMatch);
456
+				preg_match('/([A-Z]{3})/', $flight[5][0], $ArrivalAirportIataMatch);
457 457
 				$DepartureAirportIata = $DepartureAirportIataMatch[0];
458 458
 				$ArrivalAirportIata = $ArrivalAirportIataMatch[0];
459
-				$departureTime = substr(trim(str_replace(' lunes','',str_replace('&nbsp;','',$flight[3][2]))),0,5);
460
-				$arrivalTime = trim(str_replace(' lunes','',str_replace('&nbsp;','',$flight[5][1])));
459
+				$departureTime = substr(trim(str_replace(' lunes', '', str_replace('&nbsp;', '', $flight[3][2]))), 0, 5);
460
+				$arrivalTime = trim(str_replace(' lunes', '', str_replace('&nbsp;', '', $flight[5][1])));
461 461
 				if ($arrivalTime == 'Hora estimada de llegada') {
462
-					$arrivalTime = substr(trim(str_replace(' lunes','',str_replace('&nbsp;','',$flight[5][2]))),0,5);
463
-				} else $arrivalTime = substr($arrivalTime,0,5);
464
-				return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_iberia');
462
+					$arrivalTime = substr(trim(str_replace(' lunes', '', str_replace('&nbsp;', '', $flight[5][2]))), 0, 5);
463
+				} else $arrivalTime = substr($arrivalTime, 0, 5);
464
+				return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_iberia');
465 465
 			}
466 466
 		}
467 467
 		return array();
@@ -474,11 +474,11 @@  discard block
 block discarded – undo
474 474
 	* @return Flight departure and arrival airports and time
475 475
 	*/
476 476
 
477
-	private function getStarAlliance($callsign, $date = 'NOW',$carrier = '') {
477
+	private function getStarAlliance($callsign, $date = 'NOW', $carrier = '') {
478 478
 		$Common = new Common();
479
-		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
479
+		$numvol = preg_replace('/^[A-Z]*/', '', $callsign);
480 480
 		$check_date = new Datetime($date);
481
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
481
+		if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array();
482 482
 		$url = "http://www.staralliance.com/flifoQueryAction.do?myAirline=&airlineCode=".$carrier."&flightNo=".$numvol."&day=".$check_date->format('d')."&month=".$check_date->format('m')."&year=".$check_date->format('Y')."&departuredate=".$check_date->format('d-M-Y');
483 483
 		$data = $Common->getData($url);
484 484
 		if ($data != '') {
@@ -487,13 +487,13 @@  discard block
 block discarded – undo
487 487
 				$flight = $table;
488 488
 				//print_r($table);
489 489
 				if (isset($flight[25]) && isset($flight[29])) {
490
-					preg_match('/([A-Z]{3})/',$flight[25][1],$DepartureAirportIataMatch);
491
-					preg_match('/([A-Z]{3})/',$flight[25][3],$ArrivalAirportIataMatch);
490
+					preg_match('/([A-Z]{3})/', $flight[25][1], $DepartureAirportIataMatch);
491
+					preg_match('/([A-Z]{3})/', $flight[25][3], $ArrivalAirportIataMatch);
492 492
 					$DepartureAirportIata = $DepartureAirportIataMatch[0];
493 493
 					$ArrivalAirportIata = $ArrivalAirportIataMatch[0];
494
-					$departureTime = substr(trim(str_replace('Scheduled: ','',$flight[29][0])),0,5);
495
-					$arrivalTime = substr(trim(str_replace('Scheduled: ','',$flight[29][1])),0,5);
496
-					return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_staralliance');
494
+					$departureTime = substr(trim(str_replace('Scheduled: ', '', $flight[29][0])), 0, 5);
495
+					$arrivalTime = substr(trim(str_replace('Scheduled: ', '', $flight[29][1])), 0, 5);
496
+					return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_staralliance');
497 497
 				} else return array();
498 498
 			}
499 499
 			
@@ -511,10 +511,10 @@  discard block
 block discarded – undo
511 511
 	*/
512 512
 	private function getAlitalia($callsign, $date = 'NOW') {
513 513
 		$Common = new Common();
514
-		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
514
+		$numvol = preg_replace('/^[A-Z]*/', '', $callsign);
515 515
 		$check_date = new Datetime($date);
516
-		$url= "http://booking.alitalia.com/FlightStatus/fr_fr/FlightInfo?Brand=az&NumeroVolo=".$numvol."&DataCompleta=".$check_date->format('d/m/Y');
517
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
516
+		$url = "http://booking.alitalia.com/FlightStatus/fr_fr/FlightInfo?Brand=az&NumeroVolo=".$numvol."&DataCompleta=".$check_date->format('d/m/Y');
517
+		if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array();
518 518
 		$data = $Common->getData($url);
519 519
 		if ($data != '') {
520 520
 			$table = $Common->text2array($data);
@@ -522,7 +522,7 @@  discard block
 block discarded – undo
522 522
 			$ArrivalAirportIata = '';
523 523
 			$departureTime = $table[4];
524 524
 			$arrivalTime = $table[5];
525
-			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_alitalia');
525
+			return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_alitalia');
526 526
 		}
527 527
 	}
528 528
 
@@ -534,21 +534,21 @@  discard block
 block discarded – undo
534 534
 	*/
535 535
 	private function getBrussels($callsign, $date = 'NOW') {
536 536
 		$Common = new Common();
537
-		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
537
+		$numvol = preg_replace('/^[A-Z]*/', '', $callsign);
538 538
 		$check_date = new Datetime($date);
539
-		$url= "http://www.brusselsairlines.com/api/flightstatus/getresults?from=NA&to=NA&date=".$check_date->format('d/m/Y')."&hour=NA&lookup=flightnumber&flightnumber=".$numvol."&publicationID=302";
539
+		$url = "http://www.brusselsairlines.com/api/flightstatus/getresults?from=NA&to=NA&date=".$check_date->format('d/m/Y')."&hour=NA&lookup=flightnumber&flightnumber=".$numvol."&publicationID=302";
540 540
 		//http://www.brusselsairlines.com/fr-fr/informations-pratiques/statut-de-votre-vol/resultat.aspx?flightnumber=".$numvol."&date=".$check_date->format('d/m/Y')."&lookup=flightnumber";
541
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
541
+		if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array();
542 542
 		$data = $Common->getData($url);
543 543
 		if ($data != '') {
544 544
 		    //echo $data;
545
-		    $parsed_json = json_decode($data,true);
545
+		    $parsed_json = json_decode($data, true);
546 546
 		    if (isset($parsed_json[0]['FromAirportCode'])) {
547 547
 			$DepartureAirportIata = $parsed_json[0]['FromAirportCode'];
548 548
 			$ArrivalAirportIata = $parsed_json[0]['ToAirportCode'];
549
-			$departureTime = date('H:i',strtotime($parsed_json[0]['ScheduledDepatureDate']));
550
-			$arrivalTime = date('H:i',strtotime($parsed_json[0]['ScheduledArrivalDate']));
551
-			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_brussels');
549
+			$departureTime = date('H:i', strtotime($parsed_json[0]['ScheduledDepatureDate']));
550
+			$arrivalTime = date('H:i', strtotime($parsed_json[0]['ScheduledArrivalDate']));
551
+			return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_brussels');
552 552
 		    }
553 553
 		}
554 554
 	}
@@ -625,21 +625,21 @@  discard block
 block discarded – undo
625 625
 	*/
626 626
 	private function getFlyTap($callsign) {
627 627
 		$Common = new Common();
628
-		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
629
-		$url= "http://www.flytap.com/France/fr/PlanifierEtReserver/Outils/DepartsEtArrivees";
628
+		$numvol = preg_replace('/^[A-Z]*/', '', $callsign);
629
+		$url = "http://www.flytap.com/France/fr/PlanifierEtReserver/Outils/DepartsEtArrivees";
630 630
 		//$check_date = new Datetime($date);
631
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
632
-		$post = array('arrivalsdepartures_content' => 'number','arrivalsdepartures_tp' => $numvol,'arrivalsdepartures_trk' => 'ARR','arrivalsdepartures_date_trk' => '1','aptCode' => '','arrivalsdepartures' => 'DEP','arrivalsdepartures_date' => '1','aptCodeFrom' => '','aptCodeTo' => '','arrivalsdepartures2' => 'DEP','arrivalsdepartures_date2' => '1');
633
-		$data = $Common->getData($url,'post',$post);
631
+		if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array();
632
+		$post = array('arrivalsdepartures_content' => 'number', 'arrivalsdepartures_tp' => $numvol, 'arrivalsdepartures_trk' => 'ARR', 'arrivalsdepartures_date_trk' => '1', 'aptCode' => '', 'arrivalsdepartures' => 'DEP', 'arrivalsdepartures_date' => '1', 'aptCodeFrom' => '', 'aptCodeTo' => '', 'arrivalsdepartures2' => 'DEP', 'arrivalsdepartures_date2' => '1');
633
+		$data = $Common->getData($url, 'post', $post);
634 634
 		if ($data != '') {
635 635
 			$table = $Common->table2array($data);
636
-			$departureTime = trim(substr($table[15][0],0,5));
637
-			$arrivalTime = trim(substr($table[35][0],0,5));
638
-			preg_match('/([A-Z]{3})/',$table[11][0],$DepartureAirportIataMatch);
639
-			preg_match('/([A-Z]{3})/',$table[31][0],$ArrivalAirportIataMatch);
636
+			$departureTime = trim(substr($table[15][0], 0, 5));
637
+			$arrivalTime = trim(substr($table[35][0], 0, 5));
638
+			preg_match('/([A-Z]{3})/', $table[11][0], $DepartureAirportIataMatch);
639
+			preg_match('/([A-Z]{3})/', $table[31][0], $ArrivalAirportIataMatch);
640 640
 			$DepartureAirportIata = $DepartureAirportIataMatch[0];
641 641
 			$ArrivalAirportIata = $ArrivalAirportIataMatch[0];
642
-			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_flytap');
642
+			return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_flytap');
643 643
 		}
644 644
 		return array();
645 645
 	}
@@ -661,10 +661,10 @@  discard block
 block discarded – undo
661 661
 			} 
662 662
 		}
663 663
 		if ($airline_icao == '') return array();
664
-		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
665
-		$url= "http://info.flightmapper.net/flight/".$airline_icao.'_'.$numvol;
664
+		$numvol = preg_replace('/^[A-Z]*/', '', $callsign);
665
+		$url = "http://info.flightmapper.net/flight/".$airline_icao.'_'.$numvol;
666 666
 		//$check_date = new Datetime($date);
667
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
667
+		if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array();
668 668
 		$data = $Common->getData($url);
669 669
 		if ($data != '') {
670 670
 			$table = $Common->table2array($data);
@@ -674,13 +674,13 @@  discard block
 block discarded – undo
674 674
 				$darr = '';
675 675
 				$ahour = '';
676 676
 				$aarr = '';
677
-				$n = sscanf($sched,'%*s %5[0-9:] %*[^()] (%3[A-Z]) %5[0-9:] %*[^()] (%3[A-Z])',$dhour,$darr,$ahour,$aarr);
677
+				$n = sscanf($sched, '%*s %5[0-9:] %*[^()] (%3[A-Z]) %5[0-9:] %*[^()] (%3[A-Z])', $dhour, $darr, $ahour, $aarr);
678 678
 				if ($n == 7) {
679 679
 				    $departureTime = $dhour;
680 680
 				    $arrivalTime = $ahour;
681
-				    $DepartureAirportIata = str_replace(array('(',')'),'',$darr);
682
-				    $ArrivalAirportIata = str_replace(array('(',')'),'',$aarr);
683
-				    return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_flightmapper');
681
+				    $DepartureAirportIata = str_replace(array('(', ')'), '', $darr);
682
+				    $ArrivalAirportIata = str_replace(array('(', ')'), '', $aarr);
683
+				    return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_flightmapper');
684 684
 				}
685 685
 			}
686 686
 		}
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
 			$url = 'http://'.$globalFlightAwareUsername.':'.$globalFlightAwarePassword.'@flightxml.flightaware.com/json/FlightXML3/FlightInfoStatus?ident='.$callsign;
713 713
 			$data = $Common->getData($url);
714 714
 			if ($data != '') {
715
-				$result = json_decode($data,true);
715
+				$result = json_decode($data, true);
716 716
 				$flight = $result['FlightInfoStatusResult']['flights'][0];
717 717
 				if (isset($flight['origin'])) {
718 718
 					return array(
@@ -725,18 +725,18 @@  discard block
 block discarded – undo
725 725
 			}
726 726
 		}
727 727
 		
728
-		$url= "http://flightaware.com/live/flight/".$callsign;
728
+		$url = "http://flightaware.com/live/flight/".$callsign;
729 729
 		$data = $Common->getData($url);
730 730
 		if ($data != '') {
731
-			preg_match(':<script>var trackpollBootstrap = (.*?);</script>:',$data,$result);
732
-			$flights = json_decode($result[1],true);
731
+			preg_match(':<script>var trackpollBootstrap = (.*?);</script>:', $data, $result);
732
+			$flights = json_decode($result[1], true);
733 733
 			$flight = reset($flights['flights']);
734 734
 			if (isset($flight['activityLog']['flights'][0]['origin'])) {
735 735
 				return array(
736 736
 				    'DepartureAirportIATA' => $flight['activityLog']['flights'][0]['origin']['iata'],
737
-				    'DepartureTime' => date('H:i',$flight['activityLog']['flights'][0]['takeoffTimes']['scheduled']),
737
+				    'DepartureTime' => date('H:i', $flight['activityLog']['flights'][0]['takeoffTimes']['scheduled']),
738 738
 				    'ArrivalAirportIATA' => $flight['activityLog']['flights'][0]['destination']['iata'],
739
-				    'ArrivalTime' => date('H:i',$flight['activityLog']['flights'][0]['landingTimes']['scheduled']),
739
+				    'ArrivalTime' => date('H:i', $flight['activityLog']['flights'][0]['landingTimes']['scheduled']),
740 740
 				    'Source' => 'website_flightaware');
741 741
 			}
742 742
 		}
@@ -750,20 +750,20 @@  discard block
 block discarded – undo
750 750
 	*/
751 751
 	public function getCostToTravel($callsign) {
752 752
 		$Common = new Common();
753
-		$url= "http://www.costtotravel.com/flight-number/".$callsign;
753
+		$url = "http://www.costtotravel.com/flight-number/".$callsign;
754 754
 		//$check_date = new Datetime($date);
755 755
 		//if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
756 756
 		$data = $Common->getData($url);
757 757
 		if ($data != '') {
758 758
 			$table = $Common->table2array($data);
759 759
 			if (isset($table[11][1])) {
760
-				if (is_numeric(substr($table[11][1],0,1))) $departureTime = substr($table[11][1],0,5);
760
+				if (is_numeric(substr($table[11][1], 0, 1))) $departureTime = substr($table[11][1], 0, 5);
761 761
 				else $departureTime = '';
762
-				if (is_numeric(substr($table[17][1],0,1))) $arrivalTime = substr($table[17][1],0,5);
762
+				if (is_numeric(substr($table[17][1], 0, 1))) $arrivalTime = substr($table[17][1], 0, 5);
763 763
 				else $arrivalTime = '';
764
-				$DepartureAirportIata = substr($table[13][1],0,3);
765
-				$ArrivalAirportIata = substr($table[15][1],0,3);
766
-				return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_costtotravel');
764
+				$DepartureAirportIata = substr($table[13][1], 0, 3);
765
+				$ArrivalAirportIata = substr($table[15][1], 0, 3);
766
+				return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_costtotravel');
767 767
 			}
768 768
 		}
769 769
 		return array();
@@ -775,14 +775,14 @@  discard block
 block discarded – undo
775 775
 	* @param String $date date we want flight number info
776 776
 	* @return Flight departure and arrival airports and time
777 777
 	*/
778
-	private function getAirCanada($callsign,$date = 'NOW') {
778
+	private function getAirCanada($callsign, $date = 'NOW') {
779 779
 		$Common = new Common();
780 780
 		if (class_exists("DomDocument") === FALSE) return array();
781 781
 		date_default_timezone_set('UTC');
782 782
 		$check_date = new Datetime($date);
783
-		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
784
-		$url= "http://services.aircanada.com/portal/rest/getFlightsByFlightNumber?forceTimetable=true&flightNumber=".$numvol."&carrierCode=AC&date=".$check_date->format('m-d-Y')."&app_key=AE919FDCC80311DF9BABC975DFD72085&cache=74249";
785
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
783
+		$numvol = preg_replace('/^[A-Z]*/', '', $callsign);
784
+		$url = "http://services.aircanada.com/portal/rest/getFlightsByFlightNumber?forceTimetable=true&flightNumber=".$numvol."&carrierCode=AC&date=".$check_date->format('m-d-Y')."&app_key=AE919FDCC80311DF9BABC975DFD72085&cache=74249";
785
+		if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array();
786 786
 		$data = $Common->getData($url);
787 787
 		$dom = new DomDocument();
788 788
 		$dom->loadXML($data);
@@ -790,11 +790,11 @@  discard block
 block discarded – undo
790 790
 		$departure = $dom->getElementsByTagName('DepartureStationInfo')->item(0);
791 791
 		if (isset($departure->getElementsByTagName('Airport')->item(0)->firstChild->nodeValue)) {
792 792
 			$DepartureAirportIata = $departure->getElementsByTagName('Airport')->item(0)->firstChild->nodeValue;
793
-			$departureTime = date('H:i',strtotime($departure->getElementsByTagName('ScheduledTime')->item(0)->firstChild->nodeValue));
793
+			$departureTime = date('H:i', strtotime($departure->getElementsByTagName('ScheduledTime')->item(0)->firstChild->nodeValue));
794 794
 			$arrival = $dom->getElementsByTagName('ArrivalStationInfo')->item(0);
795 795
 			$ArrivalAirportIata = $arrival->getElementsByTagName('Airport')->item(0)->firstChild->nodeValue;
796
-			$arrivalTime = date('H:i',strtotime($arrival->getElementsByTagName('ScheduledTime')->item(0)->firstChild->nodeValue));
797
-			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_aircanada');
796
+			$arrivalTime = date('H:i', strtotime($arrival->getElementsByTagName('ScheduledTime')->item(0)->firstChild->nodeValue));
797
+			return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_aircanada');
798 798
 		} else return array();
799 799
 	}
800 800
 
@@ -806,21 +806,21 @@  discard block
 block discarded – undo
806 806
 	*/
807 807
 	private function getVietnamAirlines($callsign, $date = 'NOW') {
808 808
 		$Common = new Common();
809
-		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
809
+		$numvol = preg_replace('/^[A-Z]*/', '', $callsign);
810 810
 		$check_date = new Datetime($date);
811
-		$url= "https://cat.sabresonicweb.com/SSWVN/meridia?posid=VNVN&page=flifoFlightInfoDetailsMessage_learn&action=flightInfoDetails&airline=VN&language=fr&depDay=".$check_date->format('j')."&depMonth=".strtoupper($check_date->format('M'))."&=&flight=".$numvol."&";
812
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
811
+		$url = "https://cat.sabresonicweb.com/SSWVN/meridia?posid=VNVN&page=flifoFlightInfoDetailsMessage_learn&action=flightInfoDetails&airline=VN&language=fr&depDay=".$check_date->format('j')."&depMonth=".strtoupper($check_date->format('M'))."&=&flight=".$numvol."&";
812
+		if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array();
813 813
 		$data = $Common->getData($url);
814 814
 		if ($data != '') {
815 815
 			$table = $Common->table2array($data);
816 816
 			$flight = $table;
817
-			preg_match('/([A-Z]{3})/',$flight[3][0],$DepartureAirportIataMatch);
818
-			preg_match('/([A-Z]{3})/',$flight[21][0],$ArrivalAirportIataMatch);
817
+			preg_match('/([A-Z]{3})/', $flight[3][0], $DepartureAirportIataMatch);
818
+			preg_match('/([A-Z]{3})/', $flight[21][0], $ArrivalAirportIataMatch);
819 819
 			$DepartureAirportIata = $DepartureAirportIataMatch[0];
820 820
 			$ArrivalAirportIata = $ArrivalAirportIataMatch[0];
821 821
 			$departureTime = $flight[5][1];
822 822
 			$arrivalTime = $flight[23][1];
823
-			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_vietnamairlines');
823
+			return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_vietnamairlines');
824 824
 		}
825 825
 	}
826 826
 
@@ -831,16 +831,16 @@  discard block
 block discarded – undo
831 831
 	* @param String $carrier airline code
832 832
 	* @return Flight departure and arrival airports and time
833 833
 	*/
834
-	private function getAirBerlin($callsign, $date = 'NOW',$carrier = 'AB') {
834
+	private function getAirBerlin($callsign, $date = 'NOW', $carrier = 'AB') {
835 835
 		$Common = new Common();
836 836
 		date_default_timezone_set('UTC');
837 837
 		//AB = airberlin, HG/NLY = NIKI, 4T/BHP = Belair 
838
-		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
838
+		$numvol = preg_replace('/^[A-Z]*/', '', $callsign);
839 839
 		$check_date = new Datetime($date);
840
-		$url= "http://www.airberlin.com/en-US/site/aims.php";
841
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
842
-		$post = array('type' => 'departure','searchFlightNo' => '1','requestsent' => 'true', 'flightno' => $numvol,'date' => $check_date->format('Y-m-d'),'carrier' => $carrier);
843
-		$data = $Common->getData($url,'post',$post);
840
+		$url = "http://www.airberlin.com/en-US/site/aims.php";
841
+		if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array();
842
+		$post = array('type' => 'departure', 'searchFlightNo' => '1', 'requestsent' => 'true', 'flightno' => $numvol, 'date' => $check_date->format('Y-m-d'), 'carrier' => $carrier);
843
+		$data = $Common->getData($url, 'post', $post);
844 844
 		//echo $data;
845 845
 		$DepartureAirportIata = '';
846 846
 		$ArrivalAirportIata = '';
@@ -853,8 +853,8 @@  discard block
 block discarded – undo
853 853
 			if (isset($flight[5][2])) $departureAirport = $flight[5][2];
854 854
 			else $departureAirport = '';
855 855
 		} else return array();
856
-		$post = array('type' => 'arrival','searchFlightNo' => '1','requestsent' => 'true', 'flightno' => $numvol,'date' => $check_date->format('Y-m-d'),'carrier' => 'AB');
857
-		$data = $Common->getData($url,'post',$post);
856
+		$post = array('type' => 'arrival', 'searchFlightNo' => '1', 'requestsent' => 'true', 'flightno' => $numvol, 'date' => $check_date->format('Y-m-d'), 'carrier' => 'AB');
857
+		$data = $Common->getData($url, 'post', $post);
858 858
 		if ($data != '') {
859 859
 			$table = $Common->table2array($data);
860 860
 			$flight = $table;
@@ -882,7 +882,7 @@  discard block
 block discarded – undo
882 882
 			}
883 883
 		}
884 884
 		if (isset($DepartureAirportIata)) {
885
-			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_airberlin');
885
+			return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_airberlin');
886 886
 		} else return array();
887 887
 	}
888 888
 
@@ -892,7 +892,7 @@  discard block
 block discarded – undo
892 892
 	 * @param String $date Date
893 893
 	 * @return Array Schedules info
894 894
 	*/
895
-	public function fetchSchedule($ident,$date = 'NOW') {
895
+	public function fetchSchedule($ident, $date = 'NOW') {
896 896
 		global $globalSchedulesSources, $globalSchedulesFetch, $globalOffline, $globalFlightAwareUsername;
897 897
 		//$Common = new Common();
898 898
 		if ($globalSchedulesFetch === FALSE || (isset($globalOffline) && $globalOffline === TRUE)) return array();
@@ -962,7 +962,7 @@  discard block
 block discarded – undo
962 962
 				// Brussels Airlines
963 963
 				case "BEL":
964 964
 				case "SN":
965
-					return $this->getBrussels($ident,$date);
965
+					return $this->getBrussels($ident, $date);
966 966
 /*
967 967
 				// Copa Airlines
968 968
 				case "CMP":
@@ -1061,7 +1061,7 @@  discard block
 block discarded – undo
1061 1061
 				case "DS":
1062 1062
 				case "EZY":
1063 1063
 				case "EZS":
1064
-					return $this->getEasyJet($ident,$date);
1064
+					return $this->getEasyJet($ident, $date);
1065 1065
 				// Ryanair
1066 1066
 				case "FR":
1067 1067
 				case "RYR":
@@ -1113,19 +1113,19 @@  discard block
 block discarded – undo
1113 1113
 					return $this->getIberia($ident);
1114 1114
 				// Vietnam Airlines
1115 1115
 				case "HVN":
1116
-					return $this->getVietnamAirlines($ident,$date);
1116
+					return $this->getVietnamAirlines($ident, $date);
1117 1117
 				// Air Berlin
1118 1118
 				case "AB":
1119 1119
 				case "BER":
1120
-					return $this->getAirBerlin($ident,$date,'AB');
1120
+					return $this->getAirBerlin($ident, $date, 'AB');
1121 1121
 				// NIKI
1122 1122
 				case "HG":
1123 1123
 				case "NLY":
1124
-					return $this->getAirBerlin($ident,$date,'HG');
1124
+					return $this->getAirBerlin($ident, $date, 'HG');
1125 1125
 				// BelAir
1126 1126
 				case "4T":
1127 1127
 				case "BHP":
1128
-					return $this->getAirBerlin($ident,$date,'4T');
1128
+					return $this->getAirBerlin($ident, $date, '4T');
1129 1129
 				default:
1130 1130
 					if (strlen($airline_icao) == 3) {
1131 1131
 						$Spotter = new Spotter($this->db);
@@ -1134,9 +1134,9 @@  discard block
 block discarded – undo
1134 1134
 					}
1135 1135
 					// Randomly use a generic function to get hours
1136 1136
 					if (strlen($airline_icao) == 2) {
1137
-						if (!isset($globalSchedulesSources)) $globalSchedulesSources = array('flightmapper','costtotravel','flightaware');
1137
+						if (!isset($globalSchedulesSources)) $globalSchedulesSources = array('flightmapper', 'costtotravel', 'flightaware');
1138 1138
 						if (count($globalSchedulesSources) > 0) {
1139
-							$rand = mt_rand(0,count($globalSchedulesSources)-1);
1139
+							$rand = mt_rand(0, count($globalSchedulesSources) - 1);
1140 1140
 							$source = $globalSchedulesSources[$rand];
1141 1141
 							if ($source == 'flightmapper') return $this->getFlightMapper($ident);
1142 1142
 							elseif ($source == 'costtotravel') return $this->getCostToTravel($ident);
Please login to merge, or discard this patch.
Braces   +180 added lines, -62 removed lines patch added patch discarded remove patch
@@ -24,7 +24,9 @@  discard block
 block discarded – undo
24 24
 	public function __construct($dbc = null) {
25 25
 		$Connection = new Connection($dbc);
26 26
 		$this->db = $Connection->db();
27
-		if ($this->db === null) die('Error: No DB connection.');
27
+		if ($this->db === null) {
28
+			die('Error: No DB connection.');
29
+		}
28 30
 	}
29 31
 
30 32
 	/**
@@ -139,7 +141,9 @@  discard block
 block discarded – undo
139 141
 		$sth->closeCursor();
140 142
 		if (count($row) > 0) {
141 143
 			return $row;
142
-		} else return array();
144
+		} else {
145
+			return array();
146
+		}
143 147
 	}
144 148
 
145 149
 	/*
@@ -180,7 +184,9 @@  discard block
 block discarded – undo
180 184
 		$Common = new Common();
181 185
 		$check_date = new Datetime($date);
182 186
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
183
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
187
+		if (!filter_var($numvol,FILTER_VALIDATE_INT)) {
188
+			return array();
189
+		}
184 190
 		$url = "http://www.airfrance.fr/cgi-bin/AF/FR/fr/local/resainfovol/infovols/detailsVolJson.do?codeCompagnie[0]=".$carrier."&numeroVol[0]=".$numvol."&dayFlightDate=".$check_date->format('d')."&yearMonthFlightDate=".$check_date->format('Ym');
185 191
 		$json = $Common->getData($url);
186 192
 		var_dump($json);
@@ -207,7 +213,9 @@  discard block
 block discarded – undo
207 213
 			*/
208 214
 		
209 215
 			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_airfrance');
210
-		} else return array();
216
+		} else {
217
+			return array();
218
+		}
211 219
 	}
212 220
 
213 221
 	/**
@@ -222,7 +230,9 @@  discard block
 block discarded – undo
222 230
 		date_default_timezone_set($globalTimezone);
223 231
 		$check_date = new Datetime($date);
224 232
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
225
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
233
+		if (!filter_var($numvol,FILTER_VALIDATE_INT)) {
234
+			return array();
235
+		}
226 236
 		$url = "http://www.easyjet.com/ft/api/flights?date=".$check_date->format('Y-m-d')."&fn=".$callsign;
227 237
 		$json = $Common->getData($url);
228 238
 		$parsed_json = json_decode($json);
@@ -235,7 +245,9 @@  discard block
 block discarded – undo
235 245
 			$arrivalTime = $parsed_json->{'flights'}[0]->{'dates'}->{'fsta'};
236 246
 
237 247
 			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_easyjet');
238
-		} else return array();
248
+		} else {
249
+			return array();
250
+		}
239 251
 	}
240 252
 
241 253
 	/**
@@ -246,7 +258,9 @@  discard block
 block discarded – undo
246 258
 	private function getRyanair($callsign) {
247 259
 		$Common = new Common();
248 260
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
249
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
261
+		if (!filter_var($numvol,FILTER_VALIDATE_INT)) {
262
+			return array();
263
+		}
250 264
 		$url = "http://www.ryanair.com/fr/api/2/flight-info/0/50/";
251 265
 		$post = '{"flight":"'.$numvol.'","minDepartureTime":"00:00","maxDepartureTime":"23:59"}';
252 266
 		$headers = array('Content-Type: application/json','Content-Length: ' . strlen($post));
@@ -260,8 +274,12 @@  discard block
 block discarded – undo
260 274
 				$departureTime = $parsed_json->{'flightInfo'}[0]->{'departureTime'};
261 275
 				$arrivalTime = $parsed_json->{'flightInfo'}[0]->{'arrivalTime'};
262 276
 				return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime, 'Source' => 'website_ryanair');
263
-			} else return array();
264
-		} else return array();
277
+			} else {
278
+				return array();
279
+			}
280
+		} else {
281
+			return array();
282
+		}
265 283
 	}
266 284
 
267 285
 	/**
@@ -272,7 +290,9 @@  discard block
 block discarded – undo
272 290
 	private function getSwiss($callsign) {
273 291
 		$Common = new Common();
274 292
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
275
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
293
+		if (!filter_var($numvol,FILTER_VALIDATE_INT)) {
294
+			return array();
295
+		}
276 296
 		$url = "http://www.world-of-swiss.com/fr/routenetwork.json";
277 297
 		$json = $Common->getData($url);
278 298
 		$parsed_json = json_decode($json);
@@ -292,8 +312,12 @@  discard block
 block discarded – undo
292 312
 			}
293 313
 			if (isset($DepartureAirportIata) && isset($ArrivalAirportIata)) {
294 314
 				return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_swiss');
295
-			} else return array();
296
-		} else return array();
315
+			} else {
316
+				return array();
317
+			}
318
+		} else {
319
+			return array();
320
+		}
297 321
 	}
298 322
 	
299 323
 	/**
@@ -307,12 +331,18 @@  discard block
 block discarded – undo
307 331
 		$Common = new Common();
308 332
 		$check_date = new Datetime($date);
309 333
 		$numvol = sprintf('%04d',preg_replace('/^[A-Z]*/','',$callsign));
310
-		if (!filter_var(preg_replace('/^[A-Z]*/','',$callsign),FILTER_VALIDATE_INT)) return array();
311
-		if ($globalBritishAirwaysKey == '') return array();
334
+		if (!filter_var(preg_replace('/^[A-Z]*/','',$callsign),FILTER_VALIDATE_INT)) {
335
+			return array();
336
+		}
337
+		if ($globalBritishAirwaysKey == '') {
338
+			return array();
339
+		}
312 340
 		$url = "https://api.ba.com/rest-v1/v1/flights;flightNumber=".$numvol.";scheduledDepartureDate=".$check_date->format('Y-m-d').".json";
313 341
 		$headers = array('Client-Key: '.$globalBritishAirwaysKey);
314 342
 		$json = $Common->getData($url,'get','',$headers);
315
-		if ($json == '') return array();
343
+		if ($json == '') {
344
+			return array();
345
+		}
316 346
 		$parsed_json = json_decode($json);
317 347
 		$flights = $parsed_json->{'FlightsResponse'};
318 348
 		if (count($flights) > 0) {
@@ -321,7 +351,9 @@  discard block
 block discarded – undo
321 351
 			$departureTime = date('H:i',strtotime($parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'ScheduledDepartureDateTime'}));
322 352
 			$arrivalTime = date('H:i',strtotime($parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'ScheduledArrivalDateTime'}));
323 353
 			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_britishairways');
324
-		} else return array();
354
+		} else {
355
+			return array();
356
+		}
325 357
 	}
326 358
 
327 359
 	/**
@@ -335,19 +367,27 @@  discard block
 block discarded – undo
335 367
 		$Common = new Common();
336 368
 		$check_date = new Datetime($date);
337 369
 		$numvol = sprintf('%04d',preg_replace('/^[A-Z]*/','',$callsign));
338
-		if (!filter_var(preg_replace('/^[A-Z]*/','',$callsign),FILTER_VALIDATE_INT)) return array();
339
-		if (!isset($globalLufthansaKey) || $globalLufthansaKey == '' || !isset($globalLufthansaKey['key']) || $globalLufthansaKey['key'] == '') return array();
370
+		if (!filter_var(preg_replace('/^[A-Z]*/','',$callsign),FILTER_VALIDATE_INT)) {
371
+			return array();
372
+		}
373
+		if (!isset($globalLufthansaKey) || $globalLufthansaKey == '' || !isset($globalLufthansaKey['key']) || $globalLufthansaKey['key'] == '') {
374
+			return array();
375
+		}
340 376
 		$url = "https://api.lufthansa.com/v1/oauth/token";
341 377
 		$post = array('client_id' => $globalLufthansaKey['key'],'client_secret' => $globalLufthansaKey['secret'],'grant_type' => 'client_credentials');
342 378
 		$data = $Common->getData($url,'post',$post);
343 379
 		$parsed_data = json_decode($data);
344
-		if (!isset($parsed_data->{'access_token'})) return array();
380
+		if (!isset($parsed_data->{'access_token'})) {
381
+			return array();
382
+		}
345 383
 		$token = $parsed_data->{'access_token'};
346 384
 		
347 385
 		$url = "https://api.lufthansa.com/v1/operations/flightstatus/LH".$numvol."/".$check_date->format('Y-m-d');
348 386
 		$headers = array('Authorization: Bearer '.$token,'Accept: application/json');
349 387
 		$json = $Common->getData($url,'get','',$headers);
350
-		if ($json == '') return array();
388
+		if ($json == '') {
389
+			return array();
390
+		}
351 391
 		$parsed_json = json_decode($json);
352 392
 		if (isset($parsed_json->{'FlightStatusResource'}) && count($parsed_json->{'FlightStatusResource'}) > 0) {
353 393
 			$DepartureAirportIata = $parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Departure'}->{'AirportCode'};
@@ -355,7 +395,9 @@  discard block
 block discarded – undo
355 395
 			$ArrivalAirportIata = $parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Arrival'}->{'AirportCode'};
356 396
 			$arrivalTime = date('H:i',strtotime($parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Arrival'}->{'ScheduledTimeLocal'}->{'DateTime'}));
357 397
 			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_lufthansa');
358
-		} else return array();
398
+		} else {
399
+			return array();
400
+		}
359 401
 	}
360 402
 
361 403
 	/**
@@ -369,14 +411,20 @@  discard block
 block discarded – undo
369 411
 		$Common = new Common();
370 412
 		$check_date = new Datetime($date);
371 413
 		$numvol = sprintf('%04d',preg_replace('/^[A-Z]*/','',$callsign));
372
-		if (!filter_var(preg_replace('/^[A-Z]*/','',$callsign),FILTER_VALIDATE_INT)) return array();
373
-		if ($globalTransaviaKey == '') return array();
414
+		if (!filter_var(preg_replace('/^[A-Z]*/','',$callsign),FILTER_VALIDATE_INT)) {
415
+			return array();
416
+		}
417
+		if ($globalTransaviaKey == '') {
418
+			return array();
419
+		}
374 420
 		$url = "https://tst.api.transavia.com/v1/flightstatus/departuredate/".$check_date->format('Ymd').'/flightnumber/HV'.$numvol;
375 421
 		//$url = "https://api.transavia.com/v1/flightstatus/departuredate/".$check_date->format('Ymd').'/flightnumber/HV'.$numvol;
376 422
 		$headers = array('apikey: '.$globalTransaviaKey);
377 423
 		$json = $Common->getData($url,'get','',$headers);
378 424
 		//echo 'result : '.$json;
379
-		if ($json == '') return array();
425
+		if ($json == '') {
426
+			return array();
427
+		}
380 428
 		$parsed_json = json_decode($json);
381 429
 		
382 430
 		if (isset($parsed_json->{'data'}[0])) {
@@ -385,7 +433,9 @@  discard block
 block discarded – undo
385 433
 			$ArrivalAirportIata = $parsed_json->{'data'}[0]->{'flight'}->{'arrivalAirport'}->{'locationCode'};
386 434
 			$arrivalTime = date('H:i',strtotime($parsed_json->{'data'}[0]->{'flight'}->{'arrivalDateTime'}));
387 435
 			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_transavia');
388
-		} else return array();
436
+		} else {
437
+			return array();
438
+		}
389 439
 	}
390 440
 
391 441
 	/**
@@ -396,7 +446,9 @@  discard block
 block discarded – undo
396 446
 	public function getTunisair($callsign) {
397 447
 		$Common = new Common();
398 448
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
399
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
449
+		if (!filter_var($numvol,FILTER_VALIDATE_INT)) {
450
+			return array();
451
+		}
400 452
 		$url = "http://www.tunisair.com/site/publish/module/Volj/fr/Flight_List.asp";
401 453
 		$data = $Common->getData($url);
402 454
 		$table = $Common->table2array($data);
@@ -417,7 +469,9 @@  discard block
 block discarded – undo
417 469
 		$Common = new Common();
418 470
 		$check_date = new Datetime($date);
419 471
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
420
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
472
+		if (!filter_var($numvol,FILTER_VALIDATE_INT)) {
473
+			return array();
474
+		}
421 475
 		$final_date = str_replace('/','%2F',$check_date->format('d/m/Y'));
422 476
 		$url = "http://www.vueling.com/Base/BaseProxy/RenderMacro/?macroalias=FlightStatusResult&searchBy=bycode&date=".$final_date."&flightNumber=".$numvol."&idioma=en-GB";
423 477
 		$data = $Common->getData($url);
@@ -427,8 +481,11 @@  discard block
 block discarded – undo
427 481
 			$DepartureAirportIata = str_replace('flightOri=','',$result[0]);
428 482
 			preg_match('/flightDest=[A-Z]{3}/',$data,$result);
429 483
 			$ArrivalAirportIata = str_replace('flightDest=','',$result[0]);
430
-			if ($DepartureAirportIata != '' && $ArrivalAirportIata != '') return array('DepartureAirportIATA' => $DepartureAirportIata,'ArrivalAirportIATA' => $ArrivalAirportIata,'Source' => 'website_vueling');
431
-			else return array();
484
+			if ($DepartureAirportIata != '' && $ArrivalAirportIata != '') {
485
+				return array('DepartureAirportIATA' => $DepartureAirportIata,'ArrivalAirportIATA' => $ArrivalAirportIata,'Source' => 'website_vueling');
486
+			} else {
487
+				return array();
488
+			}
432 489
 		}
433 490
 		return array();
434 491
 	}
@@ -443,7 +500,9 @@  discard block
 block discarded – undo
443 500
 		$Common = new Common();
444 501
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
445 502
 		$check_date = new Datetime($date);
446
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
503
+		if (!filter_var($numvol,FILTER_VALIDATE_INT)) {
504
+			return array();
505
+		}
447 506
 		$url = "https://www.iberia.com/web/flightDetail.do";
448 507
 		$post = array('numvuelo' => $numvol,'fecha' => $check_date->format('Ymd'),'airlineID' => 'IB');
449 508
 		$data = $Common->getData($url,'post',$post);
@@ -460,7 +519,9 @@  discard block
 block discarded – undo
460 519
 				$arrivalTime = trim(str_replace(' lunes','',str_replace('&nbsp;','',$flight[5][1])));
461 520
 				if ($arrivalTime == 'Hora estimada de llegada') {
462 521
 					$arrivalTime = substr(trim(str_replace(' lunes','',str_replace('&nbsp;','',$flight[5][2]))),0,5);
463
-				} else $arrivalTime = substr($arrivalTime,0,5);
522
+				} else {
523
+					$arrivalTime = substr($arrivalTime,0,5);
524
+				}
464 525
 				return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_iberia');
465 526
 			}
466 527
 		}
@@ -478,7 +539,9 @@  discard block
 block discarded – undo
478 539
 		$Common = new Common();
479 540
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
480 541
 		$check_date = new Datetime($date);
481
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
542
+		if (!filter_var($numvol,FILTER_VALIDATE_INT)) {
543
+			return array();
544
+		}
482 545
 		$url = "http://www.staralliance.com/flifoQueryAction.do?myAirline=&airlineCode=".$carrier."&flightNo=".$numvol."&day=".$check_date->format('d')."&month=".$check_date->format('m')."&year=".$check_date->format('Y')."&departuredate=".$check_date->format('d-M-Y');
483 546
 		$data = $Common->getData($url);
484 547
 		if ($data != '') {
@@ -494,7 +557,9 @@  discard block
 block discarded – undo
494 557
 					$departureTime = substr(trim(str_replace('Scheduled: ','',$flight[29][0])),0,5);
495 558
 					$arrivalTime = substr(trim(str_replace('Scheduled: ','',$flight[29][1])),0,5);
496 559
 					return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_staralliance');
497
-				} else return array();
560
+				} else {
561
+					return array();
562
+				}
498 563
 			}
499 564
 			
500 565
 
@@ -514,7 +579,9 @@  discard block
 block discarded – undo
514 579
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
515 580
 		$check_date = new Datetime($date);
516 581
 		$url= "http://booking.alitalia.com/FlightStatus/fr_fr/FlightInfo?Brand=az&NumeroVolo=".$numvol."&DataCompleta=".$check_date->format('d/m/Y');
517
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
582
+		if (!filter_var($numvol,FILTER_VALIDATE_INT)) {
583
+			return array();
584
+		}
518 585
 		$data = $Common->getData($url);
519 586
 		if ($data != '') {
520 587
 			$table = $Common->text2array($data);
@@ -538,7 +605,9 @@  discard block
 block discarded – undo
538 605
 		$check_date = new Datetime($date);
539 606
 		$url= "http://www.brusselsairlines.com/api/flightstatus/getresults?from=NA&to=NA&date=".$check_date->format('d/m/Y')."&hour=NA&lookup=flightnumber&flightnumber=".$numvol."&publicationID=302";
540 607
 		//http://www.brusselsairlines.com/fr-fr/informations-pratiques/statut-de-votre-vol/resultat.aspx?flightnumber=".$numvol."&date=".$check_date->format('d/m/Y')."&lookup=flightnumber";
541
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
608
+		if (!filter_var($numvol,FILTER_VALIDATE_INT)) {
609
+			return array();
610
+		}
542 611
 		$data = $Common->getData($url);
543 612
 		if ($data != '') {
544 613
 		    //echo $data;
@@ -628,7 +697,9 @@  discard block
 block discarded – undo
628 697
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
629 698
 		$url= "http://www.flytap.com/France/fr/PlanifierEtReserver/Outils/DepartsEtArrivees";
630 699
 		//$check_date = new Datetime($date);
631
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
700
+		if (!filter_var($numvol,FILTER_VALIDATE_INT)) {
701
+			return array();
702
+		}
632 703
 		$post = array('arrivalsdepartures_content' => 'number','arrivalsdepartures_tp' => $numvol,'arrivalsdepartures_trk' => 'ARR','arrivalsdepartures_date_trk' => '1','aptCode' => '','arrivalsdepartures' => 'DEP','arrivalsdepartures_date' => '1','aptCodeFrom' => '','aptCodeTo' => '','arrivalsdepartures2' => 'DEP','arrivalsdepartures_date2' => '1');
633 704
 		$data = $Common->getData($url,'post',$post);
634 705
 		if ($data != '') {
@@ -660,11 +731,15 @@  discard block
 block discarded – undo
660 731
 				$airline_icao = substr($callsign, 0, 3);
661 732
 			} 
662 733
 		}
663
-		if ($airline_icao == '') return array();
734
+		if ($airline_icao == '') {
735
+			return array();
736
+		}
664 737
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
665 738
 		$url= "http://info.flightmapper.net/flight/".$airline_icao.'_'.$numvol;
666 739
 		//$check_date = new Datetime($date);
667
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
740
+		if (!filter_var($numvol,FILTER_VALIDATE_INT)) {
741
+			return array();
742
+		}
668 743
 		$data = $Common->getData($url);
669 744
 		if ($data != '') {
670 745
 			$table = $Common->table2array($data);
@@ -757,10 +832,16 @@  discard block
 block discarded – undo
757 832
 		if ($data != '') {
758 833
 			$table = $Common->table2array($data);
759 834
 			if (isset($table[11][1])) {
760
-				if (is_numeric(substr($table[11][1],0,1))) $departureTime = substr($table[11][1],0,5);
761
-				else $departureTime = '';
762
-				if (is_numeric(substr($table[17][1],0,1))) $arrivalTime = substr($table[17][1],0,5);
763
-				else $arrivalTime = '';
835
+				if (is_numeric(substr($table[11][1],0,1))) {
836
+					$departureTime = substr($table[11][1],0,5);
837
+				} else {
838
+					$departureTime = '';
839
+				}
840
+				if (is_numeric(substr($table[17][1],0,1))) {
841
+					$arrivalTime = substr($table[17][1],0,5);
842
+				} else {
843
+					$arrivalTime = '';
844
+				}
764 845
 				$DepartureAirportIata = substr($table[13][1],0,3);
765 846
 				$ArrivalAirportIata = substr($table[15][1],0,3);
766 847
 				return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_costtotravel');
@@ -777,16 +858,22 @@  discard block
 block discarded – undo
777 858
 	*/
778 859
 	private function getAirCanada($callsign,$date = 'NOW') {
779 860
 		$Common = new Common();
780
-		if (class_exists("DomDocument") === FALSE) return array();
861
+		if (class_exists("DomDocument") === FALSE) {
862
+			return array();
863
+		}
781 864
 		date_default_timezone_set('UTC');
782 865
 		$check_date = new Datetime($date);
783 866
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
784 867
 		$url= "http://services.aircanada.com/portal/rest/getFlightsByFlightNumber?forceTimetable=true&flightNumber=".$numvol."&carrierCode=AC&date=".$check_date->format('m-d-Y')."&app_key=AE919FDCC80311DF9BABC975DFD72085&cache=74249";
785
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
868
+		if (!filter_var($numvol,FILTER_VALIDATE_INT)) {
869
+			return array();
870
+		}
786 871
 		$data = $Common->getData($url);
787 872
 		$dom = new DomDocument();
788 873
 		$dom->loadXML($data);
789
-		if ($dom->getElementsByTagName('DepartureStationInfo')->length == 0) return array();
874
+		if ($dom->getElementsByTagName('DepartureStationInfo')->length == 0) {
875
+			return array();
876
+		}
790 877
 		$departure = $dom->getElementsByTagName('DepartureStationInfo')->item(0);
791 878
 		if (isset($departure->getElementsByTagName('Airport')->item(0)->firstChild->nodeValue)) {
792 879
 			$DepartureAirportIata = $departure->getElementsByTagName('Airport')->item(0)->firstChild->nodeValue;
@@ -795,7 +882,9 @@  discard block
 block discarded – undo
795 882
 			$ArrivalAirportIata = $arrival->getElementsByTagName('Airport')->item(0)->firstChild->nodeValue;
796 883
 			$arrivalTime = date('H:i',strtotime($arrival->getElementsByTagName('ScheduledTime')->item(0)->firstChild->nodeValue));
797 884
 			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_aircanada');
798
-		} else return array();
885
+		} else {
886
+			return array();
887
+		}
799 888
 	}
800 889
 
801 890
 	/**
@@ -809,7 +898,9 @@  discard block
 block discarded – undo
809 898
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
810 899
 		$check_date = new Datetime($date);
811 900
 		$url= "https://cat.sabresonicweb.com/SSWVN/meridia?posid=VNVN&page=flifoFlightInfoDetailsMessage_learn&action=flightInfoDetails&airline=VN&language=fr&depDay=".$check_date->format('j')."&depMonth=".strtoupper($check_date->format('M'))."&=&flight=".$numvol."&";
812
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
901
+		if (!filter_var($numvol,FILTER_VALIDATE_INT)) {
902
+			return array();
903
+		}
813 904
 		$data = $Common->getData($url);
814 905
 		if ($data != '') {
815 906
 			$table = $Common->table2array($data);
@@ -838,7 +929,9 @@  discard block
 block discarded – undo
838 929
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
839 930
 		$check_date = new Datetime($date);
840 931
 		$url= "http://www.airberlin.com/en-US/site/aims.php";
841
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
932
+		if (!filter_var($numvol,FILTER_VALIDATE_INT)) {
933
+			return array();
934
+		}
842 935
 		$post = array('type' => 'departure','searchFlightNo' => '1','requestsent' => 'true', 'flightno' => $numvol,'date' => $check_date->format('Y-m-d'),'carrier' => $carrier);
843 936
 		$data = $Common->getData($url,'post',$post);
844 937
 		//echo $data;
@@ -848,11 +941,19 @@  discard block
 block discarded – undo
848 941
 		if ($data != '') {
849 942
 			$table = $Common->table2array($data);
850 943
 			$flight = $table;
851
-			if (isset($flight[5][4])) $departureTime = $flight[5][4];
852
-			else $departureTime = '';
853
-			if (isset($flight[5][2])) $departureAirport = $flight[5][2];
854
-			else $departureAirport = '';
855
-		} else return array();
944
+			if (isset($flight[5][4])) {
945
+				$departureTime = $flight[5][4];
946
+			} else {
947
+				$departureTime = '';
948
+			}
949
+			if (isset($flight[5][2])) {
950
+				$departureAirport = $flight[5][2];
951
+			} else {
952
+				$departureAirport = '';
953
+			}
954
+		} else {
955
+			return array();
956
+		}
856 957
 		$post = array('type' => 'arrival','searchFlightNo' => '1','requestsent' => 'true', 'flightno' => $numvol,'date' => $check_date->format('Y-m-d'),'carrier' => 'AB');
857 958
 		$data = $Common->getData($url,'post',$post);
858 959
 		if ($data != '') {
@@ -865,10 +966,14 @@  discard block
 block discarded – undo
865 966
 			    $arrivalTime = '';
866 967
 			    $arrivalAirport = '';
867 968
 			}
868
-		} else return array();
969
+		} else {
970
+			return array();
971
+		}
869 972
 		$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';
870 973
 		$json = $Common->getData($url);
871
-		if ($json == '') return array();
974
+		if ($json == '') {
975
+			return array();
976
+		}
872 977
 		$parsed_json = json_decode($json);
873 978
 		$airports = $parsed_json->{'suggestList'};
874 979
 		if (count($airports) > 0) {
@@ -883,7 +988,9 @@  discard block
 block discarded – undo
883 988
 		}
884 989
 		if (isset($DepartureAirportIata)) {
885 990
 			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_airberlin');
886
-		} else return array();
991
+		} else {
992
+			return array();
993
+		}
887 994
 	}
888 995
 
889 996
 	/*
@@ -895,7 +1002,9 @@  discard block
 block discarded – undo
895 1002
 	public function fetchSchedule($ident,$date = 'NOW') {
896 1003
 		global $globalSchedulesSources, $globalSchedulesFetch, $globalOffline, $globalFlightAwareUsername;
897 1004
 		//$Common = new Common();
898
-		if ($globalSchedulesFetch === FALSE || (isset($globalOffline) && $globalOffline === TRUE)) return array();
1005
+		if ($globalSchedulesFetch === FALSE || (isset($globalOffline) && $globalOffline === TRUE)) {
1006
+			return array();
1007
+		}
899 1008
 		$airline_icao = '';
900 1009
 		if (!is_numeric(substr($ident, 0, 3)))
901 1010
 		{
@@ -1130,18 +1239,27 @@  discard block
 block discarded – undo
1130 1239
 					if (strlen($airline_icao) == 3) {
1131 1240
 						$Spotter = new Spotter($this->db);
1132 1241
 						$airline_info = $Spotter->getAllAirlineInfo($airline_icao);
1133
-						if (isset($airline_info[0]['iata'])) $airline_icao = $airline_info[0]['iata'];
1242
+						if (isset($airline_info[0]['iata'])) {
1243
+							$airline_icao = $airline_info[0]['iata'];
1244
+						}
1134 1245
 					}
1135 1246
 					// Randomly use a generic function to get hours
1136 1247
 					if (strlen($airline_icao) == 2) {
1137
-						if (!isset($globalSchedulesSources)) $globalSchedulesSources = array('flightmapper','costtotravel','flightaware');
1248
+						if (!isset($globalSchedulesSources)) {
1249
+							$globalSchedulesSources = array('flightmapper','costtotravel','flightaware');
1250
+						}
1138 1251
 						if (count($globalSchedulesSources) > 0) {
1139 1252
 							$rand = mt_rand(0,count($globalSchedulesSources)-1);
1140 1253
 							$source = $globalSchedulesSources[$rand];
1141
-							if ($source == 'flightmapper') return $this->getFlightMapper($ident);
1142
-							elseif ($source == 'costtotravel') return $this->getCostToTravel($ident);
1254
+							if ($source == 'flightmapper') {
1255
+								return $this->getFlightMapper($ident);
1256
+							} elseif ($source == 'costtotravel') {
1257
+								return $this->getCostToTravel($ident);
1258
+							}
1143 1259
 							//elseif ($source == 'flightradar24') return $this->getFlightRadar24($ident,$date);
1144
-							elseif ($source == 'flightaware' && $globalFlightAwareUsername != '') return $this->getFlightAware($ident);
1260
+							elseif ($source == 'flightaware' && $globalFlightAwareUsername != '') {
1261
+								return $this->getFlightAware($ident);
1262
+							}
1145 1263
 						}
1146 1264
 					}
1147 1265
 			}
Please login to merge, or discard this patch.
live-geojson.php 3 patches
Indentation   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -14,23 +14,23 @@  discard block
 block discarded – undo
14 14
 $usecoord = false;
15 15
 if (isset($_GET['test'])) exit();
16 16
 if (isset($_GET['tracker'])) {
17
-    $tracker = true;
17
+	$tracker = true;
18 18
 }
19 19
 if (isset($_GET['marine'])) {
20
-    $marine = true;
20
+	$marine = true;
21 21
 }
22 22
 if ($tracker) {
23
-    require_once('require/class.Tracker.php');
24
-    require_once('require/class.TrackerLive.php');
25
-    require_once('require/class.TrackerArchive.php');
23
+	require_once('require/class.Tracker.php');
24
+	require_once('require/class.TrackerLive.php');
25
+	require_once('require/class.TrackerArchive.php');
26 26
 } elseif ($marine) {
27
-    require_once('require/class.Marine.php');
28
-    require_once('require/class.MarineLive.php');
29
-    require_once('require/class.MarineArchive.php');
27
+	require_once('require/class.Marine.php');
28
+	require_once('require/class.MarineLive.php');
29
+	require_once('require/class.MarineArchive.php');
30 30
 } else {
31
-    require_once('require/class.Spotter.php');
32
-    require_once('require/class.SpotterLive.php');
33
-    require_once('require/class.SpotterArchive.php');
31
+	require_once('require/class.Spotter.php');
32
+	require_once('require/class.SpotterLive.php');
33
+	require_once('require/class.SpotterArchive.php');
34 34
 }
35 35
 
36 36
 $begintime = microtime(true);
@@ -50,10 +50,10 @@  discard block
 block discarded – undo
50 50
 $Common = new Common();
51 51
 
52 52
 if (isset($_GET['download'])) {
53
-    if ($_GET['download'] == "true")
54
-    {
53
+	if ($_GET['download'] == "true")
54
+	{
55 55
 	header('Content-disposition: attachment; filename="flightairmap.json"');
56
-    }
56
+	}
57 57
 }
58 58
 header('Content-Type: text/javascript');
59 59
 
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 	$usecoord = true;
132 132
 	$coord = explode(',',$_GET['coord']);
133 133
 	if (filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) 
134
-	    && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0) {
134
+		&& $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0) {
135 135
 		if ($tracker) {
136 136
 			$spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord,$filter);
137 137
 		} elseif ($marine) {
@@ -635,17 +635,17 @@  discard block
 block discarded – undo
635 635
 				if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history'];
636 636
 				
637 637
 				if (
638
-				    (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') 
639
-				    || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory)
638
+					(isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') 
639
+					|| ((isset($globalMapHistory) && $globalMapHistory) || $allhistory)
640 640
 				//    || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id']))
641 641
 				//    || (isset($history) && $history != '' && $history != 'NA' && $history == $spotter_item['ident'])
642
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
643
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])
644
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id']))
645
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id'])
646
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid']))
647
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid'])
648
-				    ) {
642
+					|| (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
643
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])
644
+					|| (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id']))
645
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id'])
646
+					|| (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid']))
647
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid'])
648
+					) {
649 649
 					if ($tracker) {
650 650
 						if ($from_archive || $globalArchive) {
651 651
 							$spotter_history_array = $TrackerArchive->getAllArchiveTrackerDataById($spotter_item['famtrackid']);
@@ -653,9 +653,9 @@  discard block
 block discarded – undo
653 653
 							$spotter_history_array = $TrackerLive->getAllLiveTrackerDataById($spotter_item['famtrackid']);
654 654
 						}
655 655
 						if (((isset($_COOKIE['mapmatching']) && $_COOKIE['mapmatching'] == 'true') ||
656
-						    (!isset($_COOKIE['mapmatching']) && $globalMapMatching === TRUE)) && 
657
-						    isset($_GET['zoom']) && $_GET['zoom'] > 12 && 
658
-						    isset($spotter_item['type']) && (
656
+							(!isset($_COOKIE['mapmatching']) && $globalMapMatching === TRUE)) && 
657
+							isset($_GET['zoom']) && $_GET['zoom'] > 12 && 
658
+							isset($spotter_item['type']) && (
659 659
 							$spotter_item['type'] == 'Firetruck' ||
660 660
 							$spotter_item['type'] == 'Ambulance' ||
661 661
 							$spotter_item['type'] == 'Truck (18 Wheeler)' ||
@@ -667,7 +667,7 @@  discard block
 block discarded – undo
667 667
 							$spotter_item['type'] == 'Jeep' ||
668 668
 							$spotter_item['type'] == 'Motorcycle' ||
669 669
 							$spotter_item['type'] == 'Car'
670
-						    )
670
+							)
671 671
 						) {
672 672
 							require(dirname(__FILE__).'/require/class.MapMatching.php');
673 673
 							$MapMatching = new MapMatching();
@@ -770,75 +770,75 @@  discard block
 block discarded – undo
770 770
 				}
771 771
 				
772 772
 				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
773
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
774
-				     && (isset($spotter_item['departure_airport']) 
775
-				        && $spotter_item['departure_airport'] != 'NA' 
776
-				        && isset($spotter_item['arrival_airport']) 
777
-				        && $spotter_item['arrival_airport'] != 'NA' 
778
-				        && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") 
779
-				    	    || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) {
780
-				    if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
781
-				    else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
782
-				    if (isset($spotter_item['departure_airport_latitude'])) {
773
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
774
+					 && (isset($spotter_item['departure_airport']) 
775
+						&& $spotter_item['departure_airport'] != 'NA' 
776
+						&& isset($spotter_item['arrival_airport']) 
777
+						&& $spotter_item['arrival_airport'] != 'NA' 
778
+						&& ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") 
779
+							|| (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) {
780
+					if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
781
+					else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
782
+					if (isset($spotter_item['departure_airport_latitude'])) {
783 783
 					$output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],';
784
-				    } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') {
784
+					} elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') {
785 785
 					$dairport = $Spotter->getAllAirportInfo($spotter_item['departure_airport']);
786 786
 					if (isset($dairport[0]['latitude'])) {
787
-					    $output_air .= '['.$dairport[0]['longitude'].','.$dairport[0]['latitude'].'],';
787
+						$output_air .= '['.$dairport[0]['longitude'].','.$dairport[0]['latitude'].'],';
788 788
 					}
789
-				    }
790
-				    if (isset($spotter_item['arrival_airport_latitude'])) {
789
+					}
790
+					if (isset($spotter_item['arrival_airport_latitude'])) {
791 791
 					$output_air .= '['.$spotter_item['arrival_airport_longitude'].','.$spotter_item['arrival_airport_latitude'].'],';
792
-				    } elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
792
+					} elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
793 793
 					$aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']);
794 794
 					if (isset($aairport[0]['latitude'])) {
795
-					    $output_air .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].'],';
795
+						$output_air .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].'],';
796 796
 					}
797
-				    }
798
-				    $output_air  = substr($output_air, 0, -1);
799
-				    $output_air .= ']}},';
800
-				    $output .= $output_air;
801
-				    unset($output_air);
797
+					}
798
+					$output_air  = substr($output_air, 0, -1);
799
+					$output_air .= ']}},';
800
+					$output .= $output_air;
801
+					unset($output_air);
802 802
 				}
803 803
 
804 804
 				//if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA' && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) {
805 805
 				//if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) {
806 806
 				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
807
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
808
-				     && (isset($spotter_item['arrival_airport']) 
809
-				        && $spotter_item['arrival_airport'] != 'NA' 
810
-				        && ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == "true") 
811
-				    	    || (!isset($_COOKIE['MapRemainingRoute']) && (!isset($globalMapRemainingRoute) 
812
-				    	    || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) {
813
-				    $havedata = false;
814
-				    if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
815
-				    else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
807
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
808
+					 && (isset($spotter_item['arrival_airport']) 
809
+						&& $spotter_item['arrival_airport'] != 'NA' 
810
+						&& ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == "true") 
811
+							|| (!isset($_COOKIE['MapRemainingRoute']) && (!isset($globalMapRemainingRoute) 
812
+							|| (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) {
813
+					$havedata = false;
814
+					if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
815
+					else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
816 816
 				    
817
-				    //$output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],';
818
-				    if (isset($spotter_item['arrival_airport_latitude'])) {
817
+					//$output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],';
818
+					if (isset($spotter_item['arrival_airport_latitude'])) {
819 819
 					//$output_dest .= '['.$spotter_item['arrival_airport_longitude'].','.$spotter_item['arrival_airport_latitude'].']';
820 820
 					$end_lon = $spotter_item['arrival_airport_longitude'];
821 821
 					$end_lat = $spotter_item['arrival_airport_latitude'];
822 822
 					$havedata = true;
823
-				    } elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
823
+					} elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
824 824
 					$aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']);
825 825
 					if (isset($aairport[0]['latitude'])) {
826
-					    //$output_dest .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].']';
827
-					    $end_lon = $aairport[0]['longitude'];
828
-					    $end_lat = $aairport[0]['latitude'];
829
-					    $havedata = true;
826
+						//$output_dest .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].']';
827
+						$end_lon = $aairport[0]['longitude'];
828
+						$end_lat = $aairport[0]['latitude'];
829
+						$havedata = true;
830 830
 					}
831
-				    }
832
-				    if ($havedata) {
831
+					}
832
+					if ($havedata) {
833 833
 					$line = $Common->greatCircle($spotter_item['latitude'],$spotter_item['longitude'],$end_lat,$end_lon);
834 834
 					foreach ($line[0] as $coord) {
835 835
 						$output_dest .= '['.$coord[0].','.$coord[1].'],';
836 836
 					}
837 837
 					$output_dest  = substr($output_dest, 0, -1);
838
-				    }
839
-				    $output_dest .= ']}},';
840
-				    if ($havedata) $output .= $output_dest;
841
-				    unset($output_dest);
838
+					}
839
+					$output_dest .= ']}},';
840
+					if ($havedata) $output .= $output_dest;
841
+					unset($output_dest);
842 842
 				}
843 843
 			}
844 844
 			$output  = substr($output, 0, -1);
Please login to merge, or discard this patch.
Spacing   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -64,17 +64,17 @@  discard block
 block discarded – undo
64 64
 $min = true;
65 65
 $allhistory = false;
66 66
 $filter['source'] = array();
67
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
68
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
69
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
70
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
71
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
72
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
73
-if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
74
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
75
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
76
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
77
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
67
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt'));
68
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup'));
69
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars'));
70
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs'));
71
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs'));
72
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING);
73
+if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'], FILTER_SANITIZE_STRING);
74
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING);
75
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING);
76
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING);
77
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING);
78 78
 
79 79
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
80 80
 	$min = true;
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 $spotter_array = array();
84 84
 
85 85
 if (isset($_GET['ident'])) {
86
-	$ident = urldecode(filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING));
86
+	$ident = urldecode(filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING));
87 87
 	if ($tracker) {
88 88
 		$spotter_array = $TrackerLive->getLastLiveTrackerDataByIdent($ident);
89 89
 	} elseif ($marine) {
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 	}
98 98
 	$allhistory = true;
99 99
 } elseif (isset($_GET['flightaware_id'])) {
100
-	$flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
100
+	$flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING);
101 101
 	$spotter_array = $SpotterLive->getLastLiveSpotterDataById($flightaware_id);
102 102
 	if (empty($spotter_array)) {
103 103
 		$from_archive = true;
@@ -105,11 +105,11 @@  discard block
 block discarded – undo
105 105
 	}
106 106
 	$allhistory = true;
107 107
 } elseif (isset($_GET['famtrack_id'])) {
108
-	$famtrack_id = urldecode(filter_input(INPUT_GET,'famtrack_id',FILTER_SANITIZE_STRING));
108
+	$famtrack_id = urldecode(filter_input(INPUT_GET, 'famtrack_id', FILTER_SANITIZE_STRING));
109 109
 	$spotter_array = $TrackerLive->getLastLiveTrackerDataById($famtrack_id);
110 110
 	$allhistory = true;
111 111
 } elseif (isset($_GET['fammarine_id'])) {
112
-	$fammarine_id = urldecode(filter_input(INPUT_GET,'fammarine_id',FILTER_SANITIZE_STRING));
112
+	$fammarine_id = urldecode(filter_input(INPUT_GET, 'fammarine_id', FILTER_SANITIZE_STRING));
113 113
 	$spotter_array = $MarineLive->getLastLiveMarineDataById($fammarine_id);
114 114
 	$allhistory = true;
115 115
 /*
@@ -129,15 +129,15 @@  discard block
 block discarded – undo
129 129
 */
130 130
 } elseif (isset($globalMapUseBbox) && $globalMapUseBbox && isset($_GET['coord']) && $min && !isset($_GET['archive'])) {
131 131
 	$usecoord = true;
132
-	$coord = explode(',',$_GET['coord']);
133
-	if (filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) 
132
+	$coord = explode(',', $_GET['coord']);
133
+	if (filter_var($coord[0], FILTER_VALIDATE_FLOAT) && filter_var($coord[1], FILTER_VALIDATE_FLOAT) && filter_var($coord[2], FILTER_VALIDATE_FLOAT) && filter_var($coord[3], FILTER_VALIDATE_FLOAT) 
134 134
 	    && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0) {
135 135
 		if ($tracker) {
136
-			$spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord,$filter);
136
+			$spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord, $filter);
137 137
 		} elseif ($marine) {
138
-			$spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord,$filter);
138
+			$spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord, $filter);
139 139
 		} else {
140
-			$spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord,$filter);
140
+			$spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord, $filter);
141 141
 		}
142 142
 	} else {
143 143
 		if ($tracker) {
@@ -152,12 +152,12 @@  discard block
 block discarded – undo
152 152
 	$from_archive = true;
153 153
 //	$begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
154 154
 //	$enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
155
-	$begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT);
156
-	$enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT);
157
-	$archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT);
158
-	$begindate = date('Y-m-d H:i:s',$begindate);
159
-	$enddate = date('Y-m-d H:i:s',$enddate);
160
-	$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter);
155
+	$begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT);
156
+	$enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT);
157
+	$archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT);
158
+	$begindate = date('Y-m-d H:i:s', $begindate);
159
+	$enddate = date('Y-m-d H:i:s', $enddate);
160
+	$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter);
161 161
 } elseif ($min) {
162 162
 	if ($tracker) {
163 163
 		$spotter_array = $TrackerLive->getMinLiveTrackerData($filter);
@@ -169,17 +169,17 @@  discard block
 block discarded – undo
169 169
 #	$min = true;
170 170
 } else {
171 171
 	if ($tracker) {
172
-		$spotter_array = $TrackerLive->getLiveTrackerData('','',$filter);
172
+		$spotter_array = $TrackerLive->getLiveTrackerData('', '', $filter);
173 173
 	} elseif ($marine) {
174
-		$spotter_array = $marineLive->getLiveMarineData('','',$filter);
174
+		$spotter_array = $marineLive->getLiveMarineData('', '', $filter);
175 175
 	} else {
176
-		$spotter_array = $SpotterLive->getLiveSpotterData('','',$filter);
176
+		$spotter_array = $SpotterLive->getLiveSpotterData('', '', $filter);
177 177
 	}
178 178
 }
179 179
 
180 180
 if ($usecoord) {
181 181
 	if (isset($_GET['archive'])) {
182
-		$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter);
182
+		$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter);
183 183
 	} else {
184 184
 		if ($tracker) {
185 185
 			$flightcnt = $TrackerLive->getLiveTrackerCount($filter);
@@ -192,9 +192,9 @@  discard block
 block discarded – undo
192 192
 	if ($flightcnt == '') $flightcnt = 0;
193 193
 } else $flightcnt = 0;
194 194
 
195
-$sqltime = round(microtime(true)-$begintime,2);
195
+$sqltime = round(microtime(true) - $begintime, 2);
196 196
 
197
-$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
197
+$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT);
198 198
 if ($currenttime != '') $currenttime = round($currenttime/1000);
199 199
 
200 200
 if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false;
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 		if (!empty($spotter_array) && is_array($spotter_array))
214 214
 		{
215 215
 			$output .= '"features": [';
216
-			foreach($spotter_array as $spotter_item)
216
+			foreach ($spotter_array as $spotter_item)
217 217
 			{
218 218
 				$j++;
219 219
 				unset($idistance);
@@ -270,8 +270,8 @@  discard block
 block discarded – undo
270 270
 */
271 271
 							//$output .= '"fc": "'.$spotter_item['nb'].'",';
272 272
 						if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') {
273
-							if ($compress) $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",';
274
-							else $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",';
273
+							if ($compress) $output .= '"c": "'.str_replace('\\', '', $spotter_item['ident']).'",';
274
+							else $output .= '"callsign": "'.str_replace('\\', '', $spotter_item['ident']).'",';
275 275
 							//"
276 276
 						} else {
277 277
 							if ($compress) $output .= '"c": "NA",';
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 						if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",';
281 281
 						if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) {
282 282
 							$output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",';
283
-							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",';
283
+							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ', '_', $spotter_item['aircraft_name'])).'",';
284 284
 						} elseif (isset($spotter_item['aircraft_type'])) {
285 285
 							$output .= '"aircraft_name": "NA ('.$spotter_item['aircraft_type'].')",';
286 286
 						} elseif (!$min) {
@@ -423,15 +423,15 @@  discard block
 block discarded – undo
423 423
 						if (isset($archivespeed) || $usenextlatlon) {
424 424
 							if (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
425 425
 								if (isset($spotter_item['arrival_airport_latitude'])) {
426
-									$cheading = $Common->getHeading($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['arrival_airport_latitude'],$spotter_item['arrival_airport_longitude']);
427
-									$idistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['arrival_airport_latitude'],$spotter_item['arrival_airport_longitude']);
426
+									$cheading = $Common->getHeading($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['arrival_airport_latitude'], $spotter_item['arrival_airport_longitude']);
427
+									$idistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['arrival_airport_latitude'], $spotter_item['arrival_airport_longitude']);
428 428
 									$farr_lat = $spotter_item['arrival_airport_latitude'];
429 429
 									$farr_lon = $spotter_item['arrival_airport_longitude'];
430 430
 								} else {
431 431
 									$aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']);
432 432
 									if (isset($aairport[0]['latitude'])) {
433
-										$cheading = $Common->getHeading($spotter_item['latitude'],$spotter_item['longitude'],$aairport[0]['latitude'],$aairport[0]['longitude']);
434
-										$idistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$aairport[0]['latitude'],$aairport[0]['longitude']);
433
+										$cheading = $Common->getHeading($spotter_item['latitude'], $spotter_item['longitude'], $aairport[0]['latitude'], $aairport[0]['longitude']);
434
+										$idistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $aairport[0]['latitude'], $aairport[0]['longitude']);
435 435
 										$farr_lat = $aairport[0]['latitude'];
436 436
 										$farr_lon = $aairport[0]['longitude'];
437 437
 									}
@@ -444,59 +444,59 @@  discard block
 block discarded – undo
444 444
 						if ($currenttime != '') {
445 445
 							if (strtotime($spotter_item['date']) < $currenttime) {
446 446
 								if (isset($archivespeed)) {
447
-									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
448
-									$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
447
+									$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh));
448
+									$fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']);
449 449
 									if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
450 450
 									else {
451
-										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
452
-										$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
451
+										$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, $archivespeed, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh));
452
+										$fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']);
453 453
 										if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
454 454
 										else {
455
-											$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed);
455
+											$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed);
456 456
 											$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
457 457
 										}
458 458
 									}
459 459
 								} elseif ($usenextlatlon) {
460
-									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
461
-									$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
460
+									$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, 1, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh));
461
+									$fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']);
462 462
 									if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
463 463
 									else {
464
-										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
465
-										$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
464
+										$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, 1, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh));
465
+										$fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']);
466 466
 										if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
467 467
 										else {
468
-											$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading);
468
+											$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading);
469 469
 											$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
470 470
 										}
471 471
 									}
472 472
 								}
473 473
 							} else {
474 474
 								if (isset($archivespeed)) {
475
-									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed);
475
+									$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed);
476 476
 									$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
477 477
 								} elseif ($usenextlatlon) {
478
-									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading);
478
+									$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading);
479 479
 									$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
480 480
 								}
481 481
 							}
482 482
 						} else {
483 483
 							if (isset($archivespeed)) {
484
-								$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed);
485
-								$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
484
+								$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed);
485
+								$fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']);
486 486
 								if (!isset($idistance) || $fdistance < $idistance) {
487 487
 									$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
488 488
 								} else {
489
-									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed);
489
+									$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, $archivespeed);
490 490
 									//$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
491 491
 									$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
492 492
 								}
493 493
 							} elseif ($usenextlatlon) {
494
-								$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading);
495
-								$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
494
+								$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading);
495
+								$fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']);
496 496
 								if (!isset($idistance) || $fdistance < $idistance) {
497 497
 										$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
498 498
 								} else {
499
-									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading);
499
+									$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading);
500 500
 									//$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
501 501
 									$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
502 502
 								}
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
 
506 506
 						if (!$min) $output .= '"image": "'.$image.'",';
507 507
 						if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') {
508
-							$output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",';
508
+							$output .= '"image_copyright": "'.str_replace('"', "'", trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $spotter_item['image_copyright']))).'",';
509 509
 						}
510 510
 						if (isset($spotter_item['image_source_website'])) {
511 511
 							$output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",';
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
 							$output .= '"waypoints": "'.$spotter_item['waypoints'].'",';
528 528
 						}
529 529
 						if (isset($spotter_item['acars'])) {
530
-							$output .= '"acars": "'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"), '<br />',$spotter_item['acars']['message'])).'",';
530
+							$output .= '"acars": "'.trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '<br />', $spotter_item['acars']['message'])).'",';
531 531
 						}
532 532
 						// type when not aircraft ?
533 533
 						if (isset($spotter_item['type'])) {
@@ -547,12 +547,12 @@  discard block
 block discarded – undo
547 547
 								if ($currenttime != '') {
548 548
 									if (strtotime($spotter_item['date']) < $currenttime) {
549 549
 										if (!isset($archivespeed)) $archivespeed = 1;
550
-										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date'])));
551
-										$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
550
+										$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed, ($currenttime - strtotime($spotter_item['date'])));
551
+										$fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']);
552 552
 										if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
553 553
 										else {
554
-											$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date'])));
555
-											$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
554
+											$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, $archivespeed, ($currenttime - strtotime($spotter_item['date'])));
555
+											$fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']);
556 556
 											if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
557 557
 											else {
558 558
 												$output .= $spotter_item['longitude'].', ';
@@ -631,7 +631,7 @@  discard block
 block discarded – undo
631 631
                 
632 632
 			}
633 633
 */
634
-				$history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING);
634
+				$history = filter_input(INPUT_GET, 'history', FILTER_SANITIZE_STRING);
635 635
 				if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history'];
636 636
 				
637 637
 				if (
@@ -639,11 +639,11 @@  discard block
 block discarded – undo
639 639
 				    || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory)
640 640
 				//    || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id']))
641 641
 				//    || (isset($history) && $history != '' && $history != 'NA' && $history == $spotter_item['ident'])
642
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
642
+				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id']))
643 643
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])
644
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id']))
644
+				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['fammarine_id']))
645 645
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id'])
646
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid']))
646
+				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['famtrackid']))
647 647
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid'])
648 648
 				    ) {
649 649
 					if ($tracker) {
@@ -672,9 +672,9 @@  discard block
 block discarded – undo
672 672
 							require(dirname(__FILE__).'/require/class.MapMatching.php');
673 673
 							$MapMatching = new MapMatching();
674 674
 							if (isset($spotter_item['date_iso_8601'])) {
675
-								$spotter_history_array_mm = array_merge($spotter_history_array,array(array('latitude' => $spotter_item['latitude'],'longitude' => $spotter_item['longitude'],'date' => date('c',strtotime($spotter_item['date_iso_8601'])))));
675
+								$spotter_history_array_mm = array_merge($spotter_history_array, array(array('latitude' => $spotter_item['latitude'], 'longitude' => $spotter_item['longitude'], 'date' => date('c', strtotime($spotter_item['date_iso_8601'])))));
676 676
 							} else {
677
-								$spotter_history_array_mm = array_merge($spotter_history_array,array(array('latitude' => $spotter_item['latitude'],'longitude' => $spotter_item['longitude'],'date' => date('c',strtotime($spotter_item['date'])))));
677
+								$spotter_history_array_mm = array_merge($spotter_history_array, array(array('latitude' => $spotter_item['latitude'], 'longitude' => $spotter_item['longitude'], 'date' => date('c', strtotime($spotter_item['date'])))));
678 678
 							}
679 679
 							$spotter_history_array = $MapMatching->match($spotter_history_array_mm);
680 680
 						}
@@ -706,9 +706,9 @@  discard block
 block discarded – undo
706 706
 								else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
707 707
 							}
708 708
 							$output_history .= '[';
709
-							$output_history .=  $spotter_history['longitude'].', ';
710
-							$output_history .=  $spotter_history['latitude'].', ';
711
-							$output_history .=  $spotter_history['altitude']*30.48;
709
+							$output_history .= $spotter_history['longitude'].', ';
710
+							$output_history .= $spotter_history['latitude'].', ';
711
+							$output_history .= $spotter_history['altitude']*30.48;
712 712
 							$output_history .= '],';
713 713
 							/*
714 714
 							if ($from_archive === false) {
@@ -731,8 +731,8 @@  discard block
 block discarded – undo
731 731
 								$d = true;
732 732
 							}
733 733
 							$output_history .= '[';
734
-							$output_history .=  $spotter_history['longitude'].', ';
735
-							$output_history .=  $spotter_history['latitude'];
734
+							$output_history .= $spotter_history['longitude'].', ';
735
+							$output_history .= $spotter_history['latitude'];
736 736
 							$output_history .= '],';
737 737
 							/*
738 738
 							if ($from_archive === false) {
@@ -748,9 +748,9 @@  discard block
 block discarded – undo
748 748
 						//echo $output_history;
749 749
 						if ($from_archive === false && !isset($spotter_history_array[0]['mapmatching_engine'])) {
750 750
 							$output_historyd = '[';
751
-							$output_historyd .=  $spotter_item['longitude'].', ';
752
-							$output_historyd .=  $spotter_item['latitude'];
753
-							if (isset($spotter_history['altitude'])) $output_historyd .=  ','.$spotter_item['altitude']*30.48;
751
+							$output_historyd .= $spotter_item['longitude'].', ';
752
+							$output_historyd .= $spotter_item['latitude'];
753
+							if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48;
754 754
 							$output_historyd .= '],';
755 755
 							//$output_history = $output_historyd.$output_history;
756 756
 							$output_history = $output_history.$output_historyd;
@@ -758,7 +758,7 @@  discard block
 block discarded – undo
758 758
 							$last = array_pop($spotter_history_array);
759 759
 							$latitude = $last['latitude'];
760 760
 							$longitude = $last['longitude'];
761
-							$output = str_replace('"coordinates": ['.$spotter_item['longitude'].', '.$spotter_item['latitude'].']}','"coordinates": ['.$longitude.', '.$latitude.']}',$output);
761
+							$output = str_replace('"coordinates": ['.$spotter_item['longitude'].', '.$spotter_item['latitude'].']}', '"coordinates": ['.$longitude.', '.$latitude.']}', $output);
762 762
 						}
763 763
 						
764 764
 						$output_history  = substr($output_history, 0, -1);
@@ -769,7 +769,7 @@  discard block
 block discarded – undo
769 769
 					}
770 770
 				}
771 771
 				
772
-				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
772
+				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id']))
773 773
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
774 774
 				     && (isset($spotter_item['departure_airport']) 
775 775
 				        && $spotter_item['departure_airport'] != 'NA' 
@@ -803,7 +803,7 @@  discard block
 block discarded – undo
803 803
 
804 804
 				//if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA' && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) {
805 805
 				//if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) {
806
-				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
806
+				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id']))
807 807
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
808 808
 				     && (isset($spotter_item['arrival_airport']) 
809 809
 				        && $spotter_item['arrival_airport'] != 'NA' 
@@ -830,11 +830,11 @@  discard block
 block discarded – undo
830 830
 					}
831 831
 				    }
832 832
 				    if ($havedata) {
833
-					$line = $Common->greatCircle($spotter_item['latitude'],$spotter_item['longitude'],$end_lat,$end_lon);
833
+					$line = $Common->greatCircle($spotter_item['latitude'], $spotter_item['longitude'], $end_lat, $end_lon);
834 834
 					foreach ($line[0] as $coord) {
835 835
 						$output_dest .= '['.$coord[0].','.$coord[1].'],';
836 836
 					}
837
-					$output_dest  = substr($output_dest, 0, -1);
837
+					$output_dest = substr($output_dest, 0, -1);
838 838
 				    }
839 839
 				    $output_dest .= ']}},';
840 840
 				    if ($havedata) $output .= $output_dest;
@@ -844,7 +844,7 @@  discard block
 block discarded – undo
844 844
 			$output  = substr($output, 0, -1);
845 845
 			$output .= ']';
846 846
 			$output .= ',"initial_sqltime": "'.$sqltime.'",';
847
-			$output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",';
847
+			$output .= '"totaltime": "'.round(microtime(true) - $begintime, 2).'",';
848 848
 			if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
849 849
 			$output .= '"fc": "'.$j.'"';
850 850
 		} else {
Please login to merge, or discard this patch.
Braces   +321 added lines, -130 removed lines patch added patch discarded remove patch
@@ -12,7 +12,9 @@  discard block
 block discarded – undo
12 12
 $tracker = false;
13 13
 $marine = false;
14 14
 $usecoord = false;
15
-if (isset($_GET['test'])) exit();
15
+if (isset($_GET['test'])) {
16
+	exit();
17
+}
16 18
 if (isset($_GET['tracker'])) {
17 19
     $tracker = true;
18 20
 }
@@ -57,28 +59,55 @@  discard block
 block discarded – undo
57 59
 }
58 60
 header('Content-Type: text/javascript');
59 61
 
60
-if (!isset($globalJsonCompress)) $compress = true;
61
-else $compress = $globalJsonCompress;
62
+if (!isset($globalJsonCompress)) {
63
+	$compress = true;
64
+} else {
65
+	$compress = $globalJsonCompress;
66
+}
62 67
 
63 68
 $from_archive = false;
64 69
 $min = true;
65 70
 $allhistory = false;
66 71
 $filter['source'] = array();
67
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
68
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
69
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
70
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
71
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
72
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
73
-if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
74
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
75
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
76
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
77
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
72
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') {
73
+	$filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
74
+}
75
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') {
76
+	$filter['source'] = array_merge($filter['source'],array('whazzup'));
77
+}
78
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') {
79
+	$filter['source'] = array_merge($filter['source'],array('phpvmacars'));
80
+}
81
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') {
82
+	$filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
83
+}
84
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') {
85
+	$filter['source'] = array_merge($filter['source'],array('aprs'));
86
+}
87
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') {
88
+	$filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
89
+}
90
+if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') {
91
+	$filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
92
+}
93
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') {
94
+	$filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
95
+}
96
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') {
97
+	$filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
98
+}
99
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') {
100
+	$filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
101
+}
102
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') {
103
+	$filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
104
+}
78 105
 
79 106
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
80 107
 	$min = true;
81
-} else $min = false;
108
+} else {
109
+	$min = false;
110
+}
82 111
 
83 112
 $spotter_array = array();
84 113
 
@@ -189,24 +218,38 @@  discard block
 block discarded – undo
189 218
 			$flightcnt = $SpotterLive->getLiveSpotterCount($filter);
190 219
 		}
191 220
 	}
192
-	if ($flightcnt == '') $flightcnt = 0;
193
-} else $flightcnt = 0;
221
+	if ($flightcnt == '') {
222
+		$flightcnt = 0;
223
+	}
224
+	} else {
225
+	$flightcnt = 0;
226
+}
194 227
 
195 228
 $sqltime = round(microtime(true)-$begintime,2);
196 229
 
197 230
 $currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
198
-if ($currenttime != '') $currenttime = round($currenttime/1000);
231
+if ($currenttime != '') {
232
+	$currenttime = round($currenttime/1000);
233
+}
199 234
 
200
-if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false;
201
-else $usenextlatlon = true;
202
-if ($usenextlatlon === false) $currenttime = '';
235
+if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) {
236
+	$usenextlatlon = false;
237
+} else {
238
+	$usenextlatlon = true;
239
+}
240
+if ($usenextlatlon === false) {
241
+	$currenttime = '';
242
+}
203 243
 $j = 0;
204 244
 $prev_flightaware_id = '';
205 245
 $aircrafts_shadow = array();
206 246
 $output = '{';
207 247
 	$output .= '"type": "FeatureCollection",';
208
-		if ($min) $output .= '"minimal": "true",';
209
-		else $output .= '"minimal": "false",';
248
+		if ($min) {
249
+			$output .= '"minimal": "true",';
250
+		} else {
251
+			$output .= '"minimal": "false",';
252
+		}
210 253
 		//$output .= '"fc": "'.$flightcnt.'",';
211 254
 		$output .= '"sqt": "'.$sqltime.'",';
212 255
 
@@ -251,18 +294,29 @@  discard block
 block discarded – undo
251 294
 						}
252 295
 						$output .= '"properties": {';
253 296
 						if (isset($spotter_item['flightaware_id'])) {
254
-							if ($compress) $output .= '"fi": "'.$spotter_item['flightaware_id'].'",';
255
-							else $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",';
297
+							if ($compress) {
298
+								$output .= '"fi": "'.$spotter_item['flightaware_id'].'",';
299
+							} else {
300
+								$output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",';
301
+							}
256 302
 						} elseif (isset($spotter_item['famtrackid'])) {
257
-							if ($compress) $output .= '"fti": "'.$spotter_item['famtrackid'].'",';
258
-							else $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",';
303
+							if ($compress) {
304
+								$output .= '"fti": "'.$spotter_item['famtrackid'].'",';
305
+							} else {
306
+								$output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",';
307
+							}
259 308
 						} elseif (isset($spotter_item['fammarine_id'])) {
260
-							if ($compress) $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",';
261
-							else $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",';
309
+							if ($compress) {
310
+								$output .= '"fmi": "'.$spotter_item['fammarine_id'].'",';
311
+							} else {
312
+								$output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",';
313
+							}
262 314
 						}
263 315
 						$output .= '"fc": "'.$flightcnt.'",';
264 316
 						$output .= '"sqt": "'.$sqltime.'",';
265
-						if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
317
+						if (isset($begindate)) {
318
+							$output .= '"archive_date": "'.$begindate.'",';
319
+						}
266 320
 
267 321
 /*
268 322
 							if ($min) $output .= '"minimal": "true",';
@@ -270,14 +324,22 @@  discard block
 block discarded – undo
270 324
 */
271 325
 							//$output .= '"fc": "'.$spotter_item['nb'].'",';
272 326
 						if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') {
273
-							if ($compress) $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",';
274
-							else $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",';
327
+							if ($compress) {
328
+								$output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",';
329
+							} else {
330
+								$output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",';
331
+							}
275 332
 							//"
276 333
 						} else {
277
-							if ($compress) $output .= '"c": "NA",';
278
-							else $output .= '"callsign": "NA",';
334
+							if ($compress) {
335
+								$output .= '"c": "NA",';
336
+							} else {
337
+								$output .= '"callsign": "NA",';
338
+							}
339
+						}
340
+						if (isset($spotter_item['registration'])) {
341
+							$output .= '"registration": "'.$spotter_item['registration'].'",';
279 342
 						}
280
-						if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",';
281 343
 						if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) {
282 344
 							$output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",';
283 345
 							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",';
@@ -290,16 +352,23 @@  discard block
 block discarded – undo
290 352
 							$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
291 353
 						}
292 354
 						if (!isset($spotter_item['aircraft_shadow']) && !$tracker && !$marine) {
293
-							if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = '';
294
-							else {
355
+							if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') {
356
+								$spotter_item['aircraft_shadow'] = '';
357
+							} else {
295 358
 								$aircraft_icao = $spotter_item['aircraft_icao'];
296
-								if (isset($aircrafts_shadow[$aircraft_icao])) $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao];
297
-								else {
359
+								if (isset($aircrafts_shadow[$aircraft_icao])) {
360
+									$spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao];
361
+								} else {
298 362
 									$aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']);
299
-									if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
300
-									elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png';
301
-									elseif ($aircraft_icao == 'PARAGLIDER') $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png';
302
-									else $spotter_item['aircraft_shadow'] = '';
363
+									if (count($aircraft_info) > 0) {
364
+										$spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
365
+									} elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') {
366
+										$spotter_item['aircraft_shadow'] = 'PA18.png';
367
+									} elseif ($aircraft_icao == 'PARAGLIDER') {
368
+										$spotter_item['aircraft_shadow'] = 'PARAGLIDER.png';
369
+									} else {
370
+										$spotter_item['aircraft_shadow'] = '';
371
+									}
303 372
 									$aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow'];
304 373
 								}
305 374
 							}
@@ -307,73 +376,139 @@  discard block
 block discarded – undo
307 376
 						if (!isset($spotter_item['aircraft_shadow']) || $spotter_item['aircraft_shadow'] == '') {
308 377
 							if ($tracker) {
309 378
 								if (isset($spotter_item['type']) && $spotter_item['type'] == 'Ambulance') {
310
-									if ($compress) $output .= '"as": "ambulance.png",';
311
-									else $output .= '"aircraft_shadow": "ambulance.png",';
379
+									if ($compress) {
380
+										$output .= '"as": "ambulance.png",';
381
+									} else {
382
+										$output .= '"aircraft_shadow": "ambulance.png",';
383
+									}
312 384
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') {
313
-									if ($compress) $output .= '"as": "police.png",';
314
-									else $output .= '"aircraft_shadow": "police.png",';
385
+									if ($compress) {
386
+										$output .= '"as": "police.png",';
387
+									} else {
388
+										$output .= '"aircraft_shadow": "police.png",';
389
+									}
315 390
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') {
316
-									if ($compress) $output .= '"as": "ship.png",';
317
-									else $output .= '"aircraft_shadow": "ship.png",';
391
+									if ($compress) {
392
+										$output .= '"as": "ship.png",';
393
+									} else {
394
+										$output .= '"aircraft_shadow": "ship.png",';
395
+									}
318 396
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') {
319
-									if ($compress) $output .= '"as": "ship.png",';
320
-									else $output .= '"aircraft_shadow": "ship.png",';
397
+									if ($compress) {
398
+										$output .= '"as": "ship.png",';
399
+									} else {
400
+										$output .= '"aircraft_shadow": "ship.png",';
401
+									}
321 402
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') {
322
-									if ($compress) $output .= '"as": "ship.png",';
323
-									else $output .= '"aircraft_shadow": "ship.png",';
403
+									if ($compress) {
404
+										$output .= '"as": "ship.png",';
405
+									} else {
406
+										$output .= '"aircraft_shadow": "ship.png",';
407
+									}
324 408
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') {
325
-									if ($compress) $output .= '"as": "truck.png",';
326
-									else $output .= '"aircraft_shadow": "truck.png",';
409
+									if ($compress) {
410
+										$output .= '"as": "truck.png",';
411
+									} else {
412
+										$output .= '"aircraft_shadow": "truck.png",';
413
+									}
327 414
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') {
328
-									if ($compress) $output .= '"as": "truck.png",';
329
-									else $output .= '"aircraft_shadow": "truck.png",';
415
+									if ($compress) {
416
+										$output .= '"as": "truck.png",';
417
+									} else {
418
+										$output .= '"aircraft_shadow": "truck.png",';
419
+									}
330 420
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') {
331
-									if ($compress) $output .= '"as": "aircraft.png",';
332
-									else $output .= '"aircraft_shadow": "aircraft.png",';
421
+									if ($compress) {
422
+										$output .= '"as": "aircraft.png",';
423
+									} else {
424
+										$output .= '"aircraft_shadow": "aircraft.png",';
425
+									}
333 426
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') {
334
-									if ($compress) $output .= '"as": "aircraft.png",';
335
-									else $output .= '"aircraft_shadow": "aircraft.png",';
427
+									if ($compress) {
428
+										$output .= '"as": "aircraft.png",';
429
+									} else {
430
+										$output .= '"aircraft_shadow": "aircraft.png",';
431
+									}
336 432
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') {
337
-									if ($compress) $output .= '"as": "helico.png",';
338
-									else $output .= '"aircraft_shadow": "helico.png",';
433
+									if ($compress) {
434
+										$output .= '"as": "helico.png",';
435
+									} else {
436
+										$output .= '"aircraft_shadow": "helico.png",';
437
+									}
339 438
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') {
340
-									if ($compress) $output .= '"as": "rail.png",';
341
-									else $output .= '"aircraft_shadow": "rail.png",';
439
+									if ($compress) {
440
+										$output .= '"as": "rail.png",';
441
+									} else {
442
+										$output .= '"aircraft_shadow": "rail.png",';
443
+									}
342 444
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') {
343
-									if ($compress) $output .= '"as": "firetruck.png",';
344
-									else $output .= '"aircraft_shadow": "firetruck.png",';
445
+									if ($compress) {
446
+										$output .= '"as": "firetruck.png",';
447
+									} else {
448
+										$output .= '"aircraft_shadow": "firetruck.png",';
449
+									}
345 450
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') {
346
-									if ($compress) $output .= '"as": "bus.png",';
347
-									else $output .= '"aircraft_shadow": "bus.png",';
451
+									if ($compress) {
452
+										$output .= '"as": "bus.png",';
453
+									} else {
454
+										$output .= '"aircraft_shadow": "bus.png",';
455
+									}
348 456
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') {
349
-									if ($compress) $output .= '"as": "phone.png",';
350
-									else $output .= '"aircraft_shadow": "phone.png",';
457
+									if ($compress) {
458
+										$output .= '"as": "phone.png",';
459
+									} else {
460
+										$output .= '"aircraft_shadow": "phone.png",';
461
+									}
351 462
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') {
352
-									if ($compress) $output .= '"as": "jogger.png",';
353
-									else $output .= '"aircraft_shadow": "jogger.png",';
463
+									if ($compress) {
464
+										$output .= '"as": "jogger.png",';
465
+									} else {
466
+										$output .= '"aircraft_shadow": "jogger.png",';
467
+									}
354 468
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') {
355
-									if ($compress) $output .= '"as": "bike.png",';
356
-									else $output .= '"aircraft_shadow": "bike.png",';
469
+									if ($compress) {
470
+										$output .= '"as": "bike.png",';
471
+									} else {
472
+										$output .= '"aircraft_shadow": "bike.png",';
473
+									}
357 474
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') {
358
-									if ($compress) $output .= '"as": "motorcycle.png",';
359
-									else $output .= '"aircraft_shadow": "motorcycle.png",';
475
+									if ($compress) {
476
+										$output .= '"as": "motorcycle.png",';
477
+									} else {
478
+										$output .= '"aircraft_shadow": "motorcycle.png",';
479
+									}
360 480
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') {
361
-									if ($compress) $output .= '"as": "balloon.png",';
362
-									else $output .= '"aircraft_shadow": "balloon.png",';
481
+									if ($compress) {
482
+										$output .= '"as": "balloon.png",';
483
+									} else {
484
+										$output .= '"aircraft_shadow": "balloon.png",';
485
+									}
363 486
 								} else {
364
-									if ($compress) $output .= '"as": "car.png",';
365
-									else $output .= '"aircraft_shadow": "car.png",';
487
+									if ($compress) {
488
+										$output .= '"as": "car.png",';
489
+									} else {
490
+										$output .= '"aircraft_shadow": "car.png",';
491
+									}
366 492
 								}
367 493
 							} elseif ($marine) {
368
-								if ($compress) $output .= '"as": "ship.png",';
369
-								else $output .= '"aircraft_shadow": "ship.png",';
494
+								if ($compress) {
495
+									$output .= '"as": "ship.png",';
496
+								} else {
497
+									$output .= '"aircraft_shadow": "ship.png",';
498
+								}
370 499
 							} else {
371
-								if ($compress) $output .= '"as": "default.png",';
372
-								else $output .= '"aircraft_shadow": "default.png",';
500
+								if ($compress) {
501
+									$output .= '"as": "default.png",';
502
+								} else {
503
+									$output .= '"aircraft_shadow": "default.png",';
504
+								}
373 505
 							}
374 506
 						} else {
375
-							if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
376
-							else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
507
+							if ($compress) {
508
+								$output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
509
+							} else {
510
+								$output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
511
+							}
377 512
 						}
378 513
 						if (isset($spotter_item['airline_name'])) {
379 514
 							$output .= '"airline_name": "'.$spotter_item['airline_name'].'",';
@@ -381,8 +516,11 @@  discard block
 block discarded – undo
381 516
 							$output .= '"airline_name": "NA",';
382 517
 						}
383 518
 						if (isset($spotter_item['departure_airport'])) {
384
-							if ($compress) $output .= '"dac": "'.$spotter_item['departure_airport'].'",';
385
-							else $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",';
519
+							if ($compress) {
520
+								$output .= '"dac": "'.$spotter_item['departure_airport'].'",';
521
+							} else {
522
+								$output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",';
523
+							}
386 524
 						}
387 525
 						if (isset($spotter_item['departure_airport_city'])) {
388 526
 							$output .= '"departure_airport": "'.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_country'].'",';
@@ -394,8 +532,11 @@  discard block
 block discarded – undo
394 532
 							$output .= '"arrival_airport_time": "'.$spotter_item['arrival_airport_time'].'",';
395 533
 						}
396 534
 						if (isset($spotter_item['arrival_airport'])) {
397
-							if ($compress) $output .= '"aac": "'.$spotter_item['arrival_airport'].'",';
398
-							else $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",';
535
+							if ($compress) {
536
+								$output .= '"aac": "'.$spotter_item['arrival_airport'].'",';
537
+							} else {
538
+								$output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",';
539
+							}
399 540
 						}
400 541
 						if (isset($spotter_item['arrival_airport_city'])) {
401 542
 							$output .= '"arrival_airport": "'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].'",';
@@ -414,8 +555,11 @@  discard block
 block discarded – undo
414 555
 						}
415 556
 						
416 557
 						if (isset($spotter_item['altitude'])) {
417
-							if ($compress) $output .= '"a": "'.$spotter_item['altitude'].'",';
418
-							else $output .= '"altitude": "'.$spotter_item['altitude'].'",';
558
+							if ($compress) {
559
+								$output .= '"a": "'.$spotter_item['altitude'].'",';
560
+							} else {
561
+								$output .= '"altitude": "'.$spotter_item['altitude'].'",';
562
+							}
419 563
 						}
420 564
 						
421 565
 						$heading = $spotter_item['heading'];
@@ -439,19 +583,24 @@  discard block
 block discarded – undo
439 583
 							}
440 584
 						}
441 585
 						
442
-						if ($compress)$output .= '"h": "'.$heading.'",';
443
-						else $output .= '"heading": "'.$heading.'",';
586
+						if ($compress) {
587
+							$output .= '"h": "'.$heading.'",';
588
+						} else {
589
+							$output .= '"heading": "'.$heading.'",';
590
+						}
444 591
 						if ($currenttime != '') {
445 592
 							if (strtotime($spotter_item['date']) < $currenttime) {
446 593
 								if (isset($archivespeed)) {
447 594
 									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
448 595
 									$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
449
-									if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
450
-									else {
596
+									if (!isset($idistance) || $fdistance < $idistance) {
597
+										$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
598
+									} else {
451 599
 										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
452 600
 										$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
453
-										if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
454
-										else {
601
+										if (!isset($idistance) || $fdistance < $idistance) {
602
+											$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
603
+										} else {
455 604
 											$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed);
456 605
 											$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
457 606
 										}
@@ -459,12 +608,14 @@  discard block
 block discarded – undo
459 608
 								} elseif ($usenextlatlon) {
460 609
 									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
461 610
 									$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
462
-									if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
463
-									else {
611
+									if (!isset($idistance) || $fdistance < $idistance) {
612
+										$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
613
+									} else {
464 614
 										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
465 615
 										$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
466
-										if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
467
-										else {
616
+										if (!isset($idistance) || $fdistance < $idistance) {
617
+											$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
618
+										} else {
468 619
 											$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading);
469 620
 											$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
470 621
 										}
@@ -503,7 +654,9 @@  discard block
 block discarded – undo
503 654
 							}
504 655
 						}
505 656
 
506
-						if (!$min) $output .= '"image": "'.$image.'",';
657
+						if (!$min) {
658
+							$output .= '"image": "'.$image.'",';
659
+						}
507 660
 						if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') {
508 661
 							$output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",';
509 662
 						}
@@ -511,8 +664,11 @@  discard block
 block discarded – undo
511 664
 							$output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",';
512 665
 						}
513 666
 						if (isset($spotter_item['squawk'])) {
514
-							if ($compress) $output .= '"sq": "'.$spotter_item['squawk'].'",';
515
-							else $output .= '"squawk": "'.$spotter_item['squawk'].'",';
667
+							if ($compress) {
668
+								$output .= '"sq": "'.$spotter_item['squawk'].'",';
669
+							} else {
670
+								$output .= '"squawk": "'.$spotter_item['squawk'].'",';
671
+							}
516 672
 						}
517 673
 						if (isset($spotter_item['squawk_usage'])) {
518 674
 							$output .= '"squawk_usage": "'.$spotter_item['squawk_usage'].'",';
@@ -531,14 +687,23 @@  discard block
 block discarded – undo
531 687
 						}
532 688
 						// type when not aircraft ?
533 689
 						if (isset($spotter_item['type'])) {
534
-							if ($compress) $output .= '"t": "'.$spotter_item['type'].'"';
535
-							else $output .= '"type": "'.$spotter_item['type'].'"';
690
+							if ($compress) {
691
+								$output .= '"t": "'.$spotter_item['type'].'"';
692
+							} else {
693
+								$output .= '"type": "'.$spotter_item['type'].'"';
694
+							}
536 695
 						} elseif ($marine) {
537
-							if ($compress) $output .= '"t": "ship"';
538
-							else $output .= '"type": "ship"';
696
+							if ($compress) {
697
+								$output .= '"t": "ship"';
698
+							} else {
699
+								$output .= '"type": "ship"';
700
+							}
539 701
 						} else {
540
-							if ($compress) $output .= '"t": "aircraft"';
541
-							else $output .= '"type": "aircraft"';
702
+							if ($compress) {
703
+								$output .= '"t": "aircraft"';
704
+							} else {
705
+								$output .= '"type": "aircraft"';
706
+							}
542 707
 						}
543 708
 						$output .= '},';
544 709
 						$output .= '"geometry": {';
@@ -546,15 +711,19 @@  discard block
 block discarded – undo
546 711
 								$output .= '"coordinates": [';
547 712
 								if ($currenttime != '') {
548 713
 									if (strtotime($spotter_item['date']) < $currenttime) {
549
-										if (!isset($archivespeed)) $archivespeed = 1;
714
+										if (!isset($archivespeed)) {
715
+											$archivespeed = 1;
716
+										}
550 717
 										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date'])));
551 718
 										$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
552
-										if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
553
-										else {
719
+										if (!isset($idistance) || $fdistance < $idistance) {
720
+											$output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
721
+										} else {
554 722
 											$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date'])));
555 723
 											$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
556
-											if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
557
-											else {
724
+											if (!isset($idistance) || $fdistance < $idistance) {
725
+												$output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
726
+											} else {
558 727
 												$output .= $spotter_item['longitude'].', ';
559 728
 												$output .= $spotter_item['latitude'];
560 729
 											}
@@ -632,7 +801,9 @@  discard block
 block discarded – undo
632 801
 			}
633 802
 */
634 803
 				$history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING);
635
-				if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history'];
804
+				if ($history == '' && isset($_COOKIE['history'])) {
805
+					$history = $_COOKIE['history'];
806
+				}
636 807
 				
637 808
 				if (
638 809
 				    (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') 
@@ -702,8 +873,11 @@  discard block
 block discarded – undo
702 873
 									$output_history .= ']}},';
703 874
 									$output .= $output_history;
704 875
 								}
705
-								if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
706
-								else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
876
+								if ($compress) {
877
+									$output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
878
+								} else {
879
+									$output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
880
+								}
707 881
 							}
708 882
 							$output_history .= '[';
709 883
 							$output_history .=  $spotter_history['longitude'].', ';
@@ -724,10 +898,15 @@  discard block
 block discarded – undo
724 898
 							if ($d == false) {
725 899
 								if ($compress) {
726 900
 									$output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'",';
727
-									if (isset($spotter_history_array[0]['mapmatching_engine']) && $spotter_history_array[0]['mapmatching_engine'] == 'graphhopper') $output_history .= '"atr": "Powered by <a href=\"https://www.graphhopper.com/\">GraphHopper API</a>", Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",';
728
-									elseif (isset($spotter_history_array[0]['mapmatching_engine'])) $output_history .= '"atr": "Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",';
901
+									if (isset($spotter_history_array[0]['mapmatching_engine']) && $spotter_history_array[0]['mapmatching_engine'] == 'graphhopper') {
902
+										$output_history .= '"atr": "Powered by <a href=\"https://www.graphhopper.com/\">GraphHopper API</a>", Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",';
903
+									} elseif (isset($spotter_history_array[0]['mapmatching_engine'])) {
904
+										$output_history .= '"atr": "Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",';
905
+									}
729 906
 									$output_history .= '"t": "history"},"geometry": {"type": "LineString","coordinates": [';
730
-								} else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": [';
907
+								} else {
908
+									$output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": [';
909
+								}
731 910
 								$d = true;
732 911
 							}
733 912
 							$output_history .= '[';
@@ -750,7 +929,9 @@  discard block
 block discarded – undo
750 929
 							$output_historyd = '[';
751 930
 							$output_historyd .=  $spotter_item['longitude'].', ';
752 931
 							$output_historyd .=  $spotter_item['latitude'];
753
-							if (isset($spotter_history['altitude'])) $output_historyd .=  ','.$spotter_item['altitude']*30.48;
932
+							if (isset($spotter_history['altitude'])) {
933
+								$output_historyd .=  ','.$spotter_item['altitude']*30.48;
934
+							}
754 935
 							$output_historyd .= '],';
755 936
 							//$output_history = $output_historyd.$output_history;
756 937
 							$output_history = $output_history.$output_historyd;
@@ -777,8 +958,11 @@  discard block
 block discarded – undo
777 958
 				        && $spotter_item['arrival_airport'] != 'NA' 
778 959
 				        && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") 
779 960
 				    	    || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) {
780
-				    if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
781
-				    else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
961
+				    if ($compress) {
962
+				    	$output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
963
+				    } else {
964
+				    	$output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
965
+				    }
782 966
 				    if (isset($spotter_item['departure_airport_latitude'])) {
783 967
 					$output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],';
784 968
 				    } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') {
@@ -811,8 +995,11 @@  discard block
 block discarded – undo
811 995
 				    	    || (!isset($_COOKIE['MapRemainingRoute']) && (!isset($globalMapRemainingRoute) 
812 996
 				    	    || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) {
813 997
 				    $havedata = false;
814
-				    if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
815
-				    else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
998
+				    if ($compress) {
999
+				    	$output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
1000
+				    } else {
1001
+				    	$output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
1002
+				    }
816 1003
 				    
817 1004
 				    //$output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],';
818 1005
 				    if (isset($spotter_item['arrival_airport_latitude'])) {
@@ -837,7 +1024,9 @@  discard block
 block discarded – undo
837 1024
 					$output_dest  = substr($output_dest, 0, -1);
838 1025
 				    }
839 1026
 				    $output_dest .= ']}},';
840
-				    if ($havedata) $output .= $output_dest;
1027
+				    if ($havedata) {
1028
+				    	$output .= $output_dest;
1029
+				    }
841 1030
 				    unset($output_dest);
842 1031
 				}
843 1032
 			}
@@ -845,7 +1034,9 @@  discard block
 block discarded – undo
845 1034
 			$output .= ']';
846 1035
 			$output .= ',"initial_sqltime": "'.$sqltime.'",';
847 1036
 			$output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",';
848
-			if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
1037
+			if (isset($begindate)) {
1038
+				$output .= '"archive_date": "'.$begindate.'",';
1039
+			}
849 1040
 			$output .= '"fc": "'.$j.'"';
850 1041
 		} else {
851 1042
 			$output .= '"features": ';
Please login to merge, or discard this patch.
scripts/update_db.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
 if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
10 10
 	exec("ps ux", $output, $result);
11 11
 	$j = 0;
12
-	foreach ($output as $line) if(strpos($line, dirname(__FILE__)."/update_db.php") && !strpos($line, "sh ") && !strpos($line, "sudo ")) $j++;
12
+	foreach ($output as $line) if (strpos($line, dirname(__FILE__)."/update_db.php") && !strpos($line, "sh ") && !strpos($line, "sudo ")) $j++;
13 13
 	if ($j > 1) {
14 14
 		echo "Script is already runnning...";
15 15
 		die();
Please login to merge, or discard this patch.
Braces   +30 added lines, -11 removed lines patch added patch discarded remove patch
@@ -9,7 +9,9 @@  discard block
 block discarded – undo
9 9
 if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
10 10
 	exec("ps ux", $output, $result);
11 11
 	$j = 0;
12
-	foreach ($output as $line) if(strpos($line, dirname(__FILE__)."/update_db.php") && !strpos($line, "sh ") && !strpos($line, "sudo ")) $j++;
12
+	foreach ($output as $line) {
13
+		if(strpos($line, dirname(__FILE__)."/update_db.php") && !strpos($line, "sh ") && !strpos($line, "sudo ")) $j++;
14
+	}
13 15
 	if ($j > 1) {
14 16
 		echo "Script is already runnning...";
15 17
 		die();
@@ -29,14 +31,18 @@  discard block
 block discarded – undo
29 31
 			$update_db->update_notam();
30 32
 		}
31 33
 		$update_db->insert_last_notam_update();
32
-	} elseif (isset($globalDebug) && $globalDebug && isset($globalNOTAM) && $globalNOTAM) echo "NOTAM are only updated once a day.\n";
34
+	} elseif (isset($globalDebug) && $globalDebug && isset($globalNOTAM) && $globalNOTAM) {
35
+		echo "NOTAM are only updated once a day.\n";
36
+	}
33 37
 	if ($update_db->check_last_update() && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
34 38
 		$update_db->update_all();
35 39
 	//	require_once(dirname(__FILE__).'/../require/class.Spotter.php');
36 40
 	//	$Spotter = new Spotter();
37 41
 	//	$Spotter->updateFieldsFromOtherTables();
38 42
 		$update_db->insert_last_update();
39
-	} elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM)) echo "DB are populated with external data only every 15 days ! Files are not updated more often.\n";
43
+	} elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM)) {
44
+		echo "DB are populated with external data only every 15 days ! Files are not updated more often.\n";
45
+	}
40 46
 	if (isset($globalWaypoints) && $globalWaypoints && $update_db->check_last_airspace_update()) {
41 47
 		echo "Check if new airspace version exist...";
42 48
 		echo $update_db->update_airspace_fam();
@@ -45,8 +51,11 @@  discard block
 block discarded – undo
45 51
 	if (isset($globalGeoid) && $globalGeoid && $update_db->check_last_geoid_update()) {
46 52
 		echo "Check if new geoid version exist...";
47 53
 		$error = $update_db->update_geoid_fam();
48
-		if ($error == '') $update_db->insert_last_geoid_update();
49
-		else echo $error;
54
+		if ($error == '') {
55
+			$update_db->insert_last_geoid_update();
56
+		} else {
57
+			echo $error;
58
+		}
50 59
 	}
51 60
 	if (isset($globalMarine) && $globalMarine && $update_db->check_last_marine_identity_update()) {
52 61
 		echo "Check if new marine identity version exist...";
@@ -64,13 +73,17 @@  discard block
 block discarded – undo
64 73
 			//echo "Done";
65 74
 		}
66 75
 		$update_db->insert_last_owner_update();
67
-	} elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) echo "Owner are only updated every 15 days.\n";
76
+	} elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
77
+		echo "Owner are only updated every 15 days.\n";
78
+	}
68 79
 
69 80
 	if ($update_db->check_last_airlines_update() && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
70 81
 		echo "Updating airlines...\n";
71 82
 		echo $update_db->update_airlines_fam();
72 83
 		$update_db->insert_last_airlines_update();
73
-	} elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) echo "Airlines are only updated every 15 days.\n";
84
+	} elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
85
+		echo "Airlines are only updated every 15 days.\n";
86
+	}
74 87
 
75 88
 	if (isset($globalAccidents) && $globalAccidents && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
76 89
 		require_once(dirname(__FILE__).'/../require/class.Accident.php');
@@ -79,7 +92,9 @@  discard block
 block discarded – undo
79 92
 		if ($Accident->check_last_accidents_update()) {
80 93
 			$Accident->download_update();
81 94
 			$Accident->insert_last_accidents_update();
82
-		} else echo "Accidents are updated once a day.\n";
95
+		} else {
96
+			echo "Accidents are updated once a day.\n";
97
+		}
83 98
 	}
84 99
   
85 100
 }
@@ -92,7 +107,9 @@  discard block
 block discarded – undo
92 107
 		if ($METAR->check_last_update()) {
93 108
 			$METAR->addMETARCycle();
94 109
 			$METAR->insert_last_update();
95
-		} else echo "METAR are only updated every 30 minutes.\n";
110
+		} else {
111
+			echo "METAR are only updated every 30 minutes.\n";
112
+		}
96 113
 	}
97 114
 
98 115
 	if (isset($globalSchedules) && $globalSchedules && $update_db->check_last_schedules_update() && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
@@ -100,8 +117,10 @@  discard block
 block discarded – undo
100 117
 		//$update_db->update_oneworld();
101 118
 		$update_db->update_skyteam();
102 119
 		$update_db->insert_last_schedules_update();
103
-	} elseif (isset($globalDebug) && $globalDebug && isset($globalOwner) && $globalOwner && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) echo "Schedules are only updated every 15 days.\n";
104
-}
120
+	} elseif (isset($globalDebug) && $globalDebug && isset($globalOwner) && $globalOwner && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
121
+		echo "Schedules are only updated every 15 days.\n";
122
+	}
123
+	}
105 124
 
106 125
 if (isset($globalArchiveMonths) && $globalArchiveMonths > 0) {
107 126
 	echo "Updating statistics and archive old data...\n";
Please login to merge, or discard this patch.
aircraft-data.php 2 patches
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -11,14 +11,14 @@  discard block
 block discarded – undo
11 11
 
12 12
 $from_archive = false;
13 13
 if (isset($_GET['ident'])) {
14
-	$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
14
+	$ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING);
15 15
 	if (isset($_GET['currenttime'])) {
16
-		$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
16
+		$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT);
17 17
 		$currenttime = round($currenttime/1000);
18
-		$spotter_array = $SpotterLive->getDateLiveSpotterDataByIdent($ident,$currenttime);
18
+		$spotter_array = $SpotterLive->getDateLiveSpotterDataByIdent($ident, $currenttime);
19 19
 		if (empty($spotter_array)) {
20 20
 			$from_archive = true;
21
-			$spotter_array = $SpotterArchive->getDateArchiveSpotterDataByIdent($ident,$currenttime);
21
+			$spotter_array = $SpotterArchive->getDateArchiveSpotterDataByIdent($ident, $currenttime);
22 22
 		}
23 23
 	} else {
24 24
 		$spotter_array = $SpotterLive->getLastLiveSpotterDataByIdent($ident);
@@ -29,15 +29,15 @@  discard block
 block discarded – undo
29 29
 	}
30 30
 }
31 31
 if (isset($_GET['flightaware_id'])) {
32
-	$flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
32
+	$flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING);
33 33
 	if (isset($_GET['currenttime'])) {
34
-		$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
34
+		$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT);
35 35
 		$currenttime = round($currenttime/1000);
36
-		$spotter_array = $SpotterLive->getDateLiveSpotterDataById($flightaware_id,$currenttime);
36
+		$spotter_array = $SpotterLive->getDateLiveSpotterDataById($flightaware_id, $currenttime);
37 37
 		if (empty($spotter_array)) {
38 38
 			$from_archive = true;
39 39
 //			$spotter_array = $SpotterArchive->getLastArchiveSpotterDataById($flightaware_id);
40
-			$spotter_array = $SpotterArchive->getDateArchiveSpotterDataById($flightaware_id,$currenttime);
40
+			$spotter_array = $SpotterArchive->getDateArchiveSpotterDataById($flightaware_id, $currenttime);
41 41
 		}
42 42
 	} else {
43 43
 		$spotter_array = $SpotterLive->getLastLiveSpotterDataById($flightaware_id);
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	if (isset($spotter_item['image_thumbnail']) && $spotter_item['image_thumbnail'] != "")
58 58
 	{
59 59
 		if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') {
60
-			$image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
60
+			$image = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']);
61 61
 		} else $image = $spotter_item['image_thumbnail'];
62 62
 	}
63 63
 	/* else {
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 		print '<div class="nomobile airports"><div class="airport"><span class="code"><a href="'.$globalURL.'/airport/'.$spotter_item['departure_airport'].'" target="_blank">'.$spotter_item['departure_airport'].'</a></span>'.$spotter_item['departure_airport_city'].' '.$spotter_item['departure_airport_country'];
81 81
 		if (isset($spotter_item['departure_airport_time']) && $spotter_item['departure_airport_time'] != 'NULL') {
82 82
 			if ($spotter_item['departure_airport_time'] > 2460) {
83
-				print '<br /><span class="time">'.date('H:m',$spotter_item['departure_airport_time']).'</span>';
83
+				print '<br /><span class="time">'.date('H:m', $spotter_item['departure_airport_time']).'</span>';
84 84
 			} else {
85 85
 				print '<br /><span class="time">'.$spotter_item['departure_airport_time'].'</span>';
86 86
 			}
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 		print '<span class="code"><a href="'.$globalURL.'/airport/'.$spotter_item['arrival_airport'].'" target="_blank">'.$spotter_item['arrival_airport'].'</a></span>'.$spotter_item['arrival_airport_city'].' '.$spotter_item['arrival_airport_country'];
90 90
 		if (isset($spotter_item['arrival_airport_time']) && $spotter_item['arrival_airport_time'] != 'NULL') {
91 91
 			if ($spotter_item['arrival_airport_time'] > 2460) {
92
-				print '<br /><span class="time">'.date('H:m',$spotter_item['arrival_airport_time']).'</span>';
92
+				print '<br /><span class="time">'.date('H:m', $spotter_item['arrival_airport_time']).'</span>';
93 93
 			} else {
94 94
 				print '<br /><span class="time">'.$spotter_item['arrival_airport_time'].'</span>';
95 95
 			}
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	print '<span>'._("Aircraft").'</span>';
109 109
 	if (isset($spotter_item['aircraft_wiki'])) print '<a href="'.$spotter_item['aircraft_wiki'].'">'.$spotter_item['aircraft_name'].'</a>';
110 110
 	if (isset($spotter_item['aircraft_type']) && isset($spotter_item['aircraft_manufacturer']) && $spotter_item['aircraft_manufacturer'] != 'N/A' && isset($spotter_item['aircraft_name']) && $spotter_item['aircraft_name'] != 'N/A') {
111
-		$aircraft_names = explode('/',$spotter_item['aircraft_name']);
111
+		$aircraft_names = explode('/', $spotter_item['aircraft_name']);
112 112
 		if (count($aircraft_names) == 1) print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')</a>';
113 113
 		else print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'" title="'.$spotter_item['aircraft_name'].'">'.$spotter_item['aircraft_manufacturer'].' '.$aircraft_names[0].' ('.$spotter_item['aircraft_type'].')</a>';
114 114
 	} elseif (isset($spotter_item['aircraft_type'])) print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_type'].'</a>';
@@ -118,8 +118,8 @@  discard block
 block discarded – undo
118 118
 	print '<div id ="altitude"><span>'._("Altitude").'</span>';
119 119
 	if (isset($globalGroundAltitude) && $globalGroundAltitude) {
120 120
 		try {
121
-			$groundAltitude = $Elevation->getElevation($spotter_item['latitude'],$spotter_item['longitude']);
122
-		} catch(Exception $e) {
121
+			$groundAltitude = $Elevation->getElevation($spotter_item['latitude'], $spotter_item['longitude']);
122
+		} catch (Exception $e) {
123 123
 			// If catched not exist
124 124
 		}
125 125
 	}
@@ -158,9 +158,9 @@  discard block
 block discarded – undo
158 158
 	if (isset($globalCam) && $globalCam) {
159 159
 		require_once(dirname(__FILE__).'/require/class.Common.php');
160 160
 		$Common = new Common();
161
-		$azimuth = round($Common->azimuth($globalCenterLatitude,$globalCenterLongitude,$spotter_item['latitude'],$spotter_item['longitude']));
162
-		$distance = $Common->distance($globalCenterLatitude,$globalCenterLongitude,$spotter_item['latitude'],$spotter_item['longitude'],'m');
163
-		$plunge = round($Common->plunge($globalCenterAltitude,$spotter_item['real_altitude'],$distance));
161
+		$azimuth = round($Common->azimuth($globalCenterLatitude, $globalCenterLongitude, $spotter_item['latitude'], $spotter_item['longitude']));
162
+		$distance = $Common->distance($globalCenterLatitude, $globalCenterLongitude, $spotter_item['latitude'], $spotter_item['longitude'], 'm');
163
+		$plunge = round($Common->plunge($globalCenterAltitude, $spotter_item['real_altitude'], $distance));
164 164
 		print '<div id="camcoordinates"><span>'._("Cam Coordinates").'</span>';
165 165
 		print 'azimuth: '.$azimuth;
166 166
 		print ' / ';
@@ -170,16 +170,16 @@  discard block
 block discarded – undo
170 170
 		print '</div>';
171 171
 		//echo $Common->getData('http://127.0.0.1/camera.php?azimuth='.$azimuth.'&plunge='.$plunge,'get','','','','','','',false,true);
172 172
 		//echo $Common->getData('file://'.dirname(__FILE__).'/camera.php?azimuth='.$azimuth.'&plunge='.$plunge,'get','','','','','','',false,true);
173
-		echo $Common->getData('http://'.$_SERVER['SERVER_NAME'].'/camera.php?azimuth='.$azimuth.'&plunge='.$plunge,'get','','','','','','',false,true);
173
+		echo $Common->getData('http://'.$_SERVER['SERVER_NAME'].'/camera.php?azimuth='.$azimuth.'&plunge='.$plunge, 'get', '', '', '', '', '', '', false, true);
174 174
 	}
175 175
   
176 176
 	print '<div id="heading"><span>'._("Heading").'</span>'.$spotter_item['heading'].'°</div>';
177 177
 	if (isset($spotter_item['verticalrate']) && $spotter_item['verticalrate'] != '') {
178 178
 		print '<div id="verticalrate"><span>'._("Vertical rate").'</span>';
179 179
 		if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) {
180
-			print $spotter_item['verticalrate']. ' ft/min';
180
+			print $spotter_item['verticalrate'].' ft/min';
181 181
 		} else {
182
-			print round($spotter_item['verticalrate']*0.3048). ' m/min';
182
+			print round($spotter_item['verticalrate']*0.3048).' m/min';
183 183
 		}
184 184
 		print '</div>';
185 185
 	}
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 	print '</div>';
215 215
 	if (isset($globalVA) && $globalVA && isset($globalphpVMS) && $globalphpVMS && isset($globalVATSIM) && $globalVATSIM && isset($globalIVAO) && $globalIVAO && isset($spotter_item['format_source']) && $spotter_item['format_source'] != '' && $spotter_item['format_source'] != 'pireps') print '<div class="waypoints"><span>'._("Source").'</span>'.$spotter_item['format_source'].'</div>';
216 216
 	if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>';
217
-	if (isset($spotter_item['acars']['message'])) print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'<br/>',$spotter_item['acars']['message'])).'</div>';
217
+	if (isset($spotter_item['acars']['message'])) print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '<br/>', $spotter_item['acars']['message'])).'</div>';
218 218
 	if (isset($spotter_item['squawk']) && $spotter_item['squawk'] != '' && $spotter_item['squawk'] != 0) print '<div class="bottom">'._("Squawk:").' '.$spotter_item['squawk'].' - '.$spotter_item['squawk_usage'].'</div>';
219 219
 	print '</div>';
220 220
 }
Please login to merge, or discard this patch.
Braces   +52 added lines, -19 removed lines patch added patch discarded remove patch
@@ -58,7 +58,9 @@  discard block
 block discarded – undo
58 58
 	{
59 59
 		if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') {
60 60
 			$image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
61
-		} else $image = $spotter_item['image_thumbnail'];
61
+		} else {
62
+			$image = $spotter_item['image_thumbnail'];
63
+		}
62 64
 	}
63 65
 	/* else {
64 66
 		$image = "images/placeholder_thumb.png";
@@ -75,10 +77,14 @@  discard block
 block discarded – undo
75 77
 	print '<div class="callsign-details">';
76 78
 	if ($spotter_item['ident'] != 'Not Available') {
77 79
 		print '<div class="callsign"><a href="'.$globalURL.'/redirect/'.$spotter_item['flightaware_id'].'" target="_blank">'.$spotter_item['ident'].'</a>';
78
-		if (isset($spotter_item['blocked']) && $spotter_item['blocked'] === true) print '<img src="'.$globalURL.'/images/forbidden.png" title="'._("Callsign is in blocked FAA list").'" class="blocked" />';
80
+		if (isset($spotter_item['blocked']) && $spotter_item['blocked'] === true) {
81
+			print '<img src="'.$globalURL.'/images/forbidden.png" title="'._("Callsign is in blocked FAA list").'" class="blocked" />';
82
+		}
79 83
 		print '</div>';
80 84
 	}
81
-	if (isset($spotter_item['airline_name']) && $spotter_item['airline_name'] != 'Not Available') print '<div class="airline">'.$spotter_item['airline_name'].'</div>';
85
+	if (isset($spotter_item['airline_name']) && $spotter_item['airline_name'] != 'Not Available') {
86
+		print '<div class="airline">'.$spotter_item['airline_name'].'</div>';
87
+	}
82 88
 	print '</div>';
83 89
 	if ($spotter_item['departure_airport'] != 'NA' && $spotter_item['arrival_airport'] != 'NA') {
84 90
 		print '<div class="nomobile airports"><div class="airport"><span class="code"><a href="'.$globalURL.'/airport/'.$spotter_item['departure_airport'].'" target="_blank">'.$spotter_item['departure_airport'].'</a></span>'.$spotter_item['departure_airport_city'].' '.$spotter_item['departure_airport_country'];
@@ -110,13 +116,21 @@  discard block
 block discarded – undo
110 116
 	print '</div>';
111 117
 	print '<div id="aircraft">';
112 118
 	print '<span>'._("Aircraft").'</span>';
113
-	if (isset($spotter_item['aircraft_wiki'])) print '<a href="'.$spotter_item['aircraft_wiki'].'">'.$spotter_item['aircraft_name'].'</a>';
119
+	if (isset($spotter_item['aircraft_wiki'])) {
120
+		print '<a href="'.$spotter_item['aircraft_wiki'].'">'.$spotter_item['aircraft_name'].'</a>';
121
+	}
114 122
 	if (isset($spotter_item['aircraft_type']) && isset($spotter_item['aircraft_manufacturer']) && $spotter_item['aircraft_manufacturer'] != 'N/A' && isset($spotter_item['aircraft_name']) && $spotter_item['aircraft_name'] != 'N/A') {
115 123
 		$aircraft_names = explode('/',$spotter_item['aircraft_name']);
116
-		if (count($aircraft_names) == 1) print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')</a>';
117
-		else print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'" title="'.$spotter_item['aircraft_name'].'">'.$spotter_item['aircraft_manufacturer'].' '.$aircraft_names[0].' ('.$spotter_item['aircraft_type'].')</a>';
118
-	} elseif (isset($spotter_item['aircraft_type'])) print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_type'].'</a>';
119
-	else print $spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'];
124
+		if (count($aircraft_names) == 1) {
125
+			print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')</a>';
126
+		} else {
127
+			print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'" title="'.$spotter_item['aircraft_name'].'">'.$spotter_item['aircraft_manufacturer'].' '.$aircraft_names[0].' ('.$spotter_item['aircraft_type'].')</a>';
128
+		}
129
+	} elseif (isset($spotter_item['aircraft_type'])) {
130
+		print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_type'].'</a>';
131
+	} else {
132
+		print $spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'];
133
+	}
120 134
 	
121 135
 	print '</div>';
122 136
 	print '<div id ="altitude"><span>'._("Altitude").'</span>';
@@ -129,11 +143,17 @@  discard block
 block discarded – undo
129 143
 	}
130 144
 
131 145
 	if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) {
132
-		if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') print $spotter_item['real_altitude'].' feet (FL'.$spotter_item['altitude'].')';
133
-		else print $spotter_item['altitude'].'00 feet (FL'.$spotter_item['altitude'].')';
146
+		if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') {
147
+			print $spotter_item['real_altitude'].' feet (FL'.$spotter_item['altitude'].')';
148
+		} else {
149
+			print $spotter_item['altitude'].'00 feet (FL'.$spotter_item['altitude'].')';
150
+		}
134 151
 	} else {
135
-		if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') print round($spotter_item['real_altitude']*0.3048).' m (FL'.$spotter_item['altitude'].')';
136
-		else print round($spotter_item['altitude']*30.48).' m (FL'.$spotter_item['altitude'].')';
152
+		if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') {
153
+			print round($spotter_item['real_altitude']*0.3048).' m (FL'.$spotter_item['altitude'].')';
154
+		} else {
155
+			print round($spotter_item['altitude']*30.48).' m (FL'.$spotter_item['altitude'].')';
156
+		}
137 157
 	}
138 158
 
139 159
 	if (isset($groundAltitude) && $groundAltitude < $spotter_item['altitude']*30.48) {
@@ -147,7 +167,9 @@  discard block
 block discarded – undo
147 167
 		print '</i>';
148 168
 	}
149 169
 	print '</div>';
150
-	if (isset($spotter_item['registration']) && $spotter_item['registration'] != '') print '<div><span>'._("Registration").'</span><a href="'.$globalURL.'/registration/'.$spotter_item['registration'].'" target="_blank">'.$spotter_item['registration'].'</a></div>';
170
+	if (isset($spotter_item['registration']) && $spotter_item['registration'] != '') {
171
+		print '<div><span>'._("Registration").'</span><a href="'.$globalURL.'/registration/'.$spotter_item['registration'].'" target="_blank">'.$spotter_item['registration'].'</a></div>';
172
+	}
151 173
 	print '<div id="speed"><span>'._("Speed").'</span>';
152 174
 	if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) {
153 175
 		print round($spotter_item['ground_speed']*1.15078).' mph';
@@ -189,8 +211,11 @@  discard block
 block discarded – undo
189 211
 	}
190 212
 	if (isset($spotter_item['pilot_name']) && $spotter_item['pilot_name'] != '') {
191 213
 		print '<div id="pilot"><span>'._("Pilot").'</span>';
192
-		if (isset($spotter_item['pilot_id'])) print $spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')';
193
-		else print $spotter_item['pilot_name'];
214
+		if (isset($spotter_item['pilot_id'])) {
215
+			print $spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')';
216
+		} else {
217
+			print $spotter_item['pilot_name'];
218
+		}
194 219
 		print '</div>';
195 220
 	}
196 221
 	if (isset($spotter_item['aircraft_owner']) && $spotter_item['aircraft_owner'] != '') {
@@ -216,10 +241,18 @@  discard block
 block discarded – undo
216 241
 	}
217 242
 	print '</div>';
218 243
 	print '</div>';
219
-	if (isset($globalVA) && $globalVA && isset($globalphpVMS) && $globalphpVMS && isset($globalVATSIM) && $globalVATSIM && isset($globalIVAO) && $globalIVAO && isset($spotter_item['format_source']) && $spotter_item['format_source'] != '' && $spotter_item['format_source'] != 'pireps') print '<div class="waypoints"><span>'._("Source").'</span>'.$spotter_item['format_source'].'</div>';
220
-	if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>';
221
-	if (isset($spotter_item['acars']['message'])) print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'<br/>',$spotter_item['acars']['message'])).'</div>';
222
-	if (isset($spotter_item['squawk']) && $spotter_item['squawk'] != '' && $spotter_item['squawk'] != 0) print '<div class="bottom">'._("Squawk:").' '.$spotter_item['squawk'].' - '.$spotter_item['squawk_usage'].'</div>';
244
+	if (isset($globalVA) && $globalVA && isset($globalphpVMS) && $globalphpVMS && isset($globalVATSIM) && $globalVATSIM && isset($globalIVAO) && $globalIVAO && isset($spotter_item['format_source']) && $spotter_item['format_source'] != '' && $spotter_item['format_source'] != 'pireps') {
245
+		print '<div class="waypoints"><span>'._("Source").'</span>'.$spotter_item['format_source'].'</div>';
246
+	}
247
+	if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') {
248
+		print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>';
249
+	}
250
+	if (isset($spotter_item['acars']['message'])) {
251
+		print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'<br/>',$spotter_item['acars']['message'])).'</div>';
252
+	}
253
+	if (isset($spotter_item['squawk']) && $spotter_item['squawk'] != '' && $spotter_item['squawk'] != 0) {
254
+		print '<div class="bottom">'._("Squawk:").' '.$spotter_item['squawk'].' - '.$spotter_item['squawk_usage'].'</div>';
255
+	}
223 256
 	print '</div>';
224 257
 }
225 258
 ?>
Please login to merge, or discard this patch.
live-czml.php 3 patches
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -50,30 +50,30 @@  discard block
 block discarded – undo
50 50
 
51 51
 
52 52
 function quaternionrotate($heading, $attitude = 0, $bank = 0) {
53
-    // Assuming the angles are in radians.
54
-    $c1 = cos($heading/2);
55
-    $s1 = sin($heading/2);
56
-    $c2 = cos($attitude/2);
57
-    $s2 = sin($attitude/2);
58
-    $c3 = cos($bank/2);
59
-    $s3 = sin($bank/2);
60
-    $c1c2 = $c1*$c2;
61
-    $s1s2 = $s1*$s2;
62
-    $w =$c1c2*$c3 - $s1s2*$s3;
63
-    $x =$c1c2*$s3 + $s1s2*$c3;
64
-    $y =$s1*$c2*$c3 + $c1*$s2*$s3;
65
-    $z =$c1*$s2*$c3 - $s1*$c2*$s3;
66
-    return array('x' => $x,'y' => $y,'z' => $z,'w' => $w);
53
+	// Assuming the angles are in radians.
54
+	$c1 = cos($heading/2);
55
+	$s1 = sin($heading/2);
56
+	$c2 = cos($attitude/2);
57
+	$s2 = sin($attitude/2);
58
+	$c3 = cos($bank/2);
59
+	$s3 = sin($bank/2);
60
+	$c1c2 = $c1*$c2;
61
+	$s1s2 = $s1*$s2;
62
+	$w =$c1c2*$c3 - $s1s2*$s3;
63
+	$x =$c1c2*$s3 + $s1s2*$c3;
64
+	$y =$s1*$c2*$c3 + $c1*$s2*$s3;
65
+	$z =$c1*$s2*$c3 - $s1*$c2*$s3;
66
+	return array('x' => $x,'y' => $y,'z' => $z,'w' => $w);
67 67
 //    return array('x' => '0.0','y' => '-0.931','z' => '0.0','w' => '0.365');
68 68
 
69 69
 }
70 70
 
71 71
 
72 72
 if (isset($_GET['download'])) {
73
-    if ($_GET['download'] == "true")
74
-    {
73
+	if ($_GET['download'] == "true")
74
+	{
75 75
 	header('Content-disposition: attachment; filename="flightairmap.json"');
76
-    }
76
+	}
77 77
 }
78 78
 header('Content-Type: text/javascript');
79 79
 
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 	if (isset($_GET['coord']) && $_GET['coord'] != '') {
167 167
 		$coord = explode(',',$_GET['coord']);
168 168
 		if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) 
169
-		    && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) {
169
+			&& $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) {
170 170
 			$coord = array();
171 171
 		}
172 172
 	}
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 	if (isset($_GET['coord']) && $_GET['coord'] != '') {
177 177
 		$coord = explode(',',$_GET['coord']);
178 178
 		if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) 
179
-		    && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) {
179
+			&& $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) {
180 180
 			$coord = array();
181 181
 		}
182 182
 	}
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 	if (!((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '')) && isset($_GET['coord']) && $_GET['coord'] != '') {
187 187
 		$coord = explode(',',$_GET['coord']);
188 188
 		if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) 
189
-		    && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) {
189
+			&& $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) {
190 190
 			$coord = array();
191 191
 		}
192 192
 	}
@@ -287,10 +287,10 @@  discard block
 block discarded – undo
287 287
 			$image = "images/placeholder_thumb.png";
288 288
 		}
289 289
 
290
-                if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id'];
291
-                elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid'];
292
-                elseif (isset($spotter_item['fammarine_id'])) $id = $spotter_item['fammarine_id'];
293
-                if ($prev_flightaware_id != $id) {
290
+				if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id'];
291
+				elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid'];
292
+				elseif (isset($spotter_item['fammarine_id'])) $id = $spotter_item['fammarine_id'];
293
+				if ($prev_flightaware_id != $id) {
294 294
 			if ($prev_flightaware_id != '') {
295 295
 				/*
296 296
 				if ($nblatlong == 1) {
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
 							$spotter_item['wake_category'] = $aircraft_info[0]['wake_category'];
371 371
 							$spotter_item['engine_count'] = $aircraft_info[0]['engine_count'];
372 372
 						} else $aircraft_shadow = '';
373
-	    					$output .= ' "billboard" : {"image" : "'.$globalURL.'/images/aircrafts/new/'.$aircraft_shadow.'","scale" : 0.5';
373
+							$output .= ' "billboard" : {"image" : "'.$globalURL.'/images/aircrafts/new/'.$aircraft_shadow.'","scale" : 0.5';
374 374
 						if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true' && isset($_COOKIE['IconColor'])) {
375 375
 							$rgb = $Common->hex2rgb($_COOKIE['IconColor']);
376 376
 							$output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}';
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
 							$rgb = $Common->hex2rgb($_COOKIE['IconColor']);
402 402
 							$output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}';
403 403
 						}
404
-    						$output .= '},';
404
+							$output .= '},';
405 405
 					} elseif (isset($modelsdb[$aircraft_icao]) && $aircraft_icao != '') {
406 406
 						$output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$modelsdb[$aircraft_icao].'","scale" : 1.0,"minimumPixelSize": 20';
407 407
 						$output .= ',"heightReference": "'.$heightrelative.'"';
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
 							$rgb = $Common->hex2rgb($_COOKIE['IconColor']);
410 410
 							$output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}';
411 411
 						}
412
-    						$output .= '},';
412
+							$output .= '},';
413 413
 					} elseif ($aircraft_icao != '') {
414 414
 						$aircraft_info = $Spotter->getAllAircraftInfo($aircraft_icao);
415 415
 						if (isset($aircraft_info[0]['engine_type'])) {
Please login to merge, or discard this patch.
Spacing   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -59,11 +59,11 @@  discard block
 block discarded – undo
59 59
     $s3 = sin($bank/2);
60 60
     $c1c2 = $c1*$c2;
61 61
     $s1s2 = $s1*$s2;
62
-    $w =$c1c2*$c3 - $s1s2*$s3;
63
-    $x =$c1c2*$s3 + $s1s2*$c3;
64
-    $y =$s1*$c2*$c3 + $c1*$s2*$s3;
65
-    $z =$c1*$s2*$c3 - $s1*$c2*$s3;
66
-    return array('x' => $x,'y' => $y,'z' => $z,'w' => $w);
62
+    $w = $c1c2*$c3 - $s1s2*$s3;
63
+    $x = $c1c2*$s3 + $s1s2*$c3;
64
+    $y = $s1*$c2*$c3 + $c1*$s2*$s3;
65
+    $z = $c1*$s2*$c3 - $s1*$c2*$s3;
66
+    return array('x' => $x, 'y' => $y, 'z' => $z, 'w' => $w);
67 67
 //    return array('x' => '0.0','y' => '-0.931','z' => '0.0','w' => '0.365');
68 68
 
69 69
 }
@@ -84,17 +84,17 @@  discard block
 block discarded – undo
84 84
 $min = false;
85 85
 $allhistory = false;
86 86
 $filter['source'] = array();
87
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
88
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
89
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
90
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
91
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
92
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
93
-if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
94
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
95
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
96
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
97
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
87
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt'));
88
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup'));
89
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars'));
90
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs'));
91
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs'));
92
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING);
93
+if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'], FILTER_SANITIZE_STRING);
94
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING);
95
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING);
96
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING);
97
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING);
98 98
 /*
99 99
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
100 100
 	$min = true;
@@ -141,12 +141,12 @@  discard block
 block discarded – undo
141 141
 	$from_archive = true;
142 142
 //	$begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
143 143
 //	$enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
144
-	$begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT);
145
-	$enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT);
146
-	$archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT);
147
-	$begindate = date('Y-m-d H:i:s',$begindate);
148
-	$enddate = date('Y-m-d H:i:s',$enddate);
149
-	$spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter);
144
+	$begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT);
145
+	$enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT);
146
+	$archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT);
147
+	$begindate = date('Y-m-d H:i:s', $begindate);
148
+	$enddate = date('Y-m-d H:i:s', $enddate);
149
+	$spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate, $enddate, $filter);
150 150
 } elseif (isset($_COOKIE['archive']) && isset($_COOKIE['archive_begin']) && isset($_COOKIE['archive_end']) && isset($_COOKIE['archive_speed'])) {
151 151
 	$from_archive = true;
152 152
 //	$begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
@@ -156,55 +156,55 @@  discard block
 block discarded – undo
156 156
 	$begindate = $_COOKIE['archive_begin'];
157 157
 	$enddate = $_COOKIE['archive_end'];
158 158
 
159
-	$archivespeed = filter_var($_COOKIE['archive_speed'],FILTER_SANITIZE_NUMBER_INT);
160
-	$begindate = date('Y-m-d H:i:s',$begindate);
161
-	$enddate = date('Y-m-d H:i:s',$enddate);
159
+	$archivespeed = filter_var($_COOKIE['archive_speed'], FILTER_SANITIZE_NUMBER_INT);
160
+	$begindate = date('Y-m-d H:i:s', $begindate);
161
+	$enddate = date('Y-m-d H:i:s', $enddate);
162 162
 //	echo 'Begin : '.$begindate.' - End : '.$enddate."\n";
163
-	$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter);
163
+	$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter);
164 164
 } elseif ($tracker) {
165 165
 	$coord = array();
166 166
 	if (isset($_GET['coord']) && $_GET['coord'] != '') {
167
-		$coord = explode(',',$_GET['coord']);
168
-		if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) 
167
+		$coord = explode(',', $_GET['coord']);
168
+		if (!(filter_var($coord[0], FILTER_VALIDATE_FLOAT) && filter_var($coord[1], FILTER_VALIDATE_FLOAT) && filter_var($coord[2], FILTER_VALIDATE_FLOAT) && filter_var($coord[3], FILTER_VALIDATE_FLOAT) 
169 169
 		    && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) {
170 170
 			$coord = array();
171 171
 		}
172 172
 	}
173
-	$spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord,$filter,true);
173
+	$spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord, $filter, true);
174 174
 } elseif ($marine) {
175 175
 	$coord = array();
176 176
 	if (isset($_GET['coord']) && $_GET['coord'] != '') {
177
-		$coord = explode(',',$_GET['coord']);
178
-		if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) 
177
+		$coord = explode(',', $_GET['coord']);
178
+		if (!(filter_var($coord[0], FILTER_VALIDATE_FLOAT) && filter_var($coord[1], FILTER_VALIDATE_FLOAT) && filter_var($coord[2], FILTER_VALIDATE_FLOAT) && filter_var($coord[3], FILTER_VALIDATE_FLOAT) 
179 179
 		    && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) {
180 180
 			$coord = array();
181 181
 		}
182 182
 	}
183
-	$spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,true);
183
+	$spotter_array = $MarineLive->getMinLastLiveMarineData($coord, $filter, true);
184 184
 } else {
185 185
 	$coord = array();
186 186
 	if (!((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '')) && isset($_GET['coord']) && $_GET['coord'] != '') {
187
-		$coord = explode(',',$_GET['coord']);
188
-		if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) 
187
+		$coord = explode(',', $_GET['coord']);
188
+		if (!(filter_var($coord[0], FILTER_VALIDATE_FLOAT) && filter_var($coord[1], FILTER_VALIDATE_FLOAT) && filter_var($coord[2], FILTER_VALIDATE_FLOAT) && filter_var($coord[3], FILTER_VALIDATE_FLOAT) 
189 189
 		    && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) {
190 190
 			$coord = array();
191 191
 		}
192 192
 	}
193 193
 	$previous_filter = $filter;
194 194
 	if ((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '')) {
195
-		$filter = array_merge($filter,array('id' => $_COOKIE['MapTrack']));
196
-		$spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,true);
195
+		$filter = array_merge($filter, array('id' => $_COOKIE['MapTrack']));
196
+		$spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord, $filter, true);
197 197
 	} elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && !empty($coord)) {
198
-		$spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,true,$_COOKIE['MapTrack']);
198
+		$spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord, $filter, true, $_COOKIE['MapTrack']);
199 199
 	} else {
200
-		$spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,true);
200
+		$spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord, $filter, true);
201 201
 	}
202 202
 	$filter = $previous_filter;
203 203
 }
204 204
 //print_r($spotter_array);
205 205
 if (!empty($spotter_array) && isset($coord)) {
206 206
 	if (isset($_GET['archive'])) {
207
-		$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter);
207
+		$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter);
208 208
 	} elseif ($tracker) {
209 209
 		$flightcnt = $TrackerLive->getLiveTrackerCount($filter);
210 210
 	} elseif ($marine) {
@@ -215,17 +215,17 @@  discard block
 block discarded – undo
215 215
 	if ($flightcnt == '') $flightcnt = 0;
216 216
 } else $flightcnt = 0;
217 217
 
218
-$sqltime = round(microtime(true)-$begintime,2);
218
+$sqltime = round(microtime(true) - $begintime, 2);
219 219
 $minitime = time();
220 220
 $minitracktime_begin = time();
221 221
 $minitracktime = $minitracktime_begin;
222 222
 $maxitime = 0;
223
-$lastupdate = filter_input(INPUT_GET,'update',FILTER_SANITIZE_NUMBER_INT);
223
+$lastupdate = filter_input(INPUT_GET, 'update', FILTER_SANITIZE_NUMBER_INT);
224 224
 $modelsdb = array();
225 225
 if (file_exists(dirname(__FILE__).'/models/modelsdb')) {
226
-	if (($handle = fopen(dirname(__FILE__).'/models/modelsdb','r')) !== FALSE) {
227
-		while (($row = fgetcsv($handle,1000)) !== FALSE) {
228
-			if (isset($row[1]) ){
226
+	if (($handle = fopen(dirname(__FILE__).'/models/modelsdb', 'r')) !== FALSE) {
227
+		while (($row = fgetcsv($handle, 1000)) !== FALSE) {
228
+			if (isset($row[1])) {
229 229
 				$model = $row[0];
230 230
 				$modelsdb[$model] = $row[1];
231 231
 			}
@@ -235,9 +235,9 @@  discard block
 block discarded – undo
235 235
 }
236 236
 $modelsdb2 = array();
237 237
 if (file_exists(dirname(__FILE__).'/models/gltf2/modelsdb')) {
238
-	if (($handle = fopen(dirname(__FILE__).'/models/gltf2/modelsdb','r')) !== FALSE) {
239
-		while (($row = fgetcsv($handle,1000)) !== FALSE) {
240
-			if (isset($row[1]) ){
238
+	if (($handle = fopen(dirname(__FILE__).'/models/gltf2/modelsdb', 'r')) !== FALSE) {
239
+		while (($row = fgetcsv($handle, 1000)) !== FALSE) {
240
+			if (isset($row[1])) {
241 241
 				$model = $row[0];
242 242
 				$glb = $row[1];
243 243
 				if (isset($row[2])) {
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 if (!empty($spotter_array) && is_array($spotter_array))
282 282
 {
283 283
 	$nblatlong = 0;
284
-	foreach($spotter_array as $spotter_item)
284
+	foreach ($spotter_array as $spotter_item)
285 285
 	{
286 286
 		$j++;
287 287
 		//if (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'airwhere') $heightrelative = 'RELATIVE_TO_GROUND';
@@ -323,9 +323,9 @@  discard block
 block discarded – undo
323 323
 			$output .= '"lastupdate": "'.$lastupdate.'",';
324 324
 			if (isset($spotter_item['format_source'])) $output .= '"format": "'.$spotter_item['format_source'].'",';
325 325
 			if ($tracker) {
326
-				$output.= '"type": "tracker"';
326
+				$output .= '"type": "tracker"';
327 327
 			} elseif ($marine) {
328
-				$output.= '"type": "marine"';
328
+				$output .= '"type": "marine"';
329 329
 			} else {
330 330
 				if ($one3dmodel === false && isset($globalMap3DLiveries) && $globalMap3DLiveries) {
331 331
 					$aircraft_icao = $spotter_item['aircraft_icao'];
@@ -339,14 +339,14 @@  discard block
 block discarded – undo
339 339
 						if (isset($airline_icao)) {
340 340
 							$imagefile = $aircraft_icao.'-'.$airline_icao.'.png';
341 341
 							if (file_exists(dirname(__FILE__).'/models/gltf2/liveries/'.$imagefile)) {
342
-								$output.= '"liveries": "'.$globalURL.'/models/gltf2/liveries/'.$imagefile.'",';
342
+								$output .= '"liveries": "'.$globalURL.'/models/gltf2/liveries/'.$imagefile.'",';
343 343
 							}
344 344
 						}
345 345
 					}
346
-					if ($ident != '') $output.= '"ident": "'.$ident.'",';
346
+					if ($ident != '') $output .= '"ident": "'.$ident.'",';
347 347
 				}
348
-				$output.= '"gltf2": %gltf2%,';
349
-				$output.= '"type": "flight"';
348
+				$output .= '"gltf2": %gltf2%,';
349
+				$output .= '"type": "flight"';
350 350
 			}
351 351
 			$output .= '},';
352 352
 
@@ -717,8 +717,8 @@  discard block
 block discarded – undo
717 717
 					$output .= '},';
718 718
 				}
719 719
 			}
720
-			if (isset($onground) && $onground) $output = str_replace('%onground%','true',$output);
721
-			else $output = str_replace('%onground%','false',$output);
720
+			if (isset($onground) && $onground) $output = str_replace('%onground%', 'true', $output);
721
+			else $output = str_replace('%onground%', 'false', $output);
722 722
 
723 723
 	//		$output .= '"heightReference": "CLAMP_TO_GROUND",';
724 724
 			//$output .= '"heightReference": "'.$heightrelative.'",';
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
 			if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']);
735 735
 			if (isset($_COOKIE['MapTrack']) && $id == $_COOKIE['MapTrack'] && $minitracktime > strtotime($spotter_item['date'])) $minitracktime = strtotime($spotter_item['date']);
736 736
 			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
737
-			$output .= '"'.date("c",strtotime($spotter_item['date'])).'", ';
737
+			$output .= '"'.date("c", strtotime($spotter_item['date'])).'", ';
738 738
 			$output .= $spotter_item['longitude'].', ';
739 739
 			$output .= $spotter_item['latitude'];
740 740
 			$prevlong = $spotter_item['longitude'];
@@ -762,8 +762,8 @@  discard block
 block discarded – undo
762 762
 			//$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0));
763 763
 			//$orientation .= '"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w'];
764 764
 		} else {
765
-			$nblatlong = $nblatlong+1;
766
-			$output .= ',"'.date("c",strtotime($spotter_item['date'])).'", ';
765
+			$nblatlong = $nblatlong + 1;
766
+			$output .= ',"'.date("c", strtotime($spotter_item['date'])).'", ';
767 767
 			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
768 768
 			if ($spotter_item['ground_speed'] == 0) {
769 769
 				$output .= $prevlong.', ';
@@ -803,21 +803,21 @@  discard block
 block discarded – undo
803 803
 }
804 804
 $output .= ']';
805 805
 if (isset($globalArchive) && $globalArchive === TRUE) {
806
-	if ((time()-$globalLiveInterval) > $minitime) {
807
-		if (time()-$globalLiveInterval > $maxitime) {
808
-			$output = str_replace('%minitime%',date("c",$maxitime),$output);
806
+	if ((time() - $globalLiveInterval) > $minitime) {
807
+		if (time() - $globalLiveInterval > $maxitime) {
808
+			$output = str_replace('%minitime%', date("c", $maxitime), $output);
809 809
 		} else {
810
-			$output = str_replace('%minitime%',date("c",time()-$globalLiveInterval),$output);
810
+			$output = str_replace('%minitime%', date("c", time() - $globalLiveInterval), $output);
811 811
 		}
812 812
 	}
813
-	else $output = str_replace('%minitime%',date("c",$minitime),$output);
813
+	else $output = str_replace('%minitime%', date("c", $minitime), $output);
814 814
 } elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && $minitracktime != $minitracktime_begin) {
815
-	$output = str_replace('%minitime%',date("c",$minitracktime),$output);
815
+	$output = str_replace('%minitime%', date("c", $minitracktime), $output);
816 816
 } else {
817
-	$output = str_replace('%minitime%',date("c",$minitime),$output);
817
+	$output = str_replace('%minitime%', date("c", $minitime), $output);
818 818
 }
819
-$output = str_replace('%maxitime%',date("c",$maxitime),$output);
820
-if ($gltf2) $output = str_replace('%gltf2%','true',$output);
821
-else $output = str_replace('%gltf2%','false',$output);
819
+$output = str_replace('%maxitime%', date("c", $maxitime), $output);
820
+if ($gltf2) $output = str_replace('%gltf2%', 'true', $output);
821
+else $output = str_replace('%gltf2%', 'false', $output);
822 822
 print $output;
823 823
 ?>
Please login to merge, or discard this patch.
Braces   +123 added lines, -45 removed lines patch added patch discarded remove patch
@@ -19,8 +19,12 @@  discard block
 block discarded – undo
19 19
 }
20 20
 $tracker = false;
21 21
 $marine = false;
22
-if (isset($_GET['tracker'])) $tracker = true;
23
-if (isset($_GET['marine'])) $marine = true;
22
+if (isset($_GET['tracker'])) {
23
+	$tracker = true;
24
+}
25
+if (isset($_GET['marine'])) {
26
+	$marine = true;
27
+}
24 28
 if ($tracker) {
25 29
 	require_once('require/class.Tracker.php');
26 30
 	require_once('require/class.TrackerLive.php');
@@ -77,24 +81,49 @@  discard block
 block discarded – undo
77 81
 }
78 82
 header('Content-Type: text/javascript');
79 83
 
80
-if (!isset($globalJsonCompress)) $compress = true;
81
-else $compress = $globalJsonCompress;
84
+if (!isset($globalJsonCompress)) {
85
+	$compress = true;
86
+} else {
87
+	$compress = $globalJsonCompress;
88
+}
82 89
 
83 90
 $from_archive = false;
84 91
 $min = false;
85 92
 $allhistory = false;
86 93
 $filter['source'] = array();
87
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
88
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
89
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
90
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
91
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
92
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
93
-if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
94
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
95
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
96
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
97
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
94
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') {
95
+	$filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
96
+}
97
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') {
98
+	$filter['source'] = array_merge($filter['source'],array('whazzup'));
99
+}
100
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') {
101
+	$filter['source'] = array_merge($filter['source'],array('phpvmacars'));
102
+}
103
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') {
104
+	$filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
105
+}
106
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') {
107
+	$filter['source'] = array_merge($filter['source'],array('aprs'));
108
+}
109
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') {
110
+	$filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
111
+}
112
+if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') {
113
+	$filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
114
+}
115
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') {
116
+	$filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
117
+}
118
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') {
119
+	$filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
120
+}
121
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') {
122
+	$filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
123
+}
124
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') {
125
+	$filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
126
+}
98 127
 /*
99 128
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
100 129
 	$min = true;
@@ -212,8 +241,12 @@  discard block
 block discarded – undo
212 241
 	} else {
213 242
 		$flightcnt = $SpotterLive->getLiveSpotterCount($filter);
214 243
 	}
215
-	if ($flightcnt == '') $flightcnt = 0;
216
-} else $flightcnt = 0;
244
+	if ($flightcnt == '') {
245
+		$flightcnt = 0;
246
+	}
247
+	} else {
248
+	$flightcnt = 0;
249
+}
217 250
 
218 251
 $sqltime = round(microtime(true)-$begintime,2);
219 252
 $minitime = time();
@@ -257,7 +290,9 @@  discard block
 block discarded – undo
257 290
 $prev_flightaware_id = '';
258 291
 $speed = 1;
259 292
 $gltf2 = false;
260
-if (isset($archivespeed)) $speed = $archivespeed;
293
+if (isset($archivespeed)) {
294
+	$speed = $archivespeed;
295
+}
261 296
 $output = '[';
262 297
 if ($tracker) {
263 298
 	$output .= '{"id" : "document", "name" : "tracker","version" : "1.0"';
@@ -293,9 +328,13 @@  discard block
 block discarded – undo
293 328
 			$image = "images/placeholder_thumb.png";
294 329
 		}
295 330
 
296
-                if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id'];
297
-                elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid'];
298
-                elseif (isset($spotter_item['fammarine_id'])) $id = $spotter_item['fammarine_id'];
331
+                if (isset($spotter_item['flightaware_id'])) {
332
+                	$id = $spotter_item['flightaware_id'];
333
+                } elseif (isset($spotter_item['famtrackid'])) {
334
+                	$id = $spotter_item['famtrackid'];
335
+                } elseif (isset($spotter_item['fammarine_id'])) {
336
+                	$id = $spotter_item['fammarine_id'];
337
+                }
299 338
                 if ($prev_flightaware_id != $id) {
300 339
 			if ($prev_flightaware_id != '') {
301 340
 				/*
@@ -321,7 +360,9 @@  discard block
 block discarded – undo
321 360
 			$output .= '"flightcnt": "'.$flightcnt.'",';
322 361
 			$output .= '"onground": %onground%,';
323 362
 			$output .= '"lastupdate": "'.$lastupdate.'",';
324
-			if (isset($spotter_item['format_source'])) $output .= '"format": "'.$spotter_item['format_source'].'",';
363
+			if (isset($spotter_item['format_source'])) {
364
+				$output .= '"format": "'.$spotter_item['format_source'].'",';
365
+			}
325 366
 			if ($tracker) {
326 367
 				$output.= '"type": "tracker"';
327 368
 			} elseif ($marine) {
@@ -343,7 +384,9 @@  discard block
 block discarded – undo
343 384
 							}
344 385
 						}
345 386
 					}
346
-					if ($ident != '') $output.= '"ident": "'.$ident.'",';
387
+					if ($ident != '') {
388
+						$output.= '"ident": "'.$ident.'",';
389
+					}
347 390
 				}
348 391
 				$output.= '"gltf2": %gltf2%,';
349 392
 				$output.= '"type": "flight"';
@@ -375,7 +418,9 @@  discard block
 block discarded – undo
375 418
 							$spotter_item['engine_type'] = $aircraft_info[0]['engine_type'];
376 419
 							$spotter_item['wake_category'] = $aircraft_info[0]['wake_category'];
377 420
 							$spotter_item['engine_count'] = $aircraft_info[0]['engine_count'];
378
-						} else $aircraft_shadow = '';
421
+						} else {
422
+							$aircraft_shadow = '';
423
+						}
379 424
 	    					$output .= ' "billboard" : {"image" : "'.$globalURL.'/images/aircrafts/new/'.$aircraft_shadow.'","scale" : 0.5';
380 425
 						if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true' && isset($_COOKIE['IconColor'])) {
381 426
 							$rgb = $Common->hex2rgb($_COOKIE['IconColor']);
@@ -383,7 +428,9 @@  discard block
 block discarded – undo
383 428
 						}
384 429
 						$output .= '},';
385 430
 					}
386
-				} else $output .= ' "billboard" : {"image" : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAfCAYAAACVgY94AAAACXBIWXMAAC4jAAAuIwF4pT92AAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAA7VJREFUeNrEl2uIlWUQx39nXUu0m2uQbZYrbabdLKMs/VBkmHQjioqFIhBS+hKEQpQRgVAf2u5RQkGBRUllRH4I2e5ZUBJlEZVt5i0tTfHStrZ6fn35L70d9n7Obg88vOedmWfmf2bmmZkXlRrtq9V16mZ1iVqqhd5agXvQf1c5zw/V8dXqrqO6dQKwBrgdWApsCb0VqAc2AnOrMVANwIsD4BLgTOBPYB2wHJgEzAG+ANqAu4ZsZYiuX5QwfqI2hvaNulA9J7zLQn8o76vUuuHOwXHqSzH4aIF+TWjnBkSH+nCBf716SP1KPWO4AJ6ltgfIjRW8p9U/1KPz/ry6RT2mIDNF3Zjz19Ya4G1R/J16dgWvQd2pPlXhMdVZPUTgxfCW1wJgXUJpQlvfg8zs8K8r0Caom9QHetG7NGfa1ElDBThRXRtFd/Qh16puKIS3e7+clBjdy7kL1b3q4fzJQQGck5z6Nb97kxujblWf64HXov7Vl/E4YXWccP9AAd6dAx+ox/WTArNzY1t64B0f8K0DyLXuUvRGZfcpCo1VX4tg6wB76WMB0dALf526foAX8cqUot2pGP8B2Kz+krBeNYjS8636dh/8Beo2deoA9TWp76pd6g0q9cDNwKvAD8A84EfglLRBe2g+JWAfcEF68bPABOCoAl/gIPA5MA64FVgGnNhP292W3r0SeB1YVlJXAjcBP8XwyQUj9AKwAzg2+/fQSsBhoJxBAaALaIzenZGnD911wA7gEDAD2FFSpwOzgDHZ5T7+ZSlGd2d6AXgi5+qAn+O5U0PbBVwKtAD3AHuB8f3YGBUdncCGoQ4LE9XtGRqK9LnduVPRIu2BPqwD65IYbS7Qpql7Ql9YoJcy9bwzkgPrfOCj5G33+h54E/g0PAr5thq4ApgyEgNrc27aWwVaPTA1QJ4BjgTGFvhteV40EgPrgvTP7qlmZqFnl9WD+b2posN83E/NrEkOjlI/U1fkfUYa/pe5IE3qZPW8jFOqiyN7p3pAPX04c7AxYSoDDcAjKT2LgLXA6IR2M3Bviv59wDTgQGTPH84Qd8+HXfHcoUws2zM0HMjuUPep+xP2PWpnwtw0GJsldbBpewQwE/gbeDyt7H1gcW53O7AC+A3Yn6+/W+Ld9SnWA15DAVhc8xK2TuA9YHrCuhV4EngFuBx4YagG6qv8cF+T52kB2Zy+e1I8taUacNV+uBdXO7ABmJwJpwx8XQvF9TUCWM64tiQhbq/oMv+7BwFWpQzNT8vbVQul/wwAGzzdmXU1xuUAAAAASUVORK5CYII=","scale" : 0.5},';
431
+				} else {
432
+					$output .= ' "billboard" : {"image" : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAfCAYAAACVgY94AAAACXBIWXMAAC4jAAAuIwF4pT92AAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAA7VJREFUeNrEl2uIlWUQx39nXUu0m2uQbZYrbabdLKMs/VBkmHQjioqFIhBS+hKEQpQRgVAf2u5RQkGBRUllRH4I2e5ZUBJlEZVt5i0tTfHStrZ6fn35L70d9n7Obg88vOedmWfmf2bmmZkXlRrtq9V16mZ1iVqqhd5agXvQf1c5zw/V8dXqrqO6dQKwBrgdWApsCb0VqAc2AnOrMVANwIsD4BLgTOBPYB2wHJgEzAG+ANqAu4ZsZYiuX5QwfqI2hvaNulA9J7zLQn8o76vUuuHOwXHqSzH4aIF+TWjnBkSH+nCBf716SP1KPWO4AJ6ltgfIjRW8p9U/1KPz/ry6RT2mIDNF3Zjz19Ya4G1R/J16dgWvQd2pPlXhMdVZPUTgxfCW1wJgXUJpQlvfg8zs8K8r0Caom9QHetG7NGfa1ElDBThRXRtFd/Qh16puKIS3e7+clBjdy7kL1b3q4fzJQQGck5z6Nb97kxujblWf64HXov7Vl/E4YXWccP9AAd6dAx+ox/WTArNzY1t64B0f8K0DyLXuUvRGZfcpCo1VX4tg6wB76WMB0dALf526foAX8cqUot2pGP8B2Kz+krBeNYjS8636dh/8Beo2deoA9TWp76pd6g0q9cDNwKvAD8A84EfglLRBe2g+JWAfcEF68bPABOCoAl/gIPA5MA64FVgGnNhP292W3r0SeB1YVlJXAjcBP8XwyQUj9AKwAzg2+/fQSsBhoJxBAaALaIzenZGnD911wA7gEDAD2FFSpwOzgDHZ5T7+ZSlGd2d6AXgi5+qAn+O5U0PbBVwKtAD3AHuB8f3YGBUdncCGoQ4LE9XtGRqK9LnduVPRIu2BPqwD65IYbS7Qpql7Ql9YoJcy9bwzkgPrfOCj5G33+h54E/g0PAr5thq4ApgyEgNrc27aWwVaPTA1QJ4BjgTGFvhteV40EgPrgvTP7qlmZqFnl9WD+b2posN83E/NrEkOjlI/U1fkfUYa/pe5IE3qZPW8jFOqiyN7p3pAPX04c7AxYSoDDcAjKT2LgLXA6IR2M3Bviv59wDTgQGTPH84Qd8+HXfHcoUws2zM0HMjuUPep+xP2PWpnwtw0GJsldbBpewQwE/gbeDyt7H1gcW53O7AC+A3Yn6+/W+Ld9SnWA15DAVhc8xK2TuA9YHrCuhV4EngFuBx4YagG6qv8cF+T52kB2Zy+e1I8taUacNV+uBdXO7ABmJwJpwx8XQvF9TUCWM64tiQhbq/oMv+7BwFWpQzNT8vbVQul/wwAGzzdmXU1xuUAAAAASUVORK5CYII=","scale" : 0.5},';
433
+				}
387 434
 			} elseif ($one3dmodel) {
388 435
 				if (isset($globalMap3DForceModel) && $globalMap3DForceModel != '') {
389 436
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$globalMap3DForceModel.'","scale" : 1.0,"minimumPixelSize": 20';
@@ -423,7 +470,9 @@  discard block
 block discarded – undo
423 470
 							$spotter_item['engine_type'] = $aircraft_info[0]['engine_type'];
424 471
 							$spotter_item['wake_category'] = $aircraft_info[0]['wake_category'];
425 472
 							$spotter_item['engine_count'] = $aircraft_info[0]['engine_count'];
426
-						} else $aircraft_shadow = '';
473
+						} else {
474
+							$aircraft_shadow = '';
475
+						}
427 476
 						if ($aircraft_shadow != '') {
428 477
 							if (isset($modelsdb2[$aircraft_shadow])) {
429 478
 								$output .= '"model": {"gltf" : "'.$globalURL.'/models/gltf2/'.$modelsdb2[$aircraft_shadow]['glb'].'","scale" : 1.0,"minimumPixelSize": '.$modelsdb2[$aircraft_shadow]['size'];
@@ -578,7 +627,9 @@  discard block
 block discarded – undo
578 627
 								}
579 628
 								$output .= '},';
580 629
 								//if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
581
-								if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
630
+								if ($spotter_item['aircraft_icao'] != '') {
631
+									$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
632
+								}
582 633
 								$modelsdb[$aircraft_icao] = 'Cesium_Air.glb';
583 634
 							}
584 635
 						} elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') {
@@ -600,7 +651,9 @@  discard block
 block discarded – undo
600 651
 							}
601 652
 							$output .= '},';
602 653
 							//if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
603
-							if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
654
+							if ($spotter_item['aircraft_icao'] != '') {
655
+								$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
656
+							}
604 657
 							$modelsdb[$aircraft_icao] = 'Cesium_Air.glb';
605 658
 						}
606 659
 					} else {
@@ -613,7 +666,9 @@  discard block
 block discarded – undo
613 666
 						}
614 667
 						$output .= '},';
615 668
 						//if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
616
-						if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
669
+						if ($spotter_item['aircraft_icao'] != '') {
670
+							$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
671
+						}
617 672
 						$modelsdb[$aircraft_icao] = 'Cesium_Air.glb';
618 673
 					}
619 674
 				} elseif ($tracker && isset($spotter_item['type'])) {
@@ -717,8 +772,11 @@  discard block
 block discarded – undo
717 772
 					$output .= '},';
718 773
 				}
719 774
 			}
720
-			if (isset($onground) && $onground) $output = str_replace('%onground%','true',$output);
721
-			else $output = str_replace('%onground%','false',$output);
775
+			if (isset($onground) && $onground) {
776
+				$output = str_replace('%onground%','true',$output);
777
+			} else {
778
+				$output = str_replace('%onground%','false',$output);
779
+			}
722 780
 
723 781
 	//		$output .= '"heightReference": "CLAMP_TO_GROUND",';
724 782
 			//$output .= '"heightReference": "'.$heightrelative.'",';
@@ -731,9 +789,15 @@  discard block
 block discarded – undo
731 789
 	//		$output .= '"interpolationDegree" : 5,';
732 790
 	//		$output .= '"epoch" : "'.date("c",strtotime($spotter_item['date'])).'", ';
733 791
 			$output .= '"cartographicDegrees": [';
734
-			if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']);
735
-			if (isset($_COOKIE['MapTrack']) && $id == $_COOKIE['MapTrack'] && $minitracktime > strtotime($spotter_item['date'])) $minitracktime = strtotime($spotter_item['date']);
736
-			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
792
+			if ($minitime > strtotime($spotter_item['date'])) {
793
+				$minitime = strtotime($spotter_item['date']);
794
+			}
795
+			if (isset($_COOKIE['MapTrack']) && $id == $_COOKIE['MapTrack'] && $minitracktime > strtotime($spotter_item['date'])) {
796
+				$minitracktime = strtotime($spotter_item['date']);
797
+			}
798
+			if ($maxitime < strtotime($spotter_item['date'])) {
799
+				$maxitime = strtotime($spotter_item['date']);
800
+			}
737 801
 			$output .= '"'.date("c",strtotime($spotter_item['date'])).'", ';
738 802
 			$output .= $spotter_item['longitude'].', ';
739 803
 			$output .= $spotter_item['latitude'];
@@ -756,7 +820,9 @@  discard block
 block discarded – undo
756 820
 					$output .= ', '.round($spotter_item['altitude']*30.48);
757 821
 					$prevalt = round($spotter_item['altitude']*30.48);
758 822
 				}
759
-			} else $output .= ', 0';
823
+			} else {
824
+				$output .= ', 0';
825
+			}
760 826
 			//$orientation = '"orientation" : { ';
761 827
 			//$orientation .= '"unitQuaternion": [';
762 828
 			//$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0));
@@ -764,13 +830,18 @@  discard block
 block discarded – undo
764 830
 		} else {
765 831
 			$nblatlong = $nblatlong+1;
766 832
 			$output .= ',"'.date("c",strtotime($spotter_item['date'])).'", ';
767
-			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
833
+			if ($maxitime < strtotime($spotter_item['date'])) {
834
+				$maxitime = strtotime($spotter_item['date']);
835
+			}
768 836
 			if ($spotter_item['ground_speed'] == 0) {
769 837
 				$output .= $prevlong.', ';
770 838
 				$output .= $prevlat;
771 839
 				//if (!$marine && (!isset($onground) || !$onground)) $output .= ', '.$prevalt;
772
-				if (!$marine) $output .= ', '.$prevalt;
773
-				else $output .= ', 0';
840
+				if (!$marine) {
841
+					$output .= ', '.$prevalt;
842
+				} else {
843
+					$output .= ', 0';
844
+				}
774 845
 			} else {
775 846
 				$output .= $spotter_item['longitude'].', ';
776 847
 				$output .= $spotter_item['latitude'];
@@ -783,14 +854,17 @@  discard block
 block discarded – undo
783 854
 							$output .= ', 0';
784 855
 						}
785 856
 					} else {
786
-						if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') $output .= ', '.round($spotter_item['real_altitude']*0.3048);
787
-						elseif ($tracker) {
857
+						if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') {
858
+							$output .= ', '.round($spotter_item['real_altitude']*0.3048);
859
+						} elseif ($tracker) {
788 860
 							$output .= ', '.round($spotter_item['altitude']*0.3048);
789 861
 						} else {
790 862
 							$output .= ', '.round($spotter_item['altitude']*30.48);
791 863
 						}
792 864
 					}
793
-				} else $output .= ', 0';
865
+				} else {
866
+					$output .= ', 0';
867
+				}
794 868
 			}
795 869
 			//$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0));
796 870
 			//$orientation .= ',"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w'];
@@ -809,15 +883,19 @@  discard block
 block discarded – undo
809 883
 		} else {
810 884
 			$output = str_replace('%minitime%',date("c",time()-$globalLiveInterval),$output);
811 885
 		}
886
+	} else {
887
+		$output = str_replace('%minitime%',date("c",$minitime),$output);
812 888
 	}
813
-	else $output = str_replace('%minitime%',date("c",$minitime),$output);
814
-} elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && $minitracktime != $minitracktime_begin) {
889
+	} elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && $minitracktime != $minitracktime_begin) {
815 890
 	$output = str_replace('%minitime%',date("c",$minitracktime),$output);
816 891
 } else {
817 892
 	$output = str_replace('%minitime%',date("c",$minitime),$output);
818 893
 }
819 894
 $output = str_replace('%maxitime%',date("c",$maxitime),$output);
820
-if ($gltf2) $output = str_replace('%gltf2%','true',$output);
821
-else $output = str_replace('%gltf2%','false',$output);
895
+if ($gltf2) {
896
+	$output = str_replace('%gltf2%','true',$output);
897
+} else {
898
+	$output = str_replace('%gltf2%','false',$output);
899
+}
822 900
 print $output;
823 901
 ?>
Please login to merge, or discard this patch.
js/map.3d.js.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 			break;
315 315
 		}
316 316
 	}
317
-	var tsk_geojson = Cesium.loadJson("<?php print $globalURL; ?>/tsk-geojson.php?tsk=<?php print filter_input(INPUT_GET,'tsk',FILTER_SANITIZE_URL); ?>");
317
+	var tsk_geojson = Cesium.loadJson("<?php print $globalURL; ?>/tsk-geojson.php?tsk=<?php print filter_input(INPUT_GET, 'tsk', FILTER_SANITIZE_URL); ?>");
318 318
 	tsk_geojson.then(function(geojsondata) {
319 319
 		tsk = new Cesium.CustomDataSource('tsk');
320 320
 		for (var i =0;i < geojsondata.features.length; i++) {
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 <?php
390 390
 	if (isset($_COOKIE['lastcentercoord']) || (isset($globalCenterLatitude) && isset($globalCenterLongitude) && $globalCenterLatitude != '' && $globalCenterLongitude != '')) {
391 391
 		if (isset($_COOKIE['lastcentercoord'])) {
392
-			$lastcentercoord = explode(',',$_COOKIE['lastcentercoord']);
392
+			$lastcentercoord = explode(',', $_COOKIE['lastcentercoord']);
393 393
 			if (!isset($lastcentercoord[3])) $zoom = $lastcentercoord[2]*1000000.0;
394 394
 			else $zoom = $lastcentercoord[3];
395 395
 			$viewcenterlatitude = $lastcentercoord[0];
Please login to merge, or discard this patch.
Braces   +47 added lines, -15 removed lines patch added patch discarded remove patch
@@ -5,21 +5,30 @@  discard block
 block discarded – undo
5 5
 
6 6
 document.cookie =  'MapFormat=3d; expires=Thu, 2 Aug 2100 20:47:11 UTC; path=/'
7 7
 <?php
8
-	if (isset($_COOKIE['MapType'])) $MapType = $_COOKIE['MapType'];
9
-	else $MapType = $globalMapProvider;
10
-//	unset($_COOKIE['MapType']);
8
+	if (isset($_COOKIE['MapType'])) {
9
+		$MapType = $_COOKIE['MapType'];
10
+	} else {
11
+		$MapType = $globalMapProvider;
12
+	}
13
+	//	unset($_COOKIE['MapType']);
11 14
 
12 15
 	if ($MapType != 'Mapbox' && $MapType != 'OpenStreetMap' && $MapType != 'Bing-Aerial' && $MapType != 'Bing-Hybrid' && $MapType != 'Bing-Road' && $MapType != 'offline' && $MapType != 'ArcGIS-Streetmap' && $MapType != 'ArcGIS-Satellite' && $MapType != 'NatGeo-Street') {
13
-		if (isset($globalBingMapKey) && $globalBingMapKey != '') $MapType = 'Bing-Aerial';
14
-		else $MapType = 'OpenStreetMap';
16
+		if (isset($globalBingMapKey) && $globalBingMapKey != '') {
17
+			$MapType = 'Bing-Aerial';
18
+		} else {
19
+			$MapType = 'OpenStreetMap';
20
+		}
15 21
 	}
16 22
 	if (($MapType == 'Bing-Aerial' || $MapType == 'Bing-Hybrid' || $MapType == 'Bing-Road') && (!isset($globalBingMapKey) || $globalBingMapKey == '')) {
17 23
 		$MapType = 'OpenStreetMap';
18 24
 	}
19 25
 	if ($MapType == 'Mapbox') {
20
-		if ($_COOKIE['MapTypeId'] == 'default') $MapBoxId = $globalMapboxId;
21
-		else $MapBoxId = $_COOKIE['MapTypeId'];
22
-?>
26
+		if ($_COOKIE['MapTypeId'] == 'default') {
27
+			$MapBoxId = $globalMapboxId;
28
+		} else {
29
+			$MapBoxId = $_COOKIE['MapTypeId'];
30
+		}
31
+		?>
23 32
 	var imProv = Cesium.MapboxImageryProvider({
24 33
 		credit: 'Map data © OpenStreetMap contributors, ' +
25 34
 	      'CC-BY-SA, ' +
@@ -86,13 +95,23 @@  discard block
 block discarded – undo
86 95
 		credit : 'Imagery courtesy Natural Earth'
87 96
 	});
88 97
 <?php
89
-	}  elseif (isset($globalMapCustomLayer[$MapType])) {
98
+	} elseif (isset($globalMapCustomLayer[$MapType])) {
90 99
 		$customid = $MapType;
91 100
 ?>
92 101
 	var imProv = Cesium.createOpenStreetMapImageryProvider({
93 102
 		url : '<?php print $globalMapCustomLayer[$customid]['url']; ?>',
94
-		maximumLevel: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) print $globalMapCustomLayer[$customid]['maxZoom']; else print '99'; ?>,
95
-		minimumLevel: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) print $globalMapCustomLayer[$customid]['minZoom']; else print '0'; ?>,
103
+		maximumLevel: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) {
104
+	print $globalMapCustomLayer[$customid]['maxZoom'];
105
+} else {
106
+	print '99';
107
+}
108
+?>,
109
+		minimumLevel: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) {
110
+	print $globalMapCustomLayer[$customid]['minZoom'];
111
+} else {
112
+	print '0';
113
+}
114
+?>,
96 115
 		credit: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>'
97 116
 	});
98 117
 <?php
@@ -376,7 +395,12 @@  discard block
 block discarded – undo
376 395
 	imageryProvider : imProv,
377 396
 	timeline : archive,
378 397
 	animation : false,
379
-	shadows : <?php if ((isset($globalMap3DShadows) && $globalMap3DShadows === FALSE) || (isset($_COOKIE['map3dnoshadows']) && $_COOKIE['map3dnoshadows'] == 'true')) print 'false'; else print 'true'; ?>,
398
+	shadows : <?php if ((isset($globalMap3DShadows) && $globalMap3DShadows === FALSE) || (isset($_COOKIE['map3dnoshadows']) && $_COOKIE['map3dnoshadows'] == 'true')) {
399
+	print 'false';
400
+} else {
401
+	print 'true';
402
+}
403
+?>,
380 404
 	infoBox : false,
381 405
 	navigationHelpButton : false,
382 406
 	geocoder : false,
@@ -390,8 +414,11 @@  discard block
 block discarded – undo
390 414
 	if (isset($_COOKIE['lastcentercoord']) || (isset($globalCenterLatitude) && isset($globalCenterLongitude) && $globalCenterLatitude != '' && $globalCenterLongitude != '')) {
391 415
 		if (isset($_COOKIE['lastcentercoord'])) {
392 416
 			$lastcentercoord = explode(',',$_COOKIE['lastcentercoord']);
393
-			if (!isset($lastcentercoord[3])) $zoom = $lastcentercoord[2]*1000000.0;
394
-			else $zoom = $lastcentercoord[3];
417
+			if (!isset($lastcentercoord[3])) {
418
+				$zoom = $lastcentercoord[2]*1000000.0;
419
+			} else {
420
+				$zoom = $lastcentercoord[3];
421
+			}
395 422
 			$viewcenterlatitude = $lastcentercoord[0];
396 423
 			$viewcenterlongitude = $lastcentercoord[1];
397 424
 		} else {
@@ -473,7 +500,12 @@  discard block
 block discarded – undo
473 500
 ?>
474 501
 
475 502
 update_locationsLayer();
476
-setInterval(function(){update_locationsLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
503
+setInterval(function(){update_locationsLayer()},<?php if (isset($globalMapRefresh)) {
504
+	print $globalMapRefresh*1000*2;
505
+} else {
506
+	print '60000';
507
+}
508
+?>);
477 509
 viewer.camera.moveEnd.addEventListener(function() { 
478 510
 <?php
479 511
 	if (isset($globalMapUseBbox) && $globalMapUseBbox) {
Please login to merge, or discard this patch.
airspace-geojson.php 3 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -11,13 +11,13 @@  discard block
 block discarded – undo
11 11
 $Connection = new Connection();
12 12
 
13 13
 if (!$Connection->tableExists('airspace')) {
14
-    die;
14
+	die;
15 15
 }
16 16
 
17 17
 if (isset($_GET['coord'])) 
18 18
 {
19 19
 	$coords = explode(',',$_GET['coord']);
20
-        if ($globalDBdriver == 'mysql') {
20
+		if ($globalDBdriver == 'mysql') {
21 21
 		$query = "SELECT *, ST_AsWKB(SHAPE) AS wkb FROM airspace WHERE ST_Intersects(SHAPE, ST_Envelope(linestring(point(:minlon,:minlat), point(:maxlon,:maxlat))))";
22 22
 		try {
23 23
 			$sth = $Connection->db->prepare($query);
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 		}
38 38
 	}
39 39
 } else {
40
-        if ($globalDBdriver == 'mysql') {
40
+		if ($globalDBdriver == 'mysql') {
41 41
 		$query = "SELECT *, ST_AsWKB(SHAPE) AS wkb FROM airspace";
42 42
 	} else {
43 43
 		$query = "SELECT *, ST_AsBinary(wkb_geometry,'NDR') AS wkb FROM airspace";
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
 }
52 52
 
53 53
 $geojson = array(
54
-    'type' => 'FeatureCollection',
55
-    'features' => array()
54
+	'type' => 'FeatureCollection',
55
+	'features' => array()
56 56
 );
57 57
 
58 58
 while ($row = $sth->fetch(PDO::FETCH_ASSOC))
@@ -115,9 +115,9 @@  discard block
 block discarded – undo
115 115
 		}
116 116
 		if (isset($properties['type']) && $properties['type'] != '') {
117 117
 			$feature = array(
118
-			    'type' => 'Feature',
119
-			    'geometry' => json_decode($geom->out('json')),
120
-			    'properties' => $properties
118
+				'type' => 'Feature',
119
+				'geometry' => json_decode($geom->out('json')),
120
+				'properties' => $properties
121 121
 			);
122 122
 			array_push($geojson['features'], $feature);
123 123
 		}
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -16,14 +16,14 @@  discard block
 block discarded – undo
16 16
 
17 17
 if (isset($_GET['coord'])) 
18 18
 {
19
-	$coords = explode(',',$_GET['coord']);
19
+	$coords = explode(',', $_GET['coord']);
20 20
         if ($globalDBdriver == 'mysql') {
21 21
 		$query = "SELECT *, ST_AsWKB(SHAPE) AS wkb FROM airspace WHERE ST_Intersects(SHAPE, ST_Envelope(linestring(point(:minlon,:minlat), point(:maxlon,:maxlat))))";
22 22
 		try {
23 23
 			$sth = $Connection->db->prepare($query);
24
-			$sth->execute(array(':minlon' => $coords[0],':minlat' => $coords[1],':maxlon' => $coords[2],':maxlat' => $coords[3]));
24
+			$sth->execute(array(':minlon' => $coords[0], ':minlat' => $coords[1], ':maxlon' => $coords[2], ':maxlat' => $coords[3]));
25 25
 			//$sth->execute();
26
-		} catch(PDOException $e) {
26
+		} catch (PDOException $e) {
27 27
 			echo "error";
28 28
 		}
29 29
 	} else {
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 			$sth = $Connection->db->prepare($query);
33 33
 			//$sth->execute(array(':minlon' => $coords[0],':minlat' => $coords[1],':maxlon' => $coords[2],':maxlat' => $coords[3]));
34 34
 			$sth->execute();
35
-		} catch(PDOException $e) {
35
+		} catch (PDOException $e) {
36 36
 			echo "error";
37 37
 		}
38 38
 	}
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	try {
46 46
 		$sth = $Connection->db->prepare($query);
47 47
 		$sth->execute();
48
-	} catch(PDOException $e) {
48
+	} catch (PDOException $e) {
49 49
 		echo "error";
50 50
 	}
51 51
 }
@@ -75,22 +75,22 @@  discard block
 block discarded – undo
75 75
 		if (isset($properties['ceiling'])) $properties['tops'] = $properties['ceiling'];
76 76
 		if (isset($properties['floor'])) $properties['base'] = $properties['floor'];
77 77
 		if (isset($properties['tops'])) {
78
-			if (preg_match('/^FL(\s)*(?<alt>\d+)/',strtoupper($properties['tops']),$matches)) {
78
+			if (preg_match('/^FL(\s)*(?<alt>\d+)/', strtoupper($properties['tops']), $matches)) {
79 79
 				$properties['upper_limit'] = round($matches['alt']*100*0.38048);
80
-			} elseif (preg_match('/^(?<alt>\d+)(\s)*(FT|AGL|ALT|MSL)/',strtoupper($properties['tops']),$matches)) {
80
+			} elseif (preg_match('/^(?<alt>\d+)(\s)*(FT|AGL|ALT|MSL)/', strtoupper($properties['tops']), $matches)) {
81 81
 				$properties['upper_limit'] = round($matches['alt']*0.38048);
82
-			} elseif (preg_match('/^(?<alt>\d+)(\s)*M/',strtoupper($properties['tops']),$matches)) {
82
+			} elseif (preg_match('/^(?<alt>\d+)(\s)*M/', strtoupper($properties['tops']), $matches)) {
83 83
 				$properties['upper_limit'] = $matches['alt'];
84 84
 			}
85 85
 		}
86 86
 		if (isset($properties['base'])) {
87 87
 			if ($properties['base'] == 'SFC' || $properties['base'] == 'MSL' || $properties['base'] == 'GROUND' || $properties['base'] == 'GND') {
88 88
 				$properties['lower_limit'] = 0;
89
-			} elseif (preg_match('/^FL(\s)*(?<alt>\d+)/',strtoupper($properties['base']),$matches)) {
89
+			} elseif (preg_match('/^FL(\s)*(?<alt>\d+)/', strtoupper($properties['base']), $matches)) {
90 90
 				$properties['lower_limit'] = round($matches['alt']*100*0.38048);
91
-			} elseif (preg_match('/^(?<alt>\d+)(\s)*(FT|AGL|ALT|MSL)/',strtoupper($properties['base']),$matches)) {
91
+			} elseif (preg_match('/^(?<alt>\d+)(\s)*(FT|AGL|ALT|MSL)/', strtoupper($properties['base']), $matches)) {
92 92
 				$properties['lower_limit'] = round($matches['alt']*0.38048);
93
-			} elseif (preg_match('/^(?<alt>\d+)(\s)*M/',strtoupper($properties['base']),$matches)) {
93
+			} elseif (preg_match('/^(?<alt>\d+)(\s)*M/', strtoupper($properties['base']), $matches)) {
94 94
 				$properties['lower_limit'] = $matches['alt'];
95 95
 			}
96 96
 		}
Please login to merge, or discard this patch.
Braces   +16 added lines, -6 removed lines patch added patch discarded remove patch
@@ -68,12 +68,22 @@
 block discarded – undo
68 68
 		} else {
69 69
 			$geom = geoPHP::load(stream_get_contents($row['wkb']));
70 70
 		}
71
-		if (isset($properties['type'])) $properties['type'] = trim($properties['type']);
72
-		elseif (isset($properties['class'])) $properties['type'] = trim($properties['class']);
73
-		if (isset($properties['ogr_fid'])) $properties['id'] = $properties['ogr_fid'];
74
-		elseif (isset($properties['ogc_fid'])) $properties['id'] = $properties['ogc_fid'];
75
-		if (isset($properties['ceiling'])) $properties['tops'] = $properties['ceiling'];
76
-		if (isset($properties['floor'])) $properties['base'] = $properties['floor'];
71
+		if (isset($properties['type'])) {
72
+			$properties['type'] = trim($properties['type']);
73
+		} elseif (isset($properties['class'])) {
74
+			$properties['type'] = trim($properties['class']);
75
+		}
76
+		if (isset($properties['ogr_fid'])) {
77
+			$properties['id'] = $properties['ogr_fid'];
78
+		} elseif (isset($properties['ogc_fid'])) {
79
+			$properties['id'] = $properties['ogc_fid'];
80
+		}
81
+		if (isset($properties['ceiling'])) {
82
+			$properties['tops'] = $properties['ceiling'];
83
+		}
84
+		if (isset($properties['floor'])) {
85
+			$properties['base'] = $properties['floor'];
86
+		}
77 87
 		if (isset($properties['tops'])) {
78 88
 			if (preg_match('/^FL(\s)*(?<alt>\d+)/',strtoupper($properties['tops']),$matches)) {
79 89
 				$properties['upper_limit'] = round($matches['alt']*100*0.38048);
Please login to merge, or discard this patch.
js/map-aircraft.2d.js.php 2 patches
Braces   +63 added lines, -17 removed lines patch added patch discarded remove patch
@@ -3,18 +3,31 @@  discard block
 block discarded – undo
3 3
 require_once('../require/class.Language.php'); 
4 4
 
5 5
 // Compressed GeoJson is used if true
6
-if (!isset($globalJsonCompress)) $compress = true;
7
-else $compress = $globalJsonCompress;
6
+if (!isset($globalJsonCompress)) {
7
+	$compress = true;
8
+} else {
9
+	$compress = $globalJsonCompress;
10
+}
8 11
 
9
-if (isset($_GET['ident'])) $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
10
-if (isset($_GET['flightaware_id'])) $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
12
+if (isset($_GET['ident'])) {
13
+	$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
14
+}
15
+if (isset($_GET['flightaware_id'])) {
16
+	$flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
17
+}
11 18
 $archive = false;
12
-if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') $archive = true;
19
+if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') {
20
+	$archive = true;
21
+}
13 22
 ?>
14 23
 <?php
15
-if (isset($_COOKIE['IconColor'])) $IconColor = $_COOKIE['IconColor'];
16
-elseif (isset($globalAircraftIconColor)) $IconColor = $globalAircraftIconColor;
17
-else $IconColor = '1a3151';
24
+if (isset($_COOKIE['IconColor'])) {
25
+	$IconColor = $_COOKIE['IconColor'];
26
+} elseif (isset($globalAircraftIconColor)) {
27
+	$IconColor = $globalAircraftIconColor;
28
+} else {
29
+	$IconColor = '1a3151';
30
+}
18 31
 ?>
19 32
 
20 33
 
@@ -81,9 +94,12 @@  discard block
 block discarded – undo
81 94
 
82 95
 function update_airportsLayer() {
83 96
 <?php
84
-	if (isset($_COOKIE['AirportZoom'])) $getZoom = $_COOKIE['AirportZoom'];
85
-	else $getZoom = '7';
86
-?>
97
+	if (isset($_COOKIE['AirportZoom'])) {
98
+		$getZoom = $_COOKIE['AirportZoom'];
99
+	} else {
100
+		$getZoom = '7';
101
+	}
102
+	?>
87 103
 	if (typeof airportsLayer != 'undefined') {
88 104
 		if (map.hasLayer(airportsLayer) == true) {
89 105
 			map.removeLayer(airportsLayer);
@@ -366,7 +382,12 @@  discard block
 block discarded – undo
366 382
 <?php
367 383
 		} else {
368 384
 ?>
369
-					var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
385
+					var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
386
+	print $archiveupdatetime*1000;
387
+} else {
388
+	print $globalMapRefresh*1000+20000;
389
+}
390
+?>+feature.properties.sqt*1000);
370 391
 					return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
371 392
 <?php
372 393
 		}
@@ -416,7 +437,12 @@  discard block
 block discarded – undo
416 437
 <?php
417 438
 		} else {
418 439
 ?>
419
-						var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
440
+						var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
441
+	print $archiveupdatetime*1000;
442
+} else {
443
+	print $globalMapRefresh*1000+20000;
444
+}
445
+?>+feature.properties.sqt*1000);
420 446
 						return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
421 447
 <?php
422 448
 		}
@@ -463,7 +489,12 @@  discard block
 block discarded – undo
463 489
 <?php
464 490
 		} else {
465 491
 ?>
466
-							var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
492
+							var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
493
+	print $archiveupdatetime*1000;
494
+} else {
495
+	print $globalMapRefresh*1000+20000;
496
+}
497
+?>+feature.properties.sqt*1000);
467 498
 							return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
468 499
 <?php
469 500
 		}
@@ -916,7 +947,12 @@  discard block
 block discarded – undo
916 947
 	} else {
917 948
 ?>
918 949
 	//then load it again every 30 seconds
919
-	reloadPage = setInterval(function(){if (noTimeout) getLiveData(0)},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>);
950
+	reloadPage = setInterval(function(){if (noTimeout) getLiveData(0)},<?php if (isset($globalMapRefresh)) {
951
+	print $globalMapRefresh*1000;
952
+} else {
953
+	print '30000';
954
+}
955
+?>);
920 956
 	var currentdate = new Date();
921 957
 	var currentyear = new Date().getFullYear();
922 958
 	var begindate = new Date(Date.UTC(currentyear,11,24,2,0,0,0));
@@ -928,7 +964,12 @@  discard block
 block discarded – undo
928 964
 		if (!((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) && (isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
929 965
 ?>
930 966
 	update_polarLayer();
931
-	setInterval(function(){map.removeLayer(polarLayer);update_polarLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
967
+	setInterval(function(){map.removeLayer(polarLayer);update_polarLayer()},<?php if (isset($globalMapRefresh)) {
968
+	print $globalMapRefresh*1000*2;
969
+} else {
970
+	print '60000';
971
+}
972
+?>);
932 973
 <?php
933 974
 		}
934 975
 ?>
@@ -943,7 +984,12 @@  discard block
 block discarded – undo
943 984
 	if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) {
944 985
 ?>
945 986
 	update_atcLayer();
946
-	setInterval(function(){map.removeLayer(atcLayer);update_atcLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
987
+	setInterval(function(){map.removeLayer(atcLayer);update_atcLayer()},<?php if (isset($globalMapRefresh)) {
988
+	print $globalMapRefresh*1000*2;
989
+} else {
990
+	print '60000';
991
+}
992
+?>);
947 993
 <?php
948 994
 	}
949 995
 ?>
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -6,8 +6,8 @@  discard block
 block discarded – undo
6 6
 if (!isset($globalJsonCompress)) $compress = true;
7 7
 else $compress = $globalJsonCompress;
8 8
 
9
-if (isset($_GET['ident'])) $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
10
-if (isset($_GET['flightaware_id'])) $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
9
+if (isset($_GET['ident'])) $ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING);
10
+if (isset($_GET['flightaware_id'])) $flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING);
11 11
 $archive = false;
12 12
 if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') $archive = true;
13 13
 ?>
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 		if (typeof props != 'undefined') {
216 216
 			var thedate = new Date(props);
217 217
 			$("#thedate").html(thedate.toUTCString());
218
-		//	$("#archivebox").html('<h4><?php echo str_replace("'","\'",_("Archive Date & Time")); ?></h4>' +  '<b><i class="fa fa-spinner fa-pulse fa-2x fa-fw margin-bottom"></i></b>');
218
+		//	$("#archivebox").html('<h4><?php echo str_replace("'", "\'", _("Archive Date & Time")); ?></h4>' +  '<b><i class="fa fa-spinner fa-pulse fa-2x fa-fw margin-bottom"></i></b>');
219 219
 		}
220 220
 	}
221 221
 <?php
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 <?php
367 367
 		} else {
368 368
 ?>
369
-					var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
369
+					var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000);
370 370
 					return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
371 371
 <?php
372 372
 		}
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 							/*
384 384
 							shadowUrl: iconURLShadowpath,
385 385
 							shadowSize: [<?php print $globalAircraftSize; ?>, <?php print $globalAircraftSize; ?>],
386
-							shadowAnchor: [<?php print ($globalAircraftSize/2)+1; ?>, <?php print $globalAircraftSize; ?>]
386
+							shadowAnchor: [<?php print ($globalAircraftSize/2) + 1; ?>, <?php print $globalAircraftSize; ?>]
387 387
 							*/
388 388
 						})
389 389
 					})
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
 <?php
417 417
 		} else {
418 418
 ?>
419
-						var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
419
+						var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000);
420 420
 						return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
421 421
 <?php
422 422
 		}
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
 <?php
464 464
 		} else {
465 465
 ?>
466
-							var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
466
+							var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000);
467 467
 							return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
468 468
 <?php
469 469
 		}
@@ -896,7 +896,7 @@  discard block
 block discarded – undo
896 896
 	var archivegeoJSONQuery = $.getJSON(url, function(data) {
897 897
 		$("#infobox").remove();
898 898
 		document.getElementById('archivebox').style.display = "block";
899
-		$("#archivebox").html('<h4><?php echo str_replace("'","\'",_("Archive Date & Time")); ?></h4>' +  '<b><span id="thedate"></span></b>' + '<br/><a href="#" onClick="noarchive();"><i class="fa fa-eject" aria-hidden="true"></i></a> <a href="#" onClick="archivePause();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="archivePlay();"><i class="fa fa-play" aria-hidden="true"></i></a><br/><div class="range archive"><input type="range" min="1" id="archiveboxspeed" max="50" size="10" step="1" onInput="archiveboxspeedrange.value=value;" onChange="archiveboxspeedrange.value=value;archiveplayback.setSpeed(value);" value="'+getCookie('archive_speed')+'"/><output id="archiveboxspeedrange">'+getCookie('archive_speed')+'</output></div>');
899
+		$("#archivebox").html('<h4><?php echo str_replace("'", "\'", _("Archive Date & Time")); ?></h4>' +  '<b><span id="thedate"></span></b>' + '<br/><a href="#" onClick="noarchive();"><i class="fa fa-eject" aria-hidden="true"></i></a> <a href="#" onClick="archivePause();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="archivePlay();"><i class="fa fa-play" aria-hidden="true"></i></a><br/><div class="range archive"><input type="range" min="1" id="archiveboxspeed" max="50" size="10" step="1" onInput="archiveboxspeedrange.value=value;" onChange="archiveboxspeedrange.value=value;archiveplayback.setSpeed(value);" value="'+getCookie('archive_speed')+'"/><output id="archiveboxspeedrange">'+getCookie('archive_speed')+'</output></div>');
900 900
 
901 901
 		var archiveLayerGroup = L.layerGroup();
902 902
 		var archivegeoJSON = L.geoJson(data, {
Please login to merge, or discard this patch.
index.php 3 patches
Indentation   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
     <?php }; if (isset($globalSatellite) && $globalSatellite) { ?><td><div id="ibxsatellite"><h4><?php echo _("Satellites Displayed"); ?></h4><br /><i class="fa fa-spinner fa-pulse fa-fw"></i></div></td><?php } ?>
50 50
 </tr></table></div>
51 51
 <?php
52
-    if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
52
+	if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
53 53
 ?>
54 54
 <script src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) print '?tsk='.$tsk; ?>"></script>
55 55
 <?php
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 <script src="<?php echo $globalURL; ?>/js/map-marine.3d.js.php"></script>
74 74
 <?php
75 75
 	}
76
-    }
76
+	}
77 77
 ?>
78 78
 
79 79
 <div id="sidebar" class="sidebar collapsed">
@@ -84,34 +84,34 @@  discard block
 block discarded – undo
84 84
 	<li><a href="" onclick="getUserLocation(); return false;" title="<?php echo _("Plot your Location"); ?>"><i class="fa fa-map-marker"></i></a></li>
85 85
 	<li><a href="" onclick="getCompassDirection(); return false;" title="<?php echo _("Compass Mode"); ?>"><i class="fa fa-compass"></i></a></li>
86 86
 <?php
87
-    //if ((isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') || (isset($globalBeta) && $globalBeta === TRUE)) {
87
+	//if ((isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') || (isset($globalBeta) && $globalBeta === TRUE)) {
88 88
 	if (isset($globalArchive) && $globalArchive == TRUE) {
89 89
 ?>
90 90
 	<li><a href="#archive" role="tab" title="<?php echo _("Archive"); ?>"><i class="fa fa-archive"></i></a></li>
91 91
 <?php
92 92
 	}
93
-    //}
93
+	//}
94 94
 ?>
95 95
 	<li><a href="#home" role="tab" title="<?php echo _("Layers"); ?>"><i class="fa fa-map"></i></a></li>
96 96
 	<li><a href="#filters" role="tab" title="<?php echo _("Filters"); ?>"><i class="fa fa-filter"></i></a></li>
97 97
 	<li><a href="#settings" role="tab" title="<?php echo _("Settings"); ?>"><i class="fa fa-gears"></i></a></li>
98 98
 <?php
99
-    if (isset($globalMap3D) && $globalMap3D) {
99
+	if (isset($globalMap3D) && $globalMap3D) {
100 100
 	if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
101 101
 ?>
102 102
 	<li><a href="" onclick="show3D(); return false;" role="tab" title="3D"><b>3D</b></a></li>
103 103
 <?php
104 104
 	} else {
105
-	    if (isset($globalSatellite) && $globalSatellite) {
105
+		if (isset($globalSatellite) && $globalSatellite) {
106 106
 ?>
107 107
 	<li><a href="#satellites" role="tab" title="<?php echo _("Satellites"); ?>"><i class="satellite"></i></a></li>
108 108
 <?php
109
-	    }
109
+		}
110 110
 ?>
111 111
 	<li><a href="" onclick="show2D(); return false;" role="tab" title="2D"><b>2D</b></a></li>
112 112
 <?php
113 113
 	}
114
-    }
114
+	}
115 115
 ?>
116 116
     </ul>
117 117
 
@@ -260,72 +260,72 @@  discard block
 block discarded – undo
260 260
 			    <?php
261 261
 				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider;
262 262
 				else $MapType = $_COOKIE['MapType'];
263
-			    ?>
263
+				?>
264 264
 			    <?php
265 265
 				if (isset($globalMapOffline) && $globalMapOffline === TRUE) {
266
-			    ?>
266
+				?>
267 267
 			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option>
268 268
 			    <?php
269 269
 				} else {
270
-				    if (file_exists(dirname(__FILE__).'/js/Cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml')) {
271
-			    ?>
270
+					if (file_exists(dirname(__FILE__).'/js/Cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml')) {
271
+				?>
272 272
 			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option>
273 273
 			    <?php
274
-				    }
275
-			    ?>
274
+					}
275
+				?>
276 276
 			    <option value="ArcGIS-Streetmap"<?php if ($MapType == 'ArcGIS-Streetmap') print ' selected'; ?>>ArcGIS Streetmap</option>
277 277
 			    <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Satellite') print ' selected'; ?>>ArcGIS Satellite</option>
278 278
 			    <?php
279
-				    if (isset($globalBingMapKey) && $globalBingMapKey != '') {
280
-			    ?>
279
+					if (isset($globalBingMapKey) && $globalBingMapKey != '') {
280
+				?>
281 281
 			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option>
282 282
 			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option>
283 283
 			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option>
284 284
 			    <?php
285
-				    }
286
-			    ?>
285
+					}
286
+				?>
287 287
 			    <?php
288
-				    if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
289
-			    ?>
288
+					if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
289
+				?>
290 290
 			    <?php
291 291
 					if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
292
-			    ?>
292
+				?>
293 293
 			    <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option>
294 294
 			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option>
295 295
 			    <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option>
296 296
 			    <?php
297 297
 					}
298
-			    ?>
298
+				?>
299 299
 			    <?php
300 300
 					if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
301
-			    ?>
301
+				?>
302 302
 			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option>
303 303
 			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option>
304 304
 			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option>
305 305
 			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option>
306 306
 			    <?php
307 307
 					}
308
-			    ?>
308
+				?>
309 309
 			    <?php
310 310
 					if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
311
-			    ?>
311
+				?>
312 312
 			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option>
313 313
 			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option>
314 314
 			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option>
315 315
 			    <?php
316 316
 					}
317
-			    ?>
317
+				?>
318 318
 			    <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option>
319 319
 			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth</option>
320 320
 			    <?php
321
-				    }
322
-			    ?>
321
+					}
322
+				?>
323 323
 			    <option value="NatGeo-Street"<?php if ($MapType == 'NatGeo-Street') print ' selected'; ?>>National Geographic Street</option>
324 324
 			    <?php
325
-				    if (isset($globalMapboxToken) && $globalMapboxToken != '') {
325
+					if (isset($globalMapboxToken) && $globalMapboxToken != '') {
326 326
 					if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default';
327 327
 					else $MapBoxId = $_COOKIE['MapTypeId'];
328
-			    ?>
328
+				?>
329 329
 			    <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') print ' selected'; ?>>Mapbox GL</option>
330 330
 			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option>
331 331
 			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option>
@@ -340,16 +340,16 @@  discard block
 block discarded – undo
340 340
 			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option>
341 341
 			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option>
342 342
 			    <?php
343
-				    }
344
-			    ?>
343
+					}
344
+				?>
345 345
 			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option>
346 346
 			    <?php
347 347
 				}
348
-			    ?>
348
+				?>
349 349
 			</select>
350 350
 		    </li>
351 351
 <?php
352
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d' && (!isset($globalMapOffline) || $globalMapOffline === FALSE)) {
352
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d' && (!isset($globalMapOffline) || $globalMapOffline === FALSE)) {
353 353
 ?>
354 354
 		    <li><?php echo _("Type of Terrain:"); ?>
355 355
 			<select  class="selectpicker" onchange="terrainType(this);">
@@ -360,10 +360,10 @@  discard block
 block discarded – undo
360 360
 			</select>
361 361
 		    </li>
362 362
 <?php
363
-    }
363
+	}
364 364
 ?>
365 365
 <?php
366
-    if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
366
+	if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
367 367
 ?>
368 368
 		    <li><div class="checkbox"><label><input type="checkbox" name="display2dbuildings" value="1" onclick="clickDisplay2DBuildings(this)" <?php if (isset($_COOKIE['Map2DBuildings']) && $_COOKIE['Map2DBuildings'] == 'true') print 'checked'; ?> ><?php echo _("Display 2.5D buidings on map"); ?></label></div></li>
369 369
 
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 		    <li><div class="checkbox"><label><input type="checkbox" name="satelliteestimation" value="1" onclick="clickSatelliteEstimation(this)" <?php if ((isset($_COOKIE['satelliteestimation']) && $_COOKIE['satelliteestimation'] == 'true') || (!isset($_COOKIE['satelliteestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['satelliteestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Satellites animate between updates"); ?></label></div></li>
387 387
 <?php
388 388
 	}
389
-    }
389
+	}
390 390
 ?>
391 391
 		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true' || !isset($_COOKIE['displayairports'])) print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li>
392 392
 		    <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) print 'checked'; ?> ><?php echo _("Display ground station on map"); ?></label></div></li>
@@ -405,80 +405,80 @@  discard block
 block discarded – undo
405 405
 	}
406 406
 ?>
407 407
 <?php
408
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
408
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
409 409
 ?>
410 410
 		    <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) print 'checked'; ?> ><?php echo _("Show mini-map"); ?></label></div></li>
411 411
 		    <li><div class="checkbox"><label><input type="checkbox" name="one3dmodel" value="1" onclick="useOne3Dmodel(this)" <?php if ((isset($_COOKIE['one3dmodel']) && $_COOKIE['one3dmodel'] == 'true') || (!isset($_COOKIE['one3dmodel']) && isset($globalMap3DOneModel) && $globalMap3DOneModel)) print 'checked'; ?> ><?php echo _("Use same 3D model for all aircraft (use fewer resources)"); ?></label></div></li>
412 412
 <?php
413
-    }
414
-    if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
413
+	}
414
+	if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
415 415
 ?>
416 416
 		    <li><div class="checkbox"><label><input type="checkbox" name="displaysanta" value="1" onclick="clickSanta(this)"><i class="fa fa-snowflake-o" aria-hidden="true"></i> <?php echo _("Show Santa Claus now"); ?> <i class="fa fa-snowflake-o" aria-hidden="true"></i></label></div></li>
417 417
 <?php
418
-    }
418
+	}
419 419
 ?>
420 420
 		    <?php
421 421
 			if (function_exists('array_column')) {
422
-			    if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
423
-		    ?>
422
+				if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
423
+			?>
424 424
 		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
425 425
 		    <?php
426
-			    }
426
+				}
427 427
 			} elseif (isset($globalSources)) {
428
-			    $dispolar = false;
429
-			    foreach ($globalSources as $testsource) {
430
-			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
431
-			    }
432
-			    if ($dispolar) {
433
-		    ?>
428
+				$dispolar = false;
429
+				foreach ($globalSources as $testsource) {
430
+					if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
431
+				}
432
+				if ($dispolar) {
433
+			?>
434 434
 		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
435 435
 		    <?php
436
-			    }
437
-		        }
438
-		    ?>
436
+				}
437
+				}
438
+			?>
439 439
 <?php
440
-    if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
440
+	if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
441 441
 ?>
442 442
 
443 443
 		    <?php
444 444
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
445
-		    	    if (extension_loaded('gd') && function_exists('gd_info')) {
446
-		    ?>
445
+					if (extension_loaded('gd') && function_exists('gd_info')) {
446
+			?>
447 447
 		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') print 'checked'; ?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
448 448
 		    <?php 
449 449
 				if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') {
450
-		    ?>
450
+			?>
451 451
 			<li><?php echo _("Aircraft icon color:"); ?><input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print '1a3151'; ?>"></li>
452 452
 		    <?php
453 453
 				}
454
-			    }
455
-		        }
456
-		    ?>
454
+				}
455
+				}
456
+			?>
457 457
 		    <?php
458 458
 			if (isset($globalMarine) && $globalMarine === TRUE) {
459
-			    if (extension_loaded('gd') && function_exists('gd_info')) {
460
-		    ?>
459
+				if (extension_loaded('gd') && function_exists('gd_info')) {
460
+			?>
461 461
 		    <li><?php echo _("Marine icon color:"); ?>
462 462
 			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print '1a3151'; ?>">
463 463
 		    </li>
464 464
 		    <?php
465
-			    }
466
-		        }
467
-		    ?>
465
+				}
466
+				}
467
+			?>
468 468
 		    <?php
469 469
 			if (isset($globalTracker) && $globalTracker === TRUE) {
470
-			    if (extension_loaded('gd') && function_exists('gd_info')) {
471
-		    ?>
470
+				if (extension_loaded('gd') && function_exists('gd_info')) {
471
+			?>
472 472
 		    <li><?php echo _("Tracker icon color:"); ?>
473 473
 			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) print $_COOKIE['TrackerIconColor']; elseif (isset($globalTrackerIconColor)) print $globalTrackerIconColor; else print '1a3151'; ?>">
474 474
 		    </li>
475 475
 		    <?php
476
-			    }
477
-		        }
478
-		    ?>
476
+				}
477
+				}
478
+			?>
479 479
 		    <?php
480 480
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
481
-		    ?>
481
+			?>
482 482
 		    <li><?php echo _("Show airport icon at zoom level:"); ?>
483 483
 			<div class="range">
484 484
 			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?>">
@@ -487,9 +487,9 @@  discard block
 block discarded – undo
487 487
 		    </li>
488 488
 		    <?php
489 489
 			}
490
-		    ?>
490
+			?>
491 491
 <?php
492
-    } elseif (isset($_COOKIE['MapFormat']) || $_COOKIE['MapFOrmat'] == '3d') {
492
+	} elseif (isset($_COOKIE['MapFormat']) || $_COOKIE['MapFOrmat'] == '3d') {
493 493
 ?>
494 494
 <?php
495 495
 	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
 		    </li>
522 522
 <?php
523 523
 	}
524
-    }
524
+	}
525 525
 ?>
526 526
 		    <li><?php echo _("Distance unit:"); ?>
527 527
 			<select class="selectpicker" onchange="unitdistance(this);">
@@ -554,19 +554,19 @@  discard block
 block discarded – undo
554 554
 		    <ul>
555 555
 		    <?php
556 556
 			if (!isset($globalAircraft) || $globalAircraft) {
557
-		    ?>
557
+			?>
558 558
 		    <?php
559 559
 			if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) {
560
-		    ?>
560
+			?>
561 561
 			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) print 'checked'; ?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
562 562
 			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) print 'checked'; ?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
563 563
 			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) print 'checked'; ?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
564 564
 		    <?php
565 565
 			}
566
-		    ?>
566
+			?>
567 567
 		    <?php
568 568
 			if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) {
569
-		    ?>
569
+			?>
570 570
 			<?php if (isset($globalSBS1) && $globalSBS1) { ?>
571 571
 			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) print 'checked'; ?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
572 572
 			<?php } ?>
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
 			<?php } ?>
576 576
 		    <?php
577 577
 			}
578
-		    ?>
578
+			?>
579 579
 		    <li><?php echo _("Display airlines:"); ?>
580 580
 		    <br/>
581 581
 			<select class="selectpicker" multiple onchange="airlines(this);" id="display_airlines">
@@ -595,14 +595,14 @@  discard block
 block discarded – undo
595 595
 						echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>';
596 596
 					}
597 597
 				}
598
-			    ?>
598
+				?>
599 599
 			</select>
600 600
 		    </li>
601 601
 		    <?php
602 602
 			$Spotter = new Spotter();
603 603
 			$allalliancenames = $Spotter->getAllAllianceNames();
604 604
 			if (!empty($allalliancenames)) {
605
-		    ?>
605
+			?>
606 606
 		    <li><?php echo _("Display alliance:"); ?>
607 607
 		    <br/>
608 608
 			<select class="selectpicker" onchange="alliance(this);" id="display_alliance">
@@ -616,18 +616,18 @@  discard block
 block discarded – undo
616 616
 						echo '<option value="'.$alliance_name.'">'.$alliance_name.'</option>';
617 617
 					}
618 618
 				}
619
-			    ?>
619
+				?>
620 620
 			</select>
621 621
 		    </li>
622 622
 		    <?php
623 623
 			}
624
-		    ?>
624
+			?>
625 625
 		    <?php
626 626
 			}
627
-		    ?>
627
+			?>
628 628
 		    <?php
629 629
 			if (isset($globalAPRS) && $globalAPRS) {
630
-		    ?>
630
+			?>
631 631
 		    <li><?php echo _("Display APRS sources name:"); ?>
632 632
 			<select class="selectpicker" multiple onchange="sources(this);">
633 633
 			    <?php
@@ -651,18 +651,18 @@  discard block
 block discarded – undo
651 651
 						echo '<option value="'.$src['name'].'">'.$src['name'].'</option>';
652 652
 					}
653 653
 				}
654
-			    ?>
654
+				?>
655 655
 			</select>
656 656
 		    </li>
657 657
 		    <?php
658 658
 			}
659
-		    ?>
659
+			?>
660 660
 		    <?php
661 661
 			if (!isset($globalAircraft) || $globalAircraft) {
662
-		    ?>
662
+			?>
663 663
 		    <?php
664
-			    if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS)) {
665
-		    ?>
664
+				if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS)) {
665
+			?>
666 666
 		    <li><?php echo _("Display airlines of type:"); ?><br/>
667 667
 			<select class="selectpicker" onchange="airlinestype(this);">
668 668
 			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
@@ -672,21 +672,21 @@  discard block
 block discarded – undo
672 672
 			</select>
673 673
 		    </li>
674 674
 		    <?php
675
-			    }
676
-		    ?>
675
+				}
676
+			?>
677 677
 		    <?php
678 678
 			}
679
-		    ?>
679
+			?>
680 680
 		    <?php
681 681
 			if (isset($globalMarine) && $globalMarine) {
682
-		    ?>
682
+			?>
683 683
 		    <li>
684 684
 			<?php echo _("Display vessels with MMSI:"); ?>
685 685
 			<input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) print $_COOKIE['filter_mmsi']; ?>" />
686 686
 		    </li>
687 687
 		    <?php
688 688
 			}
689
-		    ?>
689
+			?>
690 690
 		    <li>
691 691
 			<?php echo _("Display with ident:"); ?>
692 692
 			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" />
@@ -699,7 +699,7 @@  discard block
 block discarded – undo
699 699
 	    </form>
700 700
     	</div>
701 701
 <?php
702
-    if (isset($globalSatellite) && $globalSatellite) {
702
+	if (isset($globalSatellite) && $globalSatellite) {
703 703
 ?>
704 704
         <div class="sidebar-pane" id="satellites">
705 705
 	    <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
@@ -739,14 +739,14 @@  discard block
 block discarded – undo
739 739
 						print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>';
740 740
 					}
741 741
 				}
742
-			    ?>
742
+				?>
743 743
 			</select>
744 744
 		    </li>
745 745
 		</ul>
746 746
 	    </form>
747 747
 	</div>
748 748
 <?php
749
-    }
749
+	}
750 750
 ?>
751 751
     </div>
752 752
 </div>
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 require_once('require/class.Language.php');
5 5
 require_once('require/class.Satellite.php');
6 6
 
7
-$trackident = filter_input(INPUT_GET,'trackid',FILTER_SANITIZE_STRING);
7
+$trackident = filter_input(INPUT_GET, 'trackid', FILTER_SANITIZE_STRING);
8 8
 if ($trackident != '') {
9 9
 	require_once('require/class.SpotterLive.php');
10 10
 	$SpotterLive = new SpotterLive();
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 		$spotterid = $Spotter->getSpotterIDBasedOnFlightAwareID($trackident);
15 15
 		header('Location: '.$globalURL.'/flightid/'.$spotterid);
16 16
 	} else {
17
-		setcookie('MapTrack',$resulttrackident[0]['flightaware_id']);
17
+		setcookie('MapTrack', $resulttrackident[0]['flightaware_id']);
18 18
 	}
19 19
 /*
20 20
 } else {
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 		    <div class="form-group">
198 198
 			<label><?php echo _("From:"); ?></label>
199 199
 			<div class='input-group date' id='datetimepicker1'>
200
-			    <input type='text' id="start_date" name="start_date" class="form-control" value="<?php if (isset($_COOKIE['archive_begin'])) print date("Y-m-d H:i",$_COOKIE['archive_begin']); ?> UTC" required />
200
+			    <input type='text' id="start_date" name="start_date" class="form-control" value="<?php if (isset($_COOKIE['archive_begin'])) print date("Y-m-d H:i", $_COOKIE['archive_begin']); ?> UTC" required />
201 201
 			    <span class="input-group-addon">
202 202
 				<span class="glyphicon glyphicon-calendar"></span>
203 203
 			    </span>
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 		    <div class="form-group">
207 207
 			<label><?php echo _("To:"); ?></label>
208 208
 			<div class='input-group date' id='datetimepicker2'>
209
-			    <input type='text' id="end_date" name="end_date" class="form-control" value="<?php if (isset($_COOKIE['archive_end'])) print date("Y-m-d H:i",$_COOKIE['archive_end']); ?> UTC" />
209
+			    <input type='text' id="end_date" name="end_date" class="form-control" value="<?php if (isset($_COOKIE['archive_end'])) print date("Y-m-d H:i", $_COOKIE['archive_end']); ?> UTC" />
210 210
 			    <span class="input-group-addon">
211 211
 				<span class="glyphicon glyphicon-calendar"></span>
212 212
 			    </span>
@@ -354,9 +354,9 @@  discard block
 block discarded – undo
354 354
 		    <li><?php echo _("Type of Terrain:"); ?>
355 355
 			<select  class="selectpicker" onchange="terrainType(this);">
356 356
 			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option>
357
-			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option>
358
-			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option>
359
-			    <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected';?>>ArticDEM</option>
357
+			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected'; ?>>ellipsoid</option>
358
+			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected'; ?>>vr terrain</option>
359
+			    <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected'; ?>>ArticDEM</option>
360 360
 			</select>
361 361
 		    </li>
362 362
 <?php
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
 		    <li><div class="checkbox"><label><input type="checkbox" name="one3dmodel" value="1" onclick="useOne3Dmodel(this)" <?php if ((isset($_COOKIE['one3dmodel']) && $_COOKIE['one3dmodel'] == 'true') || (!isset($_COOKIE['one3dmodel']) && isset($globalMap3DOneModel) && $globalMap3DOneModel)) print 'checked'; ?> ><?php echo _("Use same 3D model for all aircraft (use fewer resources)"); ?></label></div></li>
412 412
 <?php
413 413
     }
414
-    if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
414
+    if (time() > mktime(0, 0, 0, 12, 1, date("Y")) && time() < mktime(0, 0, 0, 12, 31, date("Y"))) {
415 415
 ?>
416 416
 		    <li><div class="checkbox"><label><input type="checkbox" name="displaysanta" value="1" onclick="clickSanta(this)"><i class="fa fa-snowflake-o" aria-hidden="true"></i> <?php echo _("Show Santa Claus now"); ?> <i class="fa fa-snowflake-o" aria-hidden="true"></i></label></div></li>
417 417
 <?php
@@ -586,10 +586,10 @@  discard block
 block discarded – undo
586 586
 					$Spotter = new Spotter();
587 587
 					$allairlinenames = $Spotter->getAllAirlineNames();
588 588
 				}
589
-				foreach($allairlinenames as $airline) {
589
+				foreach ($allairlinenames as $airline) {
590 590
 					$airline_name = $airline['airline_name'];
591
-					if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...';
592
-					if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['filter_Airlines']))) {
591
+					if (strlen($airline_name) > 30) $airline_name = substr($airline_name, 0, 30).'...';
592
+					if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'], explode(',', $_COOKIE['filter_Airlines']))) {
593 593
 						echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>';
594 594
 					} else {
595 595
 						echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>';
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
 			<select class="selectpicker" onchange="alliance(this);" id="display_alliance">
609 609
 			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
610 610
 			    <?php
611
-				foreach($allalliancenames as $alliance) {
611
+				foreach ($allalliancenames as $alliance) {
612 612
 					$alliance_name = $alliance['alliance'];
613 613
 					if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] == $alliance_name) {
614 614
 						echo '<option value="'.$alliance_name.'" selected>'.$alliance_name.'</option>';
@@ -644,8 +644,8 @@  discard block
 block discarded – undo
644 644
 				*/
645 645
 				$Source = new Source();
646 646
 				$datasource = $Source->getLocationInfoByType('gs');
647
-				foreach($datasource as $src) {
648
-					if (isset($_COOKIE['filter_Sources']) && in_array($src['name'],explode(',',$_COOKIE['filter_Sources']))) {
647
+				foreach ($datasource as $src) {
648
+					if (isset($_COOKIE['filter_Sources']) && in_array($src['name'], explode(',', $_COOKIE['filter_Sources']))) {
649 649
 						echo '<option value="'.$src['name'].'" selected>'.$src['name'].'</option>';
650 650
 					} else {
651 651
 						echo '<option value="'.$src['name'].'">'.$src['name'].'</option>';
@@ -733,7 +733,7 @@  discard block
 block discarded – undo
733 733
 					else if ($type_name == 'radar') $type_name = 'Radar Calibration';
734 734
 					else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches';
735 735
 					
736
-					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) {
736
+					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'], explode(',', $_COOKIE['sattypes']))) {
737 737
 						print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>';
738 738
 					} else {
739 739
 						print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>';
Please login to merge, or discard this patch.
Braces   +513 added lines, -130 removed lines patch added patch discarded remove patch
@@ -51,7 +51,10 @@  discard block
 block discarded – undo
51 51
 <?php
52 52
     if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
53 53
 ?>
54
-<script src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) print '?tsk='.$tsk; ?>"></script>
54
+<script src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) {
55
+	print '?tsk='.$tsk;
56
+}
57
+?>"></script>
55 58
 <?php
56 59
 	if (!isset($globalAircraft) || $globalAircraft) {
57 60
 ?>
@@ -141,8 +144,14 @@  discard block
 block discarded – undo
141 144
 ?>
142 145
 		<form>
143 146
 			<ul>
144
-				<li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') print 'checked'; ?> /><?php echo _("Display waypoints"); ?></label></div></li>
145
-				<li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') print 'checked'; ?> /><?php echo _("Display airspace"); ?></label></div></li>
147
+				<li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') {
148
+	print 'checked';
149
+}
150
+?> /><?php echo _("Display waypoints"); ?></label></div></li>
151
+				<li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') {
152
+	print 'checked';
153
+}
154
+?> /><?php echo _("Display airspace"); ?></label></div></li>
146 155
 			</ul>
147 156
 		</form>
148 157
 <?php
@@ -150,8 +159,14 @@  discard block
 block discarded – undo
150 159
 ?>
151 160
 		<form>
152 161
 			<ul>
153
-				<li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') print 'checked'; ?> /><?php echo _("Display waypoints"); ?> Beta</label></div></li>
154
-				<li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') print 'checked'; ?> /><?php echo _("Display airspace"); ?> Beta</label></div></li>
162
+				<li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') {
163
+	print 'checked';
164
+}
165
+?> /><?php echo _("Display waypoints"); ?> Beta</label></div></li>
166
+				<li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') {
167
+	print 'checked';
168
+}
169
+?> /><?php echo _("Display airspace"); ?> Beta</label></div></li>
155 170
 			</ul>
156 171
 			<p>This layers are in Beta, this can and will crash.</p>
157 172
 		</form>
@@ -162,14 +177,32 @@  discard block
 block discarded – undo
162 177
 		<h1>NOTAM</h1>
163 178
 		<form>
164 179
 			<ul>
165
-				<li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam(this);" <?php if (isset($_COOKIE['notam']) && $_COOKIE['notam'] == 'true') print 'checked'; ?> /><?php echo _("Display NOTAM"); ?></label></div></li>
180
+				<li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam(this);" <?php if (isset($_COOKIE['notam']) && $_COOKIE['notam'] == 'true') {
181
+	print 'checked';
182
+}
183
+?> /><?php echo _("Display NOTAM"); ?></label></div></li>
166 184
 				<li><?php echo _("NOTAM scope:"); ?>
167 185
 					<select class="selectpicker" onchange="notamscope(this);">
168
-						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') print ' selected'; ?>>All</option>
169
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') print ' selected'; ?>>Airport/Enroute warning</option>
170
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') print ' selected'; ?>>Airport warning</option>
171
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') print ' selected'; ?>>Navigation warning</option>
172
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') print ' selected'; ?>>Enroute warning</option>
186
+						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') {
187
+	print ' selected';
188
+}
189
+?>>All</option>
190
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') {
191
+	print ' selected';
192
+}
193
+?>>Airport/Enroute warning</option>
194
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') {
195
+	print ' selected';
196
+}
197
+?>>Airport warning</option>
198
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') {
199
+	print ' selected';
200
+}
201
+?>>Navigation warning</option>
202
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') {
203
+	print ' selected';
204
+}
205
+?>>Enroute warning</option>
173 206
 					</select
174 207
 				</li>
175 208
 			</ul>
@@ -197,7 +230,10 @@  discard block
 block discarded – undo
197 230
 		    <div class="form-group">
198 231
 			<label><?php echo _("From:"); ?></label>
199 232
 			<div class='input-group date' id='datetimepicker1'>
200
-			    <input type='text' id="start_date" name="start_date" class="form-control" value="<?php if (isset($_COOKIE['archive_begin'])) print date("Y-m-d H:i",$_COOKIE['archive_begin']); ?> UTC" required />
233
+			    <input type='text' id="start_date" name="start_date" class="form-control" value="<?php if (isset($_COOKIE['archive_begin'])) {
234
+	print date("Y-m-d H:i",$_COOKIE['archive_begin']);
235
+}
236
+?> UTC" required />
201 237
 			    <span class="input-group-addon">
202 238
 				<span class="glyphicon glyphicon-calendar"></span>
203 239
 			    </span>
@@ -206,7 +242,10 @@  discard block
 block discarded – undo
206 242
 		    <div class="form-group">
207 243
 			<label><?php echo _("To:"); ?></label>
208 244
 			<div class='input-group date' id='datetimepicker2'>
209
-			    <input type='text' id="end_date" name="end_date" class="form-control" value="<?php if (isset($_COOKIE['archive_end'])) print date("Y-m-d H:i",$_COOKIE['archive_end']); ?> UTC" />
245
+			    <input type='text' id="end_date" name="end_date" class="form-control" value="<?php if (isset($_COOKIE['archive_end'])) {
246
+	print date("Y-m-d H:i",$_COOKIE['archive_end']);
247
+}
248
+?> UTC" />
210 249
 			    <span class="input-group-addon">
211 250
 				<span class="glyphicon glyphicon-calendar"></span>
212 251
 			    </span>
@@ -238,8 +277,20 @@  discard block
 block discarded – undo
238 277
 		    </script>
239 278
 		<li><?php echo _("Playback speed:"); ?>
240 279
 		    <div class="range">
241
-			<input type="range" min="0" max="50" step="1" id="archivespeed" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php  if (isset($_POST['archivespeed'])) print $_POST['archivespeed']; elseif (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?>">
242
-			<output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?></output>
280
+			<input type="range" min="0" max="50" step="1" id="archivespeed" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php  if (isset($_POST['archivespeed'])) {
281
+	print $_POST['archivespeed'];
282
+} elseif (isset($_COOKIE['archive_speed'])) {
283
+	print $_COOKIE['archive_speed'];
284
+} else {
285
+	print '1';
286
+}
287
+?>">
288
+			<output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) {
289
+	print $_COOKIE['archive_speed'];
290
+} else {
291
+	print '1';
292
+}
293
+?></output>
243 294
 		    </div>
244 295
 		</li>
245 296
 		<li><button type="button" onclick="addarchive(begindate,enddate);" class="btn btn-primary"><?php echo _("Show archive"); ?></button></li>
@@ -258,29 +309,53 @@  discard block
 block discarded – undo
258 309
 		    <li><?php echo _("Type of Map:"); ?>
259 310
 			<select  class="selectpicker" onchange="mapType(this);">
260 311
 			    <?php
261
-				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider;
262
-				else $MapType = $_COOKIE['MapType'];
312
+				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') {
313
+					$MapType = $globalMapProvider;
314
+				} else {
315
+					$MapType = $_COOKIE['MapType'];
316
+				}
263 317
 			    ?>
264 318
 			    <?php
265 319
 				if (isset($globalMapOffline) && $globalMapOffline === TRUE) {
266 320
 			    ?>
267
-			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option>
321
+			    <option value="offline"<?php if ($MapType == 'offline') {
322
+	print ' selected';
323
+}
324
+?>>Natural Earth (local)</option>
268 325
 			    <?php
269 326
 				} else {
270 327
 				    if (file_exists(dirname(__FILE__).'/js/Cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml')) {
271 328
 			    ?>
272
-			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option>
329
+			    <option value="offline"<?php if ($MapType == 'offline') {
330
+	print ' selected';
331
+}
332
+?>>Natural Earth (local)</option>
273 333
 			    <?php
274 334
 				    }
275 335
 			    ?>
276
-			    <option value="ArcGIS-Streetmap"<?php if ($MapType == 'ArcGIS-Streetmap') print ' selected'; ?>>ArcGIS Streetmap</option>
277
-			    <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Satellite') print ' selected'; ?>>ArcGIS Satellite</option>
336
+			    <option value="ArcGIS-Streetmap"<?php if ($MapType == 'ArcGIS-Streetmap') {
337
+	print ' selected';
338
+}
339
+?>>ArcGIS Streetmap</option>
340
+			    <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Satellite') {
341
+	print ' selected';
342
+}
343
+?>>ArcGIS Satellite</option>
278 344
 			    <?php
279 345
 				    if (isset($globalBingMapKey) && $globalBingMapKey != '') {
280 346
 			    ?>
281
-			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option>
282
-			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option>
283
-			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option>
347
+			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') {
348
+	print ' selected';
349
+}
350
+?>>Bing-Aerial</option>
351
+			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') {
352
+	print ' selected';
353
+}
354
+?>>Bing-Hybrid</option>
355
+			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') {
356
+	print ' selected';
357
+}
358
+?>>Bing-Road</option>
284 359
 			    <?php
285 360
 				    }
286 361
 			    ?>
@@ -290,59 +365,143 @@  discard block
 block discarded – undo
290 365
 			    <?php
291 366
 					if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
292 367
 			    ?>
293
-			    <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option>
294
-			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option>
295
-			    <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option>
368
+			    <option value="Here-Aerial"<?php if ($MapType == 'Here') {
369
+	print ' selected';
370
+}
371
+?>>Here-Aerial</option>
372
+			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') {
373
+	print ' selected';
374
+}
375
+?>>Here-Hybrid</option>
376
+			    <option value="Here-Road"<?php if ($MapType == 'Here') {
377
+	print ' selected';
378
+}
379
+?>>Here-Road</option>
296 380
 			    <?php
297 381
 					}
298 382
 			    ?>
299 383
 			    <?php
300 384
 					if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
301 385
 			    ?>
302
-			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option>
303
-			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option>
304
-			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option>
305
-			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option>
386
+			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') {
387
+	print ' selected';
388
+}
389
+?>>Google Roadmap</option>
390
+			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') {
391
+	print ' selected';
392
+}
393
+?>>Google Satellite</option>
394
+			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') {
395
+	print ' selected';
396
+}
397
+?>>Google Hybrid</option>
398
+			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') {
399
+	print ' selected';
400
+}
401
+?>>Google Terrain</option>
306 402
 			    <?php
307 403
 					}
308 404
 			    ?>
309 405
 			    <?php
310 406
 					if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
311 407
 			    ?>
312
-			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option>
313
-			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option>
314
-			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option>
408
+			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') {
409
+	print ' selected';
410
+}
411
+?>>MapQuest-OSM</option>
412
+			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') {
413
+	print ' selected';
414
+}
415
+?>>MapQuest-Aerial</option>
416
+			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') {
417
+	print ' selected';
418
+}
419
+?>>MapQuest-Hybrid</option>
315 420
 			    <?php
316 421
 					}
317 422
 			    ?>
318
-			    <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option>
319
-			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth</option>
423
+			    <option value="Yandex"<?php if ($MapType == 'Yandex') {
424
+	print ' selected';
425
+}
426
+?>>Yandex</option>
427
+			    <option value="offline"<?php if ($MapType == 'offline') {
428
+	print ' selected';
429
+}
430
+?>>Natural Earth</option>
320 431
 			    <?php
321 432
 				    }
322 433
 			    ?>
323
-			    <option value="NatGeo-Street"<?php if ($MapType == 'NatGeo-Street') print ' selected'; ?>>National Geographic Street</option>
434
+			    <option value="NatGeo-Street"<?php if ($MapType == 'NatGeo-Street') {
435
+	print ' selected';
436
+}
437
+?>>National Geographic Street</option>
324 438
 			    <?php
325 439
 				    if (isset($globalMapboxToken) && $globalMapboxToken != '') {
326
-					if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default';
327
-					else $MapBoxId = $_COOKIE['MapTypeId'];
440
+					if (!isset($_COOKIE['MapTypeId'])) {
441
+						$MapBoxId = 'default';
442
+					} else {
443
+						$MapBoxId = $_COOKIE['MapTypeId'];
444
+					}
328 445
 			    ?>
329
-			    <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') print ' selected'; ?>>Mapbox GL</option>
330
-			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option>
331
-			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option>
332
-			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option>
333
-			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') print ' selected'; ?>>Mapbox dark</option>
334
-			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') print ' selected'; ?>>Mapbox satellite</option>
335
-			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') print ' selected'; ?>>Mapbox streets-satellite</option>
336
-			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') print ' selected'; ?>>Mapbox streets-basic</option>
337
-			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') print ' selected'; ?>>Mapbox comic</option>
338
-			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') print ' selected'; ?>>Mapbox outdoors</option>
339
-			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') print ' selected'; ?>>Mapbox pencil</option>
340
-			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option>
341
-			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option>
446
+			    <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') {
447
+	print ' selected';
448
+}
449
+?>>Mapbox GL</option>
450
+			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') {
451
+	print ' selected';
452
+}
453
+?>>Mapbox default</option>
454
+			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') {
455
+	print ' selected';
456
+}
457
+?>>Mapbox streets</option>
458
+			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') {
459
+	print ' selected';
460
+}
461
+?>>Mapbox light</option>
462
+			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') {
463
+	print ' selected';
464
+}
465
+?>>Mapbox dark</option>
466
+			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') {
467
+	print ' selected';
468
+}
469
+?>>Mapbox satellite</option>
470
+			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') {
471
+	print ' selected';
472
+}
473
+?>>Mapbox streets-satellite</option>
474
+			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') {
475
+	print ' selected';
476
+}
477
+?>>Mapbox streets-basic</option>
478
+			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') {
479
+	print ' selected';
480
+}
481
+?>>Mapbox comic</option>
482
+			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') {
483
+	print ' selected';
484
+}
485
+?>>Mapbox outdoors</option>
486
+			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') {
487
+	print ' selected';
488
+}
489
+?>>Mapbox pencil</option>
490
+			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') {
491
+	print ' selected';
492
+}
493
+?>>Mapbox pirates</option>
494
+			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') {
495
+	print ' selected';
496
+}
497
+?>>Mapbox emerald</option>
342 498
 			    <?php
343 499
 				    }
344 500
 			    ?>
345
-			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option>
501
+			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') {
502
+	print ' selected';
503
+}
504
+?>>OpenStreetMap</option>
346 505
 			    <?php
347 506
 				}
348 507
 			    ?>
@@ -353,10 +512,22 @@  discard block
 block discarded – undo
353 512
 ?>
354 513
 		    <li><?php echo _("Type of Terrain:"); ?>
355 514
 			<select  class="selectpicker" onchange="terrainType(this);">
356
-			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option>
357
-			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option>
358
-			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option>
359
-			    <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected';?>>ArticDEM</option>
515
+			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') {
516
+	print ' selected';
517
+}
518
+?>>stk terrain</option>
519
+			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') {
520
+	print ' selected';
521
+}
522
+?>>ellipsoid</option>
523
+			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') {
524
+	print ' selected';
525
+}
526
+?>>vr terrain</option>
527
+			    <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') {
528
+	print ' selected';
529
+}
530
+?>>ArticDEM</option>
360 531
 			</select>
361 532
 		    </li>
362 533
 <?php
@@ -365,50 +536,98 @@  discard block
 block discarded – undo
365 536
 <?php
366 537
     if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
367 538
 ?>
368
-		    <li><div class="checkbox"><label><input type="checkbox" name="display2dbuildings" value="1" onclick="clickDisplay2DBuildings(this)" <?php if (isset($_COOKIE['Map2DBuildings']) && $_COOKIE['Map2DBuildings'] == 'true') print 'checked'; ?> ><?php echo _("Display 2.5D buidings on map"); ?></label></div></li>
539
+		    <li><div class="checkbox"><label><input type="checkbox" name="display2dbuildings" value="1" onclick="clickDisplay2DBuildings(this)" <?php if (isset($_COOKIE['Map2DBuildings']) && $_COOKIE['Map2DBuildings'] == 'true') {
540
+	print 'checked';
541
+}
542
+?> ><?php echo _("Display 2.5D buidings on map"); ?></label></div></li>
369 543
 
370 544
 <?php
371 545
 	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
372 546
 ?>
373
-		    <!--<li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') print 'checked'; ?> ><?php echo _("Display flight info as popup"); ?></label></div></li>-->
374
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true')) print 'checked'; ?> ><?php echo _("Display flight path"); ?></label></div></li>
375
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)) print 'checked'; ?> ><?php echo _("Display flight route on click"); ?></label></div></li>
376
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightremainingroute" value="1" onclick="clickFlightRemainingRoute(this)" <?php if ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == 'true') || (!isset($_COOKIE['MapRemainingRoute']) && isset($globalMapRemainingRoute) && $globalMapRemainingRoute)) print 'checked'; ?> ><?php echo _("Display flight remaining route on click"); ?></label></div></li>
377
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Planes animate between updates"); ?></label></div></li>
547
+		    <!--<li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') {
548
+	print 'checked';
549
+}
550
+?> ><?php echo _("Display flight info as popup"); ?></label></div></li>-->
551
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true')) {
552
+	print 'checked';
553
+}
554
+?> ><?php echo _("Display flight path"); ?></label></div></li>
555
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)) {
556
+	print 'checked';
557
+}
558
+?> ><?php echo _("Display flight route on click"); ?></label></div></li>
559
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightremainingroute" value="1" onclick="clickFlightRemainingRoute(this)" <?php if ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == 'true') || (!isset($_COOKIE['MapRemainingRoute']) && isset($globalMapRemainingRoute) && $globalMapRemainingRoute)) {
560
+	print 'checked';
561
+}
562
+?> ><?php echo _("Display flight remaining route on click"); ?></label></div></li>
563
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) {
564
+	print 'checked';
565
+}
566
+?> ><?php echo _("Planes animate between updates"); ?></label></div></li>
378 567
 <?php
379 568
 	} elseif (!isset($globalTracker) || $globalTracker === TRUE) {
380 569
 ?>
381
-		    <li><div class="checkbox"><label><input type="checkbox" name="mapmatching" value="1" onclick="clickMapMatching(this)" <?php if ((isset($_COOKIE['mapmatching']) && $_COOKIE['mapmatching'] == 'true') || (!isset($_COOKIE['mapmatching']) && isset($globalMapMatching) && $globalMapMatching)) print 'checked'; ?> ><?php echo _("Enable map matching"); ?></label></div></li>
570
+		    <li><div class="checkbox"><label><input type="checkbox" name="mapmatching" value="1" onclick="clickMapMatching(this)" <?php if ((isset($_COOKIE['mapmatching']) && $_COOKIE['mapmatching'] == 'true') || (!isset($_COOKIE['mapmatching']) && isset($globalMapMatching) && $globalMapMatching)) {
571
+	print 'checked';
572
+}
573
+?> ><?php echo _("Enable map matching"); ?></label></div></li>
382 574
 <?php
383 575
 	}
384 576
 	if (isset($globalSatellite) && $globalSatellite === TRUE) {
385 577
 ?>
386
-		    <li><div class="checkbox"><label><input type="checkbox" name="satelliteestimation" value="1" onclick="clickSatelliteEstimation(this)" <?php if ((isset($_COOKIE['satelliteestimation']) && $_COOKIE['satelliteestimation'] == 'true') || (!isset($_COOKIE['satelliteestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['satelliteestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Satellites animate between updates"); ?></label></div></li>
578
+		    <li><div class="checkbox"><label><input type="checkbox" name="satelliteestimation" value="1" onclick="clickSatelliteEstimation(this)" <?php if ((isset($_COOKIE['satelliteestimation']) && $_COOKIE['satelliteestimation'] == 'true') || (!isset($_COOKIE['satelliteestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['satelliteestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) {
579
+	print 'checked';
580
+}
581
+?> ><?php echo _("Satellites animate between updates"); ?></label></div></li>
387 582
 <?php
388 583
 	}
389 584
     }
390 585
 ?>
391
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true' || !isset($_COOKIE['displayairports'])) print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li>
392
-		    <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) print 'checked'; ?> ><?php echo _("Display ground station on map"); ?></label></div></li>
393
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayweatherstation" value="1" onclick="clickDisplayWeatherStation(this)" <?php if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) print 'checked'; ?> ><?php echo _("Display weather station on map"); ?></label></div></li>
394
-		    <li><div class="checkbox"><label><input type="checkbox" name="displaylightning" value="1" onclick="clickDisplayLightning(this)" <?php if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') || (!isset($_COOKIE['show_Lightning']) && (isset($globalMapLightning) && $globalMapLightning === TRUE))) print 'checked'; ?> ><?php echo _("Display lightning on map"); ?></label></div></li>
586
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true' || !isset($_COOKIE['displayairports'])) {
587
+	print 'checked';
588
+}
589
+?> ><?php echo _("Display airports on map"); ?></label></div></li>
590
+		    <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) {
591
+	print 'checked';
592
+}
593
+?> ><?php echo _("Display ground station on map"); ?></label></div></li>
594
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayweatherstation" value="1" onclick="clickDisplayWeatherStation(this)" <?php if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) {
595
+	print 'checked';
596
+}
597
+?> ><?php echo _("Display weather station on map"); ?></label></div></li>
598
+		    <li><div class="checkbox"><label><input type="checkbox" name="displaylightning" value="1" onclick="clickDisplayLightning(this)" <?php if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') || (!isset($_COOKIE['show_Lightning']) && (isset($globalMapLightning) && $globalMapLightning === TRUE))) {
599
+	print 'checked';
600
+}
601
+?> ><?php echo _("Display lightning on map"); ?></label></div></li>
395 602
 <?php
396 603
 	if (isset($globalFires)) {
397 604
 ?>
398
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayfires" value="1" onclick="clickDisplayFires(this)" <?php if ((isset($_COOKIE['show_Fires']) && $_COOKIE['show_Fires'] == 'true') || (!isset($_COOKIE['show_Fires']) && (isset($globalMapFires) && $globalMapFires === TRUE))) print 'checked'; ?> ><?php echo _("Display fires on map"); ?></label></div></li>
605
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayfires" value="1" onclick="clickDisplayFires(this)" <?php if ((isset($_COOKIE['show_Fires']) && $_COOKIE['show_Fires'] == 'true') || (!isset($_COOKIE['show_Fires']) && (isset($globalMapFires) && $globalMapFires === TRUE))) {
606
+	print 'checked';
607
+}
608
+?> ><?php echo _("Display fires on map"); ?></label></div></li>
399 609
 <?php
400 610
 	}
401 611
 	if (isset($globalMap3D) && $globalMap3D) {
402 612
 ?>
403
-		    <li><div class="checkbox"><label><input type="checkbox" name="singlemodel" value="1" onclick="clickSingleModel(this)" <?php if (isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') print 'checked'; ?> ><?php echo _("Only display selected flight on 3D mode"); ?></label></div></li>
613
+		    <li><div class="checkbox"><label><input type="checkbox" name="singlemodel" value="1" onclick="clickSingleModel(this)" <?php if (isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') {
614
+	print 'checked';
615
+}
616
+?> ><?php echo _("Only display selected flight on 3D mode"); ?></label></div></li>
404 617
 <?php
405 618
 	}
406 619
 ?>
407 620
 <?php
408 621
     if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
409 622
 ?>
410
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) print 'checked'; ?> ><?php echo _("Show mini-map"); ?></label></div></li>
411
-		    <li><div class="checkbox"><label><input type="checkbox" name="one3dmodel" value="1" onclick="useOne3Dmodel(this)" <?php if ((isset($_COOKIE['one3dmodel']) && $_COOKIE['one3dmodel'] == 'true') || (!isset($_COOKIE['one3dmodel']) && isset($globalMap3DOneModel) && $globalMap3DOneModel)) print 'checked'; ?> ><?php echo _("Use same 3D model for all aircraft (use fewer resources)"); ?></label></div></li>
623
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) {
624
+	print 'checked';
625
+}
626
+?> ><?php echo _("Show mini-map"); ?></label></div></li>
627
+		    <li><div class="checkbox"><label><input type="checkbox" name="one3dmodel" value="1" onclick="useOne3Dmodel(this)" <?php if ((isset($_COOKIE['one3dmodel']) && $_COOKIE['one3dmodel'] == 'true') || (!isset($_COOKIE['one3dmodel']) && isset($globalMap3DOneModel) && $globalMap3DOneModel)) {
628
+	print 'checked';
629
+}
630
+?> ><?php echo _("Use same 3D model for all aircraft (use fewer resources)"); ?></label></div></li>
412 631
 <?php
413 632
     }
414 633
     if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
@@ -421,17 +640,25 @@  discard block
 block discarded – undo
421 640
 			if (function_exists('array_column')) {
422 641
 			    if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
423 642
 		    ?>
424
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
643
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
644
+	print 'checked';
645
+}
646
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
425 647
 		    <?php
426 648
 			    }
427 649
 			} elseif (isset($globalSources)) {
428 650
 			    $dispolar = false;
429 651
 			    foreach ($globalSources as $testsource) {
430
-			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
652
+			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) {
653
+			        	$dispolar = true;
654
+			        }
431 655
 			    }
432 656
 			    if ($dispolar) {
433 657
 		    ?>
434
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
658
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
659
+	print 'checked';
660
+}
661
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
435 662
 		    <?php
436 663
 			    }
437 664
 		        }
@@ -444,11 +671,21 @@  discard block
 block discarded – undo
444 671
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
445 672
 		    	    if (extension_loaded('gd') && function_exists('gd_info')) {
446 673
 		    ?>
447
-		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') print 'checked'; ?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
674
+		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') {
675
+	print 'checked';
676
+}
677
+?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
448 678
 		    <?php 
449 679
 				if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') {
450 680
 		    ?>
451
-			<li><?php echo _("Aircraft icon color:"); ?><input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print '1a3151'; ?>"></li>
681
+			<li><?php echo _("Aircraft icon color:"); ?><input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) {
682
+	print $_COOKIE['IconColor'];
683
+} elseif (isset($globalAircraftIconColor)) {
684
+	print $globalAircraftIconColor;
685
+} else {
686
+	print '1a3151';
687
+}
688
+?>"></li>
452 689
 		    <?php
453 690
 				}
454 691
 			    }
@@ -459,7 +696,14 @@  discard block
 block discarded – undo
459 696
 			    if (extension_loaded('gd') && function_exists('gd_info')) {
460 697
 		    ?>
461 698
 		    <li><?php echo _("Marine icon color:"); ?>
462
-			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print '1a3151'; ?>">
699
+			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) {
700
+	print $_COOKIE['MarineIconColor'];
701
+} elseif (isset($globalMarineIconColor)) {
702
+	print $globalMarineIconColor;
703
+} else {
704
+	print '1a3151';
705
+}
706
+?>">
463 707
 		    </li>
464 708
 		    <?php
465 709
 			    }
@@ -470,7 +714,14 @@  discard block
 block discarded – undo
470 714
 			    if (extension_loaded('gd') && function_exists('gd_info')) {
471 715
 		    ?>
472 716
 		    <li><?php echo _("Tracker icon color:"); ?>
473
-			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) print $_COOKIE['TrackerIconColor']; elseif (isset($globalTrackerIconColor)) print $globalTrackerIconColor; else print '1a3151'; ?>">
717
+			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) {
718
+	print $_COOKIE['TrackerIconColor'];
719
+} elseif (isset($globalTrackerIconColor)) {
720
+	print $globalTrackerIconColor;
721
+} else {
722
+	print '1a3151';
723
+}
724
+?>">
474 725
 		    </li>
475 726
 		    <?php
476 727
 			    }
@@ -481,8 +732,22 @@  discard block
 block discarded – undo
481 732
 		    ?>
482 733
 		    <li><?php echo _("Show airport icon at zoom level:"); ?>
483 734
 			<div class="range">
484
-			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?>">
485
-			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?></output>
735
+			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) {
736
+	print $_COOKIE['AirportZoom'];
737
+} elseif (isset($globalAirportZoom)) {
738
+	print $globalAirportZoom;
739
+} else {
740
+	print '7';
741
+}
742
+?>">
743
+			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) {
744
+	print $_COOKIE['AirportZoom'];
745
+} elseif (isset($globalAirportZoom)) {
746
+	print $globalAirportZoom;
747
+} else {
748
+	print '7';
749
+}
750
+?></output>
486 751
 			</div>
487 752
 		    </li>
488 753
 		    <?php
@@ -494,10 +759,23 @@  discard block
 block discarded – undo
494 759
 <?php
495 760
 	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
496 761
 ?>
497
-		    <li><input type="checkbox" name="useliveries" value="1" onclick="useLiveries(this)" <?php if (isset($_COOKIE['UseLiveries']) && $_COOKIE['UseLiveries'] == 'true') print 'checked'; ?> ><?php echo _("Use airlines liveries"); ?></li>
498
-		    <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Aircraft color"); ?>&nbsp;
762
+		    <li><input type="checkbox" name="useliveries" value="1" onclick="useLiveries(this)" <?php if (isset($_COOKIE['UseLiveries']) && $_COOKIE['UseLiveries'] == 'true') {
763
+	print 'checked';
764
+}
765
+?> ><?php echo _("Use airlines liveries"); ?></li>
766
+		    <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') {
767
+	print 'checked';
768
+}
769
+?> ><?php echo _("Force Aircraft color"); ?>&nbsp;
499 770
 		    <!--<li><?php echo _("Aircraft icon color:"); ?>-->
500
-			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print 'ff0000'; ?>">
771
+			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) {
772
+	print $_COOKIE['IconColor'];
773
+} elseif (isset($globalAircraftIconColor)) {
774
+	print $globalAircraftIconColor;
775
+} else {
776
+	print 'ff0000';
777
+}
778
+?>">
501 779
 		    </li>
502 780
 <?php
503 781
 	}
@@ -505,9 +783,19 @@  discard block
 block discarded – undo
505 783
 <?php
506 784
 	if (isset($globalMarine) && $globalMarine === TRUE) {
507 785
 ?>
508
-		    <li><input type="checkbox" name="marinecolorforce" value="1" onclick="MarineiconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Marine color"); ?>&nbsp;
786
+		    <li><input type="checkbox" name="marinecolorforce" value="1" onclick="MarineiconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') {
787
+	print 'checked';
788
+}
789
+?> ><?php echo _("Force Marine color"); ?>&nbsp;
509 790
 		    <!--<li><?php echo _("Marine icon color:"); ?>-->
510
-			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print 'ff0000'; ?>">
791
+			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) {
792
+	print $_COOKIE['MarineIconColor'];
793
+} elseif (isset($globalMarineIconColor)) {
794
+	print $globalMarineIconColor;
795
+} else {
796
+	print 'ff0000';
797
+}
798
+?>">
511 799
 		    </li>
512 800
 <?php
513 801
 	}
@@ -515,9 +803,19 @@  discard block
 block discarded – undo
515 803
 <?php
516 804
 	if (isset($globalTracker) && $globalTracker === TRUE) {
517 805
 ?>
518
-		    <li><input type="checkbox" name="trackercolorforce" value="1" onclick="TrackericonColorForce(this)" <?php if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Tracker color"); ?>&nbsp;
806
+		    <li><input type="checkbox" name="trackercolorforce" value="1" onclick="TrackericonColorForce(this)" <?php if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true') {
807
+	print 'checked';
808
+}
809
+?> ><?php echo _("Force Tracker color"); ?>&nbsp;
519 810
 		    <!--<li><?php echo _("Tracker icon color:"); ?>-->
520
-			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) print $_COOKIE['TrackerIconColor']; elseif (isset($globalTrackerIconColor)) print $globalTrackerIconColor; else print 'ff0000'; ?>">
811
+			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) {
812
+	print $_COOKIE['TrackerIconColor'];
813
+} elseif (isset($globalTrackerIconColor)) {
814
+	print $globalTrackerIconColor;
815
+} else {
816
+	print 'ff0000';
817
+}
818
+?>">
521 819
 		    </li>
522 820
 <?php
523 821
 	}
@@ -525,22 +823,46 @@  discard block
 block discarded – undo
525 823
 ?>
526 824
 		    <li><?php echo _("Distance unit:"); ?>
527 825
 			<select class="selectpicker" onchange="unitdistance(this);">
528
-			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) echo ' selected'; ?>>km</option>
529
-			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) echo ' selected'; ?>>nm</option>
530
-			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) echo ' selected'; ?>>mi</option>
826
+			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) {
827
+	echo ' selected';
828
+}
829
+?>>km</option>
830
+			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
831
+	echo ' selected';
832
+}
833
+?>>nm</option>
834
+			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
835
+	echo ' selected';
836
+}
837
+?>>mi</option>
531 838
 		        </select>
532 839
 		    </li>
533 840
 		    <li><?php echo _("Altitude unit:"); ?>
534 841
 			<select class="selectpicker" onchange="unitaltitude(this);">
535
-			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) echo ' selected'; ?>>m</option>
536
-			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) echo ' selected'; ?>>feet</option>
842
+			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) {
843
+	echo ' selected';
844
+}
845
+?>>m</option>
846
+			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) {
847
+	echo ' selected';
848
+}
849
+?>>feet</option>
537 850
 		        </select>
538 851
 		    </li>
539 852
 		    <li><?php echo _("Speed unit:"); ?>
540 853
 			<select class="selectpicker" onchange="unitspeed(this);">
541
-			    <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) echo ' selected'; ?>>km/h</option>
542
-			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) echo ' selected'; ?>>mph</option>
543
-			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) echo ' selected'; ?>>knots</option>
854
+			    <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) {
855
+	echo ' selected';
856
+}
857
+?>>km/h</option>
858
+			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) {
859
+	echo ' selected';
860
+}
861
+?>>mph</option>
862
+			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) {
863
+	echo ' selected';
864
+}
865
+?>>knots</option>
544 866
 		        </select>
545 867
 		    </li>
546 868
 
@@ -558,9 +880,18 @@  discard block
 block discarded – undo
558 880
 		    <?php
559 881
 			if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) {
560 882
 		    ?>
561
-			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) print 'checked'; ?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
562
-			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) print 'checked'; ?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
563
-			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) print 'checked'; ?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
883
+			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) {
884
+	print 'checked';
885
+}
886
+?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
887
+			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) {
888
+	print 'checked';
889
+}
890
+?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
891
+			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) {
892
+	print 'checked';
893
+}
894
+?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
564 895
 		    <?php
565 896
 			}
566 897
 		    ?>
@@ -568,10 +899,16 @@  discard block
 block discarded – undo
568 899
 			if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) {
569 900
 		    ?>
570 901
 			<?php if (isset($globalSBS1) && $globalSBS1) { ?>
571
-			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) print 'checked'; ?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
902
+			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) {
903
+	print 'checked';
904
+}
905
+?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
572 906
 			<?php } ?>
573 907
 			<?php if (isset($globalAPRS) && $globalAPRS) { ?>
574
-			    <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') || !isset($_COOKIE['ShowAPRS'])) print 'checked'; ?> ><?php echo _("Display APRS data"); ?></label></div></li>
908
+			    <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') || !isset($_COOKIE['ShowAPRS'])) {
909
+	print 'checked';
910
+}
911
+?> ><?php echo _("Display APRS data"); ?></label></div></li>
575 912
 			<?php } ?>
576 913
 		    <?php
577 914
 			}
@@ -588,7 +925,9 @@  discard block
 block discarded – undo
588 925
 				}
589 926
 				foreach($allairlinenames as $airline) {
590 927
 					$airline_name = $airline['airline_name'];
591
-					if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...';
928
+					if (strlen($airline_name) > 30) {
929
+						$airline_name = substr($airline_name,0,30).'...';
930
+					}
592 931
 					if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['filter_Airlines']))) {
593 932
 						echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>';
594 933
 					} else {
@@ -606,7 +945,10 @@  discard block
 block discarded – undo
606 945
 		    <li><?php echo _("Display alliance:"); ?>
607 946
 		    <br/>
608 947
 			<select class="selectpicker" onchange="alliance(this);" id="display_alliance">
609
-			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
948
+			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') {
949
+	echo ' selected';
950
+}
951
+?>><?php echo _("All"); ?></option>
610 952
 			    <?php
611 953
 				foreach($allalliancenames as $alliance) {
612 954
 					$alliance_name = $alliance['alliance'];
@@ -665,10 +1007,22 @@  discard block
 block discarded – undo
665 1007
 		    ?>
666 1008
 		    <li><?php echo _("Display airlines of type:"); ?><br/>
667 1009
 			<select class="selectpicker" onchange="airlinestype(this);">
668
-			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
669
-			    <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') echo ' selected'; ?>><?php echo _("Passenger"); ?></option>
670
-			    <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') echo ' selected'; ?>><?php echo _("Cargo"); ?></option>
671
-			    <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') echo ' selected'; ?>><?php echo _("Military"); ?></option>
1010
+			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') {
1011
+	echo ' selected';
1012
+}
1013
+?>><?php echo _("All"); ?></option>
1014
+			    <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') {
1015
+	echo ' selected';
1016
+}
1017
+?>><?php echo _("Passenger"); ?></option>
1018
+			    <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') {
1019
+	echo ' selected';
1020
+}
1021
+?>><?php echo _("Cargo"); ?></option>
1022
+			    <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') {
1023
+	echo ' selected';
1024
+}
1025
+?>><?php echo _("Military"); ?></option>
672 1026
 			</select>
673 1027
 		    </li>
674 1028
 		    <?php
@@ -682,14 +1036,20 @@  discard block
 block discarded – undo
682 1036
 		    ?>
683 1037
 		    <li>
684 1038
 			<?php echo _("Display vessels with MMSI:"); ?>
685
-			<input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) print $_COOKIE['filter_mmsi']; ?>" />
1039
+			<input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) {
1040
+	print $_COOKIE['filter_mmsi'];
1041
+}
1042
+?>" />
686 1043
 		    </li>
687 1044
 		    <?php
688 1045
 			}
689 1046
 		    ?>
690 1047
 		    <li>
691 1048
 			<?php echo _("Display with ident:"); ?>
692
-			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" />
1049
+			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) {
1050
+	print $_COOKIE['filter_ident'];
1051
+}
1052
+?>" />
693 1053
 		    </li>
694 1054
 		</ul>
695 1055
 	    </form>
@@ -705,7 +1065,10 @@  discard block
 block discarded – undo
705 1065
 	    <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
706 1066
 	    <form>
707 1067
 		<ul>
708
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if ((isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') || !isset($_COOKIE['displayiss'])) print 'checked'; ?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li>
1068
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if ((isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') || !isset($_COOKIE['displayiss'])) {
1069
+	print 'checked';
1070
+}
1071
+?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li>
709 1072
 		    <li><?php echo _("Type:"); ?>
710 1073
 			<select class="selectpicker" multiple onchange="sattypes(this);">
711 1074
 			    <?php
@@ -713,25 +1076,45 @@  discard block
 block discarded – undo
713 1076
 				$types = $Satellite->get_tle_types();
714 1077
 				foreach ($types as $type) {
715 1078
 					$type_name = $type['tle_type'];
716
-					if ($type_name == 'musson') $type_name = 'Russian LEO Navigation';
717
-					else if ($type_name == 'nnss') $type_name = 'Navi Navigation Satellite System';
718
-					else if ($type_name == 'sbas') $type_name = 'Satellite-Based Augmentation System';
719
-					else if ($type_name == 'glo-ops') $type_name = 'Glonass Operational';
720
-					else if ($type_name == 'gps-ops') $type_name = 'GPS Operational';
721
-					else if ($type_name == 'argos') $type_name = 'ARGOS Data Collection System';
722
-					else if ($type_name == 'tdrss') $type_name = 'Tracking and Data Relay Satellite System';
723
-					else if ($type_name == 'sarsat') $type_name = 'Search & Rescue';
724
-					else if ($type_name == 'dmc') $type_name = 'Disaster Monitoring';
725
-					else if ($type_name == 'resource') $type_name = 'Earth Resources';
726
-					else if ($type_name == 'stations') $type_name = 'Space Stations';
727
-					else if ($type_name == 'geo') $type_name = 'Geostationary';
728
-					else if ($type_name == 'amateur') $type_name = 'Amateur Radio';
729
-					else if ($type_name == 'x-comm') $type_name = 'Experimental';
730
-					else if ($type_name == 'other-comm') $type_name = 'Other Comm';
731
-					else if ($type_name == 'science') $type_name = 'Space & Earth Science';
732
-					else if ($type_name == 'military') $type_name = 'Miscellaneous Military';
733
-					else if ($type_name == 'radar') $type_name = 'Radar Calibration';
734
-					else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches';
1079
+					if ($type_name == 'musson') {
1080
+						$type_name = 'Russian LEO Navigation';
1081
+					} else if ($type_name == 'nnss') {
1082
+						$type_name = 'Navi Navigation Satellite System';
1083
+					} else if ($type_name == 'sbas') {
1084
+						$type_name = 'Satellite-Based Augmentation System';
1085
+					} else if ($type_name == 'glo-ops') {
1086
+						$type_name = 'Glonass Operational';
1087
+					} else if ($type_name == 'gps-ops') {
1088
+						$type_name = 'GPS Operational';
1089
+					} else if ($type_name == 'argos') {
1090
+						$type_name = 'ARGOS Data Collection System';
1091
+					} else if ($type_name == 'tdrss') {
1092
+						$type_name = 'Tracking and Data Relay Satellite System';
1093
+					} else if ($type_name == 'sarsat') {
1094
+						$type_name = 'Search & Rescue';
1095
+					} else if ($type_name == 'dmc') {
1096
+						$type_name = 'Disaster Monitoring';
1097
+					} else if ($type_name == 'resource') {
1098
+						$type_name = 'Earth Resources';
1099
+					} else if ($type_name == 'stations') {
1100
+						$type_name = 'Space Stations';
1101
+					} else if ($type_name == 'geo') {
1102
+						$type_name = 'Geostationary';
1103
+					} else if ($type_name == 'amateur') {
1104
+						$type_name = 'Amateur Radio';
1105
+					} else if ($type_name == 'x-comm') {
1106
+						$type_name = 'Experimental';
1107
+					} else if ($type_name == 'other-comm') {
1108
+						$type_name = 'Other Comm';
1109
+					} else if ($type_name == 'science') {
1110
+						$type_name = 'Space & Earth Science';
1111
+					} else if ($type_name == 'military') {
1112
+						$type_name = 'Miscellaneous Military';
1113
+					} else if ($type_name == 'radar') {
1114
+						$type_name = 'Radar Calibration';
1115
+					} else if ($type_name == 'tle-new') {
1116
+						$type_name = 'Last 30 days launches';
1117
+					}
735 1118
 					
736 1119
 					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) {
737 1120
 						print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>';
Please login to merge, or discard this patch.