Completed
Push — master ( 118bb3...d652ce )
by Yannick
29:38
created
footer.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,12 +2,12 @@
 block discarded – undo
2 2
 
3 3
 <footer class="container">
4 4
 	<?php
5
-	    if (isset($sql_time)) {
5
+		if (isset($sql_time)) {
6 6
 	?>
7 7
 	<i><?php echo _("Page generated in").' '.round($sql_time+$page_time,2); ?>s (<?php print round($page_time,2); ?>ms PHP - <?php print round($sql_time,2); ?>ms SQL)</i>
8 8
 	<br />
9 9
 	<?php
10
-	    }
10
+		}
11 11
 	?>
12 12
 	<span>Developed in Barrie by <a href="http://mtru.nz/" target="_blank">Mario Trunz</a> & at <a href="http://www.zugaina.com" target="_blank">Zugaina</a> by Ycarus</span> - <span><a href="<?php if (isset($globalURL)) print $globalURL; ?>/about#source">Source &amp; Credits</a></span> - <span><a href="https://www.flightairmap.fr/" target="_blank">Get source code</a></span>
13 13
 </footer>
Please login to merge, or discard this patch.
require/class.Tracker.php 1 patch
Indentation   +195 added lines, -195 removed lines patch added patch discarded remove patch
@@ -13,10 +13,10 @@  discard block
 block discarded – undo
13 13
 	}
14 14
 
15 15
 	/**
16
-	* Get SQL query part for filter used
17
-	* @param Array $filter the filter
18
-	* @return Array the SQL part
19
-	*/
16
+	 * Get SQL query part for filter used
17
+	 * @param Array $filter the filter
18
+	 * @return Array the SQL part
19
+	 */
20 20
 	
21 21
 	public function getFilter($filter = array(),$where = false,$and = false) {
22 22
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
@@ -80,14 +80,14 @@  discard block
 block discarded – undo
80 80
 	}
81 81
 
82 82
 	/**
83
-	* Executes the SQL statements to get the spotter information
84
-	*
85
-	* @param String $query the SQL query
86
-	* @param Array $params parameter of the query
87
-	* @param String $limitQuery the limit query
88
-	* @return Array the spotter information
89
-	*
90
-	*/
83
+	 * Executes the SQL statements to get the spotter information
84
+	 *
85
+	 * @param String $query the SQL query
86
+	 * @param Array $params parameter of the query
87
+	 * @param String $limitQuery the limit query
88
+	 * @return Array the spotter information
89
+	 *
90
+	 */
91 91
 	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
92 92
 	{
93 93
 		date_default_timezone_set('UTC');
@@ -200,11 +200,11 @@  discard block
 block discarded – undo
200 200
 	
201 201
 	
202 202
 	/**
203
-	* Gets all the spotter information based on the latest data entry
204
-	*
205
-	* @return Array the spotter information
206
-	*
207
-	*/
203
+	 * Gets all the spotter information based on the latest data entry
204
+	 *
205
+	 * @return Array the spotter information
206
+	 *
207
+	 */
208 208
 	public function getLatestTrackerData($limit = '', $sort = '', $filter = array())
209 209
 	{
210 210
 		global $global_query;
@@ -262,11 +262,11 @@  discard block
 block discarded – undo
262 262
 	}
263 263
 
264 264
 	/**
265
-	* Gets all the spotter information based on the callsign
266
-	*
267
-	* @return Array the spotter information
268
-	*
269
-	*/
265
+	 * Gets all the spotter information based on the callsign
266
+	 *
267
+	 * @return Array the spotter information
268
+	 *
269
+	 */
270 270
 	public function getTrackerDataByIdent($ident = '', $limit = '', $sort = '', $filter = array())
271 271
 	{
272 272
 		global $global_query;
@@ -377,12 +377,12 @@  discard block
 block discarded – undo
377 377
 
378 378
 
379 379
 	/**
380
-	* Gets all source name
381
-	*
382
-	* @param String type format of source
383
-	* @return Array list of source name
384
-	*
385
-	*/
380
+	 * Gets all source name
381
+	 *
382
+	 * @param String type format of source
383
+	 * @return Array list of source name
384
+	 *
385
+	 */
386 386
 	public function getAllSourceName($type = '',$filters = array())
387 387
 	{
388 388
 		$filter_query = $this->getFilter($filters,true,true);
@@ -412,11 +412,11 @@  discard block
 block discarded – undo
412 412
 
413 413
 
414 414
 	/**
415
-	* Gets a list of all idents/callsigns
416
-	*
417
-	* @return Array list of ident/callsign names
418
-	*
419
-	*/
415
+	 * Gets a list of all idents/callsigns
416
+	 *
417
+	 * @return Array list of ident/callsign names
418
+	 *
419
+	 */
420 420
 	public function getAllIdents($filters = array())
421 421
 	{
422 422
 		$filter_query = $this->getFilter($filters,true,true);
@@ -484,18 +484,18 @@  discard block
 block discarded – undo
484 484
 	
485 485
 	
486 486
 	/**
487
-	* Update ident spotter data
488
-	*
489
-	* @param String $flightaware_id the ID from flightaware
490
-	* @param String $ident the flight ident
491
-	* @return String success or false
492
-	*
493
-	*/	
487
+	 * Update ident spotter data
488
+	 *
489
+	 * @param String $flightaware_id the ID from flightaware
490
+	 * @param String $ident the flight ident
491
+	 * @return String success or false
492
+	 *
493
+	 */	
494 494
 	public function updateIdentTrackerData($famtrackid = '', $ident = '',$fromsource = NULL)
495 495
 	{
496 496
 
497 497
 		$query = 'UPDATE tracker_output SET ident = :ident WHERE famtrackid = :famtrackid';
498
-                $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident);
498
+				$query_values = array(':famtrackid' => $famtrackid,':ident' => $ident);
499 499
 
500 500
 		try {
501 501
 			$sth = $this->db->prepare($query);
@@ -508,18 +508,18 @@  discard block
 block discarded – undo
508 508
 
509 509
 	}
510 510
 	/**
511
-	* Update latest spotter data
512
-	*
513
-	* @param String $flightaware_id the ID from flightaware
514
-	* @param String $ident the flight ident
515
-	* @param String $arrival_airport_icao the arrival airport
516
-	* @return String success or false
517
-	*
518
-	*/	
511
+	 * Update latest spotter data
512
+	 *
513
+	 * @param String $flightaware_id the ID from flightaware
514
+	 * @param String $ident the flight ident
515
+	 * @param String $arrival_airport_icao the arrival airport
516
+	 * @return String success or false
517
+	 *
518
+	 */	
519 519
 	public function updateLatestTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $groundspeed = NULL, $date = '')
520 520
 	{
521 521
 		$query = 'UPDATE tracker_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_seen = :last_seen, last_ground_speed = :last_ground_speed WHERE famtrackid = :famtrackid';
522
-                $query_values = array(':famtrackid' => $famtrackid,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident);
522
+				$query_values = array(':famtrackid' => $famtrackid,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident);
523 523
 
524 524
 		try {
525 525
 			$sth = $this->db->prepare($query);
@@ -533,32 +533,32 @@  discard block
 block discarded – undo
533 533
 	}
534 534
 
535 535
 	/**
536
-	* Adds a new spotter data
537
-	*
538
-	* @param String $flightaware_id the ID from flightaware
539
-	* @param String $ident the flight ident
540
-	* @param String $aircraft_icao the aircraft type
541
-	* @param String $departure_airport_icao the departure airport
542
-	* @param String $arrival_airport_icao the arrival airport
543
-	* @param String $latitude latitude of flight
544
-	* @param String $longitude latitude of flight
545
-	* @param String $waypoints waypoints of flight
546
-	* @param String $altitude altitude of flight
547
-	* @param String $heading heading of flight
548
-	* @param String $groundspeed speed of flight
549
-	* @param String $date date of flight
550
-	* @param String $departure_airport_time departure time of flight
551
-	* @param String $arrival_airport_time arrival time of flight
552
-	* @param String $squawk squawk code of flight
553
-	* @param String $route_stop route stop of flight
554
-	* @param String $highlight highlight or not
555
-	* @param String $ModeS ModesS code of flight
556
-	* @param String $registration registration code of flight
557
-	* @param String $pilot_id pilot id of flight (for virtual airlines)
558
-	* @param String $pilot_name pilot name of flight (for virtual airlines)
559
-	* @param String $verticalrate vertival rate of flight
560
-	* @return String success or false
561
-	*/
536
+	 * Adds a new spotter data
537
+	 *
538
+	 * @param String $flightaware_id the ID from flightaware
539
+	 * @param String $ident the flight ident
540
+	 * @param String $aircraft_icao the aircraft type
541
+	 * @param String $departure_airport_icao the departure airport
542
+	 * @param String $arrival_airport_icao the arrival airport
543
+	 * @param String $latitude latitude of flight
544
+	 * @param String $longitude latitude of flight
545
+	 * @param String $waypoints waypoints of flight
546
+	 * @param String $altitude altitude of flight
547
+	 * @param String $heading heading of flight
548
+	 * @param String $groundspeed speed of flight
549
+	 * @param String $date date of flight
550
+	 * @param String $departure_airport_time departure time of flight
551
+	 * @param String $arrival_airport_time arrival time of flight
552
+	 * @param String $squawk squawk code of flight
553
+	 * @param String $route_stop route stop of flight
554
+	 * @param String $highlight highlight or not
555
+	 * @param String $ModeS ModesS code of flight
556
+	 * @param String $registration registration code of flight
557
+	 * @param String $pilot_id pilot id of flight (for virtual airlines)
558
+	 * @param String $pilot_name pilot name of flight (for virtual airlines)
559
+	 * @param String $verticalrate vertival rate of flight
560
+	 * @return String success or false
561
+	 */
562 562
 	public function addTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $comment = '', $type = '',$format_source = '', $source_name = '')
563 563
 	{
564 564
 		global $globalURL;
@@ -643,16 +643,16 @@  discard block
 block discarded – undo
643 643
 		$comment = filter_var($comment,FILTER_SANITIZE_STRING);
644 644
 		$type = filter_var($type,FILTER_SANITIZE_STRING);
645 645
 	
646
-                if ($latitude == '' && $longitude == '') {
647
-            		$latitude = 0;
648
-            		$longitude = 0;
649
-            	}
650
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
651
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
652
-                $query  = "INSERT INTO tracker_output (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, comment, type) 
646
+				if ($latitude == '' && $longitude == '') {
647
+					$latitude = 0;
648
+					$longitude = 0;
649
+				}
650
+				if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
651
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
652
+				$query  = "INSERT INTO tracker_output (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, comment, type) 
653 653
                 VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:speed,:date,:format_source, :source_name,:comment,:type)";
654 654
 
655
-                $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':altitude' => $altitude,':heading' => $heading,':speed' => $groundspeed,':date' => $date,':format_source' => $format_source, ':source_name' => $source_name,':comment' => $comment,':type' => $type);
655
+				$query_values = array(':famtrackid' => $famtrackid,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':altitude' => $altitude,':heading' => $heading,':speed' => $groundspeed,':date' => $date,':format_source' => $format_source, ':source_name' => $source_name,':comment' => $comment,':type' => $type);
656 656
 
657 657
 		try {
658 658
 		        
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
 			$sth->execute($query_values);
661 661
 			$this->db = null;
662 662
 		} catch (PDOException $e) {
663
-		    return "error : ".$e->getMessage();
663
+			return "error : ".$e->getMessage();
664 664
 		}
665 665
 		
666 666
 		return "success";
@@ -669,11 +669,11 @@  discard block
 block discarded – undo
669 669
 	
670 670
   
671 671
 	/**
672
-	* Gets the aircraft ident within the last hour
673
-	*
674
-	* @return String the ident
675
-	*
676
-	*/
672
+	 * Gets the aircraft ident within the last hour
673
+	 *
674
+	 * @return String the ident
675
+	 *
676
+	 */
677 677
 	public function getIdentFromLastHour($ident)
678 678
 	{
679 679
 		global $globalDBdriver, $globalTimezone;
@@ -689,11 +689,11 @@  discard block
 block discarded – undo
689 689
 								AND tracker_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
690 690
 								AND tracker_output.date < now() AT TIME ZONE 'UTC'";
691 691
 			$query_data = array(':ident' => $ident);
692
-    		}
692
+			}
693 693
 		
694 694
 		$sth = $this->db->prepare($query);
695 695
 		$sth->execute($query_data);
696
-    		$ident_result='';
696
+			$ident_result='';
697 697
 		while($row = $sth->fetch(PDO::FETCH_ASSOC))
698 698
 		{
699 699
 			$ident_result = $row['ident'];
@@ -704,11 +704,11 @@  discard block
 block discarded – undo
704 704
 	
705 705
 	
706 706
 	/**
707
-	* Gets the aircraft data from the last 20 seconds
708
-	*
709
-	* @return Array the spotter data
710
-	*
711
-	*/
707
+	 * Gets the aircraft data from the last 20 seconds
708
+	 *
709
+	 * @return Array the spotter data
710
+	 *
711
+	 */
712 712
 	public function getRealTimeData($q = '')
713 713
 	{
714 714
 		global $globalDBdriver;
@@ -746,11 +746,11 @@  discard block
 block discarded – undo
746 746
 	
747 747
 
748 748
 	/**
749
-	* Gets all number of flight over countries
750
-	*
751
-	* @return Array the airline country list
752
-	*
753
-	*/
749
+	 * Gets all number of flight over countries
750
+	 *
751
+	 * @return Array the airline country list
752
+	 *
753
+	 */
754 754
 
755 755
 	public function countAllTrackerOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
756 756
 	{
@@ -821,11 +821,11 @@  discard block
 block discarded – undo
821 821
 	}
822 822
 	
823 823
 	/**
824
-	* Gets all callsigns that have flown over
825
-	*
826
-	* @return Array the callsign list
827
-	*
828
-	*/
824
+	 * Gets all callsigns that have flown over
825
+	 *
826
+	 * @return Array the callsign list
827
+	 *
828
+	 */
829 829
 	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
830 830
 	{
831 831
 		global $globalDBdriver;
@@ -892,11 +892,11 @@  discard block
 block discarded – undo
892 892
 
893 893
 
894 894
 	/**
895
-	* Counts all dates
896
-	*
897
-	* @return Array the date list
898
-	*
899
-	*/
895
+	 * Counts all dates
896
+	 *
897
+	 * @return Array the date list
898
+	 *
899
+	 */
900 900
 	public function countAllDates($filters = array())
901 901
 	{
902 902
 		global $globalTimezone, $globalDBdriver;
@@ -942,11 +942,11 @@  discard block
 block discarded – undo
942 942
 	
943 943
 	
944 944
 	/**
945
-	* Counts all dates during the last 7 days
946
-	*
947
-	* @return Array the date list
948
-	*
949
-	*/
945
+	 * Counts all dates during the last 7 days
946
+	 *
947
+	 * @return Array the date list
948
+	 *
949
+	 */
950 950
 	public function countAllDatesLast7Days($filters = array())
951 951
 	{
952 952
 		global $globalTimezone, $globalDBdriver;
@@ -968,7 +968,7 @@  discard block
 block discarded – undo
968 968
 			$query .= " GROUP BY date_name 
969 969
 								ORDER BY date_name ASC";
970 970
 			$query_data = array(':offset' => $offset);
971
-    		}
971
+			}
972 972
 		
973 973
 		$sth = $this->db->prepare($query);
974 974
 		$sth->execute($query_data);
@@ -988,11 +988,11 @@  discard block
 block discarded – undo
988 988
 	}
989 989
 
990 990
 	/**
991
-	* Counts all dates during the last month
992
-	*
993
-	* @return Array the date list
994
-	*
995
-	*/
991
+	 * Counts all dates during the last month
992
+	 *
993
+	 * @return Array the date list
994
+	 *
995
+	 */
996 996
 	public function countAllDatesLastMonth($filters = array())
997 997
 	{
998 998
 		global $globalTimezone, $globalDBdriver;
@@ -1014,7 +1014,7 @@  discard block
 block discarded – undo
1014 1014
 			$query .= " GROUP BY date_name 
1015 1015
 								ORDER BY date_name ASC";
1016 1016
 			$query_data = array(':offset' => $offset);
1017
-    		}
1017
+			}
1018 1018
 		
1019 1019
 		$sth = $this->db->prepare($query);
1020 1020
 		$sth->execute($query_data);
@@ -1036,11 +1036,11 @@  discard block
 block discarded – undo
1036 1036
 
1037 1037
 
1038 1038
 	/**
1039
-	* Counts all month
1040
-	*
1041
-	* @return Array the month list
1042
-	*
1043
-	*/
1039
+	 * Counts all month
1040
+	 *
1041
+	 * @return Array the month list
1042
+	 *
1043
+	 */
1044 1044
 	public function countAllMonths($filters = array())
1045 1045
 	{
1046 1046
 		global $globalTimezone, $globalDBdriver;
@@ -1085,11 +1085,11 @@  discard block
 block discarded – undo
1085 1085
 	
1086 1086
 
1087 1087
 	/**
1088
-	* Counts all dates during the last year
1089
-	*
1090
-	* @return Array the date list
1091
-	*
1092
-	*/
1088
+	 * Counts all dates during the last year
1089
+	 *
1090
+	 * @return Array the date list
1091
+	 *
1092
+	 */
1093 1093
 	public function countAllMonthsLastYear($filters)
1094 1094
 	{
1095 1095
 		global $globalTimezone, $globalDBdriver;
@@ -1111,7 +1111,7 @@  discard block
 block discarded – undo
1111 1111
 			$query .= " GROUP BY year_name, month_name
1112 1112
 								ORDER BY year_name, month_name ASC";
1113 1113
 			$query_data = array(':offset' => $offset);
1114
-    		}
1114
+			}
1115 1115
 		
1116 1116
 		$sth = $this->db->prepare($query);
1117 1117
 		$sth->execute($query_data);
@@ -1134,11 +1134,11 @@  discard block
 block discarded – undo
1134 1134
 	
1135 1135
 	
1136 1136
 	/**
1137
-	* Counts all hours
1138
-	*
1139
-	* @return Array the hour list
1140
-	*
1141
-	*/
1137
+	 * Counts all hours
1138
+	 *
1139
+	 * @return Array the hour list
1140
+	 *
1141
+	 */
1142 1142
 	public function countAllHours($orderby,$filters = array())
1143 1143
 	{
1144 1144
 		global $globalTimezone, $globalDBdriver;
@@ -1201,11 +1201,11 @@  discard block
 block discarded – undo
1201 1201
 	
1202 1202
 	
1203 1203
 	/**
1204
-	* Counts all hours by date
1205
-	*
1206
-	* @return Array the hour list
1207
-	*
1208
-	*/
1204
+	 * Counts all hours by date
1205
+	 *
1206
+	 * @return Array the hour list
1207
+	 *
1208
+	 */
1209 1209
 	public function countAllHoursByDate($date, $filters = array())
1210 1210
 	{
1211 1211
 		global $globalTimezone, $globalDBdriver;
@@ -1249,11 +1249,11 @@  discard block
 block discarded – undo
1249 1249
 	
1250 1250
 	
1251 1251
 	/**
1252
-	* Counts all hours by a ident/callsign
1253
-	*
1254
-	* @return Array the hour list
1255
-	*
1256
-	*/
1252
+	 * Counts all hours by a ident/callsign
1253
+	 *
1254
+	 * @return Array the hour list
1255
+	 *
1256
+	 */
1257 1257
 	public function countAllHoursByIdent($ident, $filters = array())
1258 1258
 	{
1259 1259
 		global $globalTimezone, $globalDBdriver;
@@ -1298,11 +1298,11 @@  discard block
 block discarded – undo
1298 1298
 	
1299 1299
 	
1300 1300
 	/**
1301
-	* Counts all flights that have flown over
1302
-	*
1303
-	* @return Integer the number of flights
1304
-	*
1305
-	*/
1301
+	 * Counts all flights that have flown over
1302
+	 *
1303
+	 * @return Integer the number of flights
1304
+	 *
1305
+	 */
1306 1306
 	public function countOverallTracker($filters = array(),$year = '',$month = '')
1307 1307
 	{
1308 1308
 		global $globalDBdriver;
@@ -1338,11 +1338,11 @@  discard block
 block discarded – undo
1338 1338
 	
1339 1339
   
1340 1340
 	/**
1341
-	* Counts all hours of today
1342
-	*
1343
-	* @return Array the hour list
1344
-	*
1345
-	*/
1341
+	 * Counts all hours of today
1342
+	 *
1343
+	 * @return Array the hour list
1344
+	 *
1345
+	 */
1346 1346
 	public function countAllHoursFromToday($filters = array())
1347 1347
 	{
1348 1348
 		global $globalTimezone, $globalDBdriver;
@@ -1382,12 +1382,12 @@  discard block
 block discarded – undo
1382 1382
 	}
1383 1383
     
1384 1384
     
1385
-     /**
1386
-	* Gets the Barrie Spotter ID based on the FlightAware ID
1387
-	*
1388
-	* @return Integer the Barrie Spotter ID
1385
+	 /**
1386
+	  * Gets the Barrie Spotter ID based on the FlightAware ID
1387
+	  *
1388
+	  * @return Integer the Barrie Spotter ID
1389 1389
 q	*
1390
-	*/
1390
+	  */
1391 1391
 	public function getTrackerIDBasedOnFamTrackID($famtrackid)
1392 1392
 	{
1393 1393
 		$famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING);
@@ -1408,13 +1408,13 @@  discard block
 block discarded – undo
1408 1408
   
1409 1409
  
1410 1410
 	/**
1411
-	* Parses a date string
1412
-	*
1413
-	* @param String $dateString the date string
1414
-	* @param String $timezone the timezone of a user
1415
-	* @return Array the time information
1416
-	*
1417
-	*/
1411
+	 * Parses a date string
1412
+	 *
1413
+	 * @param String $dateString the date string
1414
+	 * @param String $timezone the timezone of a user
1415
+	 * @return Array the time information
1416
+	 *
1417
+	 */
1418 1418
 	public function parseDateString($dateString, $timezone = '')
1419 1419
 	{
1420 1420
 		$time_array = array();
@@ -1447,12 +1447,12 @@  discard block
 block discarded – undo
1447 1447
 	}
1448 1448
 	
1449 1449
 	/**
1450
-	* Parses the direction degrees to working
1451
-	*
1452
-	* @param Float $direction the direction in degrees
1453
-	* @return Array the direction information
1454
-	*
1455
-	*/
1450
+	 * Parses the direction degrees to working
1451
+	 *
1452
+	 * @param Float $direction the direction in degrees
1453
+	 * @return Array the direction information
1454
+	 *
1455
+	 */
1456 1456
 	public function parseDirection($direction = 0)
1457 1457
 	{
1458 1458
 		if ($direction == '') $direction = 0;
@@ -1531,12 +1531,12 @@  discard block
 block discarded – undo
1531 1531
 	
1532 1532
 	
1533 1533
 	/**
1534
-	* Gets Country from latitude/longitude
1535
-	*
1536
-	* @param Float $latitude latitute of the flight
1537
-	* @param Float $longitude longitute of the flight
1538
-	* @return String the countrie
1539
-	*/
1534
+	 * Gets Country from latitude/longitude
1535
+	 *
1536
+	 * @param Float $latitude latitute of the flight
1537
+	 * @param Float $longitude longitute of the flight
1538
+	 * @return String the countrie
1539
+	 */
1540 1540
 	public function getCountryFromLatitudeLongitude($latitude,$longitude)
1541 1541
 	{
1542 1542
 		global $globalDBdriver, $globalDebug;
@@ -1573,11 +1573,11 @@  discard block
 block discarded – undo
1573 1573
 	}
1574 1574
 
1575 1575
 	/**
1576
-	* Gets Country from iso2
1577
-	*
1578
-	* @param String $iso2 ISO2 country code
1579
-	* @return String the countrie
1580
-	*/
1576
+	 * Gets Country from iso2
1577
+	 *
1578
+	 * @param String $iso2 ISO2 country code
1579
+	 * @return String the countrie
1580
+	 */
1581 1581
 	public function getCountryFromISO2($iso2)
1582 1582
 	{
1583 1583
 		global $globalDBdriver, $globalDebug;
@@ -1606,12 +1606,12 @@  discard block
 block discarded – undo
1606 1606
 
1607 1607
 	
1608 1608
 	/**
1609
-	* Gets the short url from bit.ly
1610
-	*
1611
-	* @param String $url the full url
1612
-	* @return String the bit.ly url
1613
-	*
1614
-	*/
1609
+	 * Gets the short url from bit.ly
1610
+	 *
1611
+	 * @param String $url the full url
1612
+	 * @return String the bit.ly url
1613
+	 *
1614
+	 */
1615 1615
 	public function getBitlyURL($url)
1616 1616
 	{
1617 1617
 		global $globalBitlyAccessToken;
Please login to merge, or discard this patch.
require/class.TrackerImport.php 1 patch
Indentation   +140 added lines, -140 removed lines patch added patch discarded remove patch
@@ -7,16 +7,16 @@  discard block
 block discarded – undo
7 7
 require_once(dirname(__FILE__).'/class.Source.php');
8 8
 
9 9
 class TrackerImport {
10
-    private $all_tracked = array();
11
-    private $last_delete_hourly = 0;
12
-    private $last_delete = 0;
13
-    private $stats = array();
14
-    private $tmd = 0;
15
-    private $source_location = array();
16
-    public $db = null;
17
-    public $nb = 0;
10
+	private $all_tracked = array();
11
+	private $last_delete_hourly = 0;
12
+	private $last_delete = 0;
13
+	private $stats = array();
14
+	private $tmd = 0;
15
+	private $source_location = array();
16
+	public $db = null;
17
+	public $nb = 0;
18 18
 
19
-    public function __construct($dbc = null) {
19
+	public function __construct($dbc = null) {
20 20
 	global $globalBeta;
21 21
 	$Connection = new Connection($dbc);
22 22
 	$this->db = $Connection->db();
@@ -38,50 +38,50 @@  discard block
 block discarded – undo
38 38
 	    }
39 39
 	}
40 40
 	*/
41
-    }
41
+	}
42 42
 
43
-    public function checkAll() {
43
+	public function checkAll() {
44 44
 	global $globalDebug;
45 45
 	if ($globalDebug) echo "Update last seen tracked data...\n";
46 46
 	foreach ($this->all_tracked as $key => $flight) {
47
-	    if (isset($this->all_tracked[$key]['id'])) {
47
+		if (isset($this->all_tracked[$key]['id'])) {
48 48
 		//echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].'  '.$this->all_tracked[$key]['longitude']."\n";
49
-    		$Tracker = new Tracker($this->db);
50
-        	$Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']);
51
-            }
49
+			$Tracker = new Tracker($this->db);
50
+			$Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']);
51
+			}
52
+	}
52 53
 	}
53
-    }
54 54
 
55
-    public function del() {
55
+	public function del() {
56 56
 	global $globalDebug;
57 57
 	// Delete old infos
58 58
 	if ($globalDebug) echo 'Delete old values and update latest data...'."\n";
59 59
 	foreach ($this->all_tracked as $key => $flight) {
60
-    	    if (isset($flight['lastupdate'])) {
61
-        	if ($flight['lastupdate'] < (time()-3000)) {
62
-            	    if (isset($this->all_tracked[$key]['id'])) {
63
-            		if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n";
60
+			if (isset($flight['lastupdate'])) {
61
+			if ($flight['lastupdate'] < (time()-3000)) {
62
+					if (isset($this->all_tracked[$key]['id'])) {
63
+					if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n";
64 64
 			/*
65 65
 			$TrackerLive = new TrackerLive();
66 66
             		$TrackerLive->deleteLiveTrackerDataById($this->all_tracked[$key]['id']);
67 67
 			$TrackerLive->db = null;
68 68
 			*/
69
-            		//$real_arrival = $this->arrival($key);
70
-            		$Tracker = new Tracker($this->db);
71
-            		if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') {
69
+					//$real_arrival = $this->arrival($key);
70
+					$Tracker = new Tracker($this->db);
71
+					if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') {
72 72
 				$result = $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed']);
73 73
 				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
74 74
 			}
75 75
 			// Put in archive
76 76
 //			$Tracker->db = null;
77
-            	    }
78
-            	    unset($this->all_tracked[$key]);
79
-    	        }
80
-	    }
81
-        }
82
-    }
77
+					}
78
+					unset($this->all_tracked[$key]);
79
+				}
80
+		}
81
+		}
82
+	}
83 83
 
84
-    public function add($line) {
84
+	public function add($line) {
85 85
 	global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked;
86 86
 	if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02';
87 87
 	date_default_timezone_set('UTC');
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
 	
91 91
 	// SBS format is CSV format
92 92
 	if(is_array($line) && isset($line['ident'])) {
93
-	    //print_r($line);
94
-  	    if (isset($line['ident'])) {
93
+		//print_r($line);
94
+  		if (isset($line['ident'])) {
95 95
 
96 96
 		/*
97 97
 		// Increment message number
@@ -107,29 +107,29 @@  discard block
 block discarded – undo
107 107
 		*/
108 108
 		
109 109
 		$Common = new Common();
110
-	        if (!isset($line['id'])) $id = trim($line['ident']);
111
-	        else $id = trim($line['id']);
110
+			if (!isset($line['id'])) $id = trim($line['ident']);
111
+			else $id = trim($line['id']);
112 112
 		
113 113
 		if (!isset($this->all_tracked[$id])) {
114
-		    $this->all_tracked[$id] = array();
115
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedTracker' => 0));
116
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','noarchive' => false,'putinarchive' => true,'over_country' => ''));
117
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time()));
118
-		    if (!isset($line['id'])) {
114
+			$this->all_tracked[$id] = array();
115
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedTracker' => 0));
116
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','noarchive' => false,'putinarchive' => true,'over_country' => ''));
117
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time()));
118
+			if (!isset($line['id'])) {
119 119
 			if (!isset($globalDaemon)) $globalDaemon = TRUE;
120 120
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi')));
121
-		     } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id']));
122
-		    if ($globalAllTracked !== FALSE) $dataFound = true;
121
+			 } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id']));
122
+			if ($globalAllTracked !== FALSE) $dataFound = true;
123 123
 		}
124 124
 		
125 125
 		if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) {
126
-		    if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_tracked[$id]['datetime'])) {
126
+			if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_tracked[$id]['datetime'])) {
127 127
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime']));
128
-		    } else {
128
+			} else {
129 129
 				if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n";
130 130
 				elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n";
131 131
 				return '';
132
-		    }
132
+			}
133 133
 		} elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) {
134 134
 			if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!";
135 135
 			return '';
@@ -146,38 +146,38 @@  discard block
 block discarded – undo
146 146
 		
147 147
 		//if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9-]+$/', $line['ident'])) {
148 148
 		if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident']))) {
149
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident'])));
150
-		    if ($this->all_tracked[$id]['addedTracker'] == 1) {
149
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident'])));
150
+			if ($this->all_tracked[$id]['addedTracker'] == 1) {
151 151
 			$timeelapsed = microtime(true);
152
-            		$Tracker = new Tracker($this->db);
153
-            		$fromsource = NULL;
154
-            		$result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource);
152
+					$Tracker = new Tracker($this->db);
153
+					$fromsource = NULL;
154
+					$result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource);
155 155
 			if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
156 156
 			$Tracker->db = null;
157 157
 			if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
158
-		    }
159
-		    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident']));
158
+			}
159
+			if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident']));
160 160
 		}
161 161
 
162 162
 		if (isset($line['speed']) && $line['speed'] != '') {
163
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed'])));
164
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true));
163
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed'])));
164
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true));
165 165
 		} else if (!isset($this->all_tracked[$id]['speed_fromsrc']) && isset($this->all_tracked[$id]['time_last_coord']) && $this->all_tracked[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) {
166
-		    $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m');
167
-		    if ($distance > 100 && $distance < 10000) {
166
+			$distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m');
167
+			if ($distance > 100 && $distance < 10000) {
168 168
 			$speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']);
169 169
 			$speed = $speed*3.6;
170 170
 			if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed)));
171 171
   			if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['ident']." : ".$speed." - distance : ".$distance."\n";
172
-		    }
172
+			}
173 173
 		}
174 174
 
175
-	        if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) {
176
-	    	    if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']);
177
-	    	    else unset($timediff);
178
-	    	    if ($this->tmd > 5 || !isset($timediff) || $timediff > 100 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) {
175
+			if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) {
176
+				if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']);
177
+				else unset($timediff);
178
+				if ($this->tmd > 5 || !isset($timediff) || $timediff > 100 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) {
179 179
 			if (isset($this->all_tracked[$id]['archive_latitude']) && isset($this->all_tracked[$id]['archive_longitude']) && isset($this->all_tracked[$id]['livedb_latitude']) && isset($this->all_tracked[$id]['livedb_longitude'])) {
180
-			    if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) {
180
+				if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) {
181 181
 				$this->all_tracked[$id]['archive_latitude'] = $line['latitude'];
182 182
 				$this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
183 183
 				$this->all_tracked[$id]['putinarchive'] = true;
@@ -191,120 +191,120 @@  discard block
 block discarded – undo
191 191
 				if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
192 192
 				$this->tmd = 0;
193 193
 				if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n";
194
-			    }
194
+				}
195 195
 			}
196 196
 
197 197
 			if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) {
198 198
 				if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude'];
199 199
 				if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') {
200
-				    $this->all_tracked[$id]['livedb_latitude'] = $line['latitude'];
201
-				    $dataFound = true;
202
-				    $this->all_tracked[$id]['time_last_coord'] = time();
200
+					$this->all_tracked[$id]['livedb_latitude'] = $line['latitude'];
201
+					$dataFound = true;
202
+					$this->all_tracked[$id]['time_last_coord'] = time();
203 203
 				}
204 204
 				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude']));
205 205
 			}
206 206
 			if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) {
207
-			    if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
207
+				if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
208 208
 				if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
209 209
 				if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') {
210
-				    $this->all_tracked[$id]['livedb_longitude'] = $line['longitude'];
211
-				    $dataFound = true;
212
-				    $this->all_tracked[$id]['time_last_coord'] = time();
210
+					$this->all_tracked[$id]['livedb_longitude'] = $line['longitude'];
211
+					$dataFound = true;
212
+					$this->all_tracked[$id]['time_last_coord'] = time();
213 213
 				}
214 214
 				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('longitude' => $line['longitude']));
215 215
 			}
216 216
 
217
-		    } else if ($globalDebug && $timediff > 20) {
217
+			} else if ($globalDebug && $timediff > 20) {
218 218
 			$this->tmd = $this->tmd + 1;
219 219
 			echo '!!! Too much distance in short time... for '.$this->all_tracked[$id]['ident']."\n";
220 220
 			echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')."m -";
221 221
 			echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')/$timediff)*3.6)." km/h - ";
222 222
 			echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_tracked[$id]['latitude'].' - prev long : '.$this->all_tracked[$id]['longitude']." \n";
223
-		    }
223
+			}
224 224
 		}
225 225
 		if (isset($line['last_update']) && $line['last_update'] != '') {
226
-		    if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true;
227
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update']));
226
+			if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true;
227
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update']));
228 228
 		}
229 229
 		if (isset($line['format_source']) && $line['format_source'] != '') {
230
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source']));
230
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source']));
231 231
 		}
232 232
 		if (isset($line['source_name']) && $line['source_name'] != '') {
233
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name']));
233
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name']));
234 234
 		}
235 235
 		if (isset($line['comment']) && $line['comment'] != '') {
236
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('comment' => $line['comment']));
237
-		    //$dataFound = true;
236
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('comment' => $line['comment']));
237
+			//$dataFound = true;
238 238
 		}
239 239
 		if (isset($line['type']) && $line['type'] != '') {
240
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type']));
241
-		    //$dataFound = true;
240
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type']));
241
+			//$dataFound = true;
242 242
 		}
243 243
 
244 244
 		if (isset($line['altitude']) && $line['altitude'] != '') {
245
-		    //if (!isset($this->all_tracked[$id]['altitude']) || $this->all_tracked[$id]['altitude'] == '' || ($this->all_tracked[$id]['altitude'] > 0 && $line['altitude'] != 0)) {
245
+			//if (!isset($this->all_tracked[$id]['altitude']) || $this->all_tracked[$id]['altitude'] == '' || ($this->all_tracked[$id]['altitude'] > 0 && $line['altitude'] != 0)) {
246 246
 			if (is_int($this->all_tracked[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_tracked[$id]['altitude']) > 3) $this->all_tracked[$id]['putinarchive'] = true;
247 247
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude' => round($line['altitude']/100)));
248 248
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude_real' => $line['altitude']));
249 249
 			//$dataFound = true;
250
-		    //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n";
250
+			//} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n";
251 251
   		}
252 252
 
253 253
 		if (isset($line['noarchive']) && $line['noarchive'] === true) {
254
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true));
254
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true));
255 255
 		}
256 256
 		
257 257
 		if (isset($line['heading']) && $line['heading'] != '') {
258
-		    if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true;
259
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading'])));
260
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true));
261
-		    //$dataFound = true;
258
+			if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true;
259
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading'])));
260
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true));
261
+			//$dataFound = true;
262 262
   		} elseif (!isset($this->all_tracked[$id]['heading_fromsrc']) && isset($this->all_tracked[$id]['archive_latitude']) && $this->all_tracked[$id]['archive_latitude'] != $this->all_tracked[$id]['latitude'] && isset($this->all_tracked[$id]['archive_longitude']) && $this->all_tracked[$id]['archive_longitude'] != $this->all_tracked[$id]['longitude']) {
263
-  		    $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']);
264
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading)));
265
-		    if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true;
266
-  		    if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n";
263
+  			$heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']);
264
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading)));
265
+			if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true;
266
+  			if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n";
267 267
   		}
268 268
 		//if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false;
269 269
 
270 270
 		if ($dataFound === true && isset($this->all_tracked[$id]['ident'])) {
271
-		    $this->all_tracked[$id]['lastupdate'] = time();
272
-		    if ($this->all_tracked[$id]['addedTracker'] == 0) {
273
-		        if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == ''  || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
274
-			    if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) {
271
+			$this->all_tracked[$id]['lastupdate'] = time();
272
+			if ($this->all_tracked[$id]['addedTracker'] == 0) {
273
+				if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == ''  || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
274
+				if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) {
275 275
 				if ($globalDebug) echo "Check if aircraft is already in DB...";
276 276
 				$timeelapsed = microtime(true);
277 277
 				$TrackerLive = new TrackerLive($this->db);
278 278
 				if (isset($line['id'])) {
279
-				    $recent_ident = $TrackerLive->checkIdRecent($line['id']);
280
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
279
+					$recent_ident = $TrackerLive->checkIdRecent($line['id']);
280
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
281 281
 				} elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') {
282
-				    $recent_ident = $TrackerLive->checkIdentRecent($this->all_tracked[$id]['ident']);
283
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
282
+					$recent_ident = $TrackerLive->checkIdentRecent($this->all_tracked[$id]['ident']);
283
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
284 284
 				} else $recent_ident = '';
285 285
 				$TrackerLive->db=null;
286 286
 
287 287
 				if ($globalDebug && $recent_ident == '') echo " Not in DB.\n";
288 288
 				elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n";
289
-			    } else {
289
+				} else {
290 290
 				$recent_ident = '';
291 291
 				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0));
292
-			    }
293
-			    //if there was no aircraft with the same callsign within the last hour and go post it into the archive
294
-			    if($recent_ident == "")
295
-			    {
292
+				}
293
+				//if there was no aircraft with the same callsign within the last hour and go post it into the archive
294
+				if($recent_ident == "")
295
+				{
296 296
 				if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : ";
297 297
 				//adds the spotter data for the archive
298
-				    $highlight = '';
299
-				    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi')));
300
-				    $timeelapsed = microtime(true);
301
-				    $Tracker = new Tracker($this->db);
302
-				    $result = $Tracker->addTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']);
303
-				    $Tracker->db = null;
304
-				    if ($globalDebug && isset($result)) echo $result."\n";
305
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
298
+					$highlight = '';
299
+					if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi')));
300
+					$timeelapsed = microtime(true);
301
+					$Tracker = new Tracker($this->db);
302
+					$result = $Tracker->addTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']);
303
+					$Tracker->db = null;
304
+					if ($globalDebug && isset($result)) echo $result."\n";
305
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
306 306
 				    
307
-				    /*
307
+					/*
308 308
 				    // Add source stat in DB
309 309
 				    $Stats = new Stats($this->db);
310 310
 				    if (!empty($this->stats)) {
@@ -331,20 +331,20 @@  discard block
 block discarded – undo
331 331
 				    }
332 332
 				    $Stats->db = null;
333 333
 				    */
334
-				    $this->del();
334
+					$this->del();
335 335
 				//$ignoreImport = false;
336 336
 				$this->all_tracked[$id]['addedTracker'] = 1;
337 337
 				//print_r($this->all_tracked[$id]);
338 338
 				if ($this->last_delete == 0 || time() - $this->last_delete > 1800) {
339
-				    if ($globalDebug) echo "---- Deleting Live Tracker data older than 9 hours...";
340
-				    //TrackerLive->deleteLiveTrackerDataNotUpdated();
341
-				    $TrackerLive = new TrackerLive($this->db);
342
-				    $TrackerLive->deleteLiveTrackerData();
343
-				    $TrackerLive->db=null;
344
-				    if ($globalDebug) echo " Done\n";
345
-				    $this->last_delete = time();
339
+					if ($globalDebug) echo "---- Deleting Live Tracker data older than 9 hours...";
340
+					//TrackerLive->deleteLiveTrackerDataNotUpdated();
341
+					$TrackerLive = new TrackerLive($this->db);
342
+					$TrackerLive->deleteLiveTrackerData();
343
+					$TrackerLive->db=null;
344
+					if ($globalDebug) echo " Done\n";
345
+					$this->last_delete = time();
346 346
 				}
347
-			    } else {
347
+				} else {
348 348
 				$this->all_tracked[$id]['id'] = $recent_ident;
349 349
 				$this->all_tracked[$id]['addedTracker'] = 1;
350 350
 				if (isset($globalDaemon) && !$globalDaemon) {
@@ -353,16 +353,16 @@  discard block
 block discarded – undo
353 353
 					$Tracker->db = null;
354 354
 				}
355 355
 				
356
-			    }
356
+				}
357
+			}
357 358
 			}
358
-		    }
359
-		    //adds the spotter LIVE data
360
-		    if ($globalDebug) {
359
+			//adds the spotter LIVE data
360
+			if ($globalDebug) {
361 361
 			echo 'DATA : ident : '.$this->all_tracked[$id]['ident'].' - type : '.$this->all_tracked[$id]['type'].' - Latitude : '.$this->all_tracked[$id]['latitude'].' - Longitude : '.$this->all_tracked[$id]['longitude'].' - Altitude : '.$this->all_tracked[$id]['altitude'].' - Heading : '.$this->all_tracked[$id]['heading'].' - Speed : '.$this->all_tracked[$id]['speed']."\n";
362
-		    }
363
-		    $ignoreImport = false;
362
+			}
363
+			$ignoreImport = false;
364 364
 
365
-		    if (!$ignoreImport) {
365
+			if (!$ignoreImport) {
366 366
 			if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
367 367
 				if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : ";
368 368
 				$timeelapsed = microtime(true);
@@ -434,22 +434,22 @@  discard block
 block discarded – undo
434 434
 			
435 435
 			
436 436
 			if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) {
437
-			    if ($globalDebug) echo "---- Deleting Live Tracker data Not updated since 2 hour...";
438
-			    $TrackerLive = new TrackerLive($this->db);
439
-			    $TrackerLive->deleteLiveTrackerDataNotUpdated();
440
-			    $TrackerLive->db = null;
441
-			    //TrackerLive->deleteLiveTrackerData();
442
-			    if ($globalDebug) echo " Done\n";
443
-			    $this->last_delete_hourly = time();
437
+				if ($globalDebug) echo "---- Deleting Live Tracker data Not updated since 2 hour...";
438
+				$TrackerLive = new TrackerLive($this->db);
439
+				$TrackerLive->deleteLiveTrackerDataNotUpdated();
440
+				$TrackerLive->db = null;
441
+				//TrackerLive->deleteLiveTrackerData();
442
+				if ($globalDebug) echo " Done\n";
443
+				$this->last_delete_hourly = time();
444 444
 			}
445 445
 			
446
-		    }
447
-		    //$ignoreImport = false;
446
+			}
447
+			//$ignoreImport = false;
448 448
 		}
449 449
 		//if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN);
450 450
 		if ($send) return $this->all_tracked[$id];
451
-	    }
451
+		}
452
+	}
452 453
 	}
453
-    }
454 454
 }
455 455
 ?>
Please login to merge, or discard this patch.
require/class.APRS.php 1 patch
Indentation   +144 added lines, -144 removed lines patch added patch discarded remove patch
@@ -2,10 +2,10 @@  discard block
 block discarded – undo
2 2
 require_once(dirname(__FILE__).'/settings.php');
3 3
 require_once(dirname(__FILE__).'/class.Common.php');
4 4
 class aprs {
5
-    private $socket;
6
-    private $connected = false;
5
+	private $socket;
6
+	private $connected = false;
7 7
 
8
-    protected $symbols = array('!' => 'Police',
8
+	protected $symbols = array('!' => 'Police',
9 9
 	'#' => 'DIGI',
10 10
 	'$' => 'Phone',
11 11
 	'%' => 'DX Cluster',
@@ -89,13 +89,13 @@  discard block
 block discarded – undo
89 89
 	'y' => 'Yagi At QTH');
90 90
 	
91 91
 
92
-    private function urshift($n, $s) {
92
+	private function urshift($n, $s) {
93 93
 	return ($n >= 0) ? ($n >> $s) :
94
-	    (($n & 0x7fffffff) >> $s) | 
94
+		(($n & 0x7fffffff) >> $s) | 
95 95
 		(0x40000000 >> ($s - 1));
96
-    }
96
+	}
97 97
 
98
-    public function parse($input) {
98
+	public function parse($input) {
99 99
 	global $globalDebug;
100 100
 	$debug = false;
101 101
 	$result = array();
@@ -107,8 +107,8 @@  discard block
 block discarded – undo
107 107
 	
108 108
 	/* Check that end was found and body has at least one byte. */
109 109
 	if ($splitpos == 0 || $splitpos + 1 == $input_len || $splitpos === FALSE) {
110
-	    if ($globalDebug) echo '!!! APRS invalid : '.$input."\n";
111
-	    return false;
110
+		if ($globalDebug) echo '!!! APRS invalid : '.$input."\n";
111
+		return false;
112 112
 	}
113 113
 	
114 114
 	if ($debug) echo 'input : '.$input."\n";
@@ -122,31 +122,31 @@  discard block
 block discarded – undo
122 122
 	/* Parse source, target and path. */
123 123
 	//FLRDF0A52>APRS,qAS,LSTB
124 124
 	if (preg_match('/^([A-Z0-9\\-]{1,9})>(.*)$/',$header,$matches)) {
125
-	    $ident = $matches[1];
126
-	    $all_elements = $matches[2];
127
-	    if ($ident == 'AIRCRAFT') {
125
+		$ident = $matches[1];
126
+		$all_elements = $matches[2];
127
+		if ($ident == 'AIRCRAFT') {
128 128
 		$result['format_source'] = 'famaprs';
129 129
 		$result['source_type'] = 'modes';
130
-	    } elseif ($ident == 'MARINE') {
130
+		} elseif ($ident == 'MARINE') {
131 131
 		$result['format_source'] = 'famaprs';
132 132
 		$result['source_type'] = 'ais';
133
-	    } else {
133
+		} else {
134 134
 		if ($debug) echo 'ident : '.$ident."\n";
135 135
 		$result['ident'] = $ident;
136
-	    }
136
+		}
137 137
 	} else return false;
138 138
 	$elements = explode(',',$all_elements);
139 139
 	$source = end($elements);
140 140
 	$result['source'] = $source;
141 141
 	foreach ($elements as $element) {
142
-	    if (preg_match('/^([a-zA-Z0-9-]{1,9})([*]?)$/',$element)) {
143
-	        //echo "ok";
144
-	        //if ($element == 'TCPIP*') return false;
145
-	    } elseif (!preg_match('/^([0-9A-F]{32})$/',$element)) {
142
+		if (preg_match('/^([a-zA-Z0-9-]{1,9})([*]?)$/',$element)) {
143
+			//echo "ok";
144
+			//if ($element == 'TCPIP*') return false;
145
+		} elseif (!preg_match('/^([0-9A-F]{32})$/',$element)) {
146 146
 		if ($debug) echo 'element : '.$element."\n";
147 147
 		return false;
148
-	    }
149
-	    /*
148
+		}
149
+		/*
150 150
 	    } elseif (preg_match('/^([0-9A-F]{32})$/',$element)) {
151 151
 		//echo "ok";
152 152
 	    } else {
@@ -173,49 +173,49 @@  discard block
 block discarded – undo
173 173
 	$body_parse = substr($body,1);
174 174
 	//echo 'Body : '.$body."\n";
175 175
 	if (preg_match('/^;(.){9}\*/',$body,$matches)) {
176
-	    $body_parse = substr($body_parse,10);
177
-	    $find = true;
178
-	    //echo $body_parse."\n";
176
+		$body_parse = substr($body_parse,10);
177
+		$find = true;
178
+		//echo $body_parse."\n";
179 179
 	}
180 180
 	if (preg_match('/^`(.*)\//',$body,$matches)) {
181
-	    $body_parse = substr($body_parse,strlen($matches[1])-1);
182
-	    $find = true;
183
-	    //echo $body_parse."\n";
181
+		$body_parse = substr($body_parse,strlen($matches[1])-1);
182
+		$find = true;
183
+		//echo $body_parse."\n";
184 184
 	}
185 185
 	if (preg_match("/^'(.*)\//",$body,$matches)) {
186
-	    $body_parse = substr($body_parse,strlen($matches[1])-1);
187
-	    $find = true;
188
-	    //echo $body_parse."\n";
186
+		$body_parse = substr($body_parse,strlen($matches[1])-1);
187
+		$find = true;
188
+		//echo $body_parse."\n";
189 189
 	}
190 190
 	if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([zh\\/])/',$body_parse,$matches)) {
191
-	    $find = true;
192
-	    //print_r($matches);
193
-	    $timestamp = $matches[0];
194
-	    if ($matches[4] == 'h') {
191
+		$find = true;
192
+		//print_r($matches);
193
+		$timestamp = $matches[0];
194
+		if ($matches[4] == 'h') {
195 195
 		$timestamp = strtotime(date('Ymd').' '.$matches[1].':'.$matches[2].':'.$matches[3]);
196 196
 		//echo 'timestamp : '.$timestamp.' - now : '.time()."\n";
197 197
 		/*
198 198
 		if (time() + 3900 < $timestamp) $timestamp -= 86400;
199 199
 		elseif (time() - 82500 > $timestamp) $timestamp += 86400;
200 200
 		*/
201
-	    } elseif ($matches[4] == 'z' || $matches[4] == '/') {
201
+		} elseif ($matches[4] == 'z' || $matches[4] == '/') {
202 202
 		// This work or not ?
203 203
 		$timestamp = strtotime(date('Ym').$matches[1].' '.$matches[2].':'.$matches[3]);
204
-	    }
205
-	    $body_parse = substr($body_parse,7);
206
-	    $result['timestamp'] = $timestamp;
207
-	    //echo date('Ymd H:i:s',$timestamp);
204
+		}
205
+		$body_parse = substr($body_parse,7);
206
+		$result['timestamp'] = $timestamp;
207
+		//echo date('Ymd H:i:s',$timestamp);
208 208
 	}
209 209
 	if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})/',$body_parse,$matches)) {
210
-	    $find = true;
211
-	    $timestamp = strtotime(date('Y').$matches[1].$matches[2].' '.$matches[3].':'.$matches[4]);
212
-	    $body_parse = substr($body_parse,8);
213
-	    $result['timestamp'] = $timestamp;
214
-	    //echo date('Ymd H:i:s',$timestamp);
210
+		$find = true;
211
+		$timestamp = strtotime(date('Y').$matches[1].$matches[2].' '.$matches[3].':'.$matches[4]);
212
+		$body_parse = substr($body_parse,8);
213
+		$result['timestamp'] = $timestamp;
214
+		//echo date('Ymd H:i:s',$timestamp);
215 215
 	}
216 216
 	//if (strlen($body_parse) > 19) {
217
-	    if (preg_match('/^([0-9]{2})([0-7 ][0-9 ]\\.[0-9 ]{2})([NnSs])(.)([0-9]{3})([0-7 ][0-9 ]\\.[0-9 ]{2})([EeWw])(.)/',$body_parse,$matches)) {
218
-	    $find = true;
217
+		if (preg_match('/^([0-9]{2})([0-7 ][0-9 ]\\.[0-9 ]{2})([NnSs])(.)([0-9]{3})([0-7 ][0-9 ]\\.[0-9 ]{2})([EeWw])(.)/',$body_parse,$matches)) {
218
+		$find = true;
219 219
 		// 4658.70N/00707.78Ez
220 220
 		//print_r(str_split($body_parse));
221 221
 		
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 		$lon = intval($lon_deg);
233 233
 		if ($lat > 89 || $lon > 179) return false;
234 234
 	    
235
-	    /*
235
+		/*
236 236
 	    $tmp_5b = str_replace('.','',$lat_min);
237 237
 	    if (preg_match('/^([0-9]{0,4})( {0,4})$/',$tmp_5b,$matches)) {
238 238
 	        print_r($matches);
@@ -246,9 +246,9 @@  discard block
 block discarded – undo
246 246
 		$result['longitude'] = $longitude;
247 247
 		$body_parse = substr($body_parse,18);
248 248
 		$body_parse_len = strlen($body_parse);
249
-	    }
250
-	    $body_parse_len = strlen($body_parse);
251
-	    if ($body_parse_len > 0) {
249
+		}
250
+		$body_parse_len = strlen($body_parse);
251
+		if ($body_parse_len > 0) {
252 252
 		/*
253 253
 		if (!isset($result['timestamp']) && !isset($result['latitude'])) {
254 254
 			$body_split = str_split($body);
@@ -278,95 +278,95 @@  discard block
 block discarded – undo
278 278
 			if (isset($this->symbols[$symbol_code])) $result['symbol'] = $this->symbols[$symbol_code];
279 279
 			if ($symbol_code != '_') {
280 280
 			}
281
-		    //$body_parse = substr($body_parse,1);
282
-		    //$body_parse = trim($body_parse);
283
-		    //$body_parse_len = strlen($body_parse);
284
-		    if ($body_parse_len >= 7) {
281
+			//$body_parse = substr($body_parse,1);
282
+			//$body_parse = trim($body_parse);
283
+			//$body_parse_len = strlen($body_parse);
284
+			if ($body_parse_len >= 7) {
285 285
 			
286
-		        if (preg_match('/^([0-9\\. ]{3})\\/([0-9\\. ]{3})/',$body_parse)) {
287
-		    	    $course = substr($body_parse,0,3);
288
-		    	    $tmp_s = intval($course);
289
-		    	    if ($tmp_s >= 1 && $tmp_s <= 360) $result['heading'] = intval($course);
290
-		    	    $speed = substr($body_parse,4,3);
291
-		    	    if ($speed != '...') {
292
-		    		//$result['speed'] = round($speed*1.852);
293
-		    		$result['speed'] = intval($speed);
294
-		    	    }
295
-		    	    $body_parse = substr($body_parse,7);
296
-		        }
297
-		        // Check PHGR, PHG, RNG
298
-		    } 
299
-		    /*
286
+				if (preg_match('/^([0-9\\. ]{3})\\/([0-9\\. ]{3})/',$body_parse)) {
287
+					$course = substr($body_parse,0,3);
288
+					$tmp_s = intval($course);
289
+					if ($tmp_s >= 1 && $tmp_s <= 360) $result['heading'] = intval($course);
290
+					$speed = substr($body_parse,4,3);
291
+					if ($speed != '...') {
292
+					//$result['speed'] = round($speed*1.852);
293
+					$result['speed'] = intval($speed);
294
+					}
295
+					$body_parse = substr($body_parse,7);
296
+				}
297
+				// Check PHGR, PHG, RNG
298
+			} 
299
+			/*
300 300
 		    else if ($body_parse_len > 0) {
301 301
 			$rest = $body_parse;
302 302
 		    }
303 303
 		    */
304
-		    if (strlen($body_parse) > 0) {
305
-		        if (preg_match('/\\/A=(-[0-9]{5}|[0-9]{6})/',$body_parse,$matches)) {
306
-		            $altitude = intval($matches[1]);
307
-		            //$result['altitude'] = round($altitude*0.3048);
308
-		            $result['altitude'] = $altitude;
309
-		            //$body_parse = trim(substr($body_parse,strlen($matches[0])));
310
-		            $body_parse = trim(preg_replace('/\\/A=(-[0-9]{5}|[0-9]{6})/','',$body_parse));
311
-		        }
312
-		    }
304
+			if (strlen($body_parse) > 0) {
305
+				if (preg_match('/\\/A=(-[0-9]{5}|[0-9]{6})/',$body_parse,$matches)) {
306
+					$altitude = intval($matches[1]);
307
+					//$result['altitude'] = round($altitude*0.3048);
308
+					$result['altitude'] = $altitude;
309
+					//$body_parse = trim(substr($body_parse,strlen($matches[0])));
310
+					$body_parse = trim(preg_replace('/\\/A=(-[0-9]{5}|[0-9]{6})/','',$body_parse));
311
+				}
312
+			}
313 313
 		    
314
-		    // Telemetry
315
-		    /*
314
+			// Telemetry
315
+			/*
316 316
 		    if (preg_match('/^([0-9]+),(-?)([0-9]{1,6}|[0-9]+\\.[0-9]+|\\.[0-9]+)?,(-?)([0-9]{1,6}|[0-9]+\\.[0-9]+|\\.[0-9]+)?,(-?)([0-9]{1,6}|[0-9]+\\.[0-9]+|\\.[0-9]+)?,(-?)([0-9]{1,6}|[0-9]+\\.[0-9]+|\\.[0-9]+)?,(-?)([0-9]{1,6}|[0-9]+\\.[0-9]+|\\.[0-9]+)?,([01]{0,8})/',$body_parse,$matches)) {
317 317
 		        // Nothing yet...
318 318
 		    }
319 319
 		    */
320
-		    // DAO
320
+			// DAO
321 321
 		    
322
-		    if (preg_match('/^!([0-9A-Z]{3})/',$body_parse,$matches)) {
322
+			if (preg_match('/^!([0-9A-Z]{3})/',$body_parse,$matches)) {
323 323
 			    
324
-			    $dao = $matches[1];
325
-			    if (preg_match('/^([A-Z])([0-9]{2})/',$dao)) {
324
+				$dao = $matches[1];
325
+				if (preg_match('/^([A-Z])([0-9]{2})/',$dao)) {
326 326
 				$dao_split = str_split($dao);
327
-			        $lat_off = (($dao_split[1])-48.0)*0.001/60.0;
328
-			        $lon_off = (($dao_split[2])-48.0)*0.001/60.0;
327
+					$lat_off = (($dao_split[1])-48.0)*0.001/60.0;
328
+					$lon_off = (($dao_split[2])-48.0)*0.001/60.0;
329 329
 			    
330 330
 				if ($result['latitude'] < 0) $result['latitude'] -= $lat_off;
331 331
 				else $result['latitude'] += $lat_off;
332 332
 				if ($result['longitude'] < 0) $result['longitude'] -= $lon_off;
333 333
 				else $result['longitude'] += $lon_off;
334
-			    }
334
+				}
335 335
 			    
336
-		            $body_parse = substr($body_parse,6);
337
-		    }
336
+					$body_parse = substr($body_parse,6);
337
+			}
338 338
 		    
339
-		    if (preg_match('/CS=([0-9A-Z_]*)/',$body_parse,$matches)) {
339
+			if (preg_match('/CS=([0-9A-Z_]*)/',$body_parse,$matches)) {
340 340
 			$result['ident'] = str_replace('_',' ',$matches[1]);
341
-		    }
342
-		    if (preg_match('/SQ=([0-9]{4})/',$body_parse,$matches)) {
341
+			}
342
+			if (preg_match('/SQ=([0-9]{4})/',$body_parse,$matches)) {
343 343
 			$result['squawk'] = $matches[1];
344
-		    }
345
-		    if (preg_match('/AI=([0-9A-Z]{4})/',$body_parse,$matches)) {
344
+			}
345
+			if (preg_match('/AI=([0-9A-Z]{4})/',$body_parse,$matches)) {
346 346
 			$result['aircraft_icao'] = $matches[1];
347
-		    }
348
-		    if (preg_match('/VR=([0-9]*)/',$body_parse,$matches)) {
347
+			}
348
+			if (preg_match('/VR=([0-9]*)/',$body_parse,$matches)) {
349 349
 			$result['verticalrate'] = $matches[1];
350
-		    }
351
-		    if (preg_match('/TI=([0-9]*)/',$body_parse,$matches)) {
350
+			}
351
+			if (preg_match('/TI=([0-9]*)/',$body_parse,$matches)) {
352 352
 			$result['typeid'] = $matches[1];
353
-		    }
354
-		    if (preg_match('/SI=([0-9]*)/',$body_parse,$matches)) {
353
+			}
354
+			if (preg_match('/SI=([0-9]*)/',$body_parse,$matches)) {
355 355
 			$result['statusid'] = $matches[1];
356
-		    }
357
-		    if (preg_match('/IMO=([0-9]{7})/',$body_parse,$matches)) {
356
+			}
357
+			if (preg_match('/IMO=([0-9]{7})/',$body_parse,$matches)) {
358 358
 			$result['imo'] = $matches[1];
359
-		    }
360
-		    if (preg_match('/AD=([0-9]*)/',$body_parse,$matches)) {
359
+			}
360
+			if (preg_match('/AD=([0-9]*)/',$body_parse,$matches)) {
361 361
 			$result['arrival_date'] = $matches[1];
362
-		    }
363
-		    if (preg_match('/AC=([0-9A-Z_]*)/',$body_parse,$matches)) {
362
+			}
363
+			if (preg_match('/AC=([0-9A-Z_]*)/',$body_parse,$matches)) {
364 364
 			$result['arrival_code'] = str_replace('_',' ',$matches[1]);
365
-		    }
366
-		    // OGN comment
365
+			}
366
+			// OGN comment
367 367
 		   // echo "Before OGN : ".$body_parse."\n";
368
-		    //if (preg_match('/^id([0-9A-F]{8}) ([+-])([0-9]{3,4})fpm ([+-])([0-9.]{3,4})rot (.*)$/',$body_parse,$matches)) {
369
-		    if (preg_match('/^id([0-9A-F]{8})/',$body_parse,$matches)) {
368
+			//if (preg_match('/^id([0-9A-F]{8}) ([+-])([0-9]{3,4})fpm ([+-])([0-9.]{3,4})rot (.*)$/',$body_parse,$matches)) {
369
+			if (preg_match('/^id([0-9A-F]{8})/',$body_parse,$matches)) {
370 370
 			$id = $matches[1];
371 371
 			//$mode = substr($id,0,2);
372 372
 			$address = substr($id,2);
@@ -396,53 +396,53 @@  discard block
 block discarded – undo
396 396
 			$stealth = (intval(substr($id,0,2), 16) & 0b10000000) != 0;
397 397
 			$result['stealth'] = $stealth;
398 398
 			$result['address'] = $address;
399
-		    }
399
+			}
400 400
 		    
401
-		    //Comment
402
-		    $result['comment'] = trim($body_parse);
401
+			//Comment
402
+			$result['comment'] = trim($body_parse);
403 403
 		} else {
404
-		    // parse weather
405
-		    //$body_parse = substr($body_parse,1);
406
-		    //$body_parse_len = strlen($body_parse);
404
+			// parse weather
405
+			//$body_parse = substr($body_parse,1);
406
+			//$body_parse_len = strlen($body_parse);
407 407
 
408
-		    if (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
409
-			    $result['wind_dir'] = intval($matches[1]);
410
-			    $result['wind_speed'] = round(intval($matches[2])*1.60934,1);
411
-			    $result['wind_gust'] = round(intval($matches[3])*1.60934,1);
412
-			    $result['temp'] = round(5/9*((intval($matches[4]))-32),1);
413
-		    	    $body_parse = substr($body_parse,strlen($matches[0])+1);
414
-		    } elseif (preg_match('/^_{0,1}c([0-9 \\.\\-]{3})s([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
408
+			if (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
409
+				$result['wind_dir'] = intval($matches[1]);
410
+				$result['wind_speed'] = round(intval($matches[2])*1.60934,1);
411
+				$result['wind_gust'] = round(intval($matches[3])*1.60934,1);
412
+				$result['temp'] = round(5/9*((intval($matches[4]))-32),1);
413
+					$body_parse = substr($body_parse,strlen($matches[0])+1);
414
+			} elseif (preg_match('/^_{0,1}c([0-9 \\.\\-]{3})s([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
415 415
 			$result['wind_dir'] = intval($matches[1]);
416 416
 			$result['wind_speed'] = round($matches[2]*1.60934,1);
417 417
 			$result['wind_gust'] = round($matches[3]*1.60934,1);
418 418
 			$result['temp'] = round(5/9*(($matches[4])-32),1);
419
-		        $body_parse = substr($body_parse,strlen($matches[0])+1);
420
-		    } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
419
+				$body_parse = substr($body_parse,strlen($matches[0])+1);
420
+			} elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
421 421
 			$result['wind_dir'] = intval($matches[1]);
422 422
 			$result['wind_speed'] = round($matches[2]*1.60934,1);
423 423
 			$result['wind_gust'] = round($matches[3]*1.60934,1);
424
-		        $body_parse = substr($body_parse,strlen($matches[0])+1);
425
-		    } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)/',$body_parse,$matches)) {
424
+				$body_parse = substr($body_parse,strlen($matches[0])+1);
425
+			} elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)/',$body_parse,$matches)) {
426 426
 			$result['wind_dir'] = intval($matches[1]);
427 427
 			$result['wind_speed'] = round($matches[2]*1.60934,1);
428 428
 			$result['wind_gust'] = round($matches[3]*1.60934,1);
429
-		        $body_parse = substr($body_parse,strlen($matches[0])+1);
430
-		    }
431
-		    if (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9]+)t(-?[0-9 \\.]{1,3})/',$body_parse,$matches)) {
429
+				$body_parse = substr($body_parse,strlen($matches[0])+1);
430
+			}
431
+			if (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9]+)t(-?[0-9 \\.]{1,3})/',$body_parse,$matches)) {
432 432
 			$result['temp'] = round(5/9*(($matches[1])-32),1);
433
-		    }
433
+			}
434 434
 		}
435 435
 		} else $result['comment'] = trim($body_parse);
436 436
 
437
-	    }
437
+		}
438 438
 	//}
439 439
 	if (isset($result['latitude'])) $result['latitude'] = round($result['latitude'],4);
440 440
 	if (isset($result['longitude'])) $result['longitude'] = round($result['longitude'],4);
441 441
 	if ($debug) print_r($result);
442 442
 	return $result;
443
-    }
443
+	}
444 444
     
445
-    public function connect() {
445
+	public function connect() {
446 446
 	global $globalAPRSversion, $globalServerAPRSssid, $globalServerAPRSpass,$globalName, $globalServerAPRShost, $globalServerAPRSport;
447 447
 	$aprs_connect = 0;
448 448
 	$aprs_keep = 120;
@@ -465,32 +465,32 @@  discard block
 block discarded – undo
465 465
 		$send = socket_send( $this->socket  , $aprs_login , strlen($aprs_login) , 0 );
466 466
 		while ($msgin = socket_read($this->socket, 1000,PHP_NORMAL_READ)) {
467 467
 			if (strpos($msgin, "$aprs_ssid verified") !== FALSE) {
468
-			    echo 'APRS user verified !'."\n";
469
-			    $this->connected = true;
470
-			    return true;
471
-			    break;
468
+				echo 'APRS user verified !'."\n";
469
+				$this->connected = true;
470
+				return true;
471
+				break;
472 472
 			}
473 473
 			if (time()-$authstart > 5) {
474
-			    echo 'APRS timeout'."\n";
475
-			    break;
474
+				echo 'APRS timeout'."\n";
475
+				break;
476 476
 			}
477 477
 		}
478 478
 		socket_set_option($this->socket,SOL_SOCKET,SO_KEEPALIVE);
479 479
 	}
480
-    }
480
+	}
481 481
 
482
-    public function disconnect() {
482
+	public function disconnect() {
483 483
 	socket_close($this->socket);
484
-    }
484
+	}
485 485
     
486
-    public function send($data) {
486
+	public function send($data) {
487 487
 	if ($this->connected === false) $this->connect();
488 488
 	$send = socket_send( $this->socket  , $data , strlen($data),0);
489 489
 	if ($send === FALSE) {
490 490
 		socket_close($this->socket);
491 491
 		$this->connect();
492 492
 	}
493
-    }
493
+	}
494 494
 }
495 495
 
496 496
 class APRSSpotter extends APRS {
Please login to merge, or discard this patch.
require/class.SBS.php 1 patch
Indentation   +130 added lines, -130 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 class SBS {
3
-    static $latlon = array();
3
+	static $latlon = array();
4 4
     
5
-    public function parse($buffer) {
5
+	public function parse($buffer) {
6 6
 	// Not yet finished, no CRC checks
7 7
 	//echo $buffer."\n";
8 8
 	$data = array();
@@ -13,47 +13,47 @@  discard block
 block discarded – undo
13 13
 	$bin = gmp_strval( gmp_init($hex,16), 2);
14 14
 	//if (strlen($hex) == 28 && $this->parityCheck($hex,$bin)) {
15 15
 	if (strlen($hex) == 28) {
16
-	    $df = intval(substr($bin,0,5),2);
17
-	    //$ca = intval(substr($bin,5,3),2);
18
-	    // Only support DF17 for now
19
-	    //if ($df == 17 || ($df == 18 && ($ca == 0 || $ca == 1 || $ca == 6))) {
20
-	    if (($df == 17 || $df == 18) && ($this->parityCheck($hex,$bin) || $typehex == '@')) {
16
+		$df = intval(substr($bin,0,5),2);
17
+		//$ca = intval(substr($bin,5,3),2);
18
+		// Only support DF17 for now
19
+		//if ($df == 17 || ($df == 18 && ($ca == 0 || $ca == 1 || $ca == 6))) {
20
+		if (($df == 17 || $df == 18) && ($this->parityCheck($hex,$bin) || $typehex == '@')) {
21 21
 		$icao = substr($hex,2,6);
22 22
 		$data['hex'] = $icao;
23 23
 		$tc = intval(substr($bin,32,5),2);
24 24
 		if ($tc >= 1 && $tc <= 4) {
25
-		    //callsign
26
-		    $csbin = substr($bin,40,56);
27
-		    $charset = str_split('#ABCDEFGHIJKLMNOPQRSTUVWXYZ#####_###############0123456789######');
28
-		    $cs = '';
29
-		    $cs .= $charset[intval(substr($csbin,0,6),2)];
30
-		    $cs .= $charset[intval(substr($csbin,6,6),2)];
31
-		    $cs .= $charset[intval(substr($csbin,12,6),2)];
32
-		    $cs .= $charset[intval(substr($csbin,18,6),2)];
33
-		    $cs .= $charset[intval(substr($csbin,24,6),2)];
34
-		    $cs .= $charset[intval(substr($csbin,30,6),2)];
35
-		    $cs .= $charset[intval(substr($csbin,36,6),2)];
36
-		    $cs .= $charset[intval(substr($csbin,42,6),2)];
37
-		    $cs = str_replace('_','',$cs);
38
-		    $cs = str_replace('#','',$cs);
39
-		    $callsign = $cs;
40
-		    $data['ident'] = $callsign;
25
+			//callsign
26
+			$csbin = substr($bin,40,56);
27
+			$charset = str_split('#ABCDEFGHIJKLMNOPQRSTUVWXYZ#####_###############0123456789######');
28
+			$cs = '';
29
+			$cs .= $charset[intval(substr($csbin,0,6),2)];
30
+			$cs .= $charset[intval(substr($csbin,6,6),2)];
31
+			$cs .= $charset[intval(substr($csbin,12,6),2)];
32
+			$cs .= $charset[intval(substr($csbin,18,6),2)];
33
+			$cs .= $charset[intval(substr($csbin,24,6),2)];
34
+			$cs .= $charset[intval(substr($csbin,30,6),2)];
35
+			$cs .= $charset[intval(substr($csbin,36,6),2)];
36
+			$cs .= $charset[intval(substr($csbin,42,6),2)];
37
+			$cs = str_replace('_','',$cs);
38
+			$cs = str_replace('#','',$cs);
39
+			$callsign = $cs;
40
+			$data['ident'] = $callsign;
41 41
 		} elseif ($tc >= 9 && $tc <= 18) {
42
-		    // Check Q-bit
43
-		    $q = substr($bin,47,1);
44
-		    if ($q) {
42
+			// Check Q-bit
43
+			$q = substr($bin,47,1);
44
+			if ($q) {
45 45
 			$n = intval(substr($bin,40,7).substr($bin,48,4),2);
46 46
 			$alt = $n*25-1000;
47 47
 			$data['altitude'] = $alt;
48
-		    }
49
-		    // Check odd/even flag
50
-		    $oe = substr($bin,53,1);
51
-		    //if ($oe) => odd else even
52
-		    //  131072 is 2^17 since CPR latitude and longitude are encoded in 17 bits.
53
-		    $cprlat = intval(substr($bin,54,17),2)/131072.0;
54
-		    $cprlon = intval(substr($bin,71,17),2)/131072.0;
55
-		    if ($oe == 0) $this::$latlon[$icao] = array('latitude' => $cprlat,'longitude' => $cprlon,'created' => time());
56
-		    elseif (isset($this::$latlon[$icao]) && (time() - $this::$latlon[$icao]['created']) < 10) {
48
+			}
49
+			// Check odd/even flag
50
+			$oe = substr($bin,53,1);
51
+			//if ($oe) => odd else even
52
+			//  131072 is 2^17 since CPR latitude and longitude are encoded in 17 bits.
53
+			$cprlat = intval(substr($bin,54,17),2)/131072.0;
54
+			$cprlon = intval(substr($bin,71,17),2)/131072.0;
55
+			if ($oe == 0) $this::$latlon[$icao] = array('latitude' => $cprlat,'longitude' => $cprlon,'created' => time());
56
+			elseif (isset($this::$latlon[$icao]) && (time() - $this::$latlon[$icao]['created']) < 10) {
57 57
 			$cprlat_odd = $cprlat;
58 58
 			$cprlon_odd = $cprlon;
59 59
 			$cprlat_even = $this::$latlon[$icao]['latitude'];
@@ -66,53 +66,53 @@  discard block
 block discarded – undo
66 66
 			if ($lat_odd >= 270) $lat_odd = $lat_odd - 360;
67 67
 			// check latitude zone
68 68
 			if ($this->cprNL($lat_even) == $this->cprNL($lat_odd)) {
69
-			    if ($this::$latlon[$icao]['created'] > time()) {
69
+				if ($this::$latlon[$icao]['created'] > time()) {
70 70
 				$ni = $this->cprN($lat_even,0);
71 71
 				$m = floor($cprlon_even*($this->cprNL($lat_even)-1) - $cprlon_odd * $this->cprNL($lat_even)+0.5);
72 72
 				$lon = (360.0/$ni)*($m%$ni+$cprlon_even);
73 73
 				$lat = $lat_even;
74 74
 				if ($lon > 180) $lon = $lon -360;
75 75
 				if ($lat > -91 && $lat < 91 && $lon > -181 && $lon < 181) {
76
-				    //if ($globalDebug) echo 'cs : '.$cs.' - hex : '.$hex.' - lat : '.$lat.' - lon : '.$lon;
77
-				    $data['latitude'] = $lat;
78
-				    $data['longitude'] = $lon;
76
+					//if ($globalDebug) echo 'cs : '.$cs.' - hex : '.$hex.' - lat : '.$lat.' - lon : '.$lon;
77
+					$data['latitude'] = $lat;
78
+					$data['longitude'] = $lon;
79 79
 				}
80
-			    } else {
80
+				} else {
81 81
 				$ni = $this->cprN($lat_odd,1);
82 82
 				$m = floor($cprlon_even*($this->cprNL($lat_odd)-1) - $cprlon_odd * $this->cprNL($lat_odd)+0.5);
83 83
 				$lon = (360.0/$ni)*($m%$ni+$cprlon_odd);
84 84
 				$lat = $lat_odd;
85 85
 				if ($lon > 180) $lon = $lon -360;
86 86
 				if ($lat > -91 && $lat < 91 && $lon > -181 && $lon < 181) {
87
-				    //if ($globalDebug) echo 'icao : '.$icao.' - hex : '.$hex.' - lat : '.$lat.' - lon : '.$lon.' second'."\n";
88
-				    $data['latitude'] = $lat;
89
-				    $data['longitude'] = $lon;
87
+					//if ($globalDebug) echo 'icao : '.$icao.' - hex : '.$hex.' - lat : '.$lat.' - lon : '.$lon.' second'."\n";
88
+					$data['latitude'] = $lat;
89
+					$data['longitude'] = $lon;
90
+				}
90 91
 				}
91
-			    }
92 92
 			} else echo "Not cprNL";
93 93
 			unset($this::$latlon[$icao]);
94
-		    }
94
+			}
95 95
 		} elseif ($tc == 19) {
96
-		    // speed & heading
97
-		    $v_ew_dir = intval(substr($bin,45,1));
98
-		    $v_ew = intval(substr($bin,46,10),2);
99
-		    $v_ns_dir = intval(substr($bin,56,1));
100
-		    $v_ns = intval(substr($bin,57,10),2);
101
-		    if ($v_ew_dir) $v_ew = -1*$v_ew;
102
-		    if ($v_ns_dir) $v_ns = -1*$v_ns;
103
-		    $speed = sqrt($v_ns*$v_ns+$v_ew*$v_ew);
104
-		    $heading = atan2($v_ew,$v_ns)*360.0/(2*pi());
105
-		    if ($heading <0) $heading = $heading+360;
106
-		    $data['speed'] = $speed;
107
-		    $data['heading'] = $heading;
96
+			// speed & heading
97
+			$v_ew_dir = intval(substr($bin,45,1));
98
+			$v_ew = intval(substr($bin,46,10),2);
99
+			$v_ns_dir = intval(substr($bin,56,1));
100
+			$v_ns = intval(substr($bin,57,10),2);
101
+			if ($v_ew_dir) $v_ew = -1*$v_ew;
102
+			if ($v_ns_dir) $v_ns = -1*$v_ns;
103
+			$speed = sqrt($v_ns*$v_ns+$v_ew*$v_ew);
104
+			$heading = atan2($v_ew,$v_ns)*360.0/(2*pi());
105
+			if ($heading <0) $heading = $heading+360;
106
+			$data['speed'] = $speed;
107
+			$data['heading'] = $heading;
108
+		}
108 109
 		}
109
-	    }
110
-	    if (isset($data)) {
110
+		if (isset($data)) {
111 111
 		//print_r($data);
112 112
 		return $data;
113
-	    }
114
-        }
115
-    }
113
+		}
114
+		}
115
+	}
116 116
 
117 117
 
118 118
 	public function cprNL($lat) {
@@ -177,16 +177,16 @@  discard block
 block discarded – undo
177 177
 	if ($lat < 86.53536998) return 3;
178 178
 	if ($lat < 87.00000000) return 2;
179 179
 	return 1;
180
-    }
180
+	}
181 181
     
182
-    public function cprN($lat,$isodd) {
182
+	public function cprN($lat,$isodd) {
183 183
 	$nl = $this->cprNL($lat) - $isodd;
184 184
 	if ($nl > 1) return $nl;
185 185
 	else return 1;
186
-    }
186
+	}
187 187
 
188 188
 
189
-    function parityCheck($msg, $bin) {
189
+	function parityCheck($msg, $bin) {
190 190
 $modes_checksum_table = array(
191 191
 0x3935ea, 0x1c9af5, 0xf1b77e, 0x78dbbf, 0xc397db, 0x9e31e9, 0xb0e2f0, 0x587178,
192 192
 0x2c38bc, 0x161c5e, 0x0b0e2f, 0xfa7d13, 0x82c48d, 0xbe9842, 0x5f4c21, 0xd05c14,
@@ -208,75 +208,75 @@  discard block
 block discarded – undo
208 208
 	$checksum = intval(substr($msg,22,6),16);
209 209
 
210 210
 	for ($j = 0; $j < strlen($bin); $j++) {
211
-	    if ($bin[$j]) $crc = $crc^intval($modes_checksum_table[$j],0);
211
+		if ($bin[$j]) $crc = $crc^intval($modes_checksum_table[$j],0);
212 212
 	}
213 213
 	if ($crc == $checksum) return true;
214 214
 	else {
215
-	    //echo "**** CRC ERROR ****\n";
216
-	    return false;
215
+		//echo "**** CRC ERROR ****\n";
216
+		return false;
217
+	}
217 218
 	}
218
-    }
219 219
     
220
-    public function famaprs_to_basestation($data) {
220
+	public function famaprs_to_basestation($data) {
221 221
 	$result = array();
222
-        if (isset($data['ident']) && $data['ident'] != '') {
223
-	    $msg = array();
224
-	    $msg['msg_type'] = 'MSG';
225
-	    $msg['transmission_type'] = 1;
226
-	    $msg['session_id'] = 5;
227
-	    $msg['aircraftid'] = hexdec($data['address']);
228
-	    $msg['hex'] = $data['address'];
229
-	    $msg['flightid'] = hexdec($data['address']);
230
-	    $msg['date_gen'] = date('Y/m/d',$data['timestamp']);
231
-	    $msg['time_gen'] = date('H:i:s',$data['timestamp']).'.180';
232
-	    $msg['date_log'] = date('Y/m/d',$data['timestamp']);
233
-	    $msg['time_log'] = date('H:i:s',$data['timestamp']).'.180';
234
-	    $msg['callsign'] = $data['ident'];
235
-	    $msg['altitude'] = '';
236
-	    $msg['speed'] = '';
237
-	    $msg['track'] = '';
238
-	    $msg['latitude'] = '';
239
-	    $msg['longitude'] = '';
240
-	    $msg['verticalrate'] = '';
241
-	    $msg['squawk'] = '';
242
-	    $msg['alert'] = '';
243
-	    $msg['emergency'] = '';
244
-	    $msg['SPI'] = '';
245
-	    $msg['ground'] = '';
246
-    	    $result[] = implode(',',$msg);
247
-    	}
248
-    	if (isset($data['latitude']) && $data['latitude'] != 0) {
249
-	    $msg = array();
250
-	    $msg['msg_type'] = 'MSG';
251
-	    $msg['transmission_type'] = 2;
252
-	    $msg['session_id'] = 5;
253
-	    $msg['aircraftid'] = hexdec($data['address']);
254
-	    $msg['hex'] = $data['address'];
255
-	    $msg['flightid'] = hexdec($data['address']);
256
-	    $msg['date_gen'] = date('Y/m/d',$data['timestamp']);
257
-	    $msg['time_gen'] = date('H:i:s',$data['timestamp']).'.180';
258
-	    $msg['date_log'] = date('Y/m/d',$data['timestamp']);
259
-	    $msg['time_log'] = date('H:i:s',$data['timestamp']).'.180';
260
-	    $msg['callsign'] = '';
261
-	    if (isset($data['altitude'])) $msg['altitude'] = $data['altitude'];
262
-	    else $msg['altitude'] = '';
263
-	    $msg['speed'] = $data['speed'];
264
-	    if (isset($data['heading'])) $msg['track'] = $data['heading'];
265
-	    else $msg['track'] = '';
266
-	    $msg['latitude'] = $data['latitude'];
267
-	    $msg['longitude'] = $data['longitude'];
268
-	    if (isset($data['verticalrate'])) $msg['verticalrate'] = $data['verticalrate'];
269
-	    else $msg['verticalrate'] = '';
270
-	    if (isset($data['squawk'])) $msg['squawk'] = $data['squawk'];
271
-	    else $msg['squawk'] = 0;
272
-	    $msg['alert'] = 0;
273
-	    $msg['emergency'] = 0;
274
-	    $msg['SPI'] = 0;
275
-	    if (isset($data['ground'])) $msg['ground'] = 1;
276
-	    else $msg['ground'] = 0;
277
-    	    $result[] = implode(',',$msg);
278
-        }
279
-        return $result;
280
-    }
222
+		if (isset($data['ident']) && $data['ident'] != '') {
223
+		$msg = array();
224
+		$msg['msg_type'] = 'MSG';
225
+		$msg['transmission_type'] = 1;
226
+		$msg['session_id'] = 5;
227
+		$msg['aircraftid'] = hexdec($data['address']);
228
+		$msg['hex'] = $data['address'];
229
+		$msg['flightid'] = hexdec($data['address']);
230
+		$msg['date_gen'] = date('Y/m/d',$data['timestamp']);
231
+		$msg['time_gen'] = date('H:i:s',$data['timestamp']).'.180';
232
+		$msg['date_log'] = date('Y/m/d',$data['timestamp']);
233
+		$msg['time_log'] = date('H:i:s',$data['timestamp']).'.180';
234
+		$msg['callsign'] = $data['ident'];
235
+		$msg['altitude'] = '';
236
+		$msg['speed'] = '';
237
+		$msg['track'] = '';
238
+		$msg['latitude'] = '';
239
+		$msg['longitude'] = '';
240
+		$msg['verticalrate'] = '';
241
+		$msg['squawk'] = '';
242
+		$msg['alert'] = '';
243
+		$msg['emergency'] = '';
244
+		$msg['SPI'] = '';
245
+		$msg['ground'] = '';
246
+			$result[] = implode(',',$msg);
247
+		}
248
+		if (isset($data['latitude']) && $data['latitude'] != 0) {
249
+		$msg = array();
250
+		$msg['msg_type'] = 'MSG';
251
+		$msg['transmission_type'] = 2;
252
+		$msg['session_id'] = 5;
253
+		$msg['aircraftid'] = hexdec($data['address']);
254
+		$msg['hex'] = $data['address'];
255
+		$msg['flightid'] = hexdec($data['address']);
256
+		$msg['date_gen'] = date('Y/m/d',$data['timestamp']);
257
+		$msg['time_gen'] = date('H:i:s',$data['timestamp']).'.180';
258
+		$msg['date_log'] = date('Y/m/d',$data['timestamp']);
259
+		$msg['time_log'] = date('H:i:s',$data['timestamp']).'.180';
260
+		$msg['callsign'] = '';
261
+		if (isset($data['altitude'])) $msg['altitude'] = $data['altitude'];
262
+		else $msg['altitude'] = '';
263
+		$msg['speed'] = $data['speed'];
264
+		if (isset($data['heading'])) $msg['track'] = $data['heading'];
265
+		else $msg['track'] = '';
266
+		$msg['latitude'] = $data['latitude'];
267
+		$msg['longitude'] = $data['longitude'];
268
+		if (isset($data['verticalrate'])) $msg['verticalrate'] = $data['verticalrate'];
269
+		else $msg['verticalrate'] = '';
270
+		if (isset($data['squawk'])) $msg['squawk'] = $data['squawk'];
271
+		else $msg['squawk'] = 0;
272
+		$msg['alert'] = 0;
273
+		$msg['emergency'] = 0;
274
+		$msg['SPI'] = 0;
275
+		if (isset($data['ground'])) $msg['ground'] = 1;
276
+		else $msg['ground'] = 0;
277
+			$result[] = implode(',',$msg);
278
+		}
279
+		return $result;
280
+	}
281 281
 }
282 282
 ?>
Please login to merge, or discard this patch.
require/class.Marine.php 1 patch
Indentation   +205 added lines, -205 removed lines patch added patch discarded remove patch
@@ -11,10 +11,10 @@  discard block
 block discarded – undo
11 11
 	}
12 12
 
13 13
 	/**
14
-	* Get SQL query part for filter used
15
-	* @param Array $filter the filter
16
-	* @return Array the SQL part
17
-	*/
14
+	 * Get SQL query part for filter used
15
+	 * @param Array $filter the filter
16
+	 * @return Array the SQL part
17
+	 */
18 18
 	
19 19
 	public function getFilter($filter = array(),$where = false,$and = false) {
20 20
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
@@ -78,14 +78,14 @@  discard block
 block discarded – undo
78 78
 	}
79 79
 
80 80
 	/**
81
-	* Executes the SQL statements to get the spotter information
82
-	*
83
-	* @param String $query the SQL query
84
-	* @param Array $params parameter of the query
85
-	* @param String $limitQuery the limit query
86
-	* @return Array the spotter information
87
-	*
88
-	*/
81
+	 * Executes the SQL statements to get the spotter information
82
+	 *
83
+	 * @param String $query the SQL query
84
+	 * @param Array $params parameter of the query
85
+	 * @param String $limitQuery the limit query
86
+	 * @return Array the spotter information
87
+	 *
88
+	 */
89 89
 	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
90 90
 	{
91 91
 		date_default_timezone_set('UTC');
@@ -213,11 +213,11 @@  discard block
 block discarded – undo
213 213
 	
214 214
 	
215 215
 	/**
216
-	* Gets all the spotter information based on the latest data entry
217
-	*
218
-	* @return Array the spotter information
219
-	*
220
-	*/
216
+	 * Gets all the spotter information based on the latest data entry
217
+	 *
218
+	 * @return Array the spotter information
219
+	 *
220
+	 */
221 221
 	public function getLatestMarineData($limit = '', $sort = '', $filter = array())
222 222
 	{
223 223
 		global $global_query;
@@ -266,11 +266,11 @@  discard block
 block discarded – undo
266 266
 	}
267 267
 
268 268
 	/**
269
-	* Gets all the spotter information based on the callsign
270
-	*
271
-	* @return Array the spotter information
272
-	*
273
-	*/
269
+	 * Gets all the spotter information based on the callsign
270
+	 *
271
+	 * @return Array the spotter information
272
+	 *
273
+	 */
274 274
 	public function getMarineDataByIdent($ident = '', $limit = '', $sort = '', $filter = array())
275 275
 	{
276 276
 		global $global_query;
@@ -381,12 +381,12 @@  discard block
 block discarded – undo
381 381
 
382 382
 
383 383
 	/**
384
-	* Gets all source name
385
-	*
386
-	* @param String type format of source
387
-	* @return Array list of source name
388
-	*
389
-	*/
384
+	 * Gets all source name
385
+	 *
386
+	 * @param String type format of source
387
+	 * @return Array list of source name
388
+	 *
389
+	 */
390 390
 	public function getAllSourceName($type = '',$filters = array())
391 391
 	{
392 392
 		$filter_query = $this->getFilter($filters,true,true);
@@ -416,11 +416,11 @@  discard block
 block discarded – undo
416 416
 
417 417
 
418 418
 	/**
419
-	* Gets a list of all idents/callsigns
420
-	*
421
-	* @return Array list of ident/callsign names
422
-	*
423
-	*/
419
+	 * Gets a list of all idents/callsigns
420
+	 *
421
+	 * @return Array list of ident/callsign names
422
+	 *
423
+	 */
424 424
 	public function getAllIdents($filters = array())
425 425
 	{
426 426
 		$filter_query = $this->getFilter($filters,true,true);
@@ -444,11 +444,11 @@  discard block
 block discarded – undo
444 444
 	}
445 445
 
446 446
 	/**
447
-	* Gets all info from a mmsi
448
-	*
449
-	* @return Array list of mmsi info
450
-	*
451
-	*/
447
+	 * Gets all info from a mmsi
448
+	 *
449
+	 * @return Array list of mmsi info
450
+	 *
451
+	 */
452 452
 	public function getIdentity($mmsi)
453 453
 	{
454 454
 		$mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT);
@@ -505,18 +505,18 @@  discard block
 block discarded – undo
505 505
 	
506 506
 	
507 507
 	/**
508
-	* Update ident tracker data
509
-	*
510
-	* @param String $fammarine_id the ID
511
-	* @param String $ident the marine ident
512
-	* @return String success or false
513
-	*
514
-	*/	
508
+	 * Update ident tracker data
509
+	 *
510
+	 * @param String $fammarine_id the ID
511
+	 * @param String $ident the marine ident
512
+	 * @return String success or false
513
+	 *
514
+	 */	
515 515
 	public function updateIdentMarineData($fammarine_id = '', $ident = '',$fromsource = NULL)
516 516
 	{
517 517
 
518 518
 		$query = 'UPDATE marine_output SET ident = :ident WHERE fammarine_id = :fammarine_id';
519
-                $query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident);
519
+				$query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident);
520 520
 
521 521
 		try {
522 522
 			$sth = $this->db->prepare($query);
@@ -530,19 +530,19 @@  discard block
 block discarded – undo
530 530
 	}
531 531
 
532 532
 	/**
533
-	* Update Status data
534
-	*
535
-	* @param String $fammarine_id the ID
536
-	* @param String $status_id the marine status id
537
-	* @param String $status the marine status
538
-	* @return String success or false
539
-	*
540
-	*/	
533
+	 * Update Status data
534
+	 *
535
+	 * @param String $fammarine_id the ID
536
+	 * @param String $status_id the marine status id
537
+	 * @param String $status the marine status
538
+	 * @return String success or false
539
+	 *
540
+	 */	
541 541
 	public function updateStatusMarineData($fammarine_id = '', $status_id = '',$status = '')
542 542
 	{
543 543
 
544 544
 		$query = 'UPDATE marine_output SET status = :status, status_id = :status_id WHERE fammarine_id = :fammarine_id';
545
-                $query_values = array(':fammarine_id' => $fammarine_id,':status' => $status,':status_id' => $status_id);
545
+				$query_values = array(':fammarine_id' => $fammarine_id,':status' => $status,':status_id' => $status_id);
546 546
 
547 547
 		try {
548 548
 			$sth = $this->db->prepare($query);
@@ -555,17 +555,17 @@  discard block
 block discarded – undo
555 555
 
556 556
 	}
557 557
 	/**
558
-	* Update latest marine data
559
-	*
560
-	* @param String $fammarine_id the ID
561
-	* @param String $ident the marine ident
562
-	* @return String success or false
563
-	*
564
-	*/	
558
+	 * Update latest marine data
559
+	 *
560
+	 * @param String $fammarine_id the ID
561
+	 * @param String $ident the marine ident
562
+	 * @return String success or false
563
+	 *
564
+	 */	
565 565
 	public function updateLatestMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $groundspeed = NULL, $date = '')
566 566
 	{
567 567
 		$query = 'UPDATE marine_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_seen = :last_seen, last_ground_speed = :last_ground_speed WHERE fammarine_id = :fammarine_id';
568
-                $query_values = array(':fammarine_id' => $fammarine_id,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident);
568
+				$query_values = array(':fammarine_id' => $fammarine_id,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident);
569 569
 
570 570
 		try {
571 571
 			$sth = $this->db->prepare($query);
@@ -579,30 +579,30 @@  discard block
 block discarded – undo
579 579
 	}
580 580
 
581 581
 	/**
582
-	* Adds a new spotter data
583
-	*
584
-	* @param String $fammarine_id the ID
585
-	* @param String $ident the marine ident
586
-	* @param String $departure_airport_icao the departure airport
587
-	* @param String $arrival_airport_icao the arrival airport
588
-	* @param String $latitude latitude of flight
589
-	* @param String $longitude latitude of flight
590
-	* @param String $waypoints waypoints of flight
591
-	* @param String $heading heading of flight
592
-	* @param String $groundspeed speed of flight
593
-	* @param String $date date of flight
594
-	* @param String $departure_airport_time departure time of flight
595
-	* @param String $arrival_airport_time arrival time of flight
596
-	* @param String $squawk squawk code of flight
597
-	* @param String $route_stop route stop of flight
598
-	* @param String $highlight highlight or not
599
-	* @param String $ModeS ModesS code of flight
600
-	* @param String $registration registration code of flight
601
-	* @param String $pilot_id pilot id of flight (for virtual airlines)
602
-	* @param String $pilot_name pilot name of flight (for virtual airlines)
603
-	* @param String $verticalrate vertival rate of flight
604
-	* @return String success or false
605
-	*/
582
+	 * Adds a new spotter data
583
+	 *
584
+	 * @param String $fammarine_id the ID
585
+	 * @param String $ident the marine ident
586
+	 * @param String $departure_airport_icao the departure airport
587
+	 * @param String $arrival_airport_icao the arrival airport
588
+	 * @param String $latitude latitude of flight
589
+	 * @param String $longitude latitude of flight
590
+	 * @param String $waypoints waypoints of flight
591
+	 * @param String $heading heading of flight
592
+	 * @param String $groundspeed speed of flight
593
+	 * @param String $date date of flight
594
+	 * @param String $departure_airport_time departure time of flight
595
+	 * @param String $arrival_airport_time arrival time of flight
596
+	 * @param String $squawk squawk code of flight
597
+	 * @param String $route_stop route stop of flight
598
+	 * @param String $highlight highlight or not
599
+	 * @param String $ModeS ModesS code of flight
600
+	 * @param String $registration registration code of flight
601
+	 * @param String $pilot_id pilot id of flight (for virtual airlines)
602
+	 * @param String $pilot_name pilot name of flight (for virtual airlines)
603
+	 * @param String $verticalrate vertival rate of flight
604
+	 * @return String success or false
605
+	 */
606 606
 	public function addMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $mmsi = '',$type = '',$typeid = '',$imo = '',$callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$format_source = '', $source_name = '')
607 607
 	{
608 608
 		global $globalURL, $globalMarineImageFetch;
@@ -699,13 +699,13 @@  discard block
 block discarded – undo
699 699
 			unset($Image);
700 700
 		}
701 701
 		
702
-                if ($latitude == '' && $longitude == '') {
703
-            		$latitude = 0;
704
-            		$longitude = 0;
705
-            	}
706
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
707
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
708
-                if ($arrival_date == '') $arrival_date = NULL;
702
+				if ($latitude == '' && $longitude == '') {
703
+					$latitude = 0;
704
+					$longitude = 0;
705
+				}
706
+				if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
707
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
708
+				if ($arrival_date == '') $arrival_date = NULL;
709 709
 		$query  = "INSERT INTO marine_output (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, mmsi, type, status,imo,arrival_port_name,arrival_port_date) 
710 710
 		    VALUES (:fammarine_id,:ident,:latitude,:longitude,:heading,:speed,:date,:format_source, :source_name,:mmsi,:type,:status,:imo,:arrival_port_name,:arrival_port_date)";
711 711
 
@@ -716,7 +716,7 @@  discard block
 block discarded – undo
716 716
 			$sth->execute($query_values);
717 717
 			$this->db = null;
718 718
 		} catch (PDOException $e) {
719
-		    return "error : ".$e->getMessage();
719
+			return "error : ".$e->getMessage();
720 720
 		}
721 721
 		
722 722
 		return "success";
@@ -725,11 +725,11 @@  discard block
 block discarded – undo
725 725
 	
726 726
   
727 727
 	/**
728
-	* Gets the aircraft ident within the last hour
729
-	*
730
-	* @return String the ident
731
-	*
732
-	*/
728
+	 * Gets the aircraft ident within the last hour
729
+	 *
730
+	 * @return String the ident
731
+	 *
732
+	 */
733 733
 	public function getIdentFromLastHour($ident)
734 734
 	{
735 735
 		global $globalDBdriver, $globalTimezone;
@@ -745,11 +745,11 @@  discard block
 block discarded – undo
745 745
 								AND marine_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
746 746
 								AND marine_output.date < now() AT TIME ZONE 'UTC'";
747 747
 			$query_data = array(':ident' => $ident);
748
-    		}
748
+			}
749 749
 		
750 750
 		$sth = $this->db->prepare($query);
751 751
 		$sth->execute($query_data);
752
-    		$ident_result='';
752
+			$ident_result='';
753 753
 		while($row = $sth->fetch(PDO::FETCH_ASSOC))
754 754
 		{
755 755
 			$ident_result = $row['ident'];
@@ -760,11 +760,11 @@  discard block
 block discarded – undo
760 760
 	
761 761
 	
762 762
 	/**
763
-	* Gets the aircraft data from the last 20 seconds
764
-	*
765
-	* @return Array the spotter data
766
-	*
767
-	*/
763
+	 * Gets the aircraft data from the last 20 seconds
764
+	 *
765
+	 * @return Array the spotter data
766
+	 *
767
+	 */
768 768
 	public function getRealTimeData($q = '')
769 769
 	{
770 770
 		global $globalDBdriver;
@@ -802,11 +802,11 @@  discard block
 block discarded – undo
802 802
 	
803 803
 
804 804
 	/**
805
-	* Gets all number of flight over countries
806
-	*
807
-	* @return Array the airline country list
808
-	*
809
-	*/
805
+	 * Gets all number of flight over countries
806
+	 *
807
+	 * @return Array the airline country list
808
+	 *
809
+	 */
810 810
 
811 811
 	public function countAllMarineOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
812 812
 	{
@@ -878,11 +878,11 @@  discard block
 block discarded – undo
878 878
 	
879 879
 	
880 880
 	/**
881
-	* Gets all callsigns that have flown over
882
-	*
883
-	* @return Array the callsign list
884
-	*
885
-	*/
881
+	 * Gets all callsigns that have flown over
882
+	 *
883
+	 * @return Array the callsign list
884
+	 *
885
+	 */
886 886
 	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
887 887
 	{
888 888
 		global $globalDBdriver;
@@ -949,11 +949,11 @@  discard block
 block discarded – undo
949 949
 
950 950
 
951 951
 	/**
952
-	* Counts all dates
953
-	*
954
-	* @return Array the date list
955
-	*
956
-	*/
952
+	 * Counts all dates
953
+	 *
954
+	 * @return Array the date list
955
+	 *
956
+	 */
957 957
 	public function countAllDates($filters = array())
958 958
 	{
959 959
 		global $globalTimezone, $globalDBdriver;
@@ -999,11 +999,11 @@  discard block
 block discarded – undo
999 999
 	
1000 1000
 	
1001 1001
 	/**
1002
-	* Counts all dates during the last 7 days
1003
-	*
1004
-	* @return Array the date list
1005
-	*
1006
-	*/
1002
+	 * Counts all dates during the last 7 days
1003
+	 *
1004
+	 * @return Array the date list
1005
+	 *
1006
+	 */
1007 1007
 	public function countAllDatesLast7Days($filters = array())
1008 1008
 	{
1009 1009
 		global $globalTimezone, $globalDBdriver;
@@ -1025,7 +1025,7 @@  discard block
 block discarded – undo
1025 1025
 			$query .= " GROUP BY date_name 
1026 1026
 								ORDER BY date_name ASC";
1027 1027
 			$query_data = array(':offset' => $offset);
1028
-    		}
1028
+			}
1029 1029
 		
1030 1030
 		$sth = $this->db->prepare($query);
1031 1031
 		$sth->execute($query_data);
@@ -1045,11 +1045,11 @@  discard block
 block discarded – undo
1045 1045
 	}
1046 1046
 
1047 1047
 	/**
1048
-	* Counts all dates during the last month
1049
-	*
1050
-	* @return Array the date list
1051
-	*
1052
-	*/
1048
+	 * Counts all dates during the last month
1049
+	 *
1050
+	 * @return Array the date list
1051
+	 *
1052
+	 */
1053 1053
 	public function countAllDatesLastMonth($filters = array())
1054 1054
 	{
1055 1055
 		global $globalTimezone, $globalDBdriver;
@@ -1071,7 +1071,7 @@  discard block
 block discarded – undo
1071 1071
 			$query .= " GROUP BY date_name 
1072 1072
 								ORDER BY date_name ASC";
1073 1073
 			$query_data = array(':offset' => $offset);
1074
-    		}
1074
+			}
1075 1075
 		
1076 1076
 		$sth = $this->db->prepare($query);
1077 1077
 		$sth->execute($query_data);
@@ -1093,11 +1093,11 @@  discard block
 block discarded – undo
1093 1093
 
1094 1094
 
1095 1095
 	/**
1096
-	* Counts all month
1097
-	*
1098
-	* @return Array the month list
1099
-	*
1100
-	*/
1096
+	 * Counts all month
1097
+	 *
1098
+	 * @return Array the month list
1099
+	 *
1100
+	 */
1101 1101
 	public function countAllMonths($filters = array())
1102 1102
 	{
1103 1103
 		global $globalTimezone, $globalDBdriver;
@@ -1142,11 +1142,11 @@  discard block
 block discarded – undo
1142 1142
 	
1143 1143
 
1144 1144
 	/**
1145
-	* Counts all dates during the last year
1146
-	*
1147
-	* @return Array the date list
1148
-	*
1149
-	*/
1145
+	 * Counts all dates during the last year
1146
+	 *
1147
+	 * @return Array the date list
1148
+	 *
1149
+	 */
1150 1150
 	public function countAllMonthsLastYear($filters)
1151 1151
 	{
1152 1152
 		global $globalTimezone, $globalDBdriver;
@@ -1168,7 +1168,7 @@  discard block
 block discarded – undo
1168 1168
 			$query .= " GROUP BY year_name, month_name
1169 1169
 								ORDER BY year_name, month_name ASC";
1170 1170
 			$query_data = array(':offset' => $offset);
1171
-    		}
1171
+			}
1172 1172
 		
1173 1173
 		$sth = $this->db->prepare($query);
1174 1174
 		$sth->execute($query_data);
@@ -1191,11 +1191,11 @@  discard block
 block discarded – undo
1191 1191
 	
1192 1192
 	
1193 1193
 	/**
1194
-	* Counts all hours
1195
-	*
1196
-	* @return Array the hour list
1197
-	*
1198
-	*/
1194
+	 * Counts all hours
1195
+	 *
1196
+	 * @return Array the hour list
1197
+	 *
1198
+	 */
1199 1199
 	public function countAllHours($orderby,$filters = array())
1200 1200
 	{
1201 1201
 		global $globalTimezone, $globalDBdriver;
@@ -1258,11 +1258,11 @@  discard block
 block discarded – undo
1258 1258
 	
1259 1259
 	
1260 1260
 	/**
1261
-	* Counts all hours by date
1262
-	*
1263
-	* @return Array the hour list
1264
-	*
1265
-	*/
1261
+	 * Counts all hours by date
1262
+	 *
1263
+	 * @return Array the hour list
1264
+	 *
1265
+	 */
1266 1266
 	public function countAllHoursByDate($date, $filters = array())
1267 1267
 	{
1268 1268
 		global $globalTimezone, $globalDBdriver;
@@ -1306,11 +1306,11 @@  discard block
 block discarded – undo
1306 1306
 	
1307 1307
 	
1308 1308
 	/**
1309
-	* Counts all hours by a ident/callsign
1310
-	*
1311
-	* @return Array the hour list
1312
-	*
1313
-	*/
1309
+	 * Counts all hours by a ident/callsign
1310
+	 *
1311
+	 * @return Array the hour list
1312
+	 *
1313
+	 */
1314 1314
 	public function countAllHoursByIdent($ident, $filters = array())
1315 1315
 	{
1316 1316
 		global $globalTimezone, $globalDBdriver;
@@ -1355,11 +1355,11 @@  discard block
 block discarded – undo
1355 1355
 	
1356 1356
 	
1357 1357
 	/**
1358
-	* Counts all flights that have flown over
1359
-	*
1360
-	* @return Integer the number of flights
1361
-	*
1362
-	*/
1358
+	 * Counts all flights that have flown over
1359
+	 *
1360
+	 * @return Integer the number of flights
1361
+	 *
1362
+	 */
1363 1363
 	public function countOverallMarine($filters = array(),$year = '',$month = '')
1364 1364
 	{
1365 1365
 		global $globalDBdriver;
@@ -1395,11 +1395,11 @@  discard block
 block discarded – undo
1395 1395
 	
1396 1396
   
1397 1397
 	/**
1398
-	* Counts all hours of today
1399
-	*
1400
-	* @return Array the hour list
1401
-	*
1402
-	*/
1398
+	 * Counts all hours of today
1399
+	 *
1400
+	 * @return Array the hour list
1401
+	 *
1402
+	 */
1403 1403
 	public function countAllHoursFromToday($filters = array())
1404 1404
 	{
1405 1405
 		global $globalTimezone, $globalDBdriver;
@@ -1439,12 +1439,12 @@  discard block
 block discarded – undo
1439 1439
 	}
1440 1440
     
1441 1441
     
1442
-     /**
1443
-	* Gets the Barrie Spotter ID based on the FlightAware ID
1444
-	*
1445
-	* @return Integer the Barrie Spotter ID
1442
+	 /**
1443
+	  * Gets the Barrie Spotter ID based on the FlightAware ID
1444
+	  *
1445
+	  * @return Integer the Barrie Spotter ID
1446 1446
 q	*
1447
-	*/
1447
+	  */
1448 1448
 	public function getMarineIDBasedOnFamMarineID($fammarine_id)
1449 1449
 	{
1450 1450
 		$fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING);
@@ -1465,13 +1465,13 @@  discard block
 block discarded – undo
1465 1465
   
1466 1466
  
1467 1467
 	/**
1468
-	* Parses a date string
1469
-	*
1470
-	* @param String $dateString the date string
1471
-	* @param String $timezone the timezone of a user
1472
-	* @return Array the time information
1473
-	*
1474
-	*/
1468
+	 * Parses a date string
1469
+	 *
1470
+	 * @param String $dateString the date string
1471
+	 * @param String $timezone the timezone of a user
1472
+	 * @return Array the time information
1473
+	 *
1474
+	 */
1475 1475
 	public function parseDateString($dateString, $timezone = '')
1476 1476
 	{
1477 1477
 		$time_array = array();
@@ -1504,12 +1504,12 @@  discard block
 block discarded – undo
1504 1504
 	}
1505 1505
 	
1506 1506
 	/**
1507
-	* Parses the direction degrees to working
1508
-	*
1509
-	* @param Float $direction the direction in degrees
1510
-	* @return Array the direction information
1511
-	*
1512
-	*/
1507
+	 * Parses the direction degrees to working
1508
+	 *
1509
+	 * @param Float $direction the direction in degrees
1510
+	 * @return Array the direction information
1511
+	 *
1512
+	 */
1513 1513
 	public function parseDirection($direction = 0)
1514 1514
 	{
1515 1515
 		if ($direction == '') $direction = 0;
@@ -1588,12 +1588,12 @@  discard block
 block discarded – undo
1588 1588
 	
1589 1589
 	
1590 1590
 	/**
1591
-	* Gets Country from latitude/longitude
1592
-	*
1593
-	* @param Float $latitude latitute of the flight
1594
-	* @param Float $longitude longitute of the flight
1595
-	* @return String the countrie
1596
-	*/
1591
+	 * Gets Country from latitude/longitude
1592
+	 *
1593
+	 * @param Float $latitude latitute of the flight
1594
+	 * @param Float $longitude longitute of the flight
1595
+	 * @return String the countrie
1596
+	 */
1597 1597
 	public function getCountryFromLatitudeLongitude($latitude,$longitude)
1598 1598
 	{
1599 1599
 		global $globalDBdriver, $globalDebug;
@@ -1630,11 +1630,11 @@  discard block
 block discarded – undo
1630 1630
 	}
1631 1631
 
1632 1632
 	/**
1633
-	* Gets Country from iso2
1634
-	*
1635
-	* @param String $iso2 ISO2 country code
1636
-	* @return String the countrie
1637
-	*/
1633
+	 * Gets Country from iso2
1634
+	 *
1635
+	 * @param String $iso2 ISO2 country code
1636
+	 * @return String the countrie
1637
+	 */
1638 1638
 	public function getCountryFromISO2($iso2)
1639 1639
 	{
1640 1640
 		global $globalDBdriver, $globalDebug;
@@ -1663,12 +1663,12 @@  discard block
 block discarded – undo
1663 1663
 
1664 1664
 	
1665 1665
 	/**
1666
-	* Gets the short url from bit.ly
1667
-	*
1668
-	* @param String $url the full url
1669
-	* @return String the bit.ly url
1670
-	*
1671
-	*/
1666
+	 * Gets the short url from bit.ly
1667
+	 *
1668
+	 * @param String $url the full url
1669
+	 * @return String the bit.ly url
1670
+	 *
1671
+	 */
1672 1672
 	public function getBitlyURL($url)
1673 1673
 	{
1674 1674
 		global $globalBitlyAccessToken;
Please login to merge, or discard this patch.
statistics.php 1 patch
Indentation   +230 added lines, -230 removed lines patch added patch discarded remove patch
@@ -63,35 +63,35 @@  discard block
 block discarded – undo
63 63
 		if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone);
64 64
 		print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>';
65 65
 	}
66
-    ?>
66
+	?>
67 67
     </div>
68 68
     <?php include('statistics-sub-menu.php'); ?>
69 69
     <p class="global-stats">
70 70
 <?php
71
-    if ($type == 'aircraft') {
71
+	if ($type == 'aircraft') {
72 72
 ?>
73 73
         <span><span class="badge"><?php print number_format($Stats->countOverallFlights($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Flights"); ?></span>
74 74
 	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
75 75
         <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Arrivals seen"); ?></span>
76 76
         <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
77 77
 	<?php
78
-	    if ((isset($globalVA) && $globalVA) ||(isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
78
+		if ((isset($globalVA) && $globalVA) ||(isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
79 79
 	?>
80 80
     	    <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Pilots"); ?></span>
81 81
 	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
82 82
         <?php
83
-    	    } else {
84
-    	?>
83
+			} else {
84
+		?>
85 85
     	    <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Owners"); ?></span>
86 86
 	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
87 87
     	<?php
88
-    	    }
89
-    	?>
88
+			}
89
+		?>
90 90
         <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Aircrafts types"); ?></span>
91 91
         <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
92 92
         <?php
93
-    		if ($airline_icao == '') {
94
-    	?>
93
+			if ($airline_icao == '') {
94
+		?>
95 95
         <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name,$year,$month)); ?></span> <?php echo _("Airlines"); ?></span>
96 96
 	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
97 97
 	<?php
@@ -108,17 +108,17 @@  discard block
 block discarded – undo
108 108
 		}
109 109
 	?>
110 110
 <?php
111
-    } elseif ($type == 'marine') {
111
+	} elseif ($type == 'marine') {
112 112
 ?>
113 113
 	<span><span class="badge"><?php print number_format($Marine->countOverallMarine($filter_name,$year,$month)); ?></span> <?php echo _("Vessels"); ?></span>
114 114
 	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
115 115
 <?php
116
-    } elseif ($type == 'tracker') {
116
+	} elseif ($type == 'tracker') {
117 117
 ?>
118 118
 	<span><span class="badge"><?php print number_format($Tracker->countOverallTracker($filter_name,$year,$month)); ?></span> <?php echo _("Trackers"); ?></span>
119 119
 	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
120 120
 <?php
121
-    }
121
+	}
122 122
 ?>
123 123
     </p>
124 124
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
@@ -127,88 +127,88 @@  discard block
 block discarded – undo
127 127
             <div class="col-md-6">
128 128
                 <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2>
129 129
                  <?php
130
-                  $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month);
131
-		    if (count($aircraft_array) == 0) print _("No data available");
132
-		    else {
133
-                    print '<div id="chart1" class="chart" width="100%"></div><script>';
134
-                    $aircraft_data = '';
135
-                    foreach($aircraft_array as $aircraft_item)
136
-                    {
137
-                        $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
138
-                    }
139
-                    $aircraft_data = substr($aircraft_data, 0, -1);
140
-		    print 'var series = ['.$aircraft_data.'];';
141
-		    print 'var dataset = [];var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);';
142
-		    print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#e6e6f6","#1a3151"]);';
143
-		    print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});';
144
-                    print 'var aircraftype = new d3pie("chart1",{"header":{"title":{"fontSize":24,"font":"open sans"},"subtitle":{"color":"#999999","fontSize":12,"font":"open sans"},"titleSubtitlePadding":9},"footer":{"color":"#999999","fontSize":10,"font":"open sans","location":"bottom-left"},"size":{"canvasWidth":700,"pieOuterRadius":"60%"},"data":{"sortOrder":"value-desc","content":';
145
-                    print 'dataset';
146
-                    print '},"labels":{"outer":{"pieDistance":32},"inner":{"hideWhenLessThanPercentage":3},"mainLabel":{"fontSize":11},"percentage":{"color":"#ffffff","decimalPlaces":0},"value":{"color":"#adadad","fontSize":11},"lines":{"enabled":true},"truncation":{"enabled":true}},"effects":{"pullOutSegmentOnClick":{"effect":"linear","speed":400,"size":8}},"misc":{"gradient":{"enabled":true,"percentage":100}}});';
147
-                    print '</script>';
148
-                  }
149
-                  ?>
130
+				  $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month);
131
+			if (count($aircraft_array) == 0) print _("No data available");
132
+			else {
133
+					print '<div id="chart1" class="chart" width="100%"></div><script>';
134
+					$aircraft_data = '';
135
+					foreach($aircraft_array as $aircraft_item)
136
+					{
137
+						$aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
138
+					}
139
+					$aircraft_data = substr($aircraft_data, 0, -1);
140
+			print 'var series = ['.$aircraft_data.'];';
141
+			print 'var dataset = [];var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);';
142
+			print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#e6e6f6","#1a3151"]);';
143
+			print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});';
144
+					print 'var aircraftype = new d3pie("chart1",{"header":{"title":{"fontSize":24,"font":"open sans"},"subtitle":{"color":"#999999","fontSize":12,"font":"open sans"},"titleSubtitlePadding":9},"footer":{"color":"#999999","fontSize":10,"font":"open sans","location":"bottom-left"},"size":{"canvasWidth":700,"pieOuterRadius":"60%"},"data":{"sortOrder":"value-desc","content":';
145
+					print 'dataset';
146
+					print '},"labels":{"outer":{"pieDistance":32},"inner":{"hideWhenLessThanPercentage":3},"mainLabel":{"fontSize":11},"percentage":{"color":"#ffffff","decimalPlaces":0},"value":{"color":"#adadad","fontSize":11},"lines":{"enabled":true},"truncation":{"enabled":true}},"effects":{"pullOutSegmentOnClick":{"effect":"linear","speed":400,"size":8}},"misc":{"gradient":{"enabled":true,"percentage":100}}});';
147
+					print '</script>';
148
+				  }
149
+				  ?>
150 150
                 <div class="more">
151 151
             	    <?php
152
-            		if ($year != '' && $month != '') {
153
-            	    ?>
152
+					if ($year != '' && $month != '') {
153
+					?>
154 154
             	    <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
155 155
             	    <?php
156
-            		} else {
157
-            	    ?>
156
+					} else {
157
+					?>
158 158
             	    <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
159 159
             	    <?php
160
-            		}
161
-            	    ?>
160
+					}
161
+					?>
162 162
                 </div>
163 163
             </div>
164 164
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
165 165
 <?php
166 166
 //    echo $airline_icao;
167
-    if ($airline_icao == '' || $airline_icao == 'all') {
167
+	if ($airline_icao == '' || $airline_icao == 'all') {
168 168
 	$airline_array = $Stats->countAllAirlines(true,$filter_name,$year,$month);
169 169
 	if (count($airline_array) > 0) {
170
-            print '<div class="col-md-6">';
171
-	    print '<h2>'._("Top 10 Most Common Airline").'</h2>';
172
-	    print '<div id="chart2" class="chart" width="100%"></div><script>';
173
-	    $airline_data = '';
174
-	    foreach($airline_array as $airline_item)
175
-	    {
170
+			print '<div class="col-md-6">';
171
+		print '<h2>'._("Top 10 Most Common Airline").'</h2>';
172
+		print '<div id="chart2" class="chart" width="100%"></div><script>';
173
+		$airline_data = '';
174
+		foreach($airline_array as $airline_item)
175
+		{
176 176
 		$airline_data .= '["'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],';
177
-	    }
178
-	    $airline_data = substr($airline_data, 0, -1);
179
-	    print 'var series = ['.$airline_data.'];';
180
-	    print 'var dataset = [];var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);';
181
-	    print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#EFEFFF","#001830"]);';
182
-	    print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});';
183
-            print 'var airlinescnt = new d3pie("chart2",{"header":{"title":{"fontSize":24,"font":"open sans"},"subtitle":{"color":"#999999","fontSize":12,"font":"open sans"},"titleSubtitlePadding":9},"footer":{"color":"#999999","fontSize":10,"font":"open sans","location":"bottom-left"},"size":{"canvasWidth":700,"pieOuterRadius":"60%"},"data":{"sortOrder":"value-desc","content":';
184
-	    print 'dataset';
185
-            print '},"labels":{"outer":{"pieDistance":32},"inner":{"hideWhenLessThanPercentage":3},"mainLabel":{"fontSize":11},"percentage":{"color":"#ffffff","decimalPlaces":0},"value":{"color":"#adadad","fontSize":11},"lines":{"enabled":true},"truncation":{"enabled":true}},"effects":{"pullOutSegmentOnClick":{"effect":"linear","speed":400,"size":8}},"misc":{"gradient":{"enabled":true,"percentage":100}}});';
186
-            print '</script>';
187
-	    if ($year != '' && $month != '') {
177
+		}
178
+		$airline_data = substr($airline_data, 0, -1);
179
+		print 'var series = ['.$airline_data.'];';
180
+		print 'var dataset = [];var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);';
181
+		print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#EFEFFF","#001830"]);';
182
+		print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});';
183
+			print 'var airlinescnt = new d3pie("chart2",{"header":{"title":{"fontSize":24,"font":"open sans"},"subtitle":{"color":"#999999","fontSize":12,"font":"open sans"},"titleSubtitlePadding":9},"footer":{"color":"#999999","fontSize":10,"font":"open sans","location":"bottom-left"},"size":{"canvasWidth":700,"pieOuterRadius":"60%"},"data":{"sortOrder":"value-desc","content":';
184
+		print 'dataset';
185
+			print '},"labels":{"outer":{"pieDistance":32},"inner":{"hideWhenLessThanPercentage":3},"mainLabel":{"fontSize":11},"percentage":{"color":"#ffffff","decimalPlaces":0},"value":{"color":"#adadad","fontSize":11},"lines":{"enabled":true},"truncation":{"enabled":true}},"effects":{"pullOutSegmentOnClick":{"effect":"linear","speed":400,"size":8}},"misc":{"gradient":{"enabled":true,"percentage":100}}});';
186
+			print '</script>';
187
+		if ($year != '' && $month != '') {
188 188
 		print '<div class="more"><a href="'.$globalURL.'/statistics/airline';
189 189
 		if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao;
190 190
 		print '/'.$year.'/'.$month.'/" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
191
-	    } else {
191
+		} else {
192 192
 		print '<div class="more"><a href="'.$globalURL.'/statistics/airline';
193 193
 		if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao;
194 194
 		print '" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
195
-	    }
196
-    	    print '</div>';
195
+		}
196
+			print '</div>';
197 197
 	}
198 198
 ?>
199 199
         </div>
200 200
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
201 201
 <?php
202
-    }
202
+	}
203 203
 ?>
204 204
         <div class="row column">
205 205
 <?php
206
-    $flightover_array = $Stats->countAllFlightOverCountries(false,$airline_icao,$filter_name,$year,$month);
207
-    if ((isset($globalVA) && $globalVA) ||(isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
206
+	$flightover_array = $Stats->countAllFlightOverCountries(false,$airline_icao,$filter_name,$year,$month);
207
+	if ((isset($globalVA) && $globalVA) ||(isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
208 208
 	if (empty($flightover_array)) {
209
-	    print '<div class="col-md-12">';
209
+		print '<div class="col-md-12">';
210 210
 	} else {
211
-            print '<div class="col-md-6">';
211
+			print '<div class="col-md-6">';
212 212
 	}
213 213
 ?>
214 214
                 <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2>
@@ -216,23 +216,23 @@  discard block
 block discarded – undo
216 216
 	$pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name,$year,$month);
217 217
 	if (count($pilot_array) == 0) print _("No data available");
218 218
 	else {
219
-	    print '<div id="chart7" class="chart" width="100%"></div><script>';
220
-	    $pilot_data = '';
221
-	    foreach($pilot_array as $pilot_item)
222
-	    {
219
+		print '<div id="chart7" class="chart" width="100%"></div><script>';
220
+		$pilot_data = '';
221
+		foreach($pilot_array as $pilot_item)
222
+		{
223 223
 		$pilot_data .= '["'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],';
224
-	    }
225
-	    $pilot_data = substr($pilot_data, 0, -1);
226
-	    print 'var series = ['.$pilot_data.'];';
227
-	    print 'var dataset = [];var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);';
228
-	    print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#EFEFFF","#001830"]);';
229
-	    print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});';
230
-            print 'var pilotcnt = new d3pie("chart7",{"header":{"title":{"fontSize":24,"font":"open sans"},"subtitle":{"color":"#999999","fontSize":12,"font":"open sans"},"titleSubtitlePadding":9},"footer":{"color":"#999999","fontSize":10,"font":"open sans","location":"bottom-left"},"size":{"canvasWidth":700,"pieOuterRadius":"60%"},"data":{"sortOrder":"value-desc","content":';
231
-	    print 'dataset';
232
-            print '},"labels":{"outer":{"pieDistance":32},"inner":{"hideWhenLessThanPercentage":3},"mainLabel":{"fontSize":11},"percentage":{"color":"#ffffff","decimalPlaces":0},"value":{"color":"#adadad","fontSize":11},"lines":{"enabled":true},"truncation":{"enabled":true}},"effects":{"pullOutSegmentOnClick":{"effect":"linear","speed":400,"size":8}},"misc":{"gradient":{"enabled":true,"percentage":100}}});';
233
-            print '</script>';
234
-        }
235
-        print '<div class="more">';
224
+		}
225
+		$pilot_data = substr($pilot_data, 0, -1);
226
+		print 'var series = ['.$pilot_data.'];';
227
+		print 'var dataset = [];var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);';
228
+		print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#EFEFFF","#001830"]);';
229
+		print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});';
230
+			print 'var pilotcnt = new d3pie("chart7",{"header":{"title":{"fontSize":24,"font":"open sans"},"subtitle":{"color":"#999999","fontSize":12,"font":"open sans"},"titleSubtitlePadding":9},"footer":{"color":"#999999","fontSize":10,"font":"open sans","location":"bottom-left"},"size":{"canvasWidth":700,"pieOuterRadius":"60%"},"data":{"sortOrder":"value-desc","content":';
231
+		print 'dataset';
232
+			print '},"labels":{"outer":{"pieDistance":32},"inner":{"hideWhenLessThanPercentage":3},"mainLabel":{"fontSize":11},"percentage":{"color":"#ffffff","decimalPlaces":0},"value":{"color":"#adadad","fontSize":11},"lines":{"enabled":true},"truncation":{"enabled":true}},"effects":{"pullOutSegmentOnClick":{"effect":"linear","speed":400,"size":8}},"misc":{"gradient":{"enabled":true,"percentage":100}}});';
233
+			print '</script>';
234
+		}
235
+		print '<div class="more">';
236 236
 	print '<a href="'.$globalURL.'/statistics/pilot'; 
237 237
 	if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao;
238 238
 	print'" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a>';
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
         
243 243
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
244 244
 <?php
245
-    } else {
245
+	} else {
246 246
 ?>
247 247
             <div class="col-md-6">
248 248
                 <h2><?php echo _("Top 10 Most Common Owners"); ?></h2>
@@ -250,21 +250,21 @@  discard block
 block discarded – undo
250 250
 	$owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name,$year,$month);
251 251
 	if (count($owner_array) == 0) print _("No data available");
252 252
 	else {
253
-	    print '<div id="chart7" class="chart" width="100%"></div><script>';
254
-	    $owner_data = '';
255
-	    foreach($owner_array as $owner_item)
256
-	    {
253
+		print '<div id="chart7" class="chart" width="100%"></div><script>';
254
+		$owner_data = '';
255
+		foreach($owner_array as $owner_item)
256
+		{
257 257
 		$owner_data .= '["'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],';
258
-	    }
259
-	    $owner_data = substr($owner_data, 0, -1);
260
-	    print 'var series = ['.$owner_data.'];';
261
-	    print 'var dataset = [];var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);';
262
-	    print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#EFEFFF","#001830"]);';
263
-	    print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});';
264
-            print 'var ownercnt = new d3pie("chart7",{"header":{"title":{"fontSize":24,"font":"open sans"},"subtitle":{"color":"#999999","fontSize":12,"font":"open sans"},"titleSubtitlePadding":9},"footer":{"color":"#999999","fontSize":10,"font":"open sans","location":"bottom-left"},"size":{"canvasWidth":700,"pieOuterRadius":"60%"},"data":{"sortOrder":"value-desc","content":';
265
-	    print 'dataset';
266
-            print '},"labels":{"outer":{"pieDistance":32},"inner":{"hideWhenLessThanPercentage":3},"mainLabel":{"fontSize":11},"percentage":{"color":"#ffffff","decimalPlaces":0},"value":{"color":"#adadad","fontSize":11},"lines":{"enabled":true},"truncation":{"enabled":true}},"effects":{"pullOutSegmentOnClick":{"effect":"linear","speed":400,"size":8}},"misc":{"gradient":{"enabled":true,"percentage":100}}});';
267
-	    print '</script>';
258
+		}
259
+		$owner_data = substr($owner_data, 0, -1);
260
+		print 'var series = ['.$owner_data.'];';
261
+		print 'var dataset = [];var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);';
262
+		print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#EFEFFF","#001830"]);';
263
+		print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});';
264
+			print 'var ownercnt = new d3pie("chart7",{"header":{"title":{"fontSize":24,"font":"open sans"},"subtitle":{"color":"#999999","fontSize":12,"font":"open sans"},"titleSubtitlePadding":9},"footer":{"color":"#999999","fontSize":10,"font":"open sans","location":"bottom-left"},"size":{"canvasWidth":700,"pieOuterRadius":"60%"},"data":{"sortOrder":"value-desc","content":';
265
+		print 'dataset';
266
+			print '},"labels":{"outer":{"pieDistance":32},"inner":{"hideWhenLessThanPercentage":3},"mainLabel":{"fontSize":11},"percentage":{"color":"#ffffff","decimalPlaces":0},"value":{"color":"#adadad","fontSize":11},"lines":{"enabled":true},"truncation":{"enabled":true}},"effects":{"pullOutSegmentOnClick":{"effect":"linear","speed":400,"size":8}},"misc":{"gradient":{"enabled":true,"percentage":100}}});';
267
+		print '</script>';
268 268
 	}
269 269
 ?>
270 270
                 <div class="more">
@@ -274,8 +274,8 @@  discard block
 block discarded – undo
274 274
         
275 275
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
276 276
 <?php
277
-    }
278
-    if (!empty($flightover_array)) {
277
+	}
278
+	if (!empty($flightover_array)) {
279 279
 ?>
280 280
             <div class="col-md-6">
281 281
                 <h2><?php echo _("Top 20 Most Common Country a Flight was Over"); ?></h2>
@@ -283,20 +283,20 @@  discard block
 block discarded – undo
283 283
 	 //$flightover_array = $Stats->countAllFlightOverCountries();
284 284
 	if (count($flightover_array) == 0) print _("No data available");
285 285
 	else {
286
-	    print '<div id="chart10" class="chart" width="100%"></div><script>';
287
-	    print 'var series = [';
288
-            $flightover_data = '';
289
-	    foreach($flightover_array as $flightover_item)
290
-	    {
286
+		print '<div id="chart10" class="chart" width="100%"></div><script>';
287
+		print 'var series = [';
288
+			$flightover_data = '';
289
+		foreach($flightover_array as $flightover_item)
290
+		{
291 291
 		$flightover_data .= '[ "'.$flightover_item['flight_country_iso3'].'",'.$flightover_item['flight_count'].'],';
292
-	    }
293
-	    $flightover_data = substr($flightover_data, 0, -1);
294
-	    print $flightover_data;
295
-	    print '];';
296
-	    print 'var dataset = {};var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);';
297
-	    print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#EFEFFF","#001830"]);';
298
-	    print 'series.forEach(function(item){var iso = item[0], value = item[1]; dataset[iso] = { numberOfThings: value, fillColor: paletteScale(value) };});';
299
-	    print 'new Datamap({
292
+		}
293
+		$flightover_data = substr($flightover_data, 0, -1);
294
+		print $flightover_data;
295
+		print '];';
296
+		print 'var dataset = {};var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);';
297
+		print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#EFEFFF","#001830"]);';
298
+		print 'series.forEach(function(item){var iso = item[0], value = item[1]; dataset[iso] = { numberOfThings: value, fillColor: paletteScale(value) };});';
299
+		print 'new Datamap({
300 300
 		element: document.getElementById("chart10"),
301 301
 		projection: "mercator", // big world map
302 302
 		fills: { defaultFill: "#F5F5F5" },
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
         	    }
322 322
 		}
323 323
 	    });";
324
-	    print '</script>';
324
+		print '</script>';
325 325
 	}
326 326
 ?>
327 327
                 <div class="more">
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
                 </div>
330 330
             </div>
331 331
 <?php
332
-    }
332
+	}
333 333
 ?>
334 334
         </div>
335 335
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
@@ -339,13 +339,13 @@  discard block
 block discarded – undo
339 339
         <div class="row column">
340 340
             <div class="col-md-6">
341 341
 <?php
342
-    $airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name,$year,$month);
343
-    if (count($airport_airport_array) > 0) {
342
+	$airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name,$year,$month);
343
+	if (count($airport_airport_array) > 0) {
344 344
 	print '<h2>'._("Top 10 Most Common Departure Airports").'</h2>';
345 345
 	print '<div id="chart3" class="chart" width="100%"></div><script>';
346
-        print "\n";
347
-        print 'var series = [';
348
-        $airport_data = '';
346
+		print "\n";
347
+		print 'var series = [';
348
+		$airport_data = '';
349 349
 	foreach($airport_airport_array as $airport_item)
350 350
 	{
351 351
 		$airport_data .= '[ "'.$airport_item['airport_departure_icao_count'].'", "'.$airport_item['airport_departure_icao'].'",'.$airport_item['airport_departure_latitude'].','.$airport_item['airport_departure_longitude'].'],';
@@ -394,20 +394,20 @@  discard block
 block discarded – undo
394 394
 	print '<div class="more"><a href="'.$globalURL.'/statistics/airport-departure'; 
395 395
 	if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao;
396 396
 	print '" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
397
-    }
397
+	}
398 398
 ?>
399 399
             </div>
400 400
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
401 401
 
402 402
             <div class="col-md-6">
403 403
 <?php
404
-    $airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name,$year,$month);
405
-    if (count($airport_airport_array2) > 0) {
404
+	$airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name,$year,$month);
405
+	if (count($airport_airport_array2) > 0) {
406 406
 	print '<h2>'._("Top 10 Most Common Arrival Airports").'</h2>';
407 407
 	print '<div id="chart4" class="chart" width="100%"></div><script>';
408
-        print "\n";
409
-        print 'var series = [';
410
-        $airport_data = '';
408
+		print "\n";
409
+		print 'var series = [';
410
+		$airport_data = '';
411 411
 	foreach($airport_airport_array2 as $airport_item)
412 412
 	{
413 413
 		$airport_data .= '[ "'.$airport_item['airport_arrival_icao_count'].'", "'.$airport_item['airport_arrival_icao'].'",'.$airport_item['airport_arrival_latitude'].','.$airport_item['airport_arrival_longitude'].'],';
@@ -457,28 +457,28 @@  discard block
 block discarded – undo
457 457
 	print '<div class="more"><a href="'.$globalURL.'/statistics/airport-arrival';
458 458
 	if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao;
459 459
 	print '" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
460
-    }
460
+	}
461 461
 ?>
462 462
             </div>
463 463
         </div>
464 464
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
465 465
 <?php
466
-    if ($year == '' && $month == '') {
466
+	if ($year == '' && $month == '') {
467 467
 ?>
468 468
         <div class="row column">
469 469
             <div class="col-md-6">
470 470
                 <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2>
471 471
                 <?php
472
-                  $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name);
473
-		    if (count($year_array) == 0) print _("No data available");
474
-		    else {
472
+				  $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name);
473
+			if (count($year_array) == 0) print _("No data available");
474
+			else {
475 475
 			print '<div id="chart8" class="chart" width="100%"></div><script>';
476 476
 			$year_data = '';
477 477
 			$year_cnt = '';
478 478
 			foreach($year_array as $year_item)
479 479
 			{
480
-			    $year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",';
481
-			    $year_cnt .= $year_item['date_count'].',';
480
+				$year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",';
481
+				$year_cnt .= $year_item['date_count'].',';
482 482
 			}
483 483
 			$year_data = "['x',".substr($year_data, 0, -1)."]";
484 484
 			$year_cnt = "['flights',".substr($year_cnt,0,-1)."]";
@@ -488,8 +488,8 @@  discard block
 block discarded – undo
488 488
                 	     columns: ['.$year_data.','.$year_cnt.'], types: { flights: "area"}, colors: { flights: "#1a3151"}},
489 489
                 	     axis: { x: { type: "timeseries", localtime: false,tick: { format: "%Y-%m"}}, y: { label: "# of Flights"}},legend: { show: false }});';
490 490
 			print '</script>';
491
-                    }
492
-                  ?>
491
+					}
492
+				  ?>
493 493
                 <div class="more">
494 494
                     <a href="<?php print $globalURL; ?>/statistics/year<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
495 495
                 </div>
@@ -498,16 +498,16 @@  discard block
 block discarded – undo
498 498
             <div class="col-md-6">
499 499
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
500 500
                 <?php
501
-                  $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name);
502
-		    if (count($month_array) == 0) print _("No data available");
503
-		    else {
504
-                	print '<div id="chart9" class="chart" width="100%"></div><script>';
505
-                        $month_data = '';
501
+				  $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name);
502
+			if (count($month_array) == 0) print _("No data available");
503
+			else {
504
+					print '<div id="chart9" class="chart" width="100%"></div><script>';
505
+						$month_data = '';
506 506
 			$month_cnt = '';
507 507
 			foreach($month_array as $month_item)
508 508
 			{
509
-			    $month_data .= '"'.$month_item['date_name'].'",';
510
-			    $month_cnt .= $month_item['date_count'].',';
509
+				$month_data .= '"'.$month_item['date_name'].'",';
510
+				$month_cnt .= $month_item['date_count'].',';
511 511
 			}
512 512
 			$month_data = "['x',".substr($month_data, 0, -1)."]";
513 513
 			$month_cnt = "['flights',".substr($month_cnt,0,-1)."]";
@@ -517,9 +517,9 @@  discard block
 block discarded – undo
517 517
                 	     columns: ['.$month_data.','.$month_cnt.'], types: { flights: "area"}, colors: { flights: "#1a3151"}},
518 518
                 	     axis: { x: { type: "timeseries", localtime: false,tick: { format: "%Y-%m-%d"}}, y: { label: "# of Flights"}},legend: { show: false }});';
519 519
 			
520
-            		print '</script>';
521
-                    }
522
-                  ?>
520
+					print '</script>';
521
+					}
522
+				  ?>
523 523
                 <div class="more">
524 524
                     <a href="<?php print $globalURL; ?>/statistics/month<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
525 525
                 </div>
@@ -529,16 +529,16 @@  discard block
 block discarded – undo
529 529
             <div class="col-md-6">
530 530
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
531 531
                 <?php
532
-                    $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name);
533
-		    if (empty($date_array)) print _("No data available");
534
-		    else {
535
-                	print '<div id="chart5" class="chart" width="100%"></div><script>';
536
-                        $date_data = '';
532
+					$date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name);
533
+			if (empty($date_array)) print _("No data available");
534
+			else {
535
+					print '<div id="chart5" class="chart" width="100%"></div><script>';
536
+						$date_data = '';
537 537
 			$date_cnt = '';
538 538
 			foreach($date_array as $date_item)
539 539
 			{
540
-			    $date_data .= '"'.$date_item['date_name'].'",';
541
-			    $date_cnt .= $date_item['date_count'].',';
540
+				$date_data .= '"'.$date_item['date_name'].'",';
541
+				$date_cnt .= $date_item['date_count'].',';
542 542
 			}
543 543
 			$date_data = "['x',".substr($date_data, 0, -1)."]";
544 544
 			$date_cnt = "['flights',".substr($date_cnt,0,-1)."]";
@@ -548,9 +548,9 @@  discard block
 block discarded – undo
548 548
                 	     columns: ['.$date_data.','.$date_cnt.'], types: { flights: "area"}, colors: { flights: "#1a3151"}},
549 549
                 	     axis: { x: { type: "timeseries",tick: { format: "%Y-%m-%d"}}, y: { label: "# of Flights"}},legend: { show: false }});';
550 550
 			
551
-                	print '</script>';
552
-                    }
553
-                  ?>
551
+					print '</script>';
552
+					}
553
+				  ?>
554 554
                 <div class="more">
555 555
                     <a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
556 556
                 </div>
@@ -559,16 +559,16 @@  discard block
 block discarded – undo
559 559
             <div class="col-md-6">
560 560
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
561 561
                 <?php
562
-                  $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name);
563
-		    if (empty($hour_array)) print _("No data available");
564
-		    else {
565
-                	print '<div id="chart6" class="chart" width="100%"></div><script>';
566
-                        $hour_data = '';
562
+				  $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name);
563
+			if (empty($hour_array)) print _("No data available");
564
+			else {
565
+					print '<div id="chart6" class="chart" width="100%"></div><script>';
566
+						$hour_data = '';
567 567
 			$hour_cnt = '';
568 568
 			foreach($hour_array as $hour_item)
569 569
 			{
570
-			    $hour_data .= '"'.$hour_item['hour_name'].':00",';
571
-			    $hour_cnt .= $hour_item['hour_count'].',';
570
+				$hour_data .= '"'.$hour_item['hour_name'].':00",';
571
+				$hour_cnt .= $hour_item['hour_count'].',';
572 572
 			}
573 573
 			$hour_data = "[".substr($hour_data, 0, -1)."]";
574 574
 			$hour_cnt = "['flights',".substr($hour_cnt,0,-1)."]";
@@ -578,9 +578,9 @@  discard block
 block discarded – undo
578 578
                 	     columns: ['.$hour_cnt.'], types: { flights: "area"}, colors: { flights: "#1a3151"}},
579 579
                 	     axis: { x: { type: "category", categories: '.$hour_data.'},y: { label: "# of Flights"}},legend: { show: false }});';
580 580
 
581
-            	     print '</script>';
582
-                  }
583
-                ?>
581
+					 print '</script>';
582
+				  }
583
+				?>
584 584
                 <div class="more">
585 585
                     <a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
586 586
                 </div>
@@ -588,26 +588,26 @@  discard block
 block discarded – undo
588 588
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
589 589
         </div>
590 590
 <?php
591
-    }
591
+	}
592 592
 ?>
593 593
 
594 594
 <?php
595
-    if (($airline_icao == '' || $airline_icao == 'all') && $year == '' && $month == '' && isset($globalAccidents) && $globalAccidents) {
595
+	if (($airline_icao == '' || $airline_icao == 'all') && $year == '' && $month == '' && isset($globalAccidents) && $globalAccidents) {
596 596
 ?>
597 597
         <div class="row column">
598 598
             <div class="col-md-6">
599 599
                 <h2><?php echo _("Fatalities by Years"); ?></h2>
600 600
                 <?php
601
-                  $year_array = $Stats->countFatalitiesByYear();
602
-		    if (count($year_array) == 0) print _("No data available");
603
-		    else {
601
+				  $year_array = $Stats->countFatalitiesByYear();
602
+			if (count($year_array) == 0) print _("No data available");
603
+			else {
604 604
 			print '<div id="chart32" class="chart" width="100%"></div><script>';
605
-                        $year_data = '';
605
+						$year_data = '';
606 606
 			$year_cnt = '';
607 607
 			foreach($year_array as $year_item)
608 608
 			{
609
-			    $year_data .= '"'.$year_item['year'].'-01-01",';
610
-			    $year_cnt .= $year_item['count'].',';
609
+				$year_data .= '"'.$year_item['year'].'-01-01",';
610
+				$year_cnt .= $year_item['count'].',';
611 611
 			}
612 612
 			$year_data = "['x',".substr($year_data, 0, -1)."]";
613 613
 			$year_cnt = "['flights',".substr($year_cnt,0,-1)."]";
@@ -618,8 +618,8 @@  discard block
 block discarded – undo
618 618
                 	     axis: { x: { type: "timeseries",tick: { format: "%Y"}}, y: { label: "# of Fatalities"}},legend: { show: false }});';
619 619
 
620 620
 			print '</script>';
621
-		    }
622
-                  ?>
621
+			}
622
+				  ?>
623 623
                 <div class="more">
624 624
                     <a href="<?php print $globalURL; ?>/statistics/fatalities/year" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
625 625
                 </div>
@@ -630,16 +630,16 @@  discard block
 block discarded – undo
630 630
             <div class="col-md-6">
631 631
                 <h2><?php echo _("Fatalities last 12 Months"); ?></h2>
632 632
                 <?php
633
-                  $year_array = $Stats->countFatalitiesLast12Months();
634
-		    if (count($year_array) == 0) print _("No data available");
635
-		    else {
633
+				  $year_array = $Stats->countFatalitiesLast12Months();
634
+			if (count($year_array) == 0) print _("No data available");
635
+			else {
636 636
 			print '<div id="chart33" class="chart" width="100%"></div><script>';
637
-                        $year_data = '';
637
+						$year_data = '';
638 638
 			$year_cnt = '';
639 639
 			foreach($year_array as $year_item)
640 640
 			{
641
-			    $year_data .= '"'.$year_item['year'].'-'.$year_item['month'].'-01",';
642
-			    $year_cnt .= $year_item['count'].',';
641
+				$year_data .= '"'.$year_item['year'].'-'.$year_item['month'].'-01",';
642
+				$year_cnt .= $year_item['count'].',';
643 643
 			}
644 644
 			$year_data = "['x',".substr($year_data, 0, -1)."]";
645 645
 			$year_cnt = "['flights',".substr($year_cnt,0,-1)."]";
@@ -649,8 +649,8 @@  discard block
 block discarded – undo
649 649
                 	     columns: ['.$year_data.','.$year_cnt.'], types: { flights: "area"}, colors: { flights: "#1a3151"}},
650 650
                 	     axis: { x: { type: "timeseries",tick: { format: "%Y-%m"}}, y: { label: "# of Fatalities"}},legend: { show: false }});';
651 651
 			print '</script>';
652
-		    }
653
-                  ?>
652
+			}
653
+				  ?>
654 654
                 <div class="more">
655 655
                     <a href="<?php print $globalURL; ?>/statistics/fatalities/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
656 656
                 </div>
@@ -658,30 +658,30 @@  discard block
 block discarded – undo
658 658
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
659 659
 <br/>
660 660
 <?php
661
-    }
661
+	}
662 662
 ?>
663 663
 
664 664
 <?php
665
-    if (($airline_icao == '' || $airline_icao == 'all') && $filter_name == '' && $year == '' && $month == '') {
665
+	if (($airline_icao == '' || $airline_icao == 'all') && $filter_name == '' && $year == '' && $month == '') {
666 666
 ?>
667 667
         <div class="row column">
668 668
         	<?php
669
-        	    //$polar = $Stats->getStatsSource(date('Y-m-d'),'polar');
670
-        	    if ($year == '' && $month == '') {
671
-		        $polar = $Stats->getStatsSource('polar',date('Y'),date('m'),date('d'));
672
-		    } else {
673
-        		$polar = $Stats->getStatsSource('polar',$year,$month);
674
-        	    }
675
-        	    if (!empty($polar)) {
676
-            		print '<h2>'._("Coverage pattern").'</h2>';
677
-        		foreach ($polar as $eachpolar) {
678
-        		    unset($polar_data);
679
-	        	    $Spotter = new Spotter();
680
-        		    $data = json_decode($eachpolar['source_data']);
681
-        		    foreach($data as $value => $key) {
682
-        			$direction = $Spotter->parseDirection(($value*22.5));
683
-        			$distance = $key;
684
-        			$unit = 'km';
669
+				//$polar = $Stats->getStatsSource(date('Y-m-d'),'polar');
670
+				if ($year == '' && $month == '') {
671
+				$polar = $Stats->getStatsSource('polar',date('Y'),date('m'),date('d'));
672
+			} else {
673
+				$polar = $Stats->getStatsSource('polar',$year,$month);
674
+				}
675
+				if (!empty($polar)) {
676
+					print '<h2>'._("Coverage pattern").'</h2>';
677
+				foreach ($polar as $eachpolar) {
678
+					unset($polar_data);
679
+					$Spotter = new Spotter();
680
+					$data = json_decode($eachpolar['source_data']);
681
+					foreach($data as $value => $key) {
682
+					$direction = $Spotter->parseDirection(($value*22.5));
683
+					$distance = $key;
684
+					$unit = 'km';
685 685
 				if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
686 686
 					$distance = round($distance*0.539957);
687 687
 					$unit = 'nm';
@@ -692,10 +692,10 @@  discard block
 block discarded – undo
692 692
 					$distance = $distance;
693 693
 					$unit = 'km';
694 694
 				}
695
-        			if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
696
-        	    		else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
697
-        		    }
698
-        	?>
695
+					if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
696
+						else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
697
+					}
698
+			?>
699 699
             <div class="col-md-6">
700 700
                 <h4><?php print $eachpolar['source_name']; ?></h4>
701 701
         	<div id="polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div>
@@ -727,27 +727,27 @@  discard block
 block discarded – undo
727 727
 		</script>
728 728
             </div>
729 729
             <?php
730
-        	    }
731
-        	}
732
-            ?>
730
+				}
731
+			}
732
+			?>
733 733
         </div>
734 734
         <div class="row column">
735 735
             <div class="col-md-6">
736 736
         	<?php
737
-        	    //$msg = $Stats->getStatsSource(date('Y-m-d'),'msg');
738
-        	    if ($year == '' && $month == '') {
739
-        		$msg = $Stats->getStatsSource('msg',date('Y'),date('m'),date('d'));
740
-        	    } else {
741
-        		$msg = $Stats->getStatsSource('msg',$year,$month);
742
-        	    }
743
-        	    if (!empty($msg)) {
744
-            		print '<h2>'._("Messages received").'</h2>';
745
-        		foreach ($msg as $eachmsg) {
746
-        		    //$eachmsg = $msg[0];
747
-        		    $data = $eachmsg['source_data'];
748
-        		    if ($data > 500) $max = (round(($data+100)/100))*100;
749
-        		    else $max = 500;
750
-        	?>
737
+				//$msg = $Stats->getStatsSource(date('Y-m-d'),'msg');
738
+				if ($year == '' && $month == '') {
739
+				$msg = $Stats->getStatsSource('msg',date('Y'),date('m'),date('d'));
740
+				} else {
741
+				$msg = $Stats->getStatsSource('msg',$year,$month);
742
+				}
743
+				if (!empty($msg)) {
744
+					print '<h2>'._("Messages received").'</h2>';
745
+				foreach ($msg as $eachmsg) {
746
+					//$eachmsg = $msg[0];
747
+					$data = $eachmsg['source_data'];
748
+					if ($data > 500) $max = (round(($data+100)/100))*100;
749
+					else $max = 500;
750
+			?>
751 751
         	<div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
752 752
         	<script>
753 753
 		      var g = new JustGage({
@@ -763,9 +763,9 @@  discard block
 block discarded – undo
763 763
 			  });
764 764
 		</script>
765 765
             <?php
766
-        	   }
767
-        	}
768
-            ?>
766
+			   }
767
+			}
768
+			?>
769 769
             </div>
770 770
         </div>
771 771
         <div class="row column">
@@ -803,26 +803,26 @@  discard block
 block discarded – undo
803 803
 			//$hist_data = substr($hist_data, 0, -1);
804 804
 			$distance_data = "['x',".substr($distance_data, 0, -1)."]";
805 805
 			$nb_data = "['flights',".substr($nb_data, 0, -1)."]";
806
-            ?>
806
+			?>
807 807
             <div class="col-md-6">
808 808
                 <h2><?php echo sprintf(_("Flights Distance for %s"),$source); ?></h2>
809 809
                 <?php
810
-                    print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div><script>';
811
-		    print 'c3.generate({
810
+					print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div><script>';
811
+			print 'c3.generate({
812 812
 			bindto: "#charthist-'.str_replace(' ','_',strtolower($source)).'",
813 813
 			data: { x: "x",
814 814
 			columns: ['.$distance_data.','.$nb_data.'], types: { flights: "area"}, colors: { flights: "#1a3151"}},
815 815
 			axis: { x: {label : { text: "Distance in '.$unit.'", position: "outer-right"}}, y: { label: "# of Flights"}},legend: { show: false }});';
816
-		    print '</script>';
817
-        	?>
816
+			print '</script>';
817
+			?>
818 818
     	    </div>
819 819
 	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
820 820
         	<?php
821
-                  }
822
-                ?>
821
+				  }
822
+				?>
823 823
         </div>
824 824
 <?php
825
-    }
825
+	}
826 826
 ?>
827 827
     </div>
828 828
 </div>  
Please login to merge, or discard this patch.
index.php 1 patch
Indentation   +89 added lines, -89 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     <?php }; if (isset($globalTracker) && $globalTracker) { ?><td><div id="ibxtracker"><h4><?php echo _("Trackers Detected"); ?></h4><br /><i class="fa fa-spinner fa-pulse fa-fw"></i></div></td><?php } ?>
41 41
 </tr></table></div>
42 42
 <?php
43
-    if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
43
+	if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
44 44
 
45 45
 ?>
46 46
 <script src="<?php echo $globalURL; ?>/js/map.3d.js.php"></script>
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 <script src="<?php echo $globalURL; ?>/js/map-marine.3d.js.php"></script>
61 61
 <?php
62 62
 	}
63
-    }
63
+	}
64 64
 ?>
65 65
 <div id="dialog" title="<?php echo _("Session has timed-out"); ?>">
66 66
   <p><?php echo _("In order to save data consumption web page times out after 30 minutes. Close this dialog to continue."); ?></p>
@@ -74,34 +74,34 @@  discard block
 block discarded – undo
74 74
 	<li><a href="#" onclick="getUserLocation(); return false;" title="<?php echo _("Plot your Location"); ?>"><i class="fa fa-map-marker"></i></a></li>
75 75
 	<li><a href="#" onclick="getCompassDirection(); return false;" title="<?php echo _("Compass Mode"); ?>"><i class="fa fa-compass"></i></a></li>
76 76
 <?php
77
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
77
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
78 78
 	if (isset($globalArchive) && $globalArchive == TRUE) {
79 79
 ?>
80 80
 	<li><a href="#archive" role="tab" title="<?php echo _("Archive"); ?>"><i class="fa fa-archive"></i></a></li>
81 81
 <?php
82 82
 	}
83
-    }
83
+	}
84 84
 ?>
85 85
 	<li><a href="#home" role="tab" title="<?php echo _("Layers"); ?>"><i class="fa fa-map"></i></a></li>
86 86
 	<li><a href="#filters" role="tab" title="<?php echo _("Filters"); ?>"><i class="fa fa-filter"></i></a></li>
87 87
 	<li><a href="#settings" role="tab" title="<?php echo _("Settings"); ?>"><i class="fa fa-gears"></i></a></li>
88 88
 <?php
89
-    if (isset($globalMap3D) && $globalMap3D) {
89
+	if (isset($globalMap3D) && $globalMap3D) {
90 90
 	if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
91 91
 ?>
92 92
 	<li><a href="#" onclick="show3D(); return false;" role="tab" title="3D"><b>3D</b></a></li>
93 93
 <?php
94
-        } else {
95
-    	    if (isset($globalMapSatellites) && $globalMapSatellites) {
94
+		} else {
95
+			if (isset($globalMapSatellites) && $globalMapSatellites) {
96 96
 ?>
97 97
 	<li><a href="#satellites" role="tab" title="<?php echo _("Satellites"); ?>"><i class="satellite"></i></a></li>
98 98
 <?php
99
-	    }
99
+		}
100 100
 ?>
101 101
 	<li><a href="#" onclick="show2D(); return false;" role="tab" title="2D"><b>2D</b></a></li>
102 102
 <?php
103 103
 	}
104
-    }
104
+	}
105 105
 ?>
106 106
     </ul>
107 107
 
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 ?>
176 176
         </div>
177 177
 <?php
178
-    if (isset($globalArchive) && $globalArchive == TRUE) {
178
+	if (isset($globalArchive) && $globalArchive == TRUE) {
179 179
 ?>
180 180
         <div class="sidebar-pane" id="archive">
181 181
 	    <h1 class="sidebar-header"><?php echo _("Playback"); ?> <i>Bêta</i><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 	    </form>
236 236
 	</div>
237 237
 <?php
238
-    }
238
+	}
239 239
 ?>
240 240
         <div class="sidebar-pane" id="settings">
241 241
 	    <h1 class="sidebar-header"><?php echo _("Settings"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
@@ -246,56 +246,56 @@  discard block
 block discarded – undo
246 246
 			    <?php
247 247
 				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider;
248 248
 				else $MapType = $_COOKIE['MapType'];
249
-			    ?>
249
+				?>
250 250
 			    <?php
251 251
 				if (isset($globalBingMapKey) && $globalBingMapKey != '') {
252
-			    ?>
252
+				?>
253 253
 			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option>
254 254
 			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option>
255 255
 			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option>
256 256
 			    <?php
257 257
 				}
258
-			    ?>
258
+				?>
259 259
 			    <?php
260
-			        if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
261
-			    ?>
260
+					if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
261
+				?>
262 262
 			    <?php
263
-				    if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
264
-			    ?>
263
+					if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
264
+				?>
265 265
 			    <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option>
266 266
 			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option>
267 267
 			    <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option>
268 268
 			    <?php
269
-				    }
270
-			    ?>
269
+					}
270
+				?>
271 271
 			    <?php
272
-				    if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
273
-			    ?>
272
+					if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
273
+				?>
274 274
 			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option>
275 275
 			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option>
276 276
 			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option>
277 277
 			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option>
278 278
 			    <?php
279
-				    }
280
-			    ?>
279
+					}
280
+				?>
281 281
 			    <?php
282
-				    if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
283
-			    ?>
282
+					if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
283
+				?>
284 284
 			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option>
285 285
 			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option>
286 286
 			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option>
287 287
 			    <?php
288
-				    }
289
-			    ?>
288
+					}
289
+				?>
290 290
 			    <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option>
291 291
 			    <?php
292 292
 				}
293
-			    ?>
293
+				?>
294 294
 			    <?php
295
-				    if (isset($globalMapboxToken) && $globalMapboxToken != '') {
295
+					if (isset($globalMapboxToken) && $globalMapboxToken != '') {
296 296
 					if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default';
297 297
 					else $MapBoxId = $_COOKIE['MapTypeId'];
298
-			    ?>
298
+				?>
299 299
 			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option>
300 300
 			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option>
301 301
 			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option>
@@ -309,13 +309,13 @@  discard block
 block discarded – undo
309 309
 			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option>
310 310
 			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option>
311 311
 			    <?php
312
-				    }
313
-			    ?>
312
+					}
313
+				?>
314 314
 			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option>
315 315
 			</select>
316 316
 		    </li>
317 317
 <?php
318
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
318
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
319 319
 ?>
320 320
 		    <li><?php echo _("Type of Terrain:"); ?>
321 321
 			<select  class="selectpicker" onchange="terrainType(this);">
@@ -325,10 +325,10 @@  discard block
 block discarded – undo
325 325
 			</select>
326 326
 		    </li>
327 327
 <?php
328
-    }
328
+	}
329 329
 ?>
330 330
 <?php
331
-    if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
331
+	if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
332 332
 ?>
333 333
 		    
334 334
 		    <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>
@@ -336,75 +336,75 @@  discard block
 block discarded – undo
336 336
 		    <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'])) print 'checked'; ?> ><?php echo _("Display flight route on click"); ?></label></div></li>
337 337
 		    <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>
338 338
 <?php
339
-    }
339
+	}
340 340
 ?>
341 341
 		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true') print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li>
342 342
 <?php
343
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
343
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
344 344
 ?>
345 345
 		    <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>
346 346
 <?php
347
-    }
348
-    if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
347
+	}
348
+	if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
349 349
 ?>
350 350
 		    <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>
351 351
 <?php
352
-    }
352
+	}
353 353
 ?>
354 354
 
355 355
 		    <?php
356 356
 			if (function_exists('array_column')) {
357
-			    if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
358
-		    ?>
357
+				if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
358
+			?>
359 359
 		    <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>
360 360
 		    <?php
361
-			    }
361
+				}
362 362
 			} elseif (isset($globalSources)) {
363
-			    $dispolar = false;
364
-			    foreach ($globalSources as $testsource) {
365
-			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
366
-			    }
367
-			    if ($dispolar) {
368
-		    ?>
363
+				$dispolar = false;
364
+				foreach ($globalSources as $testsource) {
365
+					if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
366
+				}
367
+				if ($dispolar) {
368
+			?>
369 369
 		    <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>
370 370
 		    <?php
371
-			    }
372
-		        }
373
-		    ?>
371
+				}
372
+				}
373
+			?>
374 374
 <?php
375
-    if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
375
+	if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
376 376
 ?>
377 377
 
378 378
 		    <?php
379 379
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
380
-		    	    if (extension_loaded('gd') && function_exists('gd_info')) {
381
-		    ?>
380
+					if (extension_loaded('gd') && function_exists('gd_info')) {
381
+			?>
382 382
 		    <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>
383 383
 		    <?php 
384 384
 				if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') {
385
-		    ?>
385
+			?>
386 386
 		    <li><?php echo _("Aircraft icon color:"); ?>
387 387
 			<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'; ?>">
388 388
 		    </li>
389 389
 		    <?php
390 390
 				}
391
-			    }
392
-		        }
393
-		    ?>
391
+				}
392
+				}
393
+			?>
394 394
 		    <?php
395 395
 			if (isset($globalMarine) && $globalMarine === TRUE) {
396
-			    if (extension_loaded('gd') && function_exists('gd_info')) {
397
-		    ?>
396
+				if (extension_loaded('gd') && function_exists('gd_info')) {
397
+			?>
398 398
 		    <li><?php echo _("Marine icon color:"); ?>
399 399
 			<input type="color" name="marinecolor" id="html5colorpicker" onchange="iconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print '1a3151'; ?>">
400 400
 		    </li>
401 401
 		    <?php
402
-			    }
403
-		        }
404
-		    ?>
402
+				}
403
+				}
404
+			?>
405 405
 		    <?php
406 406
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
407
-		    ?>
407
+			?>
408 408
 		    <li><?php echo _("Show airport icon at zoom level:"); ?>
409 409
 			<div class="range">
410 410
 			    <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'; ?>">
@@ -413,9 +413,9 @@  discard block
 block discarded – undo
413 413
 		    </li>
414 414
 		    <?php
415 415
 			}
416
-		    ?>
416
+			?>
417 417
 <?php
418
-    } elseif (isset($_COOKIE['MapFormat']) || $_COOKIE['MapFOrmat'] == '3d') {
418
+	} elseif (isset($_COOKIE['MapFormat']) || $_COOKIE['MapFOrmat'] == '3d') {
419 419
 ?>
420 420
 <?php
421 421
 	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
 		    </li>
437 437
 <?php
438 438
 	}
439
-    }
439
+	}
440 440
 ?>
441 441
 		    <li><?php echo _("Distance unit:"); ?>
442 442
 			<select class="selectpicker" onchange="unitdistance(this);">
@@ -469,19 +469,19 @@  discard block
 block discarded – undo
469 469
 		    <ul>
470 470
 		    <?php
471 471
 			if (!isset($globalAircraft) || $globalAircraft) {
472
-		    ?>
472
+			?>
473 473
 		    <?php
474 474
 			if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) {
475
-		    ?>
475
+			?>
476 476
 			<?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 } ?>
477 477
 			<?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 } ?>
478 478
 			<?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 } ?>
479 479
 		    <?php
480 480
 			}
481
-		    ?>
481
+			?>
482 482
 		    <?php
483 483
 			if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) {
484
-		    ?>
484
+			?>
485 485
 			<?php if (isset($globalSBS1) && $globalSBS1) { ?>
486 486
 			    <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>
487 487
 			<?php } ?>
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
 			<?php } ?>
491 491
 		    <?php
492 492
 			}
493
-		    ?>
493
+			?>
494 494
 		    <li><?php echo _("Display airlines:"); ?>
495 495
 		    <br/>
496 496
 			<select class="selectpicker" multiple onchange="airlines(this);" id="display_airlines">
@@ -510,14 +510,14 @@  discard block
 block discarded – undo
510 510
 						echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>';
511 511
 					}
512 512
 				}
513
-			    ?>
513
+				?>
514 514
 			</select>
515 515
 		    </li>
516 516
 		    <?php
517 517
 			$Spotter = new Spotter();
518 518
 			$allalliancenames = $Spotter->getAllAllianceNames();
519 519
 			if (!empty($allalliancenames)) {
520
-		    ?>
520
+			?>
521 521
 		    <li><?php echo _("Display alliance:"); ?>
522 522
 		    <br/>
523 523
 			<select class="selectpicker" onchange="alliance(this);" id="display_alliance">
@@ -531,18 +531,18 @@  discard block
 block discarded – undo
531 531
 						echo '<option value="'.$alliance_name.'">'.$alliance_name.'</option>';
532 532
 					}
533 533
 				}
534
-			    ?>
534
+				?>
535 535
 			</select>
536 536
 		    </li>
537 537
 		    <?php
538 538
 			}
539
-		    ?>
539
+			?>
540 540
 		    <?php
541 541
 			}
542
-		    ?>
542
+			?>
543 543
 		    <?php
544 544
 			if (isset($globalAPRS) && $globalAPRS) {
545
-		    ?>
545
+			?>
546 546
 		    <li><?php echo _("Display APRS sources name:"); ?>
547 547
 			<select class="selectpicker" multiple onchange="sources(this);">
548 548
 			    <?php
@@ -554,18 +554,18 @@  discard block
 block discarded – undo
554 554
 						echo '<option value="'.$source['source_name'].'">'.$source['source_name'].'</option>';
555 555
 					}
556 556
 				}
557
-			    ?>
557
+				?>
558 558
 			</select>
559 559
 		    </li>
560 560
 		    <?php
561 561
 			}
562
-		    ?>
562
+			?>
563 563
 		    <?php
564 564
 			if (!isset($globalAircraft) && $globalAircraft) {
565
-		    ?>
565
+			?>
566 566
 		    <?php
567 567
 			if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS)) {
568
-		    ?>
568
+			?>
569 569
 		    <li><?php echo _("Display airlines of type:"); ?><br/>
570 570
 			<select class="selectpicker" onchange="airlinestype(this);">
571 571
 			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
@@ -576,14 +576,14 @@  discard block
 block discarded – undo
576 576
 		    </li>
577 577
 		    <?php
578 578
 			}
579
-		    ?>
579
+			?>
580 580
 		    <li>
581 581
 			<?php echo _("Display flight with ident:"); ?>
582 582
 			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" />
583 583
 		    </li>
584 584
 		    <?php
585 585
 			}
586
-		    ?>
586
+			?>
587 587
 		</ul>
588 588
 	    </form>
589 589
 	    <form method="post">
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
 	    </form>
593 593
     	</div>
594 594
 <?php
595
-    if (isset($globalMapSatellites) && $globalMapSatellites && isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
595
+	if (isset($globalMapSatellites) && $globalMapSatellites && isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
596 596
 ?>
597 597
         <div class="sidebar-pane" id="satellites">
598 598
 	    <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
@@ -632,14 +632,14 @@  discard block
 block discarded – undo
632 632
 						print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>';
633 633
 					}
634 634
 				}
635
-			    ?>
635
+				?>
636 636
 			</select>
637 637
 		    </li>
638 638
 		</ul>
639 639
 	    </form>
640 640
 	</div>
641 641
 <?php
642
-    }
642
+	}
643 643
 ?>
644 644
     </div>
645 645
 </div>
Please login to merge, or discard this patch.