Completed
Push — master ( 55ae08...b8e332 )
by Yannick
29:04
created
require/class.Scheduler.php 1 patch
Indentation   +146 added lines, -146 removed lines patch added patch discarded remove patch
@@ -27,14 +27,14 @@  discard block
 block discarded – undo
27 27
 	}
28 28
 
29 29
 	/**
30
-	* Add schedule data to database
31
-	* @param String $ident aircraft ident
32
-	* @param String $departure_airport_icao departure airport icao
33
-	* @param String $departure_airport_time departure airport time
34
-	* @param String $arrival_airport_icao arrival airport icao
35
-	* @param String $arrival_airport_time arrival airport time
30
+	 * Add schedule data to database
31
+	 * @param String $ident aircraft ident
32
+	 * @param String $departure_airport_icao departure airport icao
33
+	 * @param String $departure_airport_time departure airport time
34
+	 * @param String $arrival_airport_icao arrival airport icao
35
+	 * @param String $arrival_airport_time arrival airport time
36 36
 	/ @param String $source source of data
37
-	*/
37
+	 */
38 38
 	public function addSchedule($ident,$departure_airport_icao,$departure_airport_time,$arrival_airport_icao,$arrival_airport_time,$source = 'website') {
39 39
 		date_default_timezone_set('UTC');
40 40
 		$date = date("Y-m-d H:i:s",time());
@@ -50,18 +50,18 @@  discard block
 block discarded – undo
50 50
 		}
51 51
 		if ($sth->fetchColumn() > 0) {
52 52
 			if ($departure_airport_time == '' && $arrival_airport_time == '') {
53
-			    $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND ToAirport_ICAO = :arrival_airport_icao";
54
-			    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao);
53
+				$query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND ToAirport_ICAO = :arrival_airport_icao";
54
+				$query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao);
55 55
 			} elseif ($arrival_airport_time == '') {
56
-			    $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND FromAirport_Time = :departure_airport_time AND ToAirport_ICAO = :arrival_airport_icao";
57
-			    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao);
56
+				$query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND FromAirport_Time = :departure_airport_time AND ToAirport_ICAO = :arrival_airport_icao";
57
+				$query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao);
58 58
 			} elseif ($departure_airport_time == '') {
59
-			    $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND ToAirport_ICAO = :arrival_airport_icao AND ToAirport_Time = :arrival_airport_time";
60
-			    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time);
59
+				$query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND ToAirport_ICAO = :arrival_airport_icao AND ToAirport_Time = :arrival_airport_time";
60
+				$query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time);
61 61
 			} else {
62
-			    //$query = "SELECT COUNT(*) FROM schedule WHERE ident = :ident AND departure_airport_icao = :departure_airport_icao AND departure_airport_time = :departure_airport_time AND arrival_airport_icao = :arrival_airport_icao AND arrival_airport_time = :arrival_airport_time";
63
-			    $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND FromAirport_Time = :departure_airport_time AND ToAirport_ICAO = :arrival_airport_icao AND ToAirport_Time = :arrival_airport_time";
64
-			    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time);
62
+				//$query = "SELECT COUNT(*) FROM schedule WHERE ident = :ident AND departure_airport_icao = :departure_airport_icao AND departure_airport_time = :departure_airport_time AND arrival_airport_icao = :arrival_airport_icao AND arrival_airport_time = :arrival_airport_time";
63
+				$query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND FromAirport_Time = :departure_airport_time AND ToAirport_ICAO = :arrival_airport_icao AND ToAirport_Time = :arrival_airport_time";
64
+				$query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time);
65 65
 			}
66 66
 			try {
67 67
 				$sth = $this->db->prepare($query);
@@ -148,15 +148,15 @@  discard block
 block discarded – undo
148 148
 	*/
149 149
 	public function checkSchedule($ident) {
150 150
 		global $globalDBdriver;
151
-	        //$query = "SELECT COUNT(*) as nb FROM schedule WHERE ident = :ident AND date_added > DATE_SUB(CURDATE(), INTERVAL 8 DAY) - 8 LIMIT 1";
152
-	        if ($globalDBdriver == 'mysql') {
151
+			//$query = "SELECT COUNT(*) as nb FROM schedule WHERE ident = :ident AND date_added > DATE_SUB(CURDATE(), INTERVAL 8 DAY) - 8 LIMIT 1";
152
+			if ($globalDBdriver == 'mysql') {
153 153
 			$query = "SELECT COUNT(*) as nb FROM routes WHERE FromAirport_ICAO <> '' AND ToAirport_ICAO <> '' AND CallSign = :ident AND ((date_added BETWEEN DATE(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND DATE(NOW()) and date_modified IS NULL) OR (date_modified BETWEEN DATE(DATE_SUB(CURDATE(), INTERVAL 15 DAY)) AND DATE(NOW()))) LIMIT 1";
154 154
 		} else {
155 155
 			$query = "SELECT COUNT(*) as nb FROM routes WHERE FromAirport_ICAO <> '' AND ToAirport_ICAO <> '' AND CallSign = :ident 
156 156
 			AND ((date_added::timestamp BETWEEN CURRENT_TIMESTAMP - INTERVAL '1 MONTH' AND CURRENT_TIMESTAMP) and date_modified::timestamp IS NULL)
157 157
 			     OR (date_modified::timestamp BETWEEN CURRENT_TIMESTAMP - INTERVAL '1 MONTH' AND CURRENT_TIMESTAMP) LIMIT 1";
158 158
 		}
159
-	        $query_values = array(':ident' => $ident);
159
+			$query_values = array(':ident' => $ident);
160 160
 		 try {
161 161
 			$sth = $this->db->prepare($query);
162 162
 			$sth->execute($query_values);
@@ -169,12 +169,12 @@  discard block
 block discarded – undo
169 169
 	}
170 170
 
171 171
 	/**
172
-	* Get flight info from Air France
173
-	* @param String $callsign The callsign
174
-	* @param String $date date we want flight number info
175
-	* @param String $carrier IATA code
176
-	* @return Flight departure and arrival airports and time
177
-	*/
172
+	 * Get flight info from Air France
173
+	 * @param String $callsign The callsign
174
+	 * @param String $date date we want flight number info
175
+	 * @param String $carrier IATA code
176
+	 * @return Flight departure and arrival airports and time
177
+	 */
178 178
 	private function getAirFrance($callsign, $date = 'NOW',$carrier = 'AF') {
179 179
 		$Common = new Common();
180 180
 		$check_date = new Datetime($date);
@@ -210,11 +210,11 @@  discard block
 block discarded – undo
210 210
 	}
211 211
 
212 212
 	/**
213
-	* Get flight info from EasyJet
214
-	* @param String $callsign The callsign
215
-	* @param String $date date we want flight number info
216
-	* @return Flight departure and arrival airports and time
217
-	*/
213
+	 * Get flight info from EasyJet
214
+	 * @param String $callsign The callsign
215
+	 * @param String $date date we want flight number info
216
+	 * @return Flight departure and arrival airports and time
217
+	 */
218 218
 	private function getEasyJet($callsign, $date = 'NOW') {
219 219
 		global $globalTimezone;
220 220
 		$Common = new Common();
@@ -238,10 +238,10 @@  discard block
 block discarded – undo
238 238
 	}
239 239
 
240 240
 	/**
241
-	* Get flight info from Ryanair
242
-	* @param String $callsign The callsign
243
-	* @return Flight departure and arrival airports and time
244
-	*/
241
+	 * Get flight info from Ryanair
242
+	 * @param String $callsign The callsign
243
+	 * @return Flight departure and arrival airports and time
244
+	 */
245 245
 	private function getRyanair($callsign) {
246 246
 		$Common = new Common();
247 247
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -264,10 +264,10 @@  discard block
 block discarded – undo
264 264
 	}
265 265
 
266 266
 	/**
267
-	* Get flight info from Swiss
268
-	* @param String $callsign The callsign
269
-	* @return Flight departure and arrival airports and time
270
-	*/
267
+	 * Get flight info from Swiss
268
+	 * @param String $callsign The callsign
269
+	 * @return Flight departure and arrival airports and time
270
+	 */
271 271
 	private function getSwiss($callsign) {
272 272
 		$Common = new Common();
273 273
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -296,11 +296,11 @@  discard block
 block discarded – undo
296 296
 	}
297 297
 	
298 298
 	/**
299
-	* Get flight info from British Airways API
300
-	* @param String $callsign The callsign
301
-	* @param String $date date we want flight number info
302
-	* @return Flight departure and arrival airports and time
303
-	*/
299
+	 * Get flight info from British Airways API
300
+	 * @param String $callsign The callsign
301
+	 * @param String $date date we want flight number info
302
+	 * @return Flight departure and arrival airports and time
303
+	 */
304 304
 	public function getBritishAirways($callsign, $date = 'NOW') {
305 305
 		global $globalBritishAirwaysKey;
306 306
 		$Common = new Common();
@@ -324,11 +324,11 @@  discard block
 block discarded – undo
324 324
 	}
325 325
 
326 326
 	/**
327
-	* Get flight info from Lutfhansa API
328
-	* @param String $callsign The callsign
329
-	* @param String $date date we want flight number info
330
-	* @return Flight departure and arrival airports and time
331
-	*/
327
+	 * Get flight info from Lutfhansa API
328
+	 * @param String $callsign The callsign
329
+	 * @param String $date date we want flight number info
330
+	 * @return Flight departure and arrival airports and time
331
+	 */
332 332
 	public function getLufthansa($callsign, $date = 'NOW') {
333 333
 		global $globalLufthansaKey;
334 334
 		$Common = new Common();
@@ -358,11 +358,11 @@  discard block
 block discarded – undo
358 358
 	}
359 359
 
360 360
 	/**
361
-	* Get flight info from Transavia API
362
-	* @param String $callsign The callsign
363
-	* @param String $date date we want flight number info
364
-	* @return Flight departure and arrival airports and time
365
-	*/
361
+	 * Get flight info from Transavia API
362
+	 * @param String $callsign The callsign
363
+	 * @param String $date date we want flight number info
364
+	 * @return Flight departure and arrival airports and time
365
+	 */
366 366
 	public function getTransavia($callsign, $date = 'NOW') {
367 367
 		global $globalTransaviaKey;
368 368
 		$Common = new Common();
@@ -388,10 +388,10 @@  discard block
 block discarded – undo
388 388
 	}
389 389
 
390 390
 	/**
391
-	* Get flight info from Tunisair
392
-	* @param String $callsign The callsign
393
-	* @return Flight departure and arrival airports and time
394
-	*/
391
+	 * Get flight info from Tunisair
392
+	 * @param String $callsign The callsign
393
+	 * @return Flight departure and arrival airports and time
394
+	 */
395 395
 	public function getTunisair($callsign) {
396 396
 		$Common = new Common();
397 397
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -408,10 +408,10 @@  discard block
 block discarded – undo
408 408
 	}
409 409
 
410 410
 	/**
411
-	* Get flight info from Vueling
412
-	* @param String $callsign The callsign
413
-	* @return Flight departure and arrival airports and time
414
-	*/
411
+	 * Get flight info from Vueling
412
+	 * @param String $callsign The callsign
413
+	 * @return Flight departure and arrival airports and time
414
+	 */
415 415
 	public function getVueling($callsign,$date = 'NOW') {
416 416
 		$Common = new Common();
417 417
 		$check_date = new Datetime($date);
@@ -433,11 +433,11 @@  discard block
 block discarded – undo
433 433
 	}
434 434
 
435 435
 	/**
436
-	* Get flight info from Iberia
437
-	* @param String $callsign The callsign
438
-	* @param String $date date we want flight number info
439
-	* @return Flight departure and arrival airports and time
440
-	*/
436
+	 * Get flight info from Iberia
437
+	 * @param String $callsign The callsign
438
+	 * @param String $date date we want flight number info
439
+	 * @return Flight departure and arrival airports and time
440
+	 */
441 441
 	public function getIberia($callsign, $date = 'NOW') {
442 442
 		$Common = new Common();
443 443
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -467,11 +467,11 @@  discard block
 block discarded – undo
467 467
 	}
468 468
 
469 469
 	/**
470
-	* Get flight info from Star Alliance
471
-	* @param String $callsign The callsign
472
-	* @param String $date date we want flight number info
473
-	* @return Flight departure and arrival airports and time
474
-	*/
470
+	 * Get flight info from Star Alliance
471
+	 * @param String $callsign The callsign
472
+	 * @param String $date date we want flight number info
473
+	 * @return Flight departure and arrival airports and time
474
+	 */
475 475
 
476 476
 	private function getStarAlliance($callsign, $date = 'NOW',$carrier = '') {
477 477
 		$Common = new Common();
@@ -503,11 +503,11 @@  discard block
 block discarded – undo
503 503
 
504 504
 
505 505
 	/**
506
-	* Get flight info from Alitalia
507
-	* @param String $callsign The callsign
508
-	* @param String $date date we want flight number info
509
-	* @return Flight departure and arrival airports and time
510
-	*/
506
+	 * Get flight info from Alitalia
507
+	 * @param String $callsign The callsign
508
+	 * @param String $date date we want flight number info
509
+	 * @return Flight departure and arrival airports and time
510
+	 */
511 511
 	private function getAlitalia($callsign, $date = 'NOW') {
512 512
 		$Common = new Common();
513 513
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -526,11 +526,11 @@  discard block
 block discarded – undo
526 526
 	}
527 527
 
528 528
 	/**
529
-	* Get flight info from Brussels airlines
530
-	* @param String $callsign The callsign
531
-	* @param String $date date we want flight number info
532
-	* @return Flight departure and arrival airports and time
533
-	*/
529
+	 * Get flight info from Brussels airlines
530
+	 * @param String $callsign The callsign
531
+	 * @param String $date date we want flight number info
532
+	 * @return Flight departure and arrival airports and time
533
+	 */
534 534
 	private function getBrussels($callsign, $date = 'NOW') {
535 535
 		$Common = new Common();
536 536
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -540,24 +540,24 @@  discard block
 block discarded – undo
540 540
 		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
541 541
 		$data = $Common->getData($url);
542 542
 		if ($data != '') {
543
-		    //echo $data;
544
-		    $parsed_json = json_decode($data,true);
545
-		    if (isset($parsed_json[0]['FromAirportCode'])) {
543
+			//echo $data;
544
+			$parsed_json = json_decode($data,true);
545
+			if (isset($parsed_json[0]['FromAirportCode'])) {
546 546
 			$DepartureAirportIata = $parsed_json[0]['FromAirportCode'];
547 547
 			$ArrivalAirportIata = $parsed_json[0]['ToAirportCode'];
548 548
 			$departureTime = date('H:i',strtotime($parsed_json[0]['ScheduledDepatureDate']));
549 549
 			$arrivalTime = date('H:i',strtotime($parsed_json[0]['ScheduledArrivalDate']));
550 550
 			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_brussels');
551
-		    }
551
+			}
552 552
 		}
553 553
 	}
554 554
 
555 555
 	/**
556
-	* Get flight info from FlightRadar24
557
-	* @param String $callsign The callsign
558
-	* @param String $date date we want flight number info
559
-	* @return Flight departure and arrival airports and time
560
-	*/
556
+	 * Get flight info from FlightRadar24
557
+	 * @param String $callsign The callsign
558
+	 * @param String $date date we want flight number info
559
+	 * @return Flight departure and arrival airports and time
560
+	 */
561 561
 /*
562 562
 	public function getFlightRadar24($callsign, $date = 'NOW') {
563 563
 		$Common = new Common();
@@ -586,11 +586,11 @@  discard block
 block discarded – undo
586 586
 	}
587 587
   */
588 588
 	/**
589
-	* Get flight info from Lufthansa
590
-	* @param String $callsign The callsign
591
-	* @param String $date date we want flight number info
592
-	* @return Flight departure and arrival airports and time
593
-	*/
589
+	 * Get flight info from Lufthansa
590
+	 * @param String $callsign The callsign
591
+	 * @param String $date date we want flight number info
592
+	 * @return Flight departure and arrival airports and time
593
+	 */
594 594
 
595 595
 /*	private function getLufthansa($callsign, $date = 'NOW') {
596 596
 		$Common = new Common();
@@ -618,10 +618,10 @@  discard block
 block discarded – undo
618 618
 	}
619 619
   */
620 620
 	/**
621
-	* Get flight info from flytap
622
-	* @param String $callsign The callsign
623
-	* @return Flight departure and arrival airports and time
624
-	*/
621
+	 * Get flight info from flytap
622
+	 * @param String $callsign The callsign
623
+	 * @return Flight departure and arrival airports and time
624
+	 */
625 625
 	private function getFlyTap($callsign) {
626 626
 		$Common = new Common();
627 627
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -644,10 +644,10 @@  discard block
 block discarded – undo
644 644
 	}
645 645
 
646 646
 	/**
647
-	* Get flight info from flightmapper
648
-	* @param String $callsign The callsign
649
-	* @return Flight departure and arrival airports and time
650
-	*/
647
+	 * Get flight info from flightmapper
648
+	 * @param String $callsign The callsign
649
+	 * @return Flight departure and arrival airports and time
650
+	 */
651 651
 	public function getFlightMapper($callsign) {
652 652
 		$Common = new Common();
653 653
 		$airline_icao = '';
@@ -675,11 +675,11 @@  discard block
 block discarded – undo
675 675
 				$aarr = '';
676 676
 				$n = sscanf($sched,'%*s %5[0-9:] %*[^()] (%3[A-Z]) %5[0-9:] %*[^()] (%3[A-Z])',$dhour,$darr,$ahour,$aarr);
677 677
 				if ($n == 7) {
678
-				    $departureTime = $dhour;
679
-				    $arrivalTime = $ahour;
680
-				    $DepartureAirportIata = str_replace(array('(',')'),'',$darr);
681
-				    $ArrivalAirportIata = str_replace(array('(',')'),'',$aarr);
682
-				    return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_flightmapper');
678
+					$departureTime = $dhour;
679
+					$arrivalTime = $ahour;
680
+					$DepartureAirportIata = str_replace(array('(',')'),'',$darr);
681
+					$ArrivalAirportIata = str_replace(array('(',')'),'',$aarr);
682
+					return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_flightmapper');
683 683
 				}
684 684
 			}
685 685
 		}
@@ -687,10 +687,10 @@  discard block
 block discarded – undo
687 687
 	}
688 688
 
689 689
 	/**
690
-	* Get flight info from flightaware
691
-	* @param String $callsign The callsign
692
-	* @return Flight departure and arrival airports and time
693
-	*/
690
+	 * Get flight info from flightaware
691
+	 * @param String $callsign The callsign
692
+	 * @return Flight departure and arrival airports and time
693
+	 */
694 694
 	public function getFlightAware($callsign) {
695 695
 		global $globalFlightAwareUsername, $globalFlightAwarePassword;
696 696
 		date_default_timezone_set('UTC');
@@ -715,11 +715,11 @@  discard block
 block discarded – undo
715 715
 				$flight = $result['FlightInfoStatusResult']['flights'][0];
716 716
 				if (isset($flight['origin'])) {
717 717
 					return array(
718
-					    'DepartureAirportIATA' => $flight['origin']['alternate_ident'],
719
-					    'DepartureTime' => $flight['filed_departure_time']['time'],
720
-					    'ArrivalAirportIATA' => $flight['destination']['alternate_ident'],
721
-					    'ArrivalTime' => $flight['filed_arrival_time']['time'],
722
-					    'Source' => 'website_flightaware');
718
+						'DepartureAirportIATA' => $flight['origin']['alternate_ident'],
719
+						'DepartureTime' => $flight['filed_departure_time']['time'],
720
+						'ArrivalAirportIATA' => $flight['destination']['alternate_ident'],
721
+						'ArrivalTime' => $flight['filed_arrival_time']['time'],
722
+						'Source' => 'website_flightaware');
723 723
 				}
724 724
 			}
725 725
 		}
@@ -732,21 +732,21 @@  discard block
 block discarded – undo
732 732
 			$flight = reset($flights['flights']);
733 733
 			if (isset($flight['activityLog']['flights'][0]['origin'])) {
734 734
 				return array(
735
-				    'DepartureAirportIATA' => $flight['activityLog']['flights'][0]['origin']['iata'],
736
-				    'DepartureTime' => date('H:i',$flight['activityLog']['flights'][0]['takeoffTimes']['scheduled']),
737
-				    'ArrivalAirportIATA' => $flight['activityLog']['flights'][0]['destination']['iata'],
738
-				    'ArrivalTime' => date('H:i',$flight['activityLog']['flights'][0]['landingTimes']['scheduled']),
739
-				    'Source' => 'website_flightaware');
735
+					'DepartureAirportIATA' => $flight['activityLog']['flights'][0]['origin']['iata'],
736
+					'DepartureTime' => date('H:i',$flight['activityLog']['flights'][0]['takeoffTimes']['scheduled']),
737
+					'ArrivalAirportIATA' => $flight['activityLog']['flights'][0]['destination']['iata'],
738
+					'ArrivalTime' => date('H:i',$flight['activityLog']['flights'][0]['landingTimes']['scheduled']),
739
+					'Source' => 'website_flightaware');
740 740
 			}
741 741
 		}
742 742
 		return array();
743 743
 	}
744 744
 
745 745
 	/**
746
-	* Get flight info from CostToTravel
747
-	* @param String $callsign The callsign
748
-	* @return Flight departure and arrival airports and time
749
-	*/
746
+	 * Get flight info from CostToTravel
747
+	 * @param String $callsign The callsign
748
+	 * @return Flight departure and arrival airports and time
749
+	 */
750 750
 	public function getCostToTravel($callsign) {
751 751
 		$Common = new Common();
752 752
 		$url= "http://www.costtotravel.com/flight-number/".$callsign;
@@ -769,11 +769,11 @@  discard block
 block discarded – undo
769 769
 	}
770 770
 
771 771
 	/**
772
-	* Get flight info from Air Canada
773
-	* @param String $callsign The callsign
774
-	* @param String $date date we want flight number info
775
-	* @return Flight departure and arrival airports and time
776
-	*/
772
+	 * Get flight info from Air Canada
773
+	 * @param String $callsign The callsign
774
+	 * @param String $date date we want flight number info
775
+	 * @return Flight departure and arrival airports and time
776
+	 */
777 777
 	private function getAirCanada($callsign,$date = 'NOW') {
778 778
 		$Common = new Common();
779 779
 		if (class_exists("DomDocument") === FALSE) return array();
@@ -798,11 +798,11 @@  discard block
 block discarded – undo
798 798
 	}
799 799
 
800 800
 	/**
801
-	* Get flight info from Vietnam Airlines
802
-	* @param String $callsign The callsign
803
-	* @param String $date date we want flight number info
804
-	* @return Flight departure and arrival airports and time
805
-	*/
801
+	 * Get flight info from Vietnam Airlines
802
+	 * @param String $callsign The callsign
803
+	 * @param String $date date we want flight number info
804
+	 * @return Flight departure and arrival airports and time
805
+	 */
806 806
 	private function getVietnamAirlines($callsign, $date = 'NOW') {
807 807
 		$Common = new Common();
808 808
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
@@ -824,12 +824,12 @@  discard block
 block discarded – undo
824 824
 	}
825 825
 
826 826
 	/**
827
-	* Get flight info from Air Berlin
828
-	* @param String $callsign The callsign
829
-	* @param String $date date we want flight number info
830
-	* @param String $carrier airline code
831
-	* @return Flight departure and arrival airports and time
832
-	*/
827
+	 * Get flight info from Air Berlin
828
+	 * @param String $callsign The callsign
829
+	 * @param String $date date we want flight number info
830
+	 * @param String $carrier airline code
831
+	 * @return Flight departure and arrival airports and time
832
+	 */
833 833
 	private function getAirBerlin($callsign, $date = 'NOW',$carrier = 'AB') {
834 834
 		$Common = new Common();
835 835
 		date_default_timezone_set('UTC');
@@ -858,11 +858,11 @@  discard block
 block discarded – undo
858 858
 			$table = $Common->table2array($data);
859 859
 			$flight = $table;
860 860
 			if (isset($flight[5][4])) {
861
-			    $arrivalTime = $flight[5][4];
862
-			    $arrivalAirport = $flight[5][3];
861
+				$arrivalTime = $flight[5][4];
862
+				$arrivalAirport = $flight[5][3];
863 863
 			} else {
864
-			    $arrivalTime = '';
865
-			    $arrivalAirport = '';
864
+				$arrivalTime = '';
865
+				$arrivalAirport = '';
866 866
 			}
867 867
 		} else return array();
868 868
 		$url = 'http://www.airberlin.com/en-US/site/json/suggestAirport.php?searchfor=departures&searchflightid=0&departures%5B%5D=&suggestsource%5B0%5D=activeairports&withcountries=0&withoutroutings=0&promotion%5Bid%5D=&promotion%5Btype%5D=&routesource%5B0%5D=airberlin&routesource%5B1%5D=partner';
Please login to merge, or discard this patch.
require/class.SBS.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -198,20 +198,20 @@
 block discarded – undo
198 198
 
199 199
 	private function parityCheck($msg, $bin) {
200 200
 		$modes_checksum_table = array(
201
-		    0x3935ea, 0x1c9af5, 0xf1b77e, 0x78dbbf, 0xc397db, 0x9e31e9, 0xb0e2f0, 0x587178,
202
-		    0x2c38bc, 0x161c5e, 0x0b0e2f, 0xfa7d13, 0x82c48d, 0xbe9842, 0x5f4c21, 0xd05c14,
203
-		    0x682e0a, 0x341705, 0xe5f186, 0x72f8c3, 0xc68665, 0x9cb936, 0x4e5c9b, 0xd8d449,
204
-		    0x939020, 0x49c810, 0x24e408, 0x127204, 0x093902, 0x049c81, 0xfdb444, 0x7eda22,
205
-		    0x3f6d11, 0xe04c8c, 0x702646, 0x381323, 0xe3f395, 0x8e03ce, 0x4701e7, 0xdc7af7,
206
-		    0x91c77f, 0xb719bb, 0xa476d9, 0xadc168, 0x56e0b4, 0x2b705a, 0x15b82d, 0xf52612,
207
-		    0x7a9309, 0xc2b380, 0x6159c0, 0x30ace0, 0x185670, 0x0c2b38, 0x06159c, 0x030ace,
208
-		    0x018567, 0xff38b7, 0x80665f, 0xbfc92b, 0xa01e91, 0xaff54c, 0x57faa6, 0x2bfd53,
209
-		    0xea04ad, 0x8af852, 0x457c29, 0xdd4410, 0x6ea208, 0x375104, 0x1ba882, 0x0dd441,
210
-		    0xf91024, 0x7c8812, 0x3e4409, 0xe0d800, 0x706c00, 0x383600, 0x1c1b00, 0x0e0d80,
211
-		    0x0706c0, 0x038360, 0x01c1b0, 0x00e0d8, 0x00706c, 0x003836, 0x001c1b, 0xfff409,
212
-		    0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
213
-		    0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
214
-		    0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000
201
+			0x3935ea, 0x1c9af5, 0xf1b77e, 0x78dbbf, 0xc397db, 0x9e31e9, 0xb0e2f0, 0x587178,
202
+			0x2c38bc, 0x161c5e, 0x0b0e2f, 0xfa7d13, 0x82c48d, 0xbe9842, 0x5f4c21, 0xd05c14,
203
+			0x682e0a, 0x341705, 0xe5f186, 0x72f8c3, 0xc68665, 0x9cb936, 0x4e5c9b, 0xd8d449,
204
+			0x939020, 0x49c810, 0x24e408, 0x127204, 0x093902, 0x049c81, 0xfdb444, 0x7eda22,
205
+			0x3f6d11, 0xe04c8c, 0x702646, 0x381323, 0xe3f395, 0x8e03ce, 0x4701e7, 0xdc7af7,
206
+			0x91c77f, 0xb719bb, 0xa476d9, 0xadc168, 0x56e0b4, 0x2b705a, 0x15b82d, 0xf52612,
207
+			0x7a9309, 0xc2b380, 0x6159c0, 0x30ace0, 0x185670, 0x0c2b38, 0x06159c, 0x030ace,
208
+			0x018567, 0xff38b7, 0x80665f, 0xbfc92b, 0xa01e91, 0xaff54c, 0x57faa6, 0x2bfd53,
209
+			0xea04ad, 0x8af852, 0x457c29, 0xdd4410, 0x6ea208, 0x375104, 0x1ba882, 0x0dd441,
210
+			0xf91024, 0x7c8812, 0x3e4409, 0xe0d800, 0x706c00, 0x383600, 0x1c1b00, 0x0e0d80,
211
+			0x0706c0, 0x038360, 0x01c1b0, 0x00e0d8, 0x00706c, 0x003836, 0x001c1b, 0xfff409,
212
+			0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
213
+			0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
214
+			0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000
215 215
 		);
216 216
 		$crc = 0;
217 217
 		$checksum = intval(substr($msg,22,6),16);
Please login to merge, or discard this patch.
live-geojson.php 1 patch
Indentation   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -14,23 +14,23 @@  discard block
 block discarded – undo
14 14
 $marine = false;
15 15
 $usecoord = false;
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
 
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 	$usecoord = true;
118 118
 	$coord = explode(',',$_GET['coord']);
119 119
 	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) 
120
-	    && $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) {
120
+		&& $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) {
121 121
 		if ($tracker) {
122 122
 			$spotter_array = $TrackerLive->getLiveTrackerDatabyCoord($coord,$filter);
123 123
 		} elseif ($marine) {
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	$usecoord = true;
131 131
 	$coord = explode(',',$_GET['coord']);
132 132
 	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) 
133
-	    && $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) {
133
+		&& $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 134
 		if ($tracker) {
135 135
 			$spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord,$filter);
136 136
 		} elseif ($marine) {
@@ -634,17 +634,17 @@  discard block
 block discarded – undo
634 634
 				if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history'];
635 635
 				
636 636
 				if (
637
-				    (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') 
638
-				    || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory)
637
+					(isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') 
638
+					|| ((isset($globalMapHistory) && $globalMapHistory) || $allhistory)
639 639
 				//    || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id']))
640 640
 				//    || (isset($history) && $history != '' && $history != 'NA' && $history == $spotter_item['ident'])
641
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
642
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])
643
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id']))
644
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id'])
645
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid']))
646
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid'])
647
-				    ) {
641
+					|| (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
642
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])
643
+					|| (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id']))
644
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id'])
645
+					|| (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid']))
646
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid'])
647
+					) {
648 648
 					if ($tracker) {
649 649
 						if ($from_archive || $globalArchive) {
650 650
 							$spotter_history_array = $TrackerArchive->getAllArchiveTrackerDataById($spotter_item['famtrackid']);
@@ -652,7 +652,7 @@  discard block
 block discarded – undo
652 652
 							$spotter_history_array = $TrackerLive->getAllLiveTrackerDataById($spotter_item['famtrackid']);
653 653
 						}
654 654
 						if ($globalMapMatching === TRUE && 
655
-						    isset($spotter_item['type']) && (
655
+							isset($spotter_item['type']) && (
656 656
 							$spotter_item['type'] == 'Firetruck' ||
657 657
 							$spotter_item['type'] == 'Ambulance' ||
658 658
 							$spotter_item['type'] == 'Truck (18 Wheeler)' ||
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
 							$spotter_item['type'] == 'Jeep' ||
665 665
 							$spotter_item['type'] == 'Motorcycle' ||
666 666
 							$spotter_item['type'] == 'Car'
667
-						    )
667
+							)
668 668
 						) {
669 669
 							require(dirname(__FILE__).'/require/class.MapMatching.php');
670 670
 							$MapMatching = new MapMatching();
@@ -753,65 +753,65 @@  discard block
 block discarded – undo
753 753
 				}
754 754
 				
755 755
 				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
756
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
757
-				     && (isset($spotter_item['departure_airport']) 
758
-				        && $spotter_item['departure_airport'] != 'NA' 
759
-				        && isset($spotter_item['arrival_airport']) 
760
-				        && $spotter_item['arrival_airport'] != 'NA' 
761
-				        && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") 
762
-				    	    || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) {
763
-				    if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
764
-				    else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
765
-				    if (isset($spotter_item['departure_airport_latitude'])) {
756
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
757
+					 && (isset($spotter_item['departure_airport']) 
758
+						&& $spotter_item['departure_airport'] != 'NA' 
759
+						&& isset($spotter_item['arrival_airport']) 
760
+						&& $spotter_item['arrival_airport'] != 'NA' 
761
+						&& ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") 
762
+							|| (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) {
763
+					if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
764
+					else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
765
+					if (isset($spotter_item['departure_airport_latitude'])) {
766 766
 					$output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],';
767
-				    } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') {
767
+					} elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') {
768 768
 					$dairport = $Spotter->getAllAirportInfo($spotter_item['departure_airport']);
769 769
 					if (isset($dairport[0]['latitude'])) {
770
-					    $output_air .= '['.$dairport[0]['longitude'].','.$dairport[0]['latitude'].'],';
770
+						$output_air .= '['.$dairport[0]['longitude'].','.$dairport[0]['latitude'].'],';
771 771
 					}
772
-				    }
773
-				    if (isset($spotter_item['arrival_airport_latitude'])) {
772
+					}
773
+					if (isset($spotter_item['arrival_airport_latitude'])) {
774 774
 					$output_air .= '['.$spotter_item['arrival_airport_longitude'].','.$spotter_item['arrival_airport_latitude'].'],';
775
-				    } elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
775
+					} elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
776 776
 					$aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']);
777 777
 					if (isset($aairport[0]['latitude'])) {
778
-					    $output_air .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].'],';
778
+						$output_air .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].'],';
779 779
 					}
780
-				    }
781
-				    $output_air  = substr($output_air, 0, -1);
782
-				    $output_air .= ']}},';
783
-				    $output .= $output_air;
784
-				    unset($output_air);
780
+					}
781
+					$output_air  = substr($output_air, 0, -1);
782
+					$output_air .= ']}},';
783
+					$output .= $output_air;
784
+					unset($output_air);
785 785
 				}
786 786
 
787 787
 				//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))))) {
788 788
 				//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))))) {
789 789
 				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
790
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
791
-				     && (isset($spotter_item['arrival_airport']) 
792
-				        && $spotter_item['arrival_airport'] != 'NA' 
793
-				        && ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == "true") 
794
-				    	    || (!isset($_COOKIE['MapRemainaingRoute']) && (!isset($globalMapRemainingRoute) 
795
-				    	    || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) {
796
-				    $havedata = false;
797
-				    if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
798
-				    else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
799
-				    $output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],';
790
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
791
+					 && (isset($spotter_item['arrival_airport']) 
792
+						&& $spotter_item['arrival_airport'] != 'NA' 
793
+						&& ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == "true") 
794
+							|| (!isset($_COOKIE['MapRemainaingRoute']) && (!isset($globalMapRemainingRoute) 
795
+							|| (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) {
796
+					$havedata = false;
797
+					if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
798
+					else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
799
+					$output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],';
800 800
 
801
-				    if (isset($spotter_item['arrival_airport_latitude'])) {
801
+					if (isset($spotter_item['arrival_airport_latitude'])) {
802 802
 					$output_dest .= '['.$spotter_item['arrival_airport_longitude'].','.$spotter_item['arrival_airport_latitude'].']';
803 803
 					$havedata = true;
804
-				    } elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
804
+					} elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
805 805
 					$aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']);
806 806
 					if (isset($aairport[0]['latitude'])) {
807
-					    $output_dest .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].']';
808
-					    $havedata = true;
807
+						$output_dest .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].']';
808
+						$havedata = true;
809 809
 					}
810
-				    }
811
-				    //$output_dest  = substr($output_dest, 0, -1);
812
-				    $output_dest .= ']}},';
813
-				    if ($havedata) $output .= $output_dest;
814
-				    unset($output_dest);
810
+					}
811
+					//$output_dest  = substr($output_dest, 0, -1);
812
+					$output_dest .= ']}},';
813
+					if ($havedata) $output .= $output_dest;
814
+					unset($output_dest);
815 815
 				}
816 816
 			}
817 817
 			$output  = substr($output, 0, -1);
Please login to merge, or discard this patch.
header.php 1 patch
Indentation   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 // When button "Remove all filters" is clicked
39 39
 if (isset($_POST['removefilters'])) {
40 40
 	$allfilters = array_filter(array_keys($_COOKIE),function($key) {
41
-	    return strpos($key,'filter_') === 0;
41
+		return strpos($key,'filter_') === 0;
42 42
 	});
43 43
 	foreach ($allfilters as $filt) {
44 44
 		unset($_COOKIE[$filt]);
@@ -188,17 +188,17 @@  discard block
 block discarded – undo
188 188
 	}
189 189
 ?>
190 190
 <?php 
191
-    if (isset($_POST['archive'])) {
191
+	if (isset($_POST['archive'])) {
192 192
 ?>
193 193
 <script src="<?php print $globalURL; ?>/js/map.common.js"></script>
194 194
 <?php 
195
-	    if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
195
+		if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
196 196
 ?>
197 197
 
198 198
 <script src="<?php print $globalURL; ?>/js/map.js.php?<?php print time(); ?>&archive&begindate=<?php print strtotime($_POST['start_date']); ?>&enddate=<?php print strtotime($_POST['end_date']); ?>&archivespeed=<?php print $_POST['archivespeed']; ?>"></script>
199 199
 <?php    
200
-	    }
201
-    } else {
200
+		}
201
+	} else {
202 202
 ?>
203 203
 <?php
204 204
 /*	if (isset($globalBeta) && $globalBeta) {
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 */
211 211
 ?>
212 212
 <?php 
213
-	    if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
213
+		if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
214 214
 ?>
215 215
 <?php
216 216
 //		if (isset($globalBeta) && $globalBeta) {
@@ -241,13 +241,13 @@  discard block
 block discarded – undo
241 241
 <script src="<?php print $globalURL; ?>/js/map-satellite.2d.js.php?<?php print time(); ?>"></script>
242 242
 <?php
243 243
 		}
244
-	    }
244
+		}
245 245
 ?>
246 246
 <?php
247 247
 //	}
248 248
 ?>
249 249
 <?php
250
-    }
250
+	}
251 251
 }
252 252
 ?>
253 253
 <?php
@@ -424,34 +424,34 @@  discard block
 block discarded – undo
424 424
 
425 425
       <ul class="nav navbar-nav">
426 426
 <?php
427
-    if (isset($globalNewsFeeds['global']) && !empty($globalNewsFeeds['global'])) {
427
+	if (isset($globalNewsFeeds['global']) && !empty($globalNewsFeeds['global'])) {
428 428
 ?>
429 429
     <li><a href="<?php print $globalURL; ?>/news"><?php echo _("News"); ?></a></li>
430 430
 <?php
431
-    }
431
+	}
432 432
 ?>
433 433
 
434 434
 <?php 
435
-    $sub = false;
436
-    if (
435
+	$sub = false;
436
+	if (
437 437
 	(
438
-	    (!isset($globalAircraft) || (isset($globalAircraft) && $globalAircraft === TRUE)) && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalTracker) && $globalTracker === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE))
438
+		(!isset($globalAircraft) || (isset($globalAircraft) && $globalAircraft === TRUE)) && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalTracker) && $globalTracker === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE))
439 439
 	) || 
440 440
 	(
441
-	    isset($globalMarine) && $globalMarine === TRUE && ((isset($globalTracker) && $globalTracker === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE))
441
+		isset($globalMarine) && $globalMarine === TRUE && ((isset($globalTracker) && $globalTracker === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE))
442 442
 	) || 
443 443
 	(
444
-	    isset($globalTracker) && $globalTracker === TRUE && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE))
444
+		isset($globalTracker) && $globalTracker === TRUE && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE))
445 445
 	) || 
446 446
 	(
447
-	    isset($globalSatellite) && $globalSatellite === TRUE && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalTracker) && $globalTracker === TRUE))
447
+		isset($globalSatellite) && $globalSatellite === TRUE && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalTracker) && $globalTracker === TRUE))
448 448
 	)
449
-    ) {
449
+	) {
450 450
 	$sub = true;
451
-    }
451
+	}
452 452
 ?>
453 453
 <?php
454
-    if (!isset($globalAircraft) || $globalAircraft === TRUE) {
454
+	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
455 455
 ?>
456 456
     <li class="dropdown">
457 457
 <?php
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
 	<ul class="dropdown-menu multi-level">
463 463
       	<li class="dropdown-submenu">
464 464
 <?php
465
-        }
465
+		}
466 466
 ?>
467 467
 <?php
468 468
 	if (isset($globalNewsFeeds['aircraft']) && !empty($globalNewsFeeds['aircraft'])) {
@@ -477,25 +477,25 @@  discard block
 block discarded – undo
477 477
           <ul class="dropdown-menu">
478 478
           	<li><a href="<?php print $globalURL; ?>/aircraft"><?php echo _("Aircrafts Types"); ?></a></li>
479 479
 <?php
480
-    if (!isset($globalNoAirlines) || $globalNoAirlines === FALSE) {
480
+	if (!isset($globalNoAirlines) || $globalNoAirlines === FALSE) {
481 481
 ?>
482 482
 			<li><a href="<?php print $globalURL; ?>/airline"><?php echo _("Airlines"); ?></a></li>
483 483
 <?php
484
-    }
484
+	}
485 485
 ?>
486 486
 			<li><a href="<?php print $globalURL; ?>/airport"><?php echo _("Airports"); ?></a></li>
487 487
 <?php
488
-    if ((isset($globalUseOwner) && $globalUseOwner) || (!isset($globalUseOwner) && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM))) {
488
+	if ((isset($globalUseOwner) && $globalUseOwner) || (!isset($globalUseOwner) && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM))) {
489 489
 ?>
490 490
 			<li><a href="<?php print $globalURL; ?>/owner"><?php echo _("Owners"); ?></a></li>
491 491
 <?php
492
-    } 
493
-    if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) {
492
+	} 
493
+	if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) {
494 494
 
495 495
 ?>
496 496
 			<li><a href="<?php print $globalURL; ?>/pilot"><?php echo _("Pilots"); ?></a></li>
497 497
 <?php
498
-    }
498
+	}
499 499
 ?>
500 500
 			<li><hr /></li>
501 501
             <li><a href="<?php print $globalURL; ?>/currently"><?php echo _("Current Activity"); ?></a></li>
@@ -503,43 +503,43 @@  discard block
 block discarded – undo
503 503
             <li><a href="<?php print $globalURL; ?>/date/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Activity"); ?></a></li>
504 504
             <li><a href="<?php print $globalURL; ?>/newest"><?php echo _("Newest by Category"); ?></a></li>
505 505
             <?php
506
-        	if ($globalACARS) {
507
-        	    if (isset($globalDemo) && $globalDemo) {
508
-    	    ?>
506
+			if ($globalACARS) {
507
+				if (isset($globalDemo) && $globalDemo) {
508
+			?>
509 509
             <li><hr /></li>
510 510
             <li><i><?php echo _('ACARS data not available publicly'); ?></i></li>
511 511
             <li><a href=""><?php echo _('Latest ACARS messages'); ?></a></li>
512 512
             <li><a href=""><?php echo _('Archive ACARS messages'); ?></a></li>
513 513
             <?php
514
-        	    } else {
515
-    	    ?>
514
+				} else {
515
+			?>
516 516
             <li><hr /></li>
517 517
             <li><a href="<?php print $globalURL; ?>/acars-latest"><?php echo _("Latest ACARS messages"); ?></a></li>
518 518
             <li><a href="<?php print $globalURL; ?>/acars-archive"><?php echo _("Archive ACARS messages"); ?></a></li>
519 519
             <?php
520
-        	    }
521
-        	}
522
-    	    ?>
520
+				}
521
+			}
522
+			?>
523 523
     	    <?php
524
-    	        if (isset($globalAccidents) && $globalAccidents) {
525
-    	    ?>
524
+				if (isset($globalAccidents) && $globalAccidents) {
525
+			?>
526 526
             <li><hr /></li>
527 527
             <li><a href="<?php print $globalURL; ?>/accident-latest"><?php echo _("Latest accident"); ?></a></li>
528 528
             <li><a href="<?php print $globalURL; ?>/accident/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Accident"); ?></a></li>
529 529
             <li><a href="<?php print $globalURL; ?>/incident-latest"><?php echo _("Latest incident"); ?></a></li>
530 530
             <li><a href="<?php print $globalURL; ?>/incident/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Incident"); ?></a></li>
531 531
             <?php
532
-        	}
533
-    	    ?>
532
+			}
533
+			?>
534 534
             <li><hr /></li>
535 535
             <li><a href="<?php print $globalURL; ?>/highlights/table"><?php echo _("Special Highlights"); ?></a></li>
536 536
             <?php
537 537
 		if (!isset($globalNoUpcoming) || $globalNoUpcoming === FALSE) {
538
-	    ?>
538
+		?>
539 539
             <li><a href="<?php print $globalURL; ?>/upcoming"><?php echo _("Upcoming Flights"); ?></a></li>
540 540
 	    <?php
541 541
 		}
542
-	    ?>
542
+		?>
543 543
           </ul>
544 544
         </li>
545 545
       	<li><a href="<?php print $globalURL; ?>/search"><?php echo _("Search"); ?></a></li>
@@ -566,14 +566,14 @@  discard block
 block discarded – undo
566 566
     </ul>
567 567
 <?php
568 568
 	}
569
-    }
569
+	}
570 570
 ?>
571 571
 <?php
572
-    if (isset($globalMarine) && $globalMarine) {
572
+	if (isset($globalMarine) && $globalMarine) {
573 573
 ?>
574 574
     <li class="dropdown">
575 575
 <?php
576
-        if ($sub) {
576
+		if ($sub) {
577 577
 ?>
578 578
     <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Marines"); ?> <b class="caret"></b></a>
579 579
 	<ul class="dropdown-menu multi-level">
@@ -607,14 +607,14 @@  discard block
 block discarded – undo
607 607
 	}
608 608
 ?>
609 609
 <?php
610
-    }
610
+	}
611 611
 ?>
612 612
 <?php
613
-    if (isset($globalTracker) && $globalTracker) {
613
+	if (isset($globalTracker) && $globalTracker) {
614 614
 ?>
615 615
     <li class="dropdown">
616 616
 <?php
617
-        if ($sub) {
617
+		if ($sub) {
618 618
 ?>
619 619
     <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Trackers"); ?> <b class="caret"></b></a>
620 620
 	<ul class="dropdown-menu multi-level">
@@ -648,14 +648,14 @@  discard block
 block discarded – undo
648 648
 	}
649 649
 ?>
650 650
 <?php
651
-    }
651
+	}
652 652
 ?>
653 653
 <?php
654
-    if (isset($globalSatellite) && $globalSatellite) {
654
+	if (isset($globalSatellite) && $globalSatellite) {
655 655
 ?>
656 656
     <li class="dropdown">
657 657
 <?php
658
-        if ($sub) {
658
+		if ($sub) {
659 659
 ?>
660 660
     <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Satellites"); ?> <b class="caret"></b></a>
661 661
 	<ul class="dropdown-menu multi-level">
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
 	}
692 692
 ?>
693 693
 <?php
694
-    }
694
+	}
695 695
 ?>
696 696
 
697 697
         <li class="dropdown">
@@ -700,12 +700,12 @@  discard block
 block discarded – undo
700 700
           	<li><a href="<?php print $globalURL; ?>/about"><?php echo _("About The Project"); ?></a></li>
701 701
           	<li><a href="<?php print $globalURL; ?>/about/export"><?php echo _("Exporting Data"); ?></a></li>
702 702
 <?php
703
-    if (!isset($globalAircraft) || $globalAircraft === TRUE) {
703
+	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
704 704
 ?>
705 705
 		<li><hr /></li>
706 706
 		<li><a href="<?php print $globalURL; ?>/about/tv"><?php echo _("Spotter TV"); ?></a></li>
707 707
 <?php
708
-    }
708
+	}
709 709
 ?>
710 710
 	    <?php if (isset($globalContribute) && $globalContribute) { ?>
711 711
                 <li><hr /></li>
@@ -726,14 +726,14 @@  discard block
 block discarded – undo
726 726
   	    <form>
727 727
   		<select class="selectpicker" data-width="120px" onchange="language(this);">
728 728
   		    <?php
729
-  		        $Language = new Language();
730
-  		        $alllang = $Language->getLanguages();
731
-  		        foreach ($alllang as $key => $lang) {
732
-  		            print '<option value="'.$key.'"';
733
-  		            if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected ';
734
-  		            print '>'.$lang[0].'</option>';
735
-  		        }
736
-  		    ?>
729
+  				$Language = new Language();
730
+  				$alllang = $Language->getLanguages();
731
+  				foreach ($alllang as $key => $lang) {
732
+  					print '<option value="'.$key.'"';
733
+  					if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected ';
734
+  					print '>'.$lang[0].'</option>';
735
+  				}
736
+  			?>
737 737
   		</select>
738 738
   	    </form>
739 739
   	</div>
@@ -765,18 +765,18 @@  discard block
 block discarded – undo
765 765
 ?>
766 766
     <div class="top-header clear" role="main">
767 767
 <?php
768
-    if (isset($longitude) && isset($latitude) && $longitude != 0 && $latitude != 0) {
768
+	if (isset($longitude) && isset($latitude) && $longitude != 0 && $latitude != 0) {
769 769
 ?>
770 770
     <div id="archive-map"></div>
771 771
 <?php
772
-    }
772
+	}
773 773
 ?>
774 774
     </div>
775 775
 <?php
776 776
 }
777 777
 if ((strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) || (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false))
778 778
 {
779
-    ?>
779
+	?>
780 780
     <div class="top-header clear" role="main">
781 781
         <div id="map"></div>
782 782
 	<link rel="stylesheet" href="<?php print $globalURL; ?>/css/leaflet.css" />
@@ -787,15 +787,15 @@  discard block
 block discarded – undo
787 787
         var zoom = 13;
788 788
 //create the map
789 789
 <?php
790
-    if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) {
790
+	if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) {
791 791
 ?>
792 792
   map = L.map('map', { zoomControl:true }).setView([<?php print $airport_array[0]['latitude']; ?>,<?php print $airport_array[0]['longitude']; ?>], zoom);
793 793
 <?php
794
-    } elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) {
794
+	} elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) {
795 795
 ?>
796 796
   map = L.map('map', { zoomControl:true });
797 797
 <?php
798
-    } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) {
798
+	} elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) {
799 799
 ?>
800 800
   map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['departure_airport_latitude']; ?>,<?php print $spotter_array[0]['arrival_airport_longitude']; ?>]);
801 801
     var line = L.polyline([[<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>],[<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>]]).addTo(map);
@@ -803,22 +803,22 @@  discard block
 block discarded – undo
803 803
     var departure_airport = L.marker([<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/departure_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map);
804 804
     var arrival_airport = L.marker([<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/arrival_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map);
805 805
 <?php
806
-    } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude']) && isset($spotter_array[0]['latitude'])) {
806
+	} elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude']) && isset($spotter_array[0]['latitude'])) {
807 807
 ?>
808 808
   map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['latitude']; ?>,<?php print $spotter_array[0]['longitude']; ?>]);
809 809
 <?php
810
-    } elseif (!isset($spotter_array[0]['latitude']) && !isset($spotter_array[0]['longitude'])) {
810
+	} elseif (!isset($spotter_array[0]['latitude']) && !isset($spotter_array[0]['longitude'])) {
811 811
 ?>
812 812
   map = L.map('map', { zoomControl:true });
813 813
 <?php
814
-    }
814
+	}
815 815
 ?>
816 816
   //initialize the layer group for the aircrft markers
817 817
   var layer_data = L.layerGroup();
818 818
 
819 819
   //a few title layers
820 820
 <?php
821
-    if ($globalMapProvider == 'Mapbox') {
821
+	if ($globalMapProvider == 'Mapbox') {
822 822
 ?>
823 823
   L.tileLayer('https://{s}.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={token}', {
824 824
     maxZoom: 18,
@@ -829,14 +829,14 @@  discard block
 block discarded – undo
829 829
     token : '<?php print $globalMapboxToken; ?>'
830 830
   }).addTo(map);
831 831
 <?php
832
-    } elseif ($globalMapProvider == 'Mapbox-GL') {
832
+	} elseif ($globalMapProvider == 'Mapbox-GL') {
833 833
 ?>
834 834
     L.mapboxGL({
835 835
 	accessToken: '<?php print $globalMapboxToken; ?>',
836 836
 	style: 'mapbox://styles/mapbox/bright-v8'
837 837
   }).addTo(map);
838 838
 <?php
839
-    } elseif ($globalMapProvider == 'MapQuest-OSM') {
839
+	} elseif ($globalMapProvider == 'MapQuest-OSM') {
840 840
 ?>
841 841
   L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.png', {
842 842
     maxZoom: 18,
@@ -845,7 +845,7 @@  discard block
 block discarded – undo
845 845
       'Tiles Courtesy of <a href="http://www.mapquest.com">MapQuest</a>'
846 846
   }).addTo(map);
847 847
 <?php
848
-    } elseif ($globalMapProvider == 'MapQuest-Aerial') {
848
+	} elseif ($globalMapProvider == 'MapQuest-Aerial') {
849 849
 ?>
850 850
   L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.png', {
851 851
     maxZoom: 18,
@@ -854,27 +854,27 @@  discard block
 block discarded – undo
854 854
       'Tiles Courtesy of <a href="http://www.mapquest.com">MapQuest</a>, Portions Courtesy NASA/JPL-Caltech and U.S. Depart. of Agriculture, Farm Service Agency"'
855 855
   }).addTo(map);
856 856
 <?php
857
-    } elseif ($globalMapProvider == 'Google-Roadmap') {
857
+	} elseif ($globalMapProvider == 'Google-Roadmap') {
858 858
 ?>
859 859
     var googleLayer = new L.Google('ROADMAP');
860 860
     map.addLayer(googleLayer);
861 861
 <?php
862
-    } elseif ($globalMapProvider == 'Google-Satellite') {
862
+	} elseif ($globalMapProvider == 'Google-Satellite') {
863 863
 ?>
864 864
     var googleLayer = new L.Google('SATELLITE');
865 865
     map.addLayer(googleLayer);
866 866
 <?php
867
-    } elseif ($globalMapProvider == 'Google-Hybrid') {
867
+	} elseif ($globalMapProvider == 'Google-Hybrid') {
868 868
 ?>
869 869
     var googleLayer = new L.Google('HYBRID');
870 870
     map.addLayer(googleLayer);
871 871
 <?php
872
-    } elseif ($globalMapProvider == 'Google-Terrain') {
872
+	} elseif ($globalMapProvider == 'Google-Terrain') {
873 873
 ?>
874 874
     var googleLayer = new L.Google('Terrain');
875 875
     map.addLayer(googleLayer);
876 876
 <?php
877
-    } elseif (isset($globalMapCustomLayer[$globalMapProvider])) {
877
+	} elseif (isset($globalMapCustomLayer[$globalMapProvider])) {
878 878
 	$customid = $globalMapProvider;
879 879
 ?>
880 880
     L.tileLayer('<?php print $globalMapCustomLayer[$customid]['url']; ?>/{z}/{x}/{y}.png', {
@@ -884,7 +884,7 @@  discard block
 block discarded – undo
884 884
         attribution: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>'
885 885
     }).addTo(map);
886 886
 <?php
887
-    } elseif ($globalMapProvider == 'offline' || (isset($globalMapOffline) && $globalMapOffline === TRUE)) {
887
+	} elseif ($globalMapProvider == 'offline' || (isset($globalMapOffline) && $globalMapOffline === TRUE)) {
888 888
 ?>
889 889
     var center = map.getCenter();
890 890
     map.options.crs = L.CRS.EPSG4326;
@@ -899,8 +899,8 @@  discard block
 block discarded – undo
899 899
         attribution: 'Natural Earth'
900 900
     }).addTo(map);
901 901
 <?php
902
-    //} elseif ($globalMapProvider == 'OpenStreetMap') {
903
-    } else {
902
+	//} elseif ($globalMapProvider == 'OpenStreetMap') {
903
+	} else {
904 904
 ?>
905 905
   L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
906 906
     maxZoom: 18,
@@ -909,7 +909,7 @@  discard block
 block discarded – undo
909 909
   }).addTo(map);
910 910
 
911 911
 <?php
912
-    }
912
+	}
913 913
 ?>
914 914
         </script>
915 915
     </div>
Please login to merge, or discard this patch.
getImages.php 1 patch
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -4,31 +4,31 @@  discard block
 block discarded – undo
4 4
 	$hex = str_replace("#", "", $hex);
5 5
 	$color = array();
6 6
 	if (strlen($hex) == 3) {
7
-	    $color['r'] = hexdec(substr($hex, 0, 1) . substr($hex,0,1));
8
-	    $color['g'] = hexdec(substr($hex, 1, 1) . substr($hex,1,1));
9
-	    $color['b'] = hexdec(substr($hex, 2, 1) . substr($hex,2,1));
7
+		$color['r'] = hexdec(substr($hex, 0, 1) . substr($hex,0,1));
8
+		$color['g'] = hexdec(substr($hex, 1, 1) . substr($hex,1,1));
9
+		$color['b'] = hexdec(substr($hex, 2, 1) . substr($hex,2,1));
10 10
 	} else if (strlen($hex) == 6) {
11
-	    $color['r'] = hexdec(substr($hex, 0, 2));
12
-	    $color['g'] = hexdec(substr($hex, 2, 2));
13
-	    $color['b'] = hexdec(substr($hex, 4, 2));
11
+		$color['r'] = hexdec(substr($hex, 0, 2));
12
+		$color['g'] = hexdec(substr($hex, 2, 2));
13
+		$color['b'] = hexdec(substr($hex, 4, 2));
14 14
 	}
15 15
 	return $color;
16 16
 }
17 17
 
18 18
 
19 19
 if (!isset($_GET['color']) || $_GET['color'] == '' || !preg_match('/^([a-fA-F0-9]){3}(([a-fA-F0-9]){3})?\b/',$_GET['color'])) { 
20
-    exit(0);
20
+	exit(0);
21 21
 }
22 22
 $color = $_GET['color'];
23 23
 if (!isset($_GET['filename']) || !preg_match('/^[a-z0-9-_]+\.png$/', strtolower($_GET['filename']))) {
24
-    echo "Incorrect filename";
25
-    exit(0);
24
+	echo "Incorrect filename";
25
+	exit(0);
26 26
 }
27 27
 $filename = $_GET['filename'];
28 28
 if (file_exists(dirname(__FILE__).'/cache/'.$color.'-'.$filename) && is_readable(dirname(__FILE__).'/cache/'.$color.'-'.$filename)) {
29
-    header('Content-type: image/png');
30
-    readfile(dirname(__FILE__).'/cache/'.$color.'-'.$filename);
31
-    exit(0);
29
+	header('Content-type: image/png');
30
+	readfile(dirname(__FILE__).'/cache/'.$color.'-'.$filename);
31
+	exit(0);
32 32
 }
33 33
 if (isset($_GET['tracker'])) {
34 34
 	$original = dirname(__FILE__).'/images/vehicules/color/'.$filename;
@@ -45,68 +45,68 @@  discard block
 block discarded – undo
45 45
 	$original = dirname(__FILE__).'/images/aircrafts/new/'.$filename;
46 46
 }
47 47
 if (!file_exists($original)) {
48
-    echo "File not found";
48
+	echo "File not found";
49 49
 }
50 50
 
51 51
 if (extension_loaded('gd') && function_exists('gd_info')) {
52
-    $image = imagecreatefrompng($original);
53
-    $index = imagecolorexact($image,26,49,81);
54
-    if ($index < 0) {
52
+	$image = imagecreatefrompng($original);
53
+	$index = imagecolorexact($image,26,49,81);
54
+	if ($index < 0) {
55 55
 	$index = imagecolorexact($image,25,49,79);
56
-    }
57
-    if ($index < 0) {
56
+	}
57
+	if ($index < 0) {
58 58
 	$index = imagecolorexact($image,0,0,0);
59
-    }
60
-    $c = hexToRGB($color);
61
-    imagecolorset($image,$index,$c['r'],$c['g'],$c['b']);
59
+	}
60
+	$c = hexToRGB($color);
61
+	imagecolorset($image,$index,$c['r'],$c['g'],$c['b']);
62 62
  /*
63 63
     $ig = imagecolorat($image, 0, 0);
64 64
     imagecolortransparent($image, $ig);
65 65
    */
66 66
 
67
-    header('Content-type: image/png');
68
-    if (isset($_GET['resize']) && function_exists('imagecopyresampled')) {
67
+	header('Content-type: image/png');
68
+	if (isset($_GET['resize']) && function_exists('imagecopyresampled')) {
69 69
 	$resize = filter_input(INPUT_GET,'resize',FILTER_SANITIZE_NUMBER_INT);
70 70
 	$newimg = imagecreatetruecolor($resize,$resize);
71
-        imagealphablending($newimg, false);
71
+		imagealphablending($newimg, false);
72 72
 	imagesavealpha($newimg, true);
73 73
 	imagecopyresampled($newimg,$image,0,0,0,0,15,15,imagesx($image),imagesy($image));
74 74
 	if (isset($_GET['heading'])) {
75
-    	    $heading = filter_input(INPUT_GET,'heading',FILTER_SANITIZE_NUMBER_INT);
76
-    	    $rotation = imagerotate($newimg,$heading,imageColorAllocateAlpha($newimg,0,0,0,127));
77
-    	    imagealphablending($rotation, false);
78
-	    imagesavealpha($rotation, true);
79
-    	    imagepng($rotation);
80
-    	    imagedestroy($newimg);
81
-    	    imagedestroy($image);
82
-    	    imagedestroy($rotation);
75
+			$heading = filter_input(INPUT_GET,'heading',FILTER_SANITIZE_NUMBER_INT);
76
+			$rotation = imagerotate($newimg,$heading,imageColorAllocateAlpha($newimg,0,0,0,127));
77
+			imagealphablending($rotation, false);
78
+		imagesavealpha($rotation, true);
79
+			imagepng($rotation);
80
+			imagedestroy($newimg);
81
+			imagedestroy($image);
82
+			imagedestroy($rotation);
83 83
 	
84 84
 	} else {
85
-    	    imagepng($newimg);
86
-    	    imagedestroy($newimg);
87
-    	    imagedestroy($image);
88
-        }
89
-    } else {
85
+			imagepng($newimg);
86
+			imagedestroy($newimg);
87
+			imagedestroy($image);
88
+		}
89
+	} else {
90 90
 	imagealphablending($image, false);
91
-        imagesavealpha($image, true);
91
+		imagesavealpha($image, true);
92 92
 	imagepng($image);
93 93
 	imagepng($image);
94 94
 	if (is_writable(dirname(__FILE__).'/cache')) {
95
-    	    imagepng($image,dirname(__FILE__).'/cache/'.$color.'-'.$filename);
95
+			imagepng($image,dirname(__FILE__).'/cache/'.$color.'-'.$filename);
96
+	}
97
+		imagedestroy($image);
96 98
 	}
97
-        imagedestroy($image);
98
-    }
99 99
 } else {
100
-    header('Content-type: image/png');
101
-    if (isset($_GET['tracker'])) {
102
-        readfile(dirname(__FILE__).'/images/vehicules/'.$filename);
103
-    } elseif (isset($_GET['marine'])) {
104
-        readfile(dirname(__FILE__).'/images/vehicules/'.$filename);
105
-    } elseif (isset($_GET['satellite'])) {
106
-        readfile(dirname(__FILE__).'/images/satellites/'.$filename);
107
-    } else {
108
-        if ($color == 'FF0000') readfile(dirname(__FILE__).'/images/aircrafts/selected/'.$filename);
100
+	header('Content-type: image/png');
101
+	if (isset($_GET['tracker'])) {
102
+		readfile(dirname(__FILE__).'/images/vehicules/'.$filename);
103
+	} elseif (isset($_GET['marine'])) {
104
+		readfile(dirname(__FILE__).'/images/vehicules/'.$filename);
105
+	} elseif (isset($_GET['satellite'])) {
106
+		readfile(dirname(__FILE__).'/images/satellites/'.$filename);
107
+	} else {
108
+		if ($color == 'FF0000') readfile(dirname(__FILE__).'/images/aircrafts/selected/'.$filename);
109 109
 	else readfile(dirname(__FILE__).'/images/aircrafts/'.$filename);
110
-    }
110
+	}
111 111
 }
112 112
 ?>
113 113
\ No newline at end of file
Please login to merge, or discard this patch.