Completed
Push — master ( 35ee00...39c0a3 )
by Yannick
28:16
created
pilot-detailed.php 2 patches
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -5,13 +5,13 @@  discard block
 block discarded – undo
5 5
 require_once('require/class.Language.php');
6 6
 require_once('require/class.SpotterArchive.php');
7 7
 
8
-if (!isset($_GET['pilot'])){
8
+if (!isset($_GET['pilot'])) {
9 9
 	header('Location: '.$globalURL.'/');
10 10
 } else {
11 11
 	$Spotter = new Spotter();
12 12
 	$SpotterArchive = new SpotterArchive();
13 13
 	//calculuation for the pagination
14
-	if(!isset($_GET['limit']))
14
+	if (!isset($_GET['limit']))
15 15
 	{
16 16
 		$limit_start = 0;
17 17
 		$limit_end = 25;
@@ -32,29 +32,29 @@  discard block
 block discarded – undo
32 32
 	
33 33
 	$page_url = $globalURL.'/pilot/'.$_GET['pilot'];
34 34
 	
35
-	$pilot = filter_input(INPUT_GET,'pilot',FILTER_SANITIZE_STRING);
36
-	$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
37
-	$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
38
-	$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
35
+	$pilot = filter_input(INPUT_GET, 'pilot', FILTER_SANITIZE_STRING);
36
+	$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
37
+	$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT);
38
+	$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT);
39 39
 	$filter = array();
40
-	if ($year != '') $filter = array_merge($filter,array('year' => $year));
41
-	if ($month != '') $filter = array_merge($filter,array('month' => $month));
40
+	if ($year != '') $filter = array_merge($filter, array('year' => $year));
41
+	if ($month != '') $filter = array_merge($filter, array('month' => $month));
42 42
 	if ($sort != '') 
43 43
 	{
44
-		$spotter_array = $Spotter->getSpotterDataByPilot($pilot,$limit_start.",".$absolute_difference, $sort,$filter);
44
+		$spotter_array = $Spotter->getSpotterDataByPilot($pilot, $limit_start.",".$absolute_difference, $sort, $filter);
45 45
 		if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) {
46
-			$spotter_array = $SpotterArchive->getSpotterDataByPilot($pilot,$limit_start.",".$absolute_difference, $sort,$filter);
46
+			$spotter_array = $SpotterArchive->getSpotterDataByPilot($pilot, $limit_start.",".$absolute_difference, $sort, $filter);
47 47
 		}
48 48
 	} else {
49
-		$spotter_array = $Spotter->getSpotterDataByPilot($pilot,$limit_start.",".$absolute_difference,'',$filter);
49
+		$spotter_array = $Spotter->getSpotterDataByPilot($pilot, $limit_start.",".$absolute_difference, '', $filter);
50 50
 		if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) {
51
-			$spotter_array = $SpotterArchive->getSpotterDataByPilot($pilot,$limit_start.",".$absolute_difference,'',$filter);
51
+			$spotter_array = $SpotterArchive->getSpotterDataByPilot($pilot, $limit_start.",".$absolute_difference, '', $filter);
52 52
 		}
53 53
 	}
54 54
 
55 55
 	if (!empty($spotter_array))
56 56
 	{
57
-		$title = sprintf(_("Detailed View for %s"),$spotter_array[0]['pilot_name']);
57
+		$title = sprintf(_("Detailed View for %s"), $spotter_array[0]['pilot_name']);
58 58
 		$ident = $spotter_array[0]['ident'];
59 59
 		if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude'];
60 60
 		if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude'];
@@ -115,23 +115,23 @@  discard block
 block discarded – undo
115 115
 			$Stats = new Stats();
116 116
 			$flights = $Stats->getStatsPilot($pilot);
117 117
 		} else $flights = 0;
118
-		if ($flights == 0) $flights = $Spotter->countFlightsByPilot($pilot,$filter);
118
+		if ($flights == 0) $flights = $Spotter->countFlightsByPilot($pilot, $filter);
119 119
 		print '<div><span class="label">'._("Flights").'</span>'.$flights.'</div>';
120
-		$aircraft_type = count($Spotter->countAllAircraftTypesByPilot($pilot,$filter));
120
+		$aircraft_type = count($Spotter->countAllAircraftTypesByPilot($pilot, $filter));
121 121
 		print '<div><span class="label">'._("Aircrafts type").'</span>'.$aircraft_type.'</div>';
122
-		$aircraft_registration = count($Spotter->countAllAircraftRegistrationByPilot($pilot,$filter));
122
+		$aircraft_registration = count($Spotter->countAllAircraftRegistrationByPilot($pilot, $filter));
123 123
 		print '<div><span class="label">'._("Aircrafts").'</span>'.$aircraft_registration.'</div>';
124
-		$aircraft_manufacturer = count($Spotter->countAllAircraftManufacturerByPilot($pilot,$filter));
124
+		$aircraft_manufacturer = count($Spotter->countAllAircraftManufacturerByPilot($pilot, $filter));
125 125
 		print '<div><span class="label">'._("Manufacturers").'</span>'.$aircraft_manufacturer.'</div>';
126
-		$airlines = count($Spotter->countAllAirlinesByPilot($pilot,$filter));
126
+		$airlines = count($Spotter->countAllAirlinesByPilot($pilot, $filter));
127 127
 		print '<div><span class="label">'._("Airlines").'</span>'.$airlines.'</div>';
128
-		$duration = $Spotter->getFlightDurationByPilot($pilot,$filter);
128
+		$duration = $Spotter->getFlightDurationByPilot($pilot, $filter);
129 129
 		if ($duration != '0') print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>';
130 130
 		print '</div>';
131 131
 	
132 132
 		include('pilot-sub-menu.php');
133 133
 		print '<div class="table column">';
134
-		print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the pilot <strong>%s</strong>."),$spotter_array[0]['pilot_name']).'</p>';
134
+		print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the pilot <strong>%s</strong>."), $spotter_array[0]['pilot_name']).'</p>';
135 135
 
136 136
 		include('table-output.php'); 
137 137
 		print '<div class="pagination">';
Please login to merge, or discard this patch.
Braces   +24 added lines, -8 removed lines patch added patch discarded remove patch
@@ -37,8 +37,12 @@  discard block
 block discarded – undo
37 37
 	$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
38 38
 	$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
39 39
 	$filter = array();
40
-	if ($year != '') $filter = array_merge($filter,array('year' => $year));
41
-	if ($month != '') $filter = array_merge($filter,array('month' => $month));
40
+	if ($year != '') {
41
+		$filter = array_merge($filter,array('year' => $year));
42
+	}
43
+	if ($month != '') {
44
+		$filter = array_merge($filter,array('month' => $month));
45
+	}
42 46
 	if ($sort != '') 
43 47
 	{
44 48
 		$spotter_array = $Spotter->getSpotterDataByPilot($pilot,$limit_start.",".$absolute_difference, $sort,$filter);
@@ -56,8 +60,12 @@  discard block
 block discarded – undo
56 60
 	{
57 61
 		$title = sprintf(_("Detailed View for %s"),$spotter_array[0]['pilot_name']);
58 62
 		$ident = $spotter_array[0]['ident'];
59
-		if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude'];
60
-		if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude'];
63
+		if (isset($spotter_array[0]['latitude'])) {
64
+			$latitude = $spotter_array[0]['latitude'];
65
+		}
66
+		if (isset($spotter_array[0]['longitude'])) {
67
+			$longitude = $spotter_array[0]['longitude'];
68
+		}
61 69
 		require_once('header.php');
62 70
 		/*
63 71
 		if (isset($globalArchive) && $globalArchive) {
@@ -110,12 +118,18 @@  discard block
 block discarded – undo
110 118
 		*/
111 119
 		print '<div class="info column">';
112 120
 		print '<h1>'.$spotter_array[0]['pilot_name'].'</h1>';
113
-		if (isset($spotter_array[0]['pilot_id']) && $spotter_array[0]['pilot_id'] != '') print '<div><span class="label">'._("Pilot ID").'</span>'.$spotter_array[0]['pilot_id'].'</div>';
121
+		if (isset($spotter_array[0]['pilot_id']) && $spotter_array[0]['pilot_id'] != '') {
122
+			print '<div><span class="label">'._("Pilot ID").'</span>'.$spotter_array[0]['pilot_id'].'</div>';
123
+		}
114 124
 		if ($year == '' && $month == '') {
115 125
 			$Stats = new Stats();
116 126
 			$flights = $Stats->getStatsPilot($pilot);
117
-		} else $flights = 0;
118
-		if ($flights == 0) $flights = $Spotter->countFlightsByPilot($pilot,$filter);
127
+		} else {
128
+			$flights = 0;
129
+		}
130
+		if ($flights == 0) {
131
+			$flights = $Spotter->countFlightsByPilot($pilot,$filter);
132
+		}
119 133
 		print '<div><span class="label">'._("Flights").'</span>'.$flights.'</div>';
120 134
 		$aircraft_type = count($Spotter->countAllAircraftTypesByPilot($pilot,$filter));
121 135
 		print '<div><span class="label">'._("Aircrafts type").'</span>'.$aircraft_type.'</div>';
@@ -126,7 +140,9 @@  discard block
 block discarded – undo
126 140
 		$airlines = count($Spotter->countAllAirlinesByPilot($pilot,$filter));
127 141
 		print '<div><span class="label">'._("Airlines").'</span>'.$airlines.'</div>';
128 142
 		$duration = $Spotter->getFlightDurationByPilot($pilot,$filter);
129
-		if ($duration != '0') print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>';
143
+		if ($duration != '0') {
144
+			print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>';
145
+		}
130 146
 		print '</div>';
131 147
 	
132 148
 		include('pilot-sub-menu.php');
Please login to merge, or discard this patch.
route.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -5,8 +5,8 @@
 block discarded – undo
5 5
 
6 6
 if (isset($_POST['departure_airport']) && $_POST['departure_airport'] != '')
7 7
 {
8
-	$departure_airport = filter_input(INPUT_POST,'departure_airport',FILTER_SANITIZE_STRING);
9
-	$arrival_airport = filter_input(INPUT_POST,'arrival_airport',FILTER_SANITIZE_STRING);
8
+	$departure_airport = filter_input(INPUT_POST, 'departure_airport', FILTER_SANITIZE_STRING);
9
+	$arrival_airport = filter_input(INPUT_POST, 'arrival_airport', FILTER_SANITIZE_STRING);
10 10
 	header('Location: '.$globalURL.'/route/'.$departure_airport.'/'.$arrival_airport);
11 11
 } else {
12 12
 	if ($globalURL == '') {
Please login to merge, or discard this patch.
country-detailed.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -3,17 +3,17 @@  discard block
 block discarded – undo
3 3
 require_once('require/class.Spotter.php');
4 4
 require_once('require/class.Language.php');
5 5
 
6
-if (!isset($_GET['country'])){
6
+if (!isset($_GET['country'])) {
7 7
 	header('Location: '.$globalURL.'');
8 8
 } else {
9 9
 	$Spotter = new Spotter();
10 10
 	//calculuation for the pagination
11
-	if(!isset($_GET['limit']))
11
+	if (!isset($_GET['limit']))
12 12
 	{
13 13
 		$limit_start = 0;
14 14
 		$limit_end = 25;
15 15
 		$absolute_difference = 25;
16
-	}  else {
16
+	} else {
17 17
 		$limit_explode = explode(",", $_GET['limit']);
18 18
 		if (isset($limit_explode[1])) {
19 19
 			$limit_start = $limit_explode[0];
@@ -32,10 +32,10 @@  discard block
 block discarded – undo
32 32
 	$limit_previous_1 = $limit_start - $absolute_difference;
33 33
 	$limit_previous_2 = $limit_end - $absolute_difference;
34 34
 	
35
-	$country = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET,'country',FILTER_SANITIZE_STRING))));
35
+	$country = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET, 'country', FILTER_SANITIZE_STRING))));
36 36
 	
37 37
 	$page_url = $globalURL.'/country/'.$_GET['country'];
38
-	$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
38
+	$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
39 39
 	if ($country == 'Na') {
40 40
 		$spotter_array = array();
41 41
 	} else {
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 
49 49
 	if (!empty($spotter_array))
50 50
 	{
51
-		$title = sprintf(_("Detailed View for Airports &amp; Airlines from %s"),$country);
51
+		$title = sprintf(_("Detailed View for Airports &amp; Airlines from %s"), $country);
52 52
 
53 53
 		require_once('header.php');
54 54
 		print '<div class="select-item">';
@@ -56,9 +56,9 @@  discard block
 block discarded – undo
56 56
 		print '<select name="country" class="selectpicker" data-live-search="true">';
57 57
 		print '<option></option>';
58 58
 		$all_countries = $Spotter->getAllCountries();
59
-		foreach($all_countries as $all_country)
59
+		foreach ($all_countries as $all_country)
60 60
 		{
61
-			if($country == $all_country['country'])
61
+			if ($country == $all_country['country'])
62 62
 			{
63 63
 				print '<option value="'.strtolower(str_replace(" ", "-", $all_country['country'])).'" selected="selected">'.$all_country['country'].'</option>';
64 64
 			} else {
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 		if ($_GET['country'] != "NA")
74 74
 		{
75 75
 			print '<div class="info column">';
76
-			print '<h1>'.sprintf(_("Airports &amp; Airlines from %s"),$country).'</h1>';
76
+			print '<h1>'.sprintf(_("Airports &amp; Airlines from %s"), $country).'</h1>';
77 77
 			print '</div>';
78 78
 		} else {
79 79
 			print '<div class="alert alert-warning">'._("This special country profile shows all flights that do <u>not</u> have a country of a airline or departure/arrival airport associated with them.").'</div>';
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 
82 82
 		include('country-sub-menu.php');
83 83
 		print '<div class="table column">';
84
-		print '<p>'.sprintf(_("The table below shows the detailed information of all flights of airports (both departure &amp; arrival) OR airlines from <strong>%s</strong>."),$country).'</p>';
84
+		print '<p>'.sprintf(_("The table below shows the detailed information of all flights of airports (both departure &amp; arrival) OR airlines from <strong>%s</strong>."), $country).'</p>';
85 85
 
86 86
 		include('table-output.php');
87 87
 		print '<div class="pagination">';
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
 		$limit_start = 0;
14 14
 		$limit_end = 25;
15 15
 		$absolute_difference = 25;
16
-	}  else {
16
+	} else {
17 17
 		$limit_explode = explode(",", $_GET['limit']);
18 18
 		if (isset($limit_explode[1])) {
19 19
 			$limit_start = $limit_explode[0];
Please login to merge, or discard this patch.
search-kml.php 2 patches
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -5,14 +5,14 @@  discard block
 block discarded – undo
5 5
 $Spotter = new Spotter();
6 6
 if (isset($_GET['start_date'])) {
7 7
 	//for the date manipulation into the query
8
-	if($_GET['start_date'] != "" && $_GET['end_date'] != ""){
8
+	if ($_GET['start_date'] != "" && $_GET['end_date'] != "") {
9 9
 		$start_date = $_GET['start_date'].":00";
10 10
 		$end_date = $_GET['end_date'].":00";
11 11
 		$sql_date = $start_date.",".$end_date;
12
-	} else if($_GET['start_date'] != ""){
12
+	} else if ($_GET['start_date'] != "") {
13 13
 		$start_date = $_GET['start_date'].":00";
14 14
 		$sql_date = $start_date;
15
-	} else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){
15
+	} else if ($_GET['start_date'] == "" && $_GET['end_date'] != "") {
16 16
 		$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00";
17 17
 		$sql_date = $end_date;
18 18
 	} else $sql_date = '';
@@ -20,38 +20,38 @@  discard block
 block discarded – undo
20 20
 
21 21
 if (isset($_GET['highest_altitude'])) {
22 22
 	//for altitude manipulation
23
-	if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){
24
-		$end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT);
25
-		$start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT);
23
+	if ($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != "") {
24
+		$end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT);
25
+		$start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT);
26 26
 		$sql_altitude = $start_altitude.",".$end_altitude;
27
-	} else if($_GET['highest_altitude'] != ""){
28
-		$end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT);
27
+	} else if ($_GET['highest_altitude'] != "") {
28
+		$end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT);
29 29
 		$sql_altitude = $end_altitude;
30
-	} else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){
31
-		$start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000";
30
+	} else if ($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != "") {
31
+		$start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT).",60000";
32 32
 		$sql_altitude = $start_altitude;
33 33
 	} else $sql_altitude = '';
34 34
 } else $sql_altitude = '';
35 35
 
36 36
 //calculuation for the pagination
37
-if(!isset($_GET['limit']))
37
+if (!isset($_GET['limit']))
38 38
 {
39 39
 	if (!isset($_GET['number_results'])) {
40 40
 		$limit_start = 0;
41 41
 		$limit_end = 25;
42 42
 		$absolute_difference = 25;
43 43
 	} else {
44
-		if ($_GET['number_results'] > 1000){
44
+		if ($_GET['number_results'] > 1000) {
45 45
 			$_GET['number_results'] = 1000;
46 46
 		}
47 47
 		$limit_start = 0;
48
-		$limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
49
-		$absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
48
+		$limit_end = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT);
49
+		$absolute_difference = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT);
50 50
 	}
51
-}  else {
51
+} else {
52 52
 	$limit_explode = explode(",", $_GET['limit']);
53
-	$limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT);
54
-	$limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT);
53
+	$limit_start = filter_var($limit_explode[0], FILTER_SANITIZE_NUMBER_INT);
54
+	$limit_end = filter_var($limit_explode[1], FILTER_SANITIZE_NUMBER_INT);
55 55
 }
56 56
 
57 57
 $absolute_difference = abs($limit_start - $limit_end);
@@ -68,23 +68,23 @@  discard block
 block discarded – undo
68 68
 
69 69
 if (isset($_GET['sort'])) $sort = $_GET['sort'];
70 70
 else $sort = '';
71
-$q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING);
72
-$registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING);
73
-$aircraft = filter_input(INPUT_GET,'aircraft',FILTER_SANITIZE_STRING);
74
-$manufacturer = filter_input(INPUT_GET,'manufacturer',FILTER_SANITIZE_STRING);
75
-$highlights = filter_input(INPUT_GET,'highlights',FILTER_SANITIZE_STRING);
76
-$airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
77
-$airline_country = filter_input(INPUT_GET,'airline_country',FILTER_SANITIZE_STRING);
78
-$airline_type = filter_input(INPUT_GET,'airline_type',FILTER_SANITIZE_STRING);
79
-$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING);
80
-$airport_country = filter_input(INPUT_GET,'airport_country',FILTER_SANITIZE_STRING);
81
-$callsign = filter_input(INPUT_GET,'callsign',FILTER_SANITIZE_STRING);
82
-$owner = filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING);
83
-$pilot_id = filter_input(INPUT_GET,'pilot_id',FILTER_SANITIZE_STRING);
84
-$pilot_name = filter_input(INPUT_GET,'pilot_name',FILTER_SANITIZE_STRING);
85
-$departure_airport_route = filter_input(INPUT_GET,'departure_airport_route',FILTER_SANITIZE_STRING);
86
-$arrival_airport_route = filter_input(INPUT_GET,'arrival_airport_route',FILTER_SANITIZE_STRING);
87
-$spotter_array = $Spotter->searchSpotterData($q,$registration,$aircraft,strtolower(str_replace("-", " ", $manufacturer)),$highlights,$airline,$airline_country,$airline_type,$airport,$airport_country,$callsign,$departure_airport_route,$arrival_airport_route,$owner,$pilot_id,$pilot_name,$sql_altitude,$sql_date,$limit_start.",".$absolute_difference,$sort,'');
71
+$q = filter_input(INPUT_GET, 'q', FILTER_SANITIZE_STRING);
72
+$registration = filter_input(INPUT_GET, 'registratrion', FILTER_SANITIZE_STRING);
73
+$aircraft = filter_input(INPUT_GET, 'aircraft', FILTER_SANITIZE_STRING);
74
+$manufacturer = filter_input(INPUT_GET, 'manufacturer', FILTER_SANITIZE_STRING);
75
+$highlights = filter_input(INPUT_GET, 'highlights', FILTER_SANITIZE_STRING);
76
+$airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
77
+$airline_country = filter_input(INPUT_GET, 'airline_country', FILTER_SANITIZE_STRING);
78
+$airline_type = filter_input(INPUT_GET, 'airline_type', FILTER_SANITIZE_STRING);
79
+$airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING);
80
+$airport_country = filter_input(INPUT_GET, 'airport_country', FILTER_SANITIZE_STRING);
81
+$callsign = filter_input(INPUT_GET, 'callsign', FILTER_SANITIZE_STRING);
82
+$owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING);
83
+$pilot_id = filter_input(INPUT_GET, 'pilot_id', FILTER_SANITIZE_STRING);
84
+$pilot_name = filter_input(INPUT_GET, 'pilot_name', FILTER_SANITIZE_STRING);
85
+$departure_airport_route = filter_input(INPUT_GET, 'departure_airport_route', FILTER_SANITIZE_STRING);
86
+$arrival_airport_route = filter_input(INPUT_GET, 'arrival_airport_route', FILTER_SANITIZE_STRING);
87
+$spotter_array = $Spotter->searchSpotterData($q, $registration, $aircraft, strtolower(str_replace("-", " ", $manufacturer)), $highlights, $airline, $airline_country, $airline_type, $airport, $airport_country, $callsign, $departure_airport_route, $arrival_airport_route, $owner, $pilot_id, $pilot_name, $sql_altitude, $sql_date, $limit_start.",".$absolute_difference, $sort, '');
88 88
 
89 89
 $output = '<?xml version="1.0" encoding="UTF-8"?>';
90 90
 $output .= '<kml xmlns="http://www.opengis.net/kml/2.2">';
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 $output .= '</Style>';
113 113
 
114 114
 if (!empty($spotter_array)) {
115
-	foreach($spotter_array as $spotter_item) {
115
+	foreach ($spotter_array as $spotter_item) {
116 116
 		$altitude = $spotter_item['altitude'].'00';
117 117
 		if ($spotter_item['waypoints'] != '') {
118 118
 			//waypoint plotting
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 			$waypoint_pieces = explode(' ', $spotter_item['waypoints']);
124 124
 			$waypoint_pieces = array_chunk($waypoint_pieces, 2);
125 125
 			foreach ($waypoint_pieces as $waypoint_coordinate) {
126
-				if (isset($waypoint_coordinate[1])) $output .=  $waypoint_coordinate[1].','.$waypoint_coordinate[0].','.$altitude.' ';
126
+				if (isset($waypoint_coordinate[1])) $output .= $waypoint_coordinate[1].','.$waypoint_coordinate[0].','.$altitude.' ';
127 127
 			}
128 128
 			$output .= '</coordinates>';
129 129
 			$output .= '<altitudeMode>absolute</altitudeMode>';
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 		$output .= ' ]]></description>';
168 168
 		$output .= '<styleUrl>#departureAirport</styleUrl>';
169 169
 		$output .= '<Point>';
170
-		$output .=  '<coordinates>'.$spotter_item['departure_airport_longitude'].', '.$spotter_item['departure_airport_latitude'].', '.$spotter_item['departure_airport_altitude'].'</coordinates>';
170
+		$output .= '<coordinates>'.$spotter_item['departure_airport_longitude'].', '.$spotter_item['departure_airport_latitude'].', '.$spotter_item['departure_airport_altitude'].'</coordinates>';
171 171
 		$output .= '<altitudeMode>absolute</altitudeMode>';
172 172
 		$output .= '</Point>';
173 173
 		$output .= '</Placemark>'; 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 		$output .= ' ]]></description>';
209 209
 		$output .= '<styleUrl>#arrivalAirport</styleUrl>';
210 210
 		$output .= '<Point>';
211
-		$output .=  '<coordinates>'.$spotter_item['arrival_airport_longitude'].', '.$spotter_item['arrival_airport_latitude'].', '.$spotter_item['arrival_airport_altitude'].'</coordinates>';
211
+		$output .= '<coordinates>'.$spotter_item['arrival_airport_longitude'].', '.$spotter_item['arrival_airport_latitude'].', '.$spotter_item['arrival_airport_altitude'].'</coordinates>';
212 212
 		$output .= '<altitudeMode>absolute</altitudeMode>';
213 213
 		$output .= '</Point>';
214 214
 		$output .= '</Placemark>'; 
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 		$output .= ' ]]></description>';
253 253
 		$output .= '<styleUrl>#aircraft_'.$spotter_item['spotter_id'].'</styleUrl>';
254 254
 		$output .= '<Point>';
255
-		$output .=  '<coordinates>'.$spotter_item['longitude'].', '.$spotter_item['latitude'].', '.$altitude.'</coordinates>';
255
+		$output .= '<coordinates>'.$spotter_item['longitude'].', '.$spotter_item['latitude'].', '.$altitude.'</coordinates>';
256 256
 		$output .= '<altitudeMode>absolute</altitudeMode>';
257 257
 		$output .= '</Point>';
258 258
 		$output .= '</Placemark>'; 
Please login to merge, or discard this patch.
Braces   +21 added lines, -8 removed lines patch added patch discarded remove patch
@@ -15,8 +15,12 @@  discard block
 block discarded – undo
15 15
 	} else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){
16 16
 		$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00";
17 17
 		$sql_date = $end_date;
18
-	} else $sql_date = '';
19
-} else $sql_date = '';
18
+	} else {
19
+		$sql_date = '';
20
+	}
21
+	} else {
22
+	$sql_date = '';
23
+}
20 24
 
21 25
 if (isset($_GET['highest_altitude'])) {
22 26
 	//for altitude manipulation
@@ -30,8 +34,12 @@  discard block
 block discarded – undo
30 34
 	} else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){
31 35
 		$start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000";
32 36
 		$sql_altitude = $start_altitude;
33
-	} else $sql_altitude = '';
34
-} else $sql_altitude = '';
37
+	} else {
38
+		$sql_altitude = '';
39
+	}
40
+	} else {
41
+	$sql_altitude = '';
42
+}
35 43
 
36 44
 //calculuation for the pagination
37 45
 if(!isset($_GET['limit']))
@@ -48,7 +56,7 @@  discard block
 block discarded – undo
48 56
 		$limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
49 57
 		$absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
50 58
 	}
51
-}  else {
59
+} else {
52 60
 	$limit_explode = explode(",", $_GET['limit']);
53 61
 	$limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT);
54 62
 	$limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT);
@@ -66,8 +74,11 @@  discard block
 block discarded – undo
66 74
 
67 75
 header('Content-Type: text/xml');
68 76
 
69
-if (isset($_GET['sort'])) $sort = $_GET['sort'];
70
-else $sort = '';
77
+if (isset($_GET['sort'])) {
78
+	$sort = $_GET['sort'];
79
+} else {
80
+	$sort = '';
81
+}
71 82
 $q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING);
72 83
 $registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING);
73 84
 $aircraft = filter_input(INPUT_GET,'aircraft',FILTER_SANITIZE_STRING);
@@ -123,7 +134,9 @@  discard block
 block discarded – undo
123 134
 			$waypoint_pieces = explode(' ', $spotter_item['waypoints']);
124 135
 			$waypoint_pieces = array_chunk($waypoint_pieces, 2);
125 136
 			foreach ($waypoint_pieces as $waypoint_coordinate) {
126
-				if (isset($waypoint_coordinate[1])) $output .=  $waypoint_coordinate[1].','.$waypoint_coordinate[0].','.$altitude.' ';
137
+				if (isset($waypoint_coordinate[1])) {
138
+					$output .=  $waypoint_coordinate[1].','.$waypoint_coordinate[0].','.$altitude.' ';
139
+				}
127 140
 			}
128 141
 			$output .= '</coordinates>';
129 142
 			$output .= '<altitudeMode>absolute</altitudeMode>';
Please login to merge, or discard this patch.
live-czml.php 3 patches
Braces   +119 added lines, -43 removed lines patch added patch discarded remove patch
@@ -8,8 +8,12 @@  discard block
 block discarded – undo
8 8
 }
9 9
 $tracker = false;
10 10
 $marine = false;
11
-if (isset($_GET['tracker'])) $tracker = true;
12
-if (isset($_GET['marine'])) $marine = true;
11
+if (isset($_GET['tracker'])) {
12
+	$tracker = true;
13
+}
14
+if (isset($_GET['marine'])) {
15
+	$marine = true;
16
+}
13 17
 if ($tracker) {
14 18
 	require_once('require/class.Tracker.php');
15 19
 	require_once('require/class.TrackerLive.php');
@@ -66,24 +70,49 @@  discard block
 block discarded – undo
66 70
 }
67 71
 header('Content-Type: text/javascript');
68 72
 
69
-if (!isset($globalJsonCompress)) $compress = true;
70
-else $compress = $globalJsonCompress;
73
+if (!isset($globalJsonCompress)) {
74
+	$compress = true;
75
+} else {
76
+	$compress = $globalJsonCompress;
77
+}
71 78
 
72 79
 $from_archive = false;
73 80
 $min = false;
74 81
 $allhistory = false;
75 82
 $filter['source'] = array();
76
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
77
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
78
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
79
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
80
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
81
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
82
-if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
83
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
84
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
85
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
86
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
83
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') {
84
+	$filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
85
+}
86
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') {
87
+	$filter['source'] = array_merge($filter['source'],array('whazzup'));
88
+}
89
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') {
90
+	$filter['source'] = array_merge($filter['source'],array('phpvmacars'));
91
+}
92
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') {
93
+	$filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
94
+}
95
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') {
96
+	$filter['source'] = array_merge($filter['source'],array('aprs'));
97
+}
98
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') {
99
+	$filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
100
+}
101
+if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') {
102
+	$filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
103
+}
104
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') {
105
+	$filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
106
+}
107
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') {
108
+	$filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
109
+}
110
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') {
111
+	$filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
112
+}
113
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') {
114
+	$filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
115
+}
87 116
 /*
88 117
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
89 118
 	$min = true;
@@ -180,8 +209,12 @@  discard block
 block discarded – undo
180 209
 	} else {
181 210
 		$flightcnt = $SpotterLive->getLiveSpotterCount($filter);
182 211
 	}
183
-	if ($flightcnt == '') $flightcnt = 0;
184
-} else $flightcnt = 0;
212
+	if ($flightcnt == '') {
213
+		$flightcnt = 0;
214
+	}
215
+	} else {
216
+	$flightcnt = 0;
217
+}
185 218
 
186 219
 $sqltime = round(microtime(true)-$begintime,2);
187 220
 $minitime = time();
@@ -217,7 +250,9 @@  discard block
 block discarded – undo
217 250
 $prev_flightaware_id = '';
218 251
 $speed = 1;
219 252
 $gltf2 = false;
220
-if (isset($archivespeed)) $speed = $archivespeed;
253
+if (isset($archivespeed)) {
254
+	$speed = $archivespeed;
255
+}
221 256
 $output = '[';
222 257
 if ($tracker) {
223 258
 	$output .= '{"id" : "document", "name" : "tracker","version" : "1.0"';
@@ -253,9 +288,13 @@  discard block
 block discarded – undo
253 288
 			$image = "images/placeholder_thumb.png";
254 289
 		}
255 290
 
256
-                if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id'];
257
-                elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid'];
258
-                elseif (isset($spotter_item['fammarine_id'])) $id = $spotter_item['fammarine_id'];
291
+                if (isset($spotter_item['flightaware_id'])) {
292
+                	$id = $spotter_item['flightaware_id'];
293
+                } elseif (isset($spotter_item['famtrackid'])) {
294
+                	$id = $spotter_item['famtrackid'];
295
+                } elseif (isset($spotter_item['fammarine_id'])) {
296
+                	$id = $spotter_item['fammarine_id'];
297
+                }
259 298
                 if ($prev_flightaware_id != $id) {
260 299
 			if ($prev_flightaware_id != '') {
261 300
 				/*
@@ -303,7 +342,9 @@  discard block
 block discarded – undo
303 342
 							}
304 343
 						}
305 344
 					}
306
-					if ($ident != '') $output.= '"ident": "'.$ident.'",';
345
+					if ($ident != '') {
346
+						$output.= '"ident": "'.$ident.'",';
347
+					}
307 348
 				}
308 349
 				$output.= '"gltf2": %gltf2%,';
309 350
 				$output.= '"type": "flight"';
@@ -335,7 +376,9 @@  discard block
 block discarded – undo
335 376
 							$spotter_item['engine_type'] = $aircraft_info[0]['engine_type'];
336 377
 							$spotter_item['wake_category'] = $aircraft_info[0]['wake_category'];
337 378
 							$spotter_item['engine_count'] = $aircraft_info[0]['engine_count'];
338
-						} else $aircraft_shadow = '';
379
+						} else {
380
+							$aircraft_shadow = '';
381
+						}
339 382
 	    					$output .= ' "billboard" : {"image" : "'.$globalURL.'/images/aircrafts/new/'.$aircraft_shadow.'","scale" : 0.5';
340 383
 						if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true' && isset($_COOKIE['IconColor'])) {
341 384
 							$rgb = $Common->hex2rgb($_COOKIE['IconColor']);
@@ -343,7 +386,9 @@  discard block
 block discarded – undo
343 386
 						}
344 387
 						$output .= '},';
345 388
 					}
346
-				} else $output .= ' "billboard" : {"image" : "data:image/png;base64,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","scale" : 0.5},';
389
+				} else {
390
+					$output .= ' "billboard" : {"image" : "data:image/png;base64,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","scale" : 0.5},';
391
+				}
347 392
 			} elseif ($one3dmodel) {
348 393
 				if (isset($globalMap3DForceModel) && $globalMap3DForceModel != '') {
349 394
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$globalMap3DForceModel.'","scale" : 1.0,"minimumPixelSize": 20';
@@ -383,7 +428,9 @@  discard block
 block discarded – undo
383 428
 							$spotter_item['engine_type'] = $aircraft_info[0]['engine_type'];
384 429
 							$spotter_item['wake_category'] = $aircraft_info[0]['wake_category'];
385 430
 							$spotter_item['engine_count'] = $aircraft_info[0]['engine_count'];
386
-						} else $aircraft_shadow = '';
431
+						} else {
432
+							$aircraft_shadow = '';
433
+						}
387 434
 						if ($aircraft_shadow != '') {
388 435
 							if (isset($modelsdb[$aircraft_shadow])) {
389 436
 								$output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$modelsdb[$aircraft_shadow].'","scale" : 1.0,"minimumPixelSize": 20';
@@ -520,7 +567,9 @@  discard block
 block discarded – undo
520 567
 								}
521 568
 								$output .= '},';
522 569
 								//if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
523
-								if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
570
+								if ($spotter_item['aircraft_icao'] != '') {
571
+									$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
572
+								}
524 573
 								$modelsdb[$aircraft_icao] = 'Cesium_Air.glb';
525 574
 							}
526 575
 						} elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') {
@@ -542,7 +591,9 @@  discard block
 block discarded – undo
542 591
 							}
543 592
 							$output .= '},';
544 593
 							//if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
545
-							if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
594
+							if ($spotter_item['aircraft_icao'] != '') {
595
+								$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
596
+							}
546 597
 							$modelsdb[$aircraft_icao] = 'Cesium_Air.glb';
547 598
 						}
548 599
 					} else {
@@ -555,7 +606,9 @@  discard block
 block discarded – undo
555 606
 						}
556 607
 						$output .= '},';
557 608
 						//if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
558
-						if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
609
+						if ($spotter_item['aircraft_icao'] != '') {
610
+							$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
611
+						}
559 612
 						$modelsdb[$aircraft_icao] = 'Cesium_Air.glb';
560 613
 					}
561 614
 				} elseif ($tracker && isset($spotter_item['type'])) {
@@ -659,8 +712,11 @@  discard block
 block discarded – undo
659 712
 					$output .= '},';
660 713
 				}
661 714
 			}
662
-			if (isset($onground) && $onground) $output = str_replace('%onground%','true',$output);
663
-			else $output = str_replace('%onground%','false',$output);
715
+			if (isset($onground) && $onground) {
716
+				$output = str_replace('%onground%','true',$output);
717
+			} else {
718
+				$output = str_replace('%onground%','false',$output);
719
+			}
664 720
 
665 721
 	//		$output .= '"heightReference": "CLAMP_TO_GROUND",';
666 722
 			//$output .= '"heightReference": "'.$heightrelative.'",';
@@ -673,8 +729,12 @@  discard block
 block discarded – undo
673 729
 	//		$output .= '"interpolationDegree" : 5,';
674 730
 	//		$output .= '"epoch" : "'.date("c",strtotime($spotter_item['date'])).'", ';
675 731
 			$output .= '"cartographicDegrees": [';
676
-			if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']);
677
-			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
732
+			if ($minitime > strtotime($spotter_item['date'])) {
733
+				$minitime = strtotime($spotter_item['date']);
734
+			}
735
+			if ($maxitime < strtotime($spotter_item['date'])) {
736
+				$maxitime = strtotime($spotter_item['date']);
737
+			}
678 738
 			$output .= '"'.date("c",strtotime($spotter_item['date'])).'", ';
679 739
 			$output .= $spotter_item['longitude'].', ';
680 740
 			$output .= $spotter_item['latitude'];
@@ -697,7 +757,9 @@  discard block
 block discarded – undo
697 757
 					$output .= ', '.round($spotter_item['altitude']*30.48);
698 758
 					$prevalt = round($spotter_item['altitude']*30.48);
699 759
 				}
700
-			} else $output .= ', 0';
760
+			} else {
761
+				$output .= ', 0';
762
+			}
701 763
 			//$orientation = '"orientation" : { ';
702 764
 			//$orientation .= '"unitQuaternion": [';
703 765
 			//$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0));
@@ -705,13 +767,18 @@  discard block
 block discarded – undo
705 767
 		} else {
706 768
 			$nblatlong = $nblatlong+1;
707 769
 			$output .= ',"'.date("c",strtotime($spotter_item['date'])).'", ';
708
-			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
770
+			if ($maxitime < strtotime($spotter_item['date'])) {
771
+				$maxitime = strtotime($spotter_item['date']);
772
+			}
709 773
 			if ($spotter_item['ground_speed'] == 0) {
710 774
 				$output .= $prevlong.', ';
711 775
 				$output .= $prevlat;
712 776
 				//if (!$marine && (!isset($onground) || !$onground)) $output .= ', '.$prevalt;
713
-				if (!$marine) $output .= ', '.$prevalt;
714
-				else $output .= ', 0';
777
+				if (!$marine) {
778
+					$output .= ', '.$prevalt;
779
+				} else {
780
+					$output .= ', 0';
781
+				}
715 782
 			} else {
716 783
 				$output .= $spotter_item['longitude'].', ';
717 784
 				$output .= $spotter_item['latitude'];
@@ -724,14 +791,17 @@  discard block
 block discarded – undo
724 791
 							$output .= ', 0';
725 792
 						}
726 793
 					} else {
727
-						if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') $output .= ', '.round($spotter_item['real_altitude']*0.3048);
728
-						elseif ($tracker) {
794
+						if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') {
795
+							$output .= ', '.round($spotter_item['real_altitude']*0.3048);
796
+						} elseif ($tracker) {
729 797
 							$output .= ', '.round($spotter_item['altitude']*0.3048);
730 798
 						} else {
731 799
 							$output .= ', '.round($spotter_item['altitude']*30.48);
732 800
 						}
733 801
 					}
734
-				} else $output .= ', 0';
802
+				} else {
803
+					$output .= ', 0';
804
+				}
735 805
 			}
736 806
 			//$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0));
737 807
 			//$orientation .= ',"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w'];
@@ -750,11 +820,17 @@  discard block
 block discarded – undo
750 820
 		} else {
751 821
 			$output = str_replace('%minitime%',date("c",time()-$globalLiveInterval),$output);
752 822
 		}
823
+	} else {
824
+		$output = str_replace('%minitime%',date("c",$minitime),$output);
753 825
 	}
754
-	else $output = str_replace('%minitime%',date("c",$minitime),$output);
755
-} else $output = str_replace('%minitime%',date("c",$minitime),$output);
826
+	} else {
827
+	$output = str_replace('%minitime%',date("c",$minitime),$output);
828
+}
756 829
 $output = str_replace('%maxitime%',date("c",$maxitime),$output);
757
-if ($gltf2) $output = str_replace('%gltf2%','true',$output);
758
-else $output = str_replace('%gltf2%','false',$output);
830
+if ($gltf2) {
831
+	$output = str_replace('%gltf2%','true',$output);
832
+} else {
833
+	$output = str_replace('%gltf2%','false',$output);
834
+}
759 835
 print $output;
760 836
 ?>
Please login to merge, or discard this patch.
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -39,30 +39,30 @@  discard block
 block discarded – undo
39 39
 
40 40
 
41 41
 function quaternionrotate($heading, $attitude = 0, $bank = 0) {
42
-    // Assuming the angles are in radians.
43
-    $c1 = cos($heading/2);
44
-    $s1 = sin($heading/2);
45
-    $c2 = cos($attitude/2);
46
-    $s2 = sin($attitude/2);
47
-    $c3 = cos($bank/2);
48
-    $s3 = sin($bank/2);
49
-    $c1c2 = $c1*$c2;
50
-    $s1s2 = $s1*$s2;
51
-    $w =$c1c2*$c3 - $s1s2*$s3;
52
-    $x =$c1c2*$s3 + $s1s2*$c3;
53
-    $y =$s1*$c2*$c3 + $c1*$s2*$s3;
54
-    $z =$c1*$s2*$c3 - $s1*$c2*$s3;
55
-    return array('x' => $x,'y' => $y,'z' => $z,'w' => $w);
42
+	// Assuming the angles are in radians.
43
+	$c1 = cos($heading/2);
44
+	$s1 = sin($heading/2);
45
+	$c2 = cos($attitude/2);
46
+	$s2 = sin($attitude/2);
47
+	$c3 = cos($bank/2);
48
+	$s3 = sin($bank/2);
49
+	$c1c2 = $c1*$c2;
50
+	$s1s2 = $s1*$s2;
51
+	$w =$c1c2*$c3 - $s1s2*$s3;
52
+	$x =$c1c2*$s3 + $s1s2*$c3;
53
+	$y =$s1*$c2*$c3 + $c1*$s2*$s3;
54
+	$z =$c1*$s2*$c3 - $s1*$c2*$s3;
55
+	return array('x' => $x,'y' => $y,'z' => $z,'w' => $w);
56 56
 //    return array('x' => '0.0','y' => '-0.931','z' => '0.0','w' => '0.365');
57 57
 
58 58
 }
59 59
 
60 60
 
61 61
 if (isset($_GET['download'])) {
62
-    if ($_GET['download'] == "true")
63
-    {
62
+	if ($_GET['download'] == "true")
63
+	{
64 64
 	header('Content-disposition: attachment; filename="flightairmap.json"');
65
-    }
65
+	}
66 66
 }
67 67
 header('Content-Type: text/javascript');
68 68
 
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 	if (isset($_GET['coord']) && $_GET['coord'] != '') {
156 156
 		$coord = explode(',',$_GET['coord']);
157 157
 		if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) 
158
-		    && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) {
158
+			&& $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) {
159 159
 			$coord = array();
160 160
 		}
161 161
 	}
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 	if (isset($_GET['coord']) && $_GET['coord'] != '') {
166 166
 		$coord = explode(',',$_GET['coord']);
167 167
 		if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) 
168
-		    && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) {
168
+			&& $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) {
169 169
 			$coord = array();
170 170
 		}
171 171
 	}
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 	if (isset($_GET['coord']) && $_GET['coord'] != '') {
176 176
 		$coord = explode(',',$_GET['coord']);
177 177
 		if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) 
178
-		    && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) {
178
+			&& $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) {
179 179
 			$coord = array();
180 180
 		}
181 181
 	}
@@ -265,10 +265,10 @@  discard block
 block discarded – undo
265 265
 			$image = "images/placeholder_thumb.png";
266 266
 		}
267 267
 
268
-                if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id'];
269
-                elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid'];
270
-                elseif (isset($spotter_item['fammarine_id'])) $id = $spotter_item['fammarine_id'];
271
-                if ($prev_flightaware_id != $id) {
268
+				if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id'];
269
+				elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid'];
270
+				elseif (isset($spotter_item['fammarine_id'])) $id = $spotter_item['fammarine_id'];
271
+				if ($prev_flightaware_id != $id) {
272 272
 			if ($prev_flightaware_id != '') {
273 273
 				/*
274 274
 				if ($nblatlong == 1) {
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 							$spotter_item['wake_category'] = $aircraft_info[0]['wake_category'];
349 349
 							$spotter_item['engine_count'] = $aircraft_info[0]['engine_count'];
350 350
 						} else $aircraft_shadow = '';
351
-	    					$output .= ' "billboard" : {"image" : "'.$globalURL.'/images/aircrafts/new/'.$aircraft_shadow.'","scale" : 0.5';
351
+							$output .= ' "billboard" : {"image" : "'.$globalURL.'/images/aircrafts/new/'.$aircraft_shadow.'","scale" : 0.5';
352 352
 						if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true' && isset($_COOKIE['IconColor'])) {
353 353
 							$rgb = $Common->hex2rgb($_COOKIE['IconColor']);
354 354
 							$output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}';
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
 							$rgb = $Common->hex2rgb($_COOKIE['IconColor']);
380 380
 							$output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}';
381 381
 						}
382
-    						$output .= '},';
382
+							$output .= '},';
383 383
 					} elseif (isset($modelsdb[$aircraft_icao]) && $aircraft_icao != '') {
384 384
 						$output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$modelsdb[$aircraft_icao].'","scale" : 1.0,"minimumPixelSize": 20';
385 385
 						$output .= ',"heightReference": "'.$heightrelative.'"';
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 							$rgb = $Common->hex2rgb($_COOKIE['IconColor']);
388 388
 							$output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}';
389 389
 						}
390
-    						$output .= '},';
390
+							$output .= '},';
391 391
 					} elseif ($aircraft_icao != '') {
392 392
 						$aircraft_info = $Spotter->getAllAircraftInfo($aircraft_icao);
393 393
 						if (isset($aircraft_info[0]['engine_type'])) {
Please login to merge, or discard this patch.
Spacing   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -48,11 +48,11 @@  discard block
 block discarded – undo
48 48
     $s3 = sin($bank/2);
49 49
     $c1c2 = $c1*$c2;
50 50
     $s1s2 = $s1*$s2;
51
-    $w =$c1c2*$c3 - $s1s2*$s3;
52
-    $x =$c1c2*$s3 + $s1s2*$c3;
53
-    $y =$s1*$c2*$c3 + $c1*$s2*$s3;
54
-    $z =$c1*$s2*$c3 - $s1*$c2*$s3;
55
-    return array('x' => $x,'y' => $y,'z' => $z,'w' => $w);
51
+    $w = $c1c2*$c3 - $s1s2*$s3;
52
+    $x = $c1c2*$s3 + $s1s2*$c3;
53
+    $y = $s1*$c2*$c3 + $c1*$s2*$s3;
54
+    $z = $c1*$s2*$c3 - $s1*$c2*$s3;
55
+    return array('x' => $x, 'y' => $y, 'z' => $z, 'w' => $w);
56 56
 //    return array('x' => '0.0','y' => '-0.931','z' => '0.0','w' => '0.365');
57 57
 
58 58
 }
@@ -73,17 +73,17 @@  discard block
 block discarded – undo
73 73
 $min = false;
74 74
 $allhistory = false;
75 75
 $filter['source'] = array();
76
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
77
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
78
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
79
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
80
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
81
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
82
-if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
83
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
84
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
85
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
86
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
76
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt'));
77
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup'));
78
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars'));
79
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs'));
80
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs'));
81
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING);
82
+if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'], FILTER_SANITIZE_STRING);
83
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING);
84
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING);
85
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING);
86
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING);
87 87
 /*
88 88
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
89 89
 	$min = true;
@@ -130,12 +130,12 @@  discard block
 block discarded – undo
130 130
 	$from_archive = true;
131 131
 //	$begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
132 132
 //	$enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
133
-	$begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT);
134
-	$enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT);
135
-	$archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT);
136
-	$begindate = date('Y-m-d H:i:s',$begindate);
137
-	$enddate = date('Y-m-d H:i:s',$enddate);
138
-	$spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter);
133
+	$begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT);
134
+	$enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT);
135
+	$archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT);
136
+	$begindate = date('Y-m-d H:i:s', $begindate);
137
+	$enddate = date('Y-m-d H:i:s', $enddate);
138
+	$spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate, $enddate, $filter);
139 139
 } elseif (isset($_COOKIE['archive']) && isset($_COOKIE['archive_begin']) && isset($_COOKIE['archive_end']) && isset($_COOKIE['archive_speed'])) {
140 140
 	$from_archive = true;
141 141
 //	$begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
@@ -145,46 +145,46 @@  discard block
 block discarded – undo
145 145
 	$begindate = $_COOKIE['archive_begin'];
146 146
 	$enddate = $_COOKIE['archive_end'];
147 147
 
148
-	$archivespeed = filter_var($_COOKIE['archive_speed'],FILTER_SANITIZE_NUMBER_INT);
149
-	$begindate = date('Y-m-d H:i:s',$begindate);
150
-	$enddate = date('Y-m-d H:i:s',$enddate);
148
+	$archivespeed = filter_var($_COOKIE['archive_speed'], FILTER_SANITIZE_NUMBER_INT);
149
+	$begindate = date('Y-m-d H:i:s', $begindate);
150
+	$enddate = date('Y-m-d H:i:s', $enddate);
151 151
 //	echo 'Begin : '.$begindate.' - End : '.$enddate."\n";
152
-	$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter);
152
+	$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter);
153 153
 } elseif ($tracker) {
154 154
 	$coord = array();
155 155
 	if (isset($_GET['coord']) && $_GET['coord'] != '') {
156
-		$coord = explode(',',$_GET['coord']);
157
-		if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) 
156
+		$coord = explode(',', $_GET['coord']);
157
+		if (!(filter_var($coord[0], FILTER_VALIDATE_FLOAT) && filter_var($coord[1], FILTER_VALIDATE_FLOAT) && filter_var($coord[2], FILTER_VALIDATE_FLOAT) && filter_var($coord[3], FILTER_VALIDATE_FLOAT) 
158 158
 		    && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) {
159 159
 			$coord = array();
160 160
 		}
161 161
 	}
162
-	$spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord,$filter,true);
162
+	$spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord, $filter, true);
163 163
 } elseif ($marine) {
164 164
 	$coord = array();
165 165
 	if (isset($_GET['coord']) && $_GET['coord'] != '') {
166
-		$coord = explode(',',$_GET['coord']);
167
-		if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) 
166
+		$coord = explode(',', $_GET['coord']);
167
+		if (!(filter_var($coord[0], FILTER_VALIDATE_FLOAT) && filter_var($coord[1], FILTER_VALIDATE_FLOAT) && filter_var($coord[2], FILTER_VALIDATE_FLOAT) && filter_var($coord[3], FILTER_VALIDATE_FLOAT) 
168 168
 		    && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) {
169 169
 			$coord = array();
170 170
 		}
171 171
 	}
172
-	$spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,true);
172
+	$spotter_array = $MarineLive->getMinLastLiveMarineData($coord, $filter, true);
173 173
 } else {
174 174
 	$coord = array();
175 175
 	if (isset($_GET['coord']) && $_GET['coord'] != '') {
176
-		$coord = explode(',',$_GET['coord']);
177
-		if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) 
176
+		$coord = explode(',', $_GET['coord']);
177
+		if (!(filter_var($coord[0], FILTER_VALIDATE_FLOAT) && filter_var($coord[1], FILTER_VALIDATE_FLOAT) && filter_var($coord[2], FILTER_VALIDATE_FLOAT) && filter_var($coord[3], FILTER_VALIDATE_FLOAT) 
178 178
 		    && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) {
179 179
 			$coord = array();
180 180
 		}
181 181
 	}
182
-	$spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,true);
182
+	$spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord, $filter, true);
183 183
 }
184 184
 //print_r($spotter_array);
185 185
 if (!empty($spotter_array) && isset($coord)) {
186 186
 	if (isset($_GET['archive'])) {
187
-		$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter);
187
+		$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter);
188 188
 	} elseif ($tracker) {
189 189
 		$flightcnt = $TrackerLive->getLiveTrackerCount($filter);
190 190
 	} elseif ($marine) {
@@ -195,15 +195,15 @@  discard block
 block discarded – undo
195 195
 	if ($flightcnt == '') $flightcnt = 0;
196 196
 } else $flightcnt = 0;
197 197
 
198
-$sqltime = round(microtime(true)-$begintime,2);
198
+$sqltime = round(microtime(true) - $begintime, 2);
199 199
 $minitime = time();
200 200
 $maxitime = 0;
201
-$lastupdate = filter_input(INPUT_GET,'update',FILTER_SANITIZE_NUMBER_INT);
201
+$lastupdate = filter_input(INPUT_GET, 'update', FILTER_SANITIZE_NUMBER_INT);
202 202
 $modelsdb = array();
203 203
 if (file_exists(dirname(__FILE__).'/models/modelsdb')) {
204
-	if (($handle = fopen(dirname(__FILE__).'/models/modelsdb','r')) !== FALSE) {
205
-		while (($row = fgetcsv($handle,1000)) !== FALSE) {
206
-			if (isset($row[1]) ){
204
+	if (($handle = fopen(dirname(__FILE__).'/models/modelsdb', 'r')) !== FALSE) {
205
+		while (($row = fgetcsv($handle, 1000)) !== FALSE) {
206
+			if (isset($row[1])) {
207 207
 				$model = $row[0];
208 208
 				$modelsdb[$model] = $row[1];
209 209
 			}
@@ -213,9 +213,9 @@  discard block
 block discarded – undo
213 213
 }
214 214
 $modelsdb2 = array();
215 215
 if (file_exists(dirname(__FILE__).'/models/gltf2/modelsdb')) {
216
-	if (($handle = fopen(dirname(__FILE__).'/models/gltf2/modelsdb','r')) !== FALSE) {
217
-		while (($row = fgetcsv($handle,1000)) !== FALSE) {
218
-			if (isset($row[1]) ){
216
+	if (($handle = fopen(dirname(__FILE__).'/models/gltf2/modelsdb', 'r')) !== FALSE) {
217
+		while (($row = fgetcsv($handle, 1000)) !== FALSE) {
218
+			if (isset($row[1])) {
219 219
 				$model = $row[0];
220 220
 				$modelsdb2[$model] = $row[1];
221 221
 			}
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 if (!empty($spotter_array) && is_array($spotter_array))
254 254
 {
255 255
 	$nblatlong = 0;
256
-	foreach($spotter_array as $spotter_item)
256
+	foreach ($spotter_array as $spotter_item)
257 257
 	{
258 258
 		$j++;
259 259
 		//if (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'airwhere') $heightrelative = 'RELATIVE_TO_GROUND';
@@ -295,9 +295,9 @@  discard block
 block discarded – undo
295 295
 			$output .= '"lastupdate": "'.$lastupdate.'",';
296 296
 			$output .= '"format": "'.$spotter_item['format_source'].'",';
297 297
 			if ($tracker) {
298
-				$output.= '"type": "tracker"';
298
+				$output .= '"type": "tracker"';
299 299
 			} elseif ($marine) {
300
-				$output.= '"type": "marine"';
300
+				$output .= '"type": "marine"';
301 301
 			} else {
302 302
 				if (isset($globalMap3DLiveries) && $globalMap3DLiveries) {
303 303
 					$aircraft_icao = $spotter_item['aircraft_icao'];
@@ -311,14 +311,14 @@  discard block
 block discarded – undo
311 311
 						if (isset($airline_icao)) {
312 312
 							$imagefile = $aircraft_icao.'-'.$airline_icao.'.png';
313 313
 							if (file_exists(dirname(__FILE__).'/models/gltf2/liveries/'.$imagefile)) {
314
-								$output.= '"liveries": "'.$globalURL.'/models/gltf2/liveries/'.$imagefile.'",';
314
+								$output .= '"liveries": "'.$globalURL.'/models/gltf2/liveries/'.$imagefile.'",';
315 315
 							}
316 316
 						}
317 317
 					}
318
-					if ($ident != '') $output.= '"ident": "'.$ident.'",';
318
+					if ($ident != '') $output .= '"ident": "'.$ident.'",';
319 319
 				}
320
-				$output.= '"gltf2": %gltf2%,';
321
-				$output.= '"type": "flight"';
320
+				$output .= '"gltf2": %gltf2%,';
321
+				$output .= '"type": "flight"';
322 322
 			}
323 323
 			$output .= '},';
324 324
 
@@ -671,8 +671,8 @@  discard block
 block discarded – undo
671 671
 					$output .= '},';
672 672
 				}
673 673
 			}
674
-			if (isset($onground) && $onground) $output = str_replace('%onground%','true',$output);
675
-			else $output = str_replace('%onground%','false',$output);
674
+			if (isset($onground) && $onground) $output = str_replace('%onground%', 'true', $output);
675
+			else $output = str_replace('%onground%', 'false', $output);
676 676
 
677 677
 	//		$output .= '"heightReference": "CLAMP_TO_GROUND",';
678 678
 			//$output .= '"heightReference": "'.$heightrelative.'",';
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
 			$output .= '"cartographicDegrees": [';
688 688
 			if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']);
689 689
 			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
690
-			$output .= '"'.date("c",strtotime($spotter_item['date'])).'", ';
690
+			$output .= '"'.date("c", strtotime($spotter_item['date'])).'", ';
691 691
 			$output .= $spotter_item['longitude'].', ';
692 692
 			$output .= $spotter_item['latitude'];
693 693
 			$prevlong = $spotter_item['longitude'];
@@ -715,8 +715,8 @@  discard block
 block discarded – undo
715 715
 			//$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0));
716 716
 			//$orientation .= '"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w'];
717 717
 		} else {
718
-			$nblatlong = $nblatlong+1;
719
-			$output .= ',"'.date("c",strtotime($spotter_item['date'])).'", ';
718
+			$nblatlong = $nblatlong + 1;
719
+			$output .= ',"'.date("c", strtotime($spotter_item['date'])).'", ';
720 720
 			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
721 721
 			if ($spotter_item['ground_speed'] == 0) {
722 722
 				$output .= $prevlong.', ';
@@ -756,17 +756,17 @@  discard block
 block discarded – undo
756 756
 }
757 757
 $output .= ']';
758 758
 if (isset($globalArchive) && $globalArchive === TRUE) {
759
-	if ((time()-$globalLiveInterval) > $minitime) {
760
-		if (time()-$globalLiveInterval > $maxitime) {
761
-			$output = str_replace('%minitime%',date("c",$maxitime),$output);
759
+	if ((time() - $globalLiveInterval) > $minitime) {
760
+		if (time() - $globalLiveInterval > $maxitime) {
761
+			$output = str_replace('%minitime%', date("c", $maxitime), $output);
762 762
 		} else {
763
-			$output = str_replace('%minitime%',date("c",time()-$globalLiveInterval),$output);
763
+			$output = str_replace('%minitime%', date("c", time() - $globalLiveInterval), $output);
764 764
 		}
765 765
 	}
766
-	else $output = str_replace('%minitime%',date("c",$minitime),$output);
767
-} else $output = str_replace('%minitime%',date("c",$minitime),$output);
768
-$output = str_replace('%maxitime%',date("c",$maxitime),$output);
769
-if ($gltf2) $output = str_replace('%gltf2%','true',$output);
770
-else $output = str_replace('%gltf2%','false',$output);
766
+	else $output = str_replace('%minitime%', date("c", $minitime), $output);
767
+} else $output = str_replace('%minitime%', date("c", $minitime), $output);
768
+$output = str_replace('%maxitime%', date("c", $maxitime), $output);
769
+if ($gltf2) $output = str_replace('%gltf2%', 'true', $output);
770
+else $output = str_replace('%gltf2%', 'false', $output);
771 771
 print $output;
772 772
 ?>
Please login to merge, or discard this patch.
live-geojson.php 3 patches
Indentation   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -5,23 +5,23 @@  discard block
 block discarded – undo
5 5
 $marine = false;
6 6
 $usecoord = false;
7 7
 if (isset($_GET['tracker'])) {
8
-    $tracker = true;
8
+	$tracker = true;
9 9
 }
10 10
 if (isset($_GET['marine'])) {
11
-    $marine = true;
11
+	$marine = true;
12 12
 }
13 13
 if ($tracker) {
14
-    require_once('require/class.Tracker.php');
15
-    require_once('require/class.TrackerLive.php');
16
-    require_once('require/class.TrackerArchive.php');
14
+	require_once('require/class.Tracker.php');
15
+	require_once('require/class.TrackerLive.php');
16
+	require_once('require/class.TrackerArchive.php');
17 17
 } elseif ($marine) {
18
-    require_once('require/class.Marine.php');
19
-    require_once('require/class.MarineLive.php');
20
-    require_once('require/class.MarineArchive.php');
18
+	require_once('require/class.Marine.php');
19
+	require_once('require/class.MarineLive.php');
20
+	require_once('require/class.MarineArchive.php');
21 21
 } else {
22
-    require_once('require/class.Spotter.php');
23
-    require_once('require/class.SpotterLive.php');
24
-    require_once('require/class.SpotterArchive.php');
22
+	require_once('require/class.Spotter.php');
23
+	require_once('require/class.SpotterLive.php');
24
+	require_once('require/class.SpotterArchive.php');
25 25
 }
26 26
 
27 27
 $begintime = microtime(true);
@@ -41,10 +41,10 @@  discard block
 block discarded – undo
41 41
 $Common = new Common();
42 42
 
43 43
 if (isset($_GET['download'])) {
44
-    if ($_GET['download'] == "true")
45
-    {
44
+	if ($_GET['download'] == "true")
45
+	{
46 46
 	header('Content-disposition: attachment; filename="flightairmap.json"');
47
-    }
47
+	}
48 48
 }
49 49
 header('Content-Type: text/javascript');
50 50
 
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	$usecoord = true;
109 109
 	$coord = explode(',',$_GET['coord']);
110 110
 	if (filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) 
111
-	    && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0) {
111
+		&& $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0) {
112 112
 		if ($tracker) {
113 113
 			$spotter_array = $TrackerLive->getLiveTrackerDatabyCoord($coord,$filter);
114 114
 		} elseif ($marine) {
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	$usecoord = true;
122 122
 	$coord = explode(',',$_GET['coord']);
123 123
 	if (filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) 
124
-	    && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0) {
124
+		&& $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0) {
125 125
 		if ($tracker) {
126 126
 			$spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord,$filter);
127 127
 		} elseif ($marine) {
@@ -538,17 +538,17 @@  discard block
 block discarded – undo
538 538
 				if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history'];
539 539
 				
540 540
 				if (
541
-				    (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') 
542
-				    || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory)
541
+					(isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') 
542
+					|| ((isset($globalMapHistory) && $globalMapHistory) || $allhistory)
543 543
 				//    || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id']))
544 544
 				//    || (isset($history) && $history != '' && $history != 'NA' && $history == $spotter_item['ident'])
545
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
546
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])
547
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id']))
548
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id'])
549
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid']))
550
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid'])
551
-				    ) {
545
+					|| (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
546
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])
547
+					|| (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id']))
548
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id'])
549
+					|| (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid']))
550
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid'])
551
+					) {
552 552
 					if ($tracker) {
553 553
 						if ($from_archive || $globalArchive) {
554 554
 							$spotter_history_array = $TrackerArchive->getAllArchiveTrackerDataById($spotter_item['famtrackid']);
@@ -637,65 +637,65 @@  discard block
 block discarded – undo
637 637
 				}
638 638
 				
639 639
 				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
640
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
641
-				     && (isset($spotter_item['departure_airport']) 
642
-				        && $spotter_item['departure_airport'] != 'NA' 
643
-				        && isset($spotter_item['arrival_airport']) 
644
-				        && $spotter_item['arrival_airport'] != 'NA' 
645
-				        && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") 
646
-				    	    || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) {
647
-				    if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
648
-				    else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
649
-				    if (isset($spotter_item['departure_airport_latitude'])) {
640
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
641
+					 && (isset($spotter_item['departure_airport']) 
642
+						&& $spotter_item['departure_airport'] != 'NA' 
643
+						&& isset($spotter_item['arrival_airport']) 
644
+						&& $spotter_item['arrival_airport'] != 'NA' 
645
+						&& ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") 
646
+							|| (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) {
647
+					if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
648
+					else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
649
+					if (isset($spotter_item['departure_airport_latitude'])) {
650 650
 					$output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],';
651
-				    } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') {
651
+					} elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') {
652 652
 					$dairport = $Spotter->getAllAirportInfo($spotter_item['departure_airport']);
653 653
 					if (isset($dairport[0]['latitude'])) {
654
-					    $output_air .= '['.$dairport[0]['longitude'].','.$dairport[0]['latitude'].'],';
654
+						$output_air .= '['.$dairport[0]['longitude'].','.$dairport[0]['latitude'].'],';
655 655
 					}
656
-				    }
657
-				    if (isset($spotter_item['arrival_airport_latitude'])) {
656
+					}
657
+					if (isset($spotter_item['arrival_airport_latitude'])) {
658 658
 					$output_air .= '['.$spotter_item['arrival_airport_longitude'].','.$spotter_item['arrival_airport_latitude'].'],';
659
-				    } elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
659
+					} elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
660 660
 					$aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']);
661 661
 					if (isset($aairport[0]['latitude'])) {
662
-					    $output_air .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].'],';
662
+						$output_air .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].'],';
663 663
 					}
664
-				    }
665
-				    $output_air  = substr($output_air, 0, -1);
666
-				    $output_air .= ']}},';
667
-				    $output .= $output_air;
668
-				    unset($output_air);
664
+					}
665
+					$output_air  = substr($output_air, 0, -1);
666
+					$output_air .= ']}},';
667
+					$output .= $output_air;
668
+					unset($output_air);
669 669
 				}
670 670
 
671 671
 				//if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA' && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) {
672 672
 				//if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) {
673 673
 				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
674
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
675
-				     && (isset($spotter_item['arrival_airport']) 
676
-				        && $spotter_item['arrival_airport'] != 'NA' 
677
-				        && ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == "true") 
678
-				    	    || (!isset($_COOKIE['MapRemainaingRoute']) && (!isset($globalMapRemainingRoute) 
679
-				    	    || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) {
680
-				    $havedata = false;
681
-				    if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
682
-				    else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
683
-				    $output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],';
674
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
675
+					 && (isset($spotter_item['arrival_airport']) 
676
+						&& $spotter_item['arrival_airport'] != 'NA' 
677
+						&& ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == "true") 
678
+							|| (!isset($_COOKIE['MapRemainaingRoute']) && (!isset($globalMapRemainingRoute) 
679
+							|| (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) {
680
+					$havedata = false;
681
+					if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
682
+					else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
683
+					$output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],';
684 684
 
685
-				    if (isset($spotter_item['arrival_airport_latitude'])) {
685
+					if (isset($spotter_item['arrival_airport_latitude'])) {
686 686
 					$output_dest .= '['.$spotter_item['arrival_airport_longitude'].','.$spotter_item['arrival_airport_latitude'].']';
687 687
 					$havedata = true;
688
-				    } elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
688
+					} elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
689 689
 					$aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']);
690 690
 					if (isset($aairport[0]['latitude'])) {
691
-					    $output_dest .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].']';
692
-					    $havedata = true;
691
+						$output_dest .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].']';
692
+						$havedata = true;
693 693
 					}
694
-				    }
695
-				    //$output_dest  = substr($output_dest, 0, -1);
696
-				    $output_dest .= ']}},';
697
-				    if ($havedata) $output .= $output_dest;
698
-				    unset($output_dest);
694
+					}
695
+					//$output_dest  = substr($output_dest, 0, -1);
696
+					$output_dest .= ']}},';
697
+					if ($havedata) $output .= $output_dest;
698
+					unset($output_dest);
699 699
 				}
700 700
 			}
701 701
 			$output  = substr($output, 0, -1);
Please login to merge, or discard this patch.
Spacing   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -64,17 +64,17 @@  discard block
 block discarded – undo
64 64
 $min = true;
65 65
 $allhistory = false;
66 66
 $filter['source'] = array();
67
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
68
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
69
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
70
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
71
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
72
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
73
-if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
74
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
75
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
76
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
77
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
67
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt'));
68
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup'));
69
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars'));
70
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs'));
71
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs'));
72
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING);
73
+if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'], FILTER_SANITIZE_STRING);
74
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING);
75
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING);
76
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING);
77
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING);
78 78
 
79 79
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
80 80
 	$min = true;
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 $spotter_array = array();
84 84
 
85 85
 if (isset($_GET['ident'])) {
86
-	$ident = urldecode(filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING));
86
+	$ident = urldecode(filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING));
87 87
 	if ($tracker) {
88 88
 		$spotter_array = $TrackerLive->getLastLiveTrackerDataByIdent($ident);
89 89
 	} elseif ($marine) {
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 	}
98 98
 	$allhistory = true;
99 99
 } elseif (isset($_GET['flightaware_id'])) {
100
-	$flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
100
+	$flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING);
101 101
 	$spotter_array = $SpotterLive->getLastLiveSpotterDataById($flightaware_id);
102 102
 	if (empty($spotter_array)) {
103 103
 		$from_archive = true;
@@ -105,38 +105,38 @@  discard block
 block discarded – undo
105 105
 	}
106 106
 	$allhistory = true;
107 107
 } elseif (isset($_GET['famtrack_id'])) {
108
-	$famtrack_id = urldecode(filter_input(INPUT_GET,'famtrack_id',FILTER_SANITIZE_STRING));
108
+	$famtrack_id = urldecode(filter_input(INPUT_GET, 'famtrack_id', FILTER_SANITIZE_STRING));
109 109
 	$spotter_array = $TrackerLive->getLastLiveTrackerDataById($famtrack_id);
110 110
 	$allhistory = true;
111 111
 } elseif (isset($_GET['fammarine_id'])) {
112
-	$fammarine_id = urldecode(filter_input(INPUT_GET,'fammarine_id',FILTER_SANITIZE_STRING));
112
+	$fammarine_id = urldecode(filter_input(INPUT_GET, 'fammarine_id', FILTER_SANITIZE_STRING));
113 113
 	$spotter_array = $MarineLive->getLastLiveMarineDataById($fammarine_id);
114 114
 	$allhistory = true;
115 115
 } elseif (isset($globalMapUseBbox) && $globalMapUseBbox && isset($_GET['coord']) && (!isset($globalMapPopup) || $globalMapPopup || (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true'))) {
116 116
 //} elseif (isset($_GET['coord'])) {
117 117
 	$usecoord = true;
118
-	$coord = explode(',',$_GET['coord']);
119
-	if (filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) 
118
+	$coord = explode(',', $_GET['coord']);
119
+	if (filter_var($coord[0], FILTER_VALIDATE_FLOAT) && filter_var($coord[1], FILTER_VALIDATE_FLOAT) && filter_var($coord[2], FILTER_VALIDATE_FLOAT) && filter_var($coord[3], FILTER_VALIDATE_FLOAT) 
120 120
 	    && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0) {
121 121
 		if ($tracker) {
122
-			$spotter_array = $TrackerLive->getLiveTrackerDatabyCoord($coord,$filter);
122
+			$spotter_array = $TrackerLive->getLiveTrackerDatabyCoord($coord, $filter);
123 123
 		} elseif ($marine) {
124
-			$spotter_array = $MarineLive->getLiveMarineDatabyCoord($coord,$filter);
124
+			$spotter_array = $MarineLive->getLiveMarineDatabyCoord($coord, $filter);
125 125
 		} else {
126
-			$spotter_array = $SpotterLive->getLiveSpotterDatabyCoord($coord,$filter);
126
+			$spotter_array = $SpotterLive->getLiveSpotterDatabyCoord($coord, $filter);
127 127
 		}
128 128
 	}
129 129
 } elseif (isset($globalMapUseBbox) && $globalMapUseBbox && isset($_GET['coord']) && $min) {
130 130
 	$usecoord = true;
131
-	$coord = explode(',',$_GET['coord']);
132
-	if (filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) 
131
+	$coord = explode(',', $_GET['coord']);
132
+	if (filter_var($coord[0], FILTER_VALIDATE_FLOAT) && filter_var($coord[1], FILTER_VALIDATE_FLOAT) && filter_var($coord[2], FILTER_VALIDATE_FLOAT) && filter_var($coord[3], FILTER_VALIDATE_FLOAT) 
133 133
 	    && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0) {
134 134
 		if ($tracker) {
135
-			$spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord,$filter);
135
+			$spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord, $filter);
136 136
 		} elseif ($marine) {
137
-			$spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord,$filter);
137
+			$spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord, $filter);
138 138
 		} else {
139
-			$spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord,$filter);
139
+			$spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord, $filter);
140 140
 		}
141 141
 	} else {
142 142
 		if ($tracker) {
@@ -151,12 +151,12 @@  discard block
 block discarded – undo
151 151
 	$from_archive = true;
152 152
 //	$begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
153 153
 //	$enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
154
-	$begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT);
155
-	$enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT);
156
-	$archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT);
157
-	$begindate = date('Y-m-d H:i:s',$begindate);
158
-	$enddate = date('Y-m-d H:i:s',$enddate);
159
-	$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter);
154
+	$begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT);
155
+	$enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT);
156
+	$archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT);
157
+	$begindate = date('Y-m-d H:i:s', $begindate);
158
+	$enddate = date('Y-m-d H:i:s', $enddate);
159
+	$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter);
160 160
 } elseif ($min) {
161 161
 	if ($tracker) {
162 162
 		$spotter_array = $TrackerLive->getMinLiveTrackerData($filter);
@@ -168,17 +168,17 @@  discard block
 block discarded – undo
168 168
 #	$min = true;
169 169
 } else {
170 170
 	if ($tracker) {
171
-		$spotter_array = $TrackerLive->getLiveTrackerData('','',$filter);
171
+		$spotter_array = $TrackerLive->getLiveTrackerData('', '', $filter);
172 172
 	} elseif ($marine) {
173
-		$spotter_array = $marineLive->getLiveMarineData('','',$filter);
173
+		$spotter_array = $marineLive->getLiveMarineData('', '', $filter);
174 174
 	} else {
175
-		$spotter_array = $SpotterLive->getLiveSpotterData('','',$filter);
175
+		$spotter_array = $SpotterLive->getLiveSpotterData('', '', $filter);
176 176
 	}
177 177
 }
178 178
 
179 179
 if ($usecoord) {
180 180
 	if (isset($_GET['archive'])) {
181
-		$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter);
181
+		$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter);
182 182
 	} else {
183 183
 		if ($tracker) {
184 184
 			$flightcnt = $TrackerLive->getLiveTrackerCount($filter);
@@ -191,9 +191,9 @@  discard block
 block discarded – undo
191 191
 	if ($flightcnt == '') $flightcnt = 0;
192 192
 } else $flightcnt = 0;
193 193
 
194
-$sqltime = round(microtime(true)-$begintime,2);
194
+$sqltime = round(microtime(true) - $begintime, 2);
195 195
 
196
-$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
196
+$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT);
197 197
 if ($currenttime != '') $currenttime = round($currenttime/1000);
198 198
 
199 199
 if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false;
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 		if (!empty($spotter_array) && is_array($spotter_array))
213 213
 		{
214 214
 			$output .= '"features": [';
215
-			foreach($spotter_array as $spotter_item)
215
+			foreach ($spotter_array as $spotter_item)
216 216
 			{
217 217
 				$j++;
218 218
 				unset($idistance);
@@ -269,8 +269,8 @@  discard block
 block discarded – undo
269 269
 */
270 270
 							//$output .= '"fc": "'.$spotter_item['nb'].'",';
271 271
 						if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') {
272
-							if ($compress) $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",';
273
-							else $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",';
272
+							if ($compress) $output .= '"c": "'.str_replace('\\', '', $spotter_item['ident']).'",';
273
+							else $output .= '"callsign": "'.str_replace('\\', '', $spotter_item['ident']).'",';
274 274
 							//"
275 275
 						} else {
276 276
 							if ($compress) $output .= '"c": "NA",';
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 						if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",';
280 280
 						if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) {
281 281
 							$output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",';
282
-							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",';
282
+							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ', '_', $spotter_item['aircraft_name'])).'",';
283 283
 						} elseif (isset($spotter_item['aircraft_type'])) {
284 284
 							$output .= '"aircraft_name": "NA ('.$spotter_item['aircraft_type'].')",';
285 285
 						} elseif (!$min) {
@@ -422,15 +422,15 @@  discard block
 block discarded – undo
422 422
 						if (isset($archivespeed) || $usenextlatlon) {
423 423
 							if (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
424 424
 								if (isset($spotter_item['arrival_airport_latitude'])) {
425
-									$cheading = $Common->getHeading($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['arrival_airport_latitude'],$spotter_item['arrival_airport_longitude']);
426
-									$idistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['arrival_airport_latitude'],$spotter_item['arrival_airport_longitude']);
425
+									$cheading = $Common->getHeading($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['arrival_airport_latitude'], $spotter_item['arrival_airport_longitude']);
426
+									$idistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['arrival_airport_latitude'], $spotter_item['arrival_airport_longitude']);
427 427
 									$farr_lat = $spotter_item['arrival_airport_latitude'];
428 428
 									$farr_lon = $spotter_item['arrival_airport_longitude'];
429 429
 								} else {
430 430
 									$aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']);
431 431
 									if (isset($aairport[0]['latitude'])) {
432
-										$cheading = $Common->getHeading($spotter_item['latitude'],$spotter_item['longitude'],$aairport[0]['latitude'],$aairport[0]['longitude']);
433
-										$idistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$aairport[0]['latitude'],$aairport[0]['longitude']);
432
+										$cheading = $Common->getHeading($spotter_item['latitude'], $spotter_item['longitude'], $aairport[0]['latitude'], $aairport[0]['longitude']);
433
+										$idistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $aairport[0]['latitude'], $aairport[0]['longitude']);
434 434
 										$farr_lat = $aairport[0]['latitude'];
435 435
 										$farr_lon = $aairport[0]['longitude'];
436 436
 									}
@@ -443,59 +443,59 @@  discard block
 block discarded – undo
443 443
 						if ($currenttime != '') {
444 444
 							if (strtotime($spotter_item['date']) < $currenttime) {
445 445
 								if (isset($archivespeed)) {
446
-									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
447
-									$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
446
+									$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh));
447
+									$fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']);
448 448
 									if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
449 449
 									else {
450
-										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
451
-										$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
450
+										$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, $archivespeed, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh));
451
+										$fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']);
452 452
 										if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
453 453
 										else {
454
-											$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed);
454
+											$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed);
455 455
 											$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
456 456
 										}
457 457
 									}
458 458
 								} elseif ($usenextlatlon) {
459
-									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
460
-									$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
459
+									$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, 1, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh));
460
+									$fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']);
461 461
 									if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
462 462
 									else {
463
-										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
464
-										$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
463
+										$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, 1, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh));
464
+										$fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']);
465 465
 										if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
466 466
 										else {
467
-											$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading);
467
+											$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading);
468 468
 											$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
469 469
 										}
470 470
 									}
471 471
 								}
472 472
 							} else {
473 473
 								if (isset($archivespeed)) {
474
-									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed);
474
+									$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed);
475 475
 									$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
476 476
 								} elseif ($usenextlatlon) {
477
-									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading);
477
+									$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading);
478 478
 									$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
479 479
 								}
480 480
 							}
481 481
 						} else {
482 482
 							if (isset($archivespeed)) {
483
-								$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed);
484
-								$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
483
+								$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed);
484
+								$fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']);
485 485
 								if (!isset($idistance) || $fdistance < $idistance) {
486 486
 									$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
487 487
 								} else {
488
-									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed);
488
+									$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, $archivespeed);
489 489
 									//$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
490 490
 									$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
491 491
 								}
492 492
 							} elseif ($usenextlatlon) {
493
-								$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading);
494
-								$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
493
+								$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading);
494
+								$fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']);
495 495
 								if (!isset($idistance) || $fdistance < $idistance) {
496 496
 										$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
497 497
 								} else {
498
-									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading);
498
+									$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading);
499 499
 									//$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
500 500
 									$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
501 501
 								}
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
 
505 505
 						if (!$min) $output .= '"image": "'.$image.'",';
506 506
 						if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') {
507
-							$output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",';
507
+							$output .= '"image_copyright": "'.str_replace('"', "'", trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $spotter_item['image_copyright']))).'",';
508 508
 						}
509 509
 						if (isset($spotter_item['image_source_website'])) {
510 510
 							$output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",';
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
 							$output .= '"waypoints": "'.$spotter_item['waypoints'].'",';
527 527
 						}
528 528
 						if (isset($spotter_item['acars'])) {
529
-							$output .= '"acars": "'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"), '<br />',$spotter_item['acars']['message'])).'",';
529
+							$output .= '"acars": "'.trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '<br />', $spotter_item['acars']['message'])).'",';
530 530
 						}
531 531
 						// type when not aircraft ?
532 532
 						if (isset($spotter_item['type'])) {
@@ -546,12 +546,12 @@  discard block
 block discarded – undo
546 546
 								if ($currenttime != '') {
547 547
 									if (strtotime($spotter_item['date']) < $currenttime) {
548 548
 										if (!isset($archivespeed)) $archivespeed = 1;
549
-										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date'])));
550
-										$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
549
+										$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed, ($currenttime - strtotime($spotter_item['date'])));
550
+										$fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']);
551 551
 										if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
552 552
 										else {
553
-											$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date'])));
554
-											$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
553
+											$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, $archivespeed, ($currenttime - strtotime($spotter_item['date'])));
554
+											$fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']);
555 555
 											if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
556 556
 											else {
557 557
 												$output .= $spotter_item['longitude'].', ';
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
                 
631 631
 			}
632 632
 */
633
-				$history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING);
633
+				$history = filter_input(INPUT_GET, 'history', FILTER_SANITIZE_STRING);
634 634
 				if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history'];
635 635
 				
636 636
 				if (
@@ -638,11 +638,11 @@  discard block
 block discarded – undo
638 638
 				    || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory)
639 639
 				//    || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id']))
640 640
 				//    || (isset($history) && $history != '' && $history != 'NA' && $history == $spotter_item['ident'])
641
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
641
+				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id']))
642 642
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])
643
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id']))
643
+				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['fammarine_id']))
644 644
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id'])
645
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid']))
645
+				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['famtrackid']))
646 646
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid'])
647 647
 				    ) {
648 648
 					if ($tracker) {
@@ -679,9 +679,9 @@  discard block
 block discarded – undo
679 679
 								else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
680 680
 							}
681 681
 							$output_history .= '[';
682
-							$output_history .=  $spotter_history['longitude'].', ';
683
-							$output_history .=  $spotter_history['latitude'].', ';
684
-							$output_history .=  $spotter_history['altitude']*30.48;
682
+							$output_history .= $spotter_history['longitude'].', ';
683
+							$output_history .= $spotter_history['latitude'].', ';
684
+							$output_history .= $spotter_history['altitude']*30.48;
685 685
 							$output_history .= '],';
686 686
 							/*
687 687
 							if ($from_archive === false) {
@@ -699,8 +699,8 @@  discard block
 block discarded – undo
699 699
 								else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": [';
700 700
 							} else $d = true;
701 701
 							$output_history .= '[';
702
-							$output_history .=  $spotter_history['longitude'].', ';
703
-							$output_history .=  $spotter_history['latitude'];
702
+							$output_history .= $spotter_history['longitude'].', ';
703
+							$output_history .= $spotter_history['latitude'];
704 704
 							$output_history .= '],';
705 705
 							/*
706 706
 							if ($from_archive === false) {
@@ -716,9 +716,9 @@  discard block
 block discarded – undo
716 716
 					
717 717
 						if ($from_archive === false) {
718 718
 							$output_historyd = '[';
719
-							$output_historyd .=  $spotter_item['longitude'].', ';
720
-							$output_historyd .=  $spotter_item['latitude'];
721
-							if (isset($spotter_history['altitude'])) $output_historyd .=  ','.$spotter_item['altitude']*30.48;
719
+							$output_historyd .= $spotter_item['longitude'].', ';
720
+							$output_historyd .= $spotter_item['latitude'];
721
+							if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48;
722 722
 							$output_historyd .= '],';
723 723
 							//$output_history = $output_historyd.$output_history;
724 724
 							$output_history = $output_history.$output_historyd;
@@ -732,7 +732,7 @@  discard block
 block discarded – undo
732 732
 					}
733 733
 				}
734 734
 				
735
-				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
735
+				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id']))
736 736
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
737 737
 				     && (isset($spotter_item['departure_airport']) 
738 738
 				        && $spotter_item['departure_airport'] != 'NA' 
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
 
767 767
 				//if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA' && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) {
768 768
 				//if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) {
769
-				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
769
+				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id']))
770 770
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
771 771
 				     && (isset($spotter_item['arrival_airport']) 
772 772
 				        && $spotter_item['arrival_airport'] != 'NA' 
@@ -797,7 +797,7 @@  discard block
 block discarded – undo
797 797
 			$output  = substr($output, 0, -1);
798 798
 			$output .= ']';
799 799
 			$output .= ',"initial_sqltime": "'.$sqltime.'",';
800
-			$output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",';
800
+			$output .= '"totaltime": "'.round(microtime(true) - $begintime, 2).'",';
801 801
 			if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
802 802
 			$output .= '"fc": "'.$j.'"';
803 803
 		} else {
Please login to merge, or discard this patch.
Braces   +318 added lines, -129 removed lines patch added patch discarded remove patch
@@ -57,28 +57,55 @@  discard block
 block discarded – undo
57 57
 }
58 58
 header('Content-Type: text/javascript');
59 59
 
60
-if (!isset($globalJsonCompress)) $compress = true;
61
-else $compress = $globalJsonCompress;
60
+if (!isset($globalJsonCompress)) {
61
+	$compress = true;
62
+} else {
63
+	$compress = $globalJsonCompress;
64
+}
62 65
 
63 66
 $from_archive = false;
64 67
 $min = true;
65 68
 $allhistory = false;
66 69
 $filter['source'] = array();
67
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
68
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
69
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
70
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
71
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
72
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
73
-if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
74
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
75
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
76
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
77
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
70
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') {
71
+	$filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
72
+}
73
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') {
74
+	$filter['source'] = array_merge($filter['source'],array('whazzup'));
75
+}
76
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') {
77
+	$filter['source'] = array_merge($filter['source'],array('phpvmacars'));
78
+}
79
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') {
80
+	$filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
81
+}
82
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') {
83
+	$filter['source'] = array_merge($filter['source'],array('aprs'));
84
+}
85
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') {
86
+	$filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
87
+}
88
+if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') {
89
+	$filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
90
+}
91
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') {
92
+	$filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
93
+}
94
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') {
95
+	$filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
96
+}
97
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') {
98
+	$filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
99
+}
100
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') {
101
+	$filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
102
+}
78 103
 
79 104
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
80 105
 	$min = true;
81
-} else $min = false;
106
+} else {
107
+	$min = false;
108
+}
82 109
 
83 110
 $spotter_array = array();
84 111
 
@@ -188,24 +215,38 @@  discard block
 block discarded – undo
188 215
 			$flightcnt = $SpotterLive->getLiveSpotterCount($filter);
189 216
 		}
190 217
 	}
191
-	if ($flightcnt == '') $flightcnt = 0;
192
-} else $flightcnt = 0;
218
+	if ($flightcnt == '') {
219
+		$flightcnt = 0;
220
+	}
221
+	} else {
222
+	$flightcnt = 0;
223
+}
193 224
 
194 225
 $sqltime = round(microtime(true)-$begintime,2);
195 226
 
196 227
 $currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
197
-if ($currenttime != '') $currenttime = round($currenttime/1000);
228
+if ($currenttime != '') {
229
+	$currenttime = round($currenttime/1000);
230
+}
198 231
 
199
-if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false;
200
-else $usenextlatlon = true;
201
-if ($usenextlatlon === false) $currenttime = '';
232
+if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) {
233
+	$usenextlatlon = false;
234
+} else {
235
+	$usenextlatlon = true;
236
+}
237
+if ($usenextlatlon === false) {
238
+	$currenttime = '';
239
+}
202 240
 $j = 0;
203 241
 $prev_flightaware_id = '';
204 242
 $aircrafts_shadow = array();
205 243
 $output = '{';
206 244
 	$output .= '"type": "FeatureCollection",';
207
-		if ($min) $output .= '"minimal": "true",';
208
-		else $output .= '"minimal": "false",';
245
+		if ($min) {
246
+			$output .= '"minimal": "true",';
247
+		} else {
248
+			$output .= '"minimal": "false",';
249
+		}
209 250
 		//$output .= '"fc": "'.$flightcnt.'",';
210 251
 		$output .= '"sqt": "'.$sqltime.'",';
211 252
 
@@ -250,18 +291,29 @@  discard block
 block discarded – undo
250 291
 						}
251 292
 						$output .= '"properties": {';
252 293
 						if (isset($spotter_item['flightaware_id'])) {
253
-							if ($compress) $output .= '"fi": "'.$spotter_item['flightaware_id'].'",';
254
-							else $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",';
294
+							if ($compress) {
295
+								$output .= '"fi": "'.$spotter_item['flightaware_id'].'",';
296
+							} else {
297
+								$output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",';
298
+							}
255 299
 						} elseif (isset($spotter_item['famtrackid'])) {
256
-							if ($compress) $output .= '"fti": "'.$spotter_item['famtrackid'].'",';
257
-							else $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",';
300
+							if ($compress) {
301
+								$output .= '"fti": "'.$spotter_item['famtrackid'].'",';
302
+							} else {
303
+								$output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",';
304
+							}
258 305
 						} elseif (isset($spotter_item['fammarine_id'])) {
259
-							if ($compress) $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",';
260
-							else $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",';
306
+							if ($compress) {
307
+								$output .= '"fmi": "'.$spotter_item['fammarine_id'].'",';
308
+							} else {
309
+								$output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",';
310
+							}
261 311
 						}
262 312
 							$output .= '"fc": "'.$flightcnt.'",';
263 313
 							$output .= '"sqt": "'.$sqltime.'",';
264
-							if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
314
+							if (isset($begindate)) {
315
+								$output .= '"archive_date": "'.$begindate.'",';
316
+							}
265 317
 
266 318
 /*
267 319
 							if ($min) $output .= '"minimal": "true",';
@@ -269,14 +321,22 @@  discard block
 block discarded – undo
269 321
 */
270 322
 							//$output .= '"fc": "'.$spotter_item['nb'].'",';
271 323
 						if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') {
272
-							if ($compress) $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",';
273
-							else $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",';
324
+							if ($compress) {
325
+								$output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",';
326
+							} else {
327
+								$output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",';
328
+							}
274 329
 							//"
275 330
 						} else {
276
-							if ($compress) $output .= '"c": "NA",';
277
-							else $output .= '"callsign": "NA",';
331
+							if ($compress) {
332
+								$output .= '"c": "NA",';
333
+							} else {
334
+								$output .= '"callsign": "NA",';
335
+							}
336
+						}
337
+						if (isset($spotter_item['registration'])) {
338
+							$output .= '"registration": "'.$spotter_item['registration'].'",';
278 339
 						}
279
-						if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",';
280 340
 						if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) {
281 341
 							$output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",';
282 342
 							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",';
@@ -289,16 +349,23 @@  discard block
 block discarded – undo
289 349
 							$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
290 350
 						}
291 351
 						if (!isset($spotter_item['aircraft_shadow']) && !$tracker) {
292
-							if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = '';
293
-							else {
352
+							if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') {
353
+								$spotter_item['aircraft_shadow'] = '';
354
+							} else {
294 355
 								$aircraft_icao = $spotter_item['aircraft_icao'];
295
-								if (isset($aircrafts_shadow[$aircraft_icao])) $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao];
296
-								else {
356
+								if (isset($aircrafts_shadow[$aircraft_icao])) {
357
+									$spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao];
358
+								} else {
297 359
 									$aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']);
298
-									if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
299
-									elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png';
300
-									elseif ($aircraft_icao == 'PARAGLIDER') $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png';
301
-									else $spotter_item['aircraft_shadow'] = '';
360
+									if (count($aircraft_info) > 0) {
361
+										$spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
362
+									} elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') {
363
+										$spotter_item['aircraft_shadow'] = 'PA18.png';
364
+									} elseif ($aircraft_icao == 'PARAGLIDER') {
365
+										$spotter_item['aircraft_shadow'] = 'PARAGLIDER.png';
366
+									} else {
367
+										$spotter_item['aircraft_shadow'] = '';
368
+									}
302 369
 									$aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow'];
303 370
 								}
304 371
 							}
@@ -306,73 +373,139 @@  discard block
 block discarded – undo
306 373
 						if (!isset($spotter_item['aircraft_shadow']) || $spotter_item['aircraft_shadow'] == '') {
307 374
 							if ($tracker) {
308 375
 								if (isset($spotter_item['type']) && $spotter_item['type'] == 'Ambulance') {
309
-									if ($compress) $output .= '"as": "ambulance.png",';
310
-									else $output .= '"aircraft_shadow": "ambulance.png",';
376
+									if ($compress) {
377
+										$output .= '"as": "ambulance.png",';
378
+									} else {
379
+										$output .= '"aircraft_shadow": "ambulance.png",';
380
+									}
311 381
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') {
312
-									if ($compress) $output .= '"as": "police.png",';
313
-									else $output .= '"aircraft_shadow": "police.png",';
382
+									if ($compress) {
383
+										$output .= '"as": "police.png",';
384
+									} else {
385
+										$output .= '"aircraft_shadow": "police.png",';
386
+									}
314 387
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') {
315
-									if ($compress) $output .= '"as": "ship.png",';
316
-									else $output .= '"aircraft_shadow": "ship.png",';
388
+									if ($compress) {
389
+										$output .= '"as": "ship.png",';
390
+									} else {
391
+										$output .= '"aircraft_shadow": "ship.png",';
392
+									}
317 393
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') {
318
-									if ($compress) $output .= '"as": "ship.png",';
319
-									else $output .= '"aircraft_shadow": "ship.png",';
394
+									if ($compress) {
395
+										$output .= '"as": "ship.png",';
396
+									} else {
397
+										$output .= '"aircraft_shadow": "ship.png",';
398
+									}
320 399
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') {
321
-									if ($compress) $output .= '"as": "ship.png",';
322
-									else $output .= '"aircraft_shadow": "ship.png",';
400
+									if ($compress) {
401
+										$output .= '"as": "ship.png",';
402
+									} else {
403
+										$output .= '"aircraft_shadow": "ship.png",';
404
+									}
323 405
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') {
324
-									if ($compress) $output .= '"as": "truck.png",';
325
-									else $output .= '"aircraft_shadow": "truck.png",';
406
+									if ($compress) {
407
+										$output .= '"as": "truck.png",';
408
+									} else {
409
+										$output .= '"aircraft_shadow": "truck.png",';
410
+									}
326 411
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') {
327
-									if ($compress) $output .= '"as": "truck.png",';
328
-									else $output .= '"aircraft_shadow": "truck.png",';
412
+									if ($compress) {
413
+										$output .= '"as": "truck.png",';
414
+									} else {
415
+										$output .= '"aircraft_shadow": "truck.png",';
416
+									}
329 417
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') {
330
-									if ($compress) $output .= '"as": "aircraft.png",';
331
-									else $output .= '"aircraft_shadow": "aircraft.png",';
418
+									if ($compress) {
419
+										$output .= '"as": "aircraft.png",';
420
+									} else {
421
+										$output .= '"aircraft_shadow": "aircraft.png",';
422
+									}
332 423
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') {
333
-									if ($compress) $output .= '"as": "aircraft.png",';
334
-									else $output .= '"aircraft_shadow": "aircraft.png",';
424
+									if ($compress) {
425
+										$output .= '"as": "aircraft.png",';
426
+									} else {
427
+										$output .= '"aircraft_shadow": "aircraft.png",';
428
+									}
335 429
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') {
336
-									if ($compress) $output .= '"as": "helico.png",';
337
-									else $output .= '"aircraft_shadow": "helico.png",';
430
+									if ($compress) {
431
+										$output .= '"as": "helico.png",';
432
+									} else {
433
+										$output .= '"aircraft_shadow": "helico.png",';
434
+									}
338 435
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') {
339
-									if ($compress) $output .= '"as": "rail.png",';
340
-									else $output .= '"aircraft_shadow": "rail.png",';
436
+									if ($compress) {
437
+										$output .= '"as": "rail.png",';
438
+									} else {
439
+										$output .= '"aircraft_shadow": "rail.png",';
440
+									}
341 441
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') {
342
-									if ($compress) $output .= '"as": "firetruck.png",';
343
-									else $output .= '"aircraft_shadow": "firetruck.png",';
442
+									if ($compress) {
443
+										$output .= '"as": "firetruck.png",';
444
+									} else {
445
+										$output .= '"aircraft_shadow": "firetruck.png",';
446
+									}
344 447
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') {
345
-									if ($compress) $output .= '"as": "bus.png",';
346
-									else $output .= '"aircraft_shadow": "bus.png",';
448
+									if ($compress) {
449
+										$output .= '"as": "bus.png",';
450
+									} else {
451
+										$output .= '"aircraft_shadow": "bus.png",';
452
+									}
347 453
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') {
348
-									if ($compress) $output .= '"as": "phone.png",';
349
-									else $output .= '"aircraft_shadow": "phone.png",';
454
+									if ($compress) {
455
+										$output .= '"as": "phone.png",';
456
+									} else {
457
+										$output .= '"aircraft_shadow": "phone.png",';
458
+									}
350 459
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') {
351
-									if ($compress) $output .= '"as": "jogger.png",';
352
-									else $output .= '"aircraft_shadow": "jogger.png",';
460
+									if ($compress) {
461
+										$output .= '"as": "jogger.png",';
462
+									} else {
463
+										$output .= '"aircraft_shadow": "jogger.png",';
464
+									}
353 465
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') {
354
-									if ($compress) $output .= '"as": "bike.png",';
355
-									else $output .= '"aircraft_shadow": "bike.png",';
466
+									if ($compress) {
467
+										$output .= '"as": "bike.png",';
468
+									} else {
469
+										$output .= '"aircraft_shadow": "bike.png",';
470
+									}
356 471
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') {
357
-									if ($compress) $output .= '"as": "motorcycle.png",';
358
-									else $output .= '"aircraft_shadow": "motorcycle.png",';
472
+									if ($compress) {
473
+										$output .= '"as": "motorcycle.png",';
474
+									} else {
475
+										$output .= '"aircraft_shadow": "motorcycle.png",';
476
+									}
359 477
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') {
360
-									if ($compress) $output .= '"as": "balloon.png",';
361
-									else $output .= '"aircraft_shadow": "balloon.png",';
478
+									if ($compress) {
479
+										$output .= '"as": "balloon.png",';
480
+									} else {
481
+										$output .= '"aircraft_shadow": "balloon.png",';
482
+									}
362 483
 								} else {
363
-									if ($compress) $output .= '"as": "car.png",';
364
-									else $output .= '"aircraft_shadow": "car.png",';
484
+									if ($compress) {
485
+										$output .= '"as": "car.png",';
486
+									} else {
487
+										$output .= '"aircraft_shadow": "car.png",';
488
+									}
365 489
 								}
366 490
 							} elseif ($marine) {
367
-								if ($compress) $output .= '"as": "ship.png",';
368
-								else $output .= '"aircraft_shadow": "ship.png",';
491
+								if ($compress) {
492
+									$output .= '"as": "ship.png",';
493
+								} else {
494
+									$output .= '"aircraft_shadow": "ship.png",';
495
+								}
369 496
 							} else {
370
-								if ($compress) $output .= '"as": "default.png",';
371
-								else $output .= '"aircraft_shadow": "default.png",';
497
+								if ($compress) {
498
+									$output .= '"as": "default.png",';
499
+								} else {
500
+									$output .= '"aircraft_shadow": "default.png",';
501
+								}
372 502
 							}
373 503
 						} else {
374
-							if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
375
-							else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
504
+							if ($compress) {
505
+								$output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
506
+							} else {
507
+								$output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
508
+							}
376 509
 						}
377 510
 						if (isset($spotter_item['airline_name'])) {
378 511
 							$output .= '"airline_name": "'.$spotter_item['airline_name'].'",';
@@ -380,8 +513,11 @@  discard block
 block discarded – undo
380 513
 							$output .= '"airline_name": "NA",';
381 514
 						}
382 515
 						if (isset($spotter_item['departure_airport'])) {
383
-							if ($compress) $output .= '"dac": "'.$spotter_item['departure_airport'].'",';
384
-							else $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",';
516
+							if ($compress) {
517
+								$output .= '"dac": "'.$spotter_item['departure_airport'].'",';
518
+							} else {
519
+								$output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",';
520
+							}
385 521
 						}
386 522
 						if (isset($spotter_item['departure_airport_city'])) {
387 523
 							$output .= '"departure_airport": "'.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_country'].'",';
@@ -393,8 +529,11 @@  discard block
 block discarded – undo
393 529
 							$output .= '"arrival_airport_time": "'.$spotter_item['arrival_airport_time'].'",';
394 530
 						}
395 531
 						if (isset($spotter_item['arrival_airport'])) {
396
-							if ($compress) $output .= '"aac": "'.$spotter_item['arrival_airport'].'",';
397
-							else $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",';
532
+							if ($compress) {
533
+								$output .= '"aac": "'.$spotter_item['arrival_airport'].'",';
534
+							} else {
535
+								$output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",';
536
+							}
398 537
 						}
399 538
 						if (isset($spotter_item['arrival_airport_city'])) {
400 539
 							$output .= '"arrival_airport": "'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].'",';
@@ -413,8 +552,11 @@  discard block
 block discarded – undo
413 552
 						}
414 553
 						
415 554
 						if (isset($spotter_item['altitude'])) {
416
-							if ($compress) $output .= '"a": "'.$spotter_item['altitude'].'",';
417
-							else $output .= '"altitude": "'.$spotter_item['altitude'].'",';
555
+							if ($compress) {
556
+								$output .= '"a": "'.$spotter_item['altitude'].'",';
557
+							} else {
558
+								$output .= '"altitude": "'.$spotter_item['altitude'].'",';
559
+							}
418 560
 						}
419 561
 						
420 562
 						$heading = $spotter_item['heading'];
@@ -438,19 +580,24 @@  discard block
 block discarded – undo
438 580
 							}
439 581
 						}
440 582
 						
441
-						if ($compress)$output .= '"h": "'.$heading.'",';
442
-						else $output .= '"heading": "'.$heading.'",';
583
+						if ($compress) {
584
+							$output .= '"h": "'.$heading.'",';
585
+						} else {
586
+							$output .= '"heading": "'.$heading.'",';
587
+						}
443 588
 						if ($currenttime != '') {
444 589
 							if (strtotime($spotter_item['date']) < $currenttime) {
445 590
 								if (isset($archivespeed)) {
446 591
 									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
447 592
 									$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
448
-									if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
449
-									else {
593
+									if (!isset($idistance) || $fdistance < $idistance) {
594
+										$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
595
+									} else {
450 596
 										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
451 597
 										$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
452
-										if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
453
-										else {
598
+										if (!isset($idistance) || $fdistance < $idistance) {
599
+											$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
600
+										} else {
454 601
 											$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed);
455 602
 											$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
456 603
 										}
@@ -458,12 +605,14 @@  discard block
 block discarded – undo
458 605
 								} elseif ($usenextlatlon) {
459 606
 									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
460 607
 									$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
461
-									if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
462
-									else {
608
+									if (!isset($idistance) || $fdistance < $idistance) {
609
+										$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
610
+									} else {
463 611
 										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
464 612
 										$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
465
-										if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
466
-										else {
613
+										if (!isset($idistance) || $fdistance < $idistance) {
614
+											$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
615
+										} else {
467 616
 											$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading);
468 617
 											$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
469 618
 										}
@@ -502,7 +651,9 @@  discard block
 block discarded – undo
502 651
 							}
503 652
 						}
504 653
 
505
-						if (!$min) $output .= '"image": "'.$image.'",';
654
+						if (!$min) {
655
+							$output .= '"image": "'.$image.'",';
656
+						}
506 657
 						if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') {
507 658
 							$output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",';
508 659
 						}
@@ -510,8 +661,11 @@  discard block
 block discarded – undo
510 661
 							$output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",';
511 662
 						}
512 663
 						if (isset($spotter_item['squawk'])) {
513
-							if ($compress) $output .= '"sq": "'.$spotter_item['squawk'].'",';
514
-							else $output .= '"squawk": "'.$spotter_item['squawk'].'",';
664
+							if ($compress) {
665
+								$output .= '"sq": "'.$spotter_item['squawk'].'",';
666
+							} else {
667
+								$output .= '"squawk": "'.$spotter_item['squawk'].'",';
668
+							}
515 669
 						}
516 670
 						if (isset($spotter_item['squawk_usage'])) {
517 671
 							$output .= '"squawk_usage": "'.$spotter_item['squawk_usage'].'",';
@@ -530,14 +684,23 @@  discard block
 block discarded – undo
530 684
 						}
531 685
 						// type when not aircraft ?
532 686
 						if (isset($spotter_item['type'])) {
533
-							if ($compress) $output .= '"t": "'.$spotter_item['type'].'"';
534
-							else $output .= '"type": "'.$spotter_item['type'].'"';
687
+							if ($compress) {
688
+								$output .= '"t": "'.$spotter_item['type'].'"';
689
+							} else {
690
+								$output .= '"type": "'.$spotter_item['type'].'"';
691
+							}
535 692
 						} elseif ($marine) {
536
-							if ($compress) $output .= '"t": "ship"';
537
-							else $output .= '"type": "ship"';
693
+							if ($compress) {
694
+								$output .= '"t": "ship"';
695
+							} else {
696
+								$output .= '"type": "ship"';
697
+							}
538 698
 						} else {
539
-							if ($compress) $output .= '"t": "aircraft"';
540
-							else $output .= '"type": "aircraft"';
699
+							if ($compress) {
700
+								$output .= '"t": "aircraft"';
701
+							} else {
702
+								$output .= '"type": "aircraft"';
703
+							}
541 704
 						}
542 705
 						$output .= '},';
543 706
 						$output .= '"geometry": {';
@@ -545,15 +708,19 @@  discard block
 block discarded – undo
545 708
 								$output .= '"coordinates": [';
546 709
 								if ($currenttime != '') {
547 710
 									if (strtotime($spotter_item['date']) < $currenttime) {
548
-										if (!isset($archivespeed)) $archivespeed = 1;
711
+										if (!isset($archivespeed)) {
712
+											$archivespeed = 1;
713
+										}
549 714
 										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date'])));
550 715
 										$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
551
-										if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
552
-										else {
716
+										if (!isset($idistance) || $fdistance < $idistance) {
717
+											$output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
718
+										} else {
553 719
 											$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date'])));
554 720
 											$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
555
-											if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
556
-											else {
721
+											if (!isset($idistance) || $fdistance < $idistance) {
722
+												$output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
723
+											} else {
557 724
 												$output .= $spotter_item['longitude'].', ';
558 725
 												$output .= $spotter_item['latitude'];
559 726
 											}
@@ -631,7 +798,9 @@  discard block
 block discarded – undo
631 798
 			}
632 799
 */
633 800
 				$history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING);
634
-				if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history'];
801
+				if ($history == '' && isset($_COOKIE['history'])) {
802
+					$history = $_COOKIE['history'];
803
+				}
635 804
 				
636 805
 				if (
637 806
 				    (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') 
@@ -675,8 +844,11 @@  discard block
 block discarded – undo
675 844
 									$output_history .= ']}},';
676 845
 									$output .= $output_history;
677 846
 								}
678
-								if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
679
-								else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
847
+								if ($compress) {
848
+									$output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
849
+								} else {
850
+									$output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
851
+								}
680 852
 							}
681 853
 							$output_history .= '[';
682 854
 							$output_history .=  $spotter_history['longitude'].', ';
@@ -695,9 +867,14 @@  discard block
 block discarded – undo
695 867
 							$prev_alt = $alt;
696 868
 						} else {
697 869
 							if ($d == false) {
698
-								if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history"},"geometry": {"type": "LineString","coordinates": [';
699
-								else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": [';
700
-							} else $d = true;
870
+								if ($compress) {
871
+									$output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history"},"geometry": {"type": "LineString","coordinates": [';
872
+								} else {
873
+									$output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": [';
874
+								}
875
+							} else {
876
+								$d = true;
877
+							}
701 878
 							$output_history .= '[';
702 879
 							$output_history .=  $spotter_history['longitude'].', ';
703 880
 							$output_history .=  $spotter_history['latitude'];
@@ -718,7 +895,9 @@  discard block
 block discarded – undo
718 895
 							$output_historyd = '[';
719 896
 							$output_historyd .=  $spotter_item['longitude'].', ';
720 897
 							$output_historyd .=  $spotter_item['latitude'];
721
-							if (isset($spotter_history['altitude'])) $output_historyd .=  ','.$spotter_item['altitude']*30.48;
898
+							if (isset($spotter_history['altitude'])) {
899
+								$output_historyd .=  ','.$spotter_item['altitude']*30.48;
900
+							}
722 901
 							$output_historyd .= '],';
723 902
 							//$output_history = $output_historyd.$output_history;
724 903
 							$output_history = $output_history.$output_historyd;
@@ -740,8 +919,11 @@  discard block
 block discarded – undo
740 919
 				        && $spotter_item['arrival_airport'] != 'NA' 
741 920
 				        && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") 
742 921
 				    	    || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) {
743
-				    if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
744
-				    else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
922
+				    if ($compress) {
923
+				    	$output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
924
+				    } else {
925
+				    	$output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
926
+				    }
745 927
 				    if (isset($spotter_item['departure_airport_latitude'])) {
746 928
 					$output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],';
747 929
 				    } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') {
@@ -774,8 +956,11 @@  discard block
 block discarded – undo
774 956
 				    	    || (!isset($_COOKIE['MapRemainaingRoute']) && (!isset($globalMapRemainingRoute) 
775 957
 				    	    || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) {
776 958
 				    $havedata = false;
777
-				    if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
778
-				    else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
959
+				    if ($compress) {
960
+				    	$output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
961
+				    } else {
962
+				    	$output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
963
+				    }
779 964
 				    $output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],';
780 965
 
781 966
 				    if (isset($spotter_item['arrival_airport_latitude'])) {
@@ -790,7 +975,9 @@  discard block
 block discarded – undo
790 975
 				    }
791 976
 				    //$output_dest  = substr($output_dest, 0, -1);
792 977
 				    $output_dest .= ']}},';
793
-				    if ($havedata) $output .= $output_dest;
978
+				    if ($havedata) {
979
+				    	$output .= $output_dest;
980
+				    }
794 981
 				    unset($output_dest);
795 982
 				}
796 983
 			}
@@ -798,7 +985,9 @@  discard block
 block discarded – undo
798 985
 			$output .= ']';
799 986
 			$output .= ',"initial_sqltime": "'.$sqltime.'",';
800 987
 			$output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",';
801
-			if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
988
+			if (isset($begindate)) {
989
+				$output .= '"archive_date": "'.$begindate.'",';
990
+			}
802 991
 			$output .= '"fc": "'.$j.'"';
803 992
 		} else {
804 993
 			$output .= '"features": ';
Please login to merge, or discard this patch.
airline-statistics-registration.php 2 patches
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -8,21 +8,21 @@  discard block
 block discarded – undo
8 8
 	header('Location: '.$globalURL.'/airline');
9 9
 	die();
10 10
 }
11
-$airline = urldecode(filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING));
11
+$airline = urldecode(filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING));
12 12
 $Spotter = new Spotter();
13 13
 $alliance = false;
14
-if (strpos($airline,'alliance_') !== FALSE) {
14
+if (strpos($airline, 'alliance_') !== FALSE) {
15 15
 	$alliance = true;
16 16
 } else {
17
-	$spotter_array = $Spotter->getSpotterDataByAirline($airline,"0,1","");
17
+	$spotter_array = $Spotter->getSpotterDataByAirline($airline, "0,1", "");
18 18
 }
19 19
 
20 20
 if (!empty($spotter_array) || $alliance === true)
21 21
 {
22 22
 	if ($alliance) {
23
-		$title = sprintf(_("Most Common Aircraft by Registration from %s"),str_replace('_',' ',str_replace('alliance_','',$airline)));
23
+		$title = sprintf(_("Most Common Aircraft by Registration from %s"), str_replace('_', ' ', str_replace('alliance_', '', $airline)));
24 24
 	} else {
25
-		$title = sprintf(_("Most Common Aircraft by Registration from %s (%s)"),$spotter_array[0]['airline_name'],$spotter_array[0]['airline_icao']);
25
+		$title = sprintf(_("Most Common Aircraft by Registration from %s (%s)"), $spotter_array[0]['airline_name'], $spotter_array[0]['airline_icao']);
26 26
 	}
27 27
 	require_once('header.php');
28 28
 
@@ -33,10 +33,10 @@  discard block
 block discarded – undo
33 33
 	$alliances = $Spotter->getAllAllianceNames();
34 34
 	if (!empty($alliances)) {
35 35
 		foreach ($alliances as $al) {
36
-			if ($alliance && str_replace('_',' ',str_replace('alliance_','',$airline)) == $al['alliance']) {
37
-				print '<option value="'.str_replace(' ','_',$al['alliance']).'" selected>'.$al['alliance'].'</option>';
36
+			if ($alliance && str_replace('_', ' ', str_replace('alliance_', '', $airline)) == $al['alliance']) {
37
+				print '<option value="'.str_replace(' ', '_', $al['alliance']).'" selected>'.$al['alliance'].'</option>';
38 38
 			} else {
39
-				print '<option value="'.str_replace(' ','_',$al['alliance']).'">'.$al['alliance'].'</option>';
39
+				print '<option value="'.str_replace(' ', '_', $al['alliance']).'">'.$al['alliance'].'</option>';
40 40
 			}
41 41
 		}
42 42
 		print '<option disabled>──────────────────</option>';
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
44 44
 	$Stats = new Stats($Spotter->db);
45 45
 	$airline_names = $Stats->getAllAirlineNames();
46 46
 	if (empty($airline_names)) $airline_names = $Spotter->getAllAirlineNames();
47
-	foreach($airline_names as $airline_name)
47
+	foreach ($airline_names as $airline_name)
48 48
 	{
49
-		if($airline == $airline_name['airline_icao'])
49
+		if ($airline == $airline_name['airline_icao'])
50 50
 		{
51 51
 			print '<option value="'.$airline_name['airline_icao'].'" selected="selected">'.$airline_name['airline_name'].' ('.$airline_name['airline_icao'].')</option>';
52 52
 		} else {
@@ -80,12 +80,12 @@  discard block
 block discarded – undo
80 80
 			print '</div>';
81 81
 		} else {
82 82
 			print '<div class="info column">';
83
-			print '<h1>'.str_replace('_',' ',str_replace('alliance_','',$airline)).'</h1>';
84
-			if (@getimagesize($globalURL.'/images/airlines/'.str_replace('alliance_','',$airline).'.png') || @getimagesize('images/airlines/'.str_replace('alliance_','',$airline).'.png'))
83
+			print '<h1>'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'</h1>';
84
+			if (@getimagesize($globalURL.'/images/airlines/'.str_replace('alliance_', '', $airline).'.png') || @getimagesize('images/airlines/'.str_replace('alliance_', '', $airline).'.png'))
85 85
 			{
86
-				print '<img src="'.$globalURL.'/images/airlines/'.str_replace('alliance_','',$airline).'.png" alt="'.str_replace('_',' ',str_replace('alliance_','',$airline)).'" title="'.str_replace('_',' ',str_replace('alliance_','',$airline)).'" class="logo" />';
86
+				print '<img src="'.$globalURL.'/images/airlines/'.str_replace('alliance_', '', $airline).'.png" alt="'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'" title="'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'" class="logo" />';
87 87
 			}
88
-			print '<div><span class="label">'._("Name").'</span>'.str_replace('_',' ',str_replace('alliance_','',$airline)).'</div>';
88
+			print '<div><span class="label">'._("Name").'</span>'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'</div>';
89 89
 			print '</div>';
90 90
 		}
91 91
 	} else {
@@ -96,9 +96,9 @@  discard block
 block discarded – undo
96 96
 	print '<div class="column">';
97 97
 	print '<h2>'._("Most Common Aircraft by Registration").'</h2>';
98 98
 	if ($alliance) {
99
-		print '<p>'.sprintf(_("The statistic below shows the most common aircraft by their registration of flights from <strong>%s</strong>."),str_replace('_',' ',str_replace('alliance_','',$airline))).'</p>';
99
+		print '<p>'.sprintf(_("The statistic below shows the most common aircraft by their registration of flights from <strong>%s</strong>."), str_replace('_', ' ', str_replace('alliance_', '', $airline))).'</p>';
100 100
 	} else {
101
-		print '<p>'.sprintf(_("The statistic below shows the most common aircraft by their registration of flights from <strong>%s</strong>."),$spotter_array[0]['airline_name']).'</p>';
101
+		print '<p>'.sprintf(_("The statistic below shows the most common aircraft by their registration of flights from <strong>%s</strong>."), $spotter_array[0]['airline_name']).'</p>';
102 102
 	}
103 103
 	/*
104 104
 	if ($alliance) {
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 		$aircraft_array = $Spotter->countAllAircraftRegistrationByAirline($airline);
108 108
 	}
109 109
 	*/
110
-	$aircraft_array = $Stats->countAllAircraftRegistrations(true,$airline);
110
+	$aircraft_array = $Stats->countAllAircraftRegistrations(true, $airline);
111 111
 	if (!empty($aircraft_array))
112 112
 	{
113 113
 		print '<div class="table-responsive">';
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 		print '</thead>';
123 123
 		print '<tbody>';
124 124
 		$i = 1;
125
-		foreach($aircraft_array as $aircraft_item)
125
+		foreach ($aircraft_array as $aircraft_item)
126 126
 		{
127 127
 			print '<tr>';
128 128
 			print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
Braces   +7 added lines, -4 removed lines patch added patch discarded remove patch
@@ -43,7 +43,9 @@  discard block
 block discarded – undo
43 43
 	}
44 44
 	$Stats = new Stats($Spotter->db);
45 45
 	$airline_names = $Stats->getAllAirlineNames();
46
-	if (empty($airline_names)) $airline_names = $Spotter->getAllAirlineNames();
46
+	if (empty($airline_names)) {
47
+		$airline_names = $Spotter->getAllAirlineNames();
48
+	}
47 49
 	foreach($airline_names as $airline_name)
48 50
 	{
49 51
 		if($airline == $airline_name['airline_icao'])
@@ -66,8 +68,7 @@  discard block
 block discarded – undo
66 68
 			if ($globalIVAO && @getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.gif'))
67 69
 			{
68 70
 				print '<img src="'.$globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.gif" alt="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" title="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" class="logo" />';
69
-			}
70
-			elseif (@getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png'))
71
+			} elseif (@getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png'))
71 72
 			{
72 73
 				print '<img src="'.$globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png" alt="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" title="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" class="logo" />';
73 74
 			}
@@ -131,7 +132,9 @@  discard block
 block discarded – undo
131 132
 				$images = $Image->getSpotterImage($aircraft_item['registration']);
132 133
 				if (isset($images['image_thumbnail'])) {
133 134
 					$aircraft_item['image_thumbnail'] = $images['image_thumbnail'];
134
-				} else $aircraft_item['image_thumbnail'] = '';
135
+				} else {
136
+					$aircraft_item['image_thumbnail'] = '';
137
+				}
135 138
 			}
136 139
 			if ($aircraft_item['image_thumbnail'] != "")
137 140
 			{
Please login to merge, or discard this patch.
require/class.AIS.php 4 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 		return ($dec);
58 58
 	}
59 59
 	
60
-    /*
60
+	/*
61 61
     $ais_map64 = array(
62 62
        '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', // 48
63 63
        ':', ';', '<', '=', '>', '?', '@', 'A', 'B', 'C',
@@ -97,13 +97,13 @@  discard block
 block discarded – undo
97 97
 		//  ' ' --- '?', // 0x20 - 0x3F
98 98
 		//  '@' --- '_', // 0x40 - 0x5F
99 99
 		$ais_chars = array(
100
-		    '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
101
-		    'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
102
-		    'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']',
103
-		    '^', '_', ' ', '!', '\"', '#', '$', '%', '&', '\'',
104
-		    '(', ')', '*', '+', ',', '-', '.', '/', '0', '1',
105
-		    '2', '3', '4', '5', '6', '7', '8', '9', ':', ';',
106
-		    '<', '=', '>', '?'
100
+			'@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
101
+			'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
102
+			'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']',
103
+			'^', '_', ' ', '!', '\"', '#', '$', '%', '&', '\'',
104
+			'(', ')', '*', '+', ',', '-', '.', '/', '0', '1',
105
+			'2', '3', '4', '5', '6', '7', '8', '9', ':', ';',
106
+			'<', '=', '>', '?'
107 107
 		);
108 108
 		// "
109 109
 		$rv = '';
@@ -421,8 +421,8 @@  discard block
 block discarded – undo
421 421
 				}
422 422
 				if ($num_seq > 1) { // for multipart messages
423 423
 					if ($cmsg_sid != $msg_sid // different msg_sid
424
-					    || $msg_sid == -1 // invalid initial msg_sid
425
-					    || ($seq - $pseq) != 1 // not insequence
424
+						|| $msg_sid == -1 // invalid initial msg_sid
425
+						|| ($seq - $pseq) != 1 // not insequence
426 426
 					) {  // invalid for multipart message
427 427
 						$msg_sid = -1;
428 428
 						$cmsg_sid = -1;
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 				$itu = $itu.$pcs[5]; // get itu message
436 436
 				$filler += (int)$pcs[6][0]; // get filler
437 437
 				if ($num_seq == 1 // valid single message
438
-				    || $num_seq == $pseq // valid multi-part message
438
+					|| $num_seq == $pseq // valid multi-part message
439 439
 				) {
440 440
 					/*
441 441
 					if ($num_seq != 1) { // test
@@ -520,13 +520,13 @@  discard block
 block discarded – undo
520 520
 		else $pad = '';
521 521
 		$rv = '';
522 522
 		$ais_chars = array(
523
-		    '@'=>0, 'A'=>1, 'B'=>2, 'C'=>3, 'D'=>4, 'E'=>5, 'F'=>6, 'G'=>7, 'H'=>8, 'I'=>9,
524
-		    'J'=>10, 'K'=>11, 'L'=>12, 'M'=>13, 'N'=>14, 'O'=>15, 'P'=>16, 'Q'=>17, 'R'=>18, 'S'=>19,
525
-		    'T'=>20, 'U'=>21, 'V'=>22, 'W'=>23, 'X'=>24, 'Y'=>25, 'Z'=>26, '['=>27, '\\'=>28, ']'=>29,
526
-		    '^'=>30, '_'=>31, ' '=>32, '!'=>33, '\"'=>34, '#'=>35, '$'=>36, '%'=>37, '&'=>38, '\''=>39,
527
-		    '('=>40, ')'=>41, '*'=>42, '+'=>43, ','=>44, '-'=>45, '.'=>46, '/'=>47, '0'=>48, '1'=>49,
528
-		    '2'=>50, '3'=>51, '4'=>52, '5'=>53, '6'=>54, '7'=>55, '8'=>56, '9'=>57, ':'=>58, ';'=>59,
529
-		    '<'=>60, '='=>61, '>'=>62, '?'=>63
523
+			'@'=>0, 'A'=>1, 'B'=>2, 'C'=>3, 'D'=>4, 'E'=>5, 'F'=>6, 'G'=>7, 'H'=>8, 'I'=>9,
524
+			'J'=>10, 'K'=>11, 'L'=>12, 'M'=>13, 'N'=>14, 'O'=>15, 'P'=>16, 'Q'=>17, 'R'=>18, 'S'=>19,
525
+			'T'=>20, 'U'=>21, 'V'=>22, 'W'=>23, 'X'=>24, 'Y'=>25, 'Z'=>26, '['=>27, '\\'=>28, ']'=>29,
526
+			'^'=>30, '_'=>31, ' '=>32, '!'=>33, '\"'=>34, '#'=>35, '$'=>36, '%'=>37, '&'=>38, '\''=>39,
527
+			'('=>40, ')'=>41, '*'=>42, '+'=>43, ','=>44, '-'=>45, '.'=>46, '/'=>47, '0'=>48, '1'=>49,
528
+			'2'=>50, '3'=>51, '4'=>52, '5'=>53, '6'=>54, '7'=>55, '8'=>56, '9'=>57, ':'=>58, ';'=>59,
529
+			'<'=>60, '='=>61, '>'=>62, '?'=>63
530 530
 		);
531 531
 		// "
532 532
 		$_a = str_split($name);
Please login to merge, or discard this patch.
Doc Comments   +25 added lines patch added patch discarded remove patch
@@ -156,6 +156,10 @@  discard block
 block discarded – undo
156 156
        't', 'u', 'v', 'w' // 119
157 157
     ); // char 64
158 158
     */
159
+
160
+	/**
161
+	 * @param integer $ascii
162
+	 */
159 163
 	private function asciidec_2_8bit($ascii) {
160 164
 		//only process in the following range: 48-87, 96-119
161 165
 		if ($ascii < 48) { }
@@ -181,6 +185,10 @@  discard block
 block discarded – undo
181 185
 		return(substr($bin, -6)); 
182 186
 	}
183 187
 
188
+	/**
189
+	 * @param integer $_start
190
+	 * @param integer $_size
191
+	 */
184 192
 	private function binchar($_str, $_start, $_size) {
185 193
 		//  ' ' --- '?', // 0x20 - 0x3F
186 194
 		//  '@' --- '_', // 0x40 - 0x5F
@@ -206,6 +214,10 @@  discard block
 block discarded – undo
206 214
 	}
207 215
 
208 216
 	// function for decoding the AIS Message ITU Payload
217
+
218
+	/**
219
+	 * @param string $_aisdata
220
+	 */
209 221
 	private function decode_ais($_aisdata) {
210 222
 		$ro = new stdClass(); // return object
211 223
 		$ro->cls = 0; // AIS class undefined, also indicate unparsed msg
@@ -364,6 +376,12 @@  discard block
 block discarded – undo
364 376
 		else return '';
365 377
 	}
366 378
 
379
+	/**
380
+	 * @param string $_itu
381
+	 * @param integer $_len
382
+	 * @param integer $_filler
383
+	 * @param string $aux
384
+	 */
367 385
 	public function process_ais_itu($_itu, $_len, $_filler, $aux /*, $ais_ch*/) {
368 386
 		global $port; // tcpip port...
369 387
 		static $debug_counter = 0;
@@ -383,6 +401,10 @@  discard block
 block discarded – undo
383 401
 
384 402
 	// char* - AIS \r terminated string
385 403
 	// TCP based streams which send messages in full can use this instead of calling process_ais_buf
404
+
405
+	/**
406
+	 * @param string $rawdata
407
+	 */
386 408
 	public function process_ais_raw($rawdata, $aux = '') { // return int
387 409
 		static $num_seq; // 1 to 9
388 410
 		static $seq; // 1 to 9
@@ -607,6 +629,9 @@  discard block
 block discarded – undo
607 629
 		return $result;
608 630
 	}
609 631
 
632
+	/**
633
+	 * @param string $mmsi
634
+	 */
610 635
 	public function mmsitype($mmsi) {
611 636
 		if (strlen($mmsi) == 9) {
612 637
 			if (substr($mmsi,0,3) == '974') return 'EPIRB (Emergency Position Indicating Radio Beacon) AIS';
Please login to merge, or discard this patch.
Spacing   +129 added lines, -129 removed lines patch added patch discarded remove patch
@@ -117,31 +117,31 @@  discard block
 block discarded – undo
117 117
 
118 118
 	private function make_latf($temp) { // unsigned long 
119 119
 		$flat = 0.0; // float
120
-		$temp = $temp & 0x07FFFFFF;
121
-		if ($temp & 0x04000000) {
122
-			$temp = $temp ^ 0x07FFFFFF;
120
+		$temp = $temp&0x07FFFFFF;
121
+		if ($temp&0x04000000) {
122
+			$temp = $temp^0x07FFFFFF;
123 123
 			$temp += 1;
124
-			$flat = (float)($temp / (60.0 * 10000.0));
124
+			$flat = (float) ($temp/(60.0*10000.0));
125 125
 			$flat *= -1.0;
126
-		} else $flat = (float)($temp / (60.0 * 10000.0));
126
+		} else $flat = (float) ($temp/(60.0*10000.0));
127 127
 		return $flat; // float
128 128
 	}
129 129
 
130 130
 	private function make_lonf($temp) { // unsigned long
131 131
 		$flon = 0.0; // float
132
-		$temp = $temp & 0x0FFFFFFF;
133
-		if ($temp & 0x08000000) {
134
-			$temp = $temp ^ 0x0FFFFFFF;
132
+		$temp = $temp&0x0FFFFFFF;
133
+		if ($temp&0x08000000) {
134
+			$temp = $temp^0x0FFFFFFF;
135 135
 			$temp += 1;
136
-			$flon = (float)($temp / (60.0 * 10000.0));
136
+			$flon = (float) ($temp/(60.0*10000.0));
137 137
 			$flon *= -1.0;
138
-		} else $flon = (float)($temp / (60.0 * 10000.0));
138
+		} else $flon = (float) ($temp/(60.0*10000.0));
139 139
 		return $flon;
140 140
 	}
141 141
 
142 142
 	private function ascii_2_dec($chr) {
143
-		$dec=ord($chr);//get decimal ascii code
144
-		$hex=dechex($dec);//convert decimal to hex
143
+		$dec = ord($chr); //get decimal ascii code
144
+		$hex = dechex($dec); //convert decimal to hex
145 145
 		return ($dec);
146 146
 	}
147 147
 	
@@ -160,15 +160,15 @@  discard block
 block discarded – undo
160 160
 		//only process in the following range: 48-87, 96-119
161 161
 		if ($ascii < 48) { }
162 162
 		else {
163
-			if($ascii>119) { }
163
+			if ($ascii > 119) { }
164 164
 			else {
165
-				if ($ascii>87 && $ascii<96) ;
165
+				if ($ascii > 87 && $ascii < 96);
166 166
 				else {
167
-					$ascii=$ascii+40;
168
-					if ($ascii>128){
169
-						$ascii=$ascii+32;
167
+					$ascii = $ascii + 40;
168
+					if ($ascii > 128) {
169
+						$ascii = $ascii + 32;
170 170
 					} else {
171
-						$ascii=$ascii+40;
171
+						$ascii = $ascii + 40;
172 172
 					}
173 173
 				}
174 174
 			}
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 	}
178 178
 
179 179
 	private function dec_2_6bit($dec) {
180
-		$bin=decbin($dec);
180
+		$bin = decbin($dec);
181 181
 		return(substr($bin, -6)); 
182 182
 	}
183 183
 
@@ -195,11 +195,11 @@  discard block
 block discarded – undo
195 195
 		);
196 196
 		// "
197 197
 		$rv = '';
198
-		if ($_size % 6 == 0) {
199
-			$len = $_size / 6;
200
-			for ($i=0; $i<$len; $i++) {
201
-				$offset = $i * 6;
202
-				$rv .= $ais_chars[ bindec(substr($_str,$_start + $offset,6)) ];
198
+		if ($_size%6 == 0) {
199
+			$len = $_size/6;
200
+			for ($i = 0; $i < $len; $i++) {
201
+				$offset = $i*6;
202
+				$rv .= $ais_chars[bindec(substr($_str, $_start + $offset, 6))];
203 203
 			}
204 204
 		}
205 205
 		return $rv;
@@ -226,93 +226,93 @@  discard block
 block discarded – undo
226 226
 		$ro->eta_hour = '';
227 227
 		$ro->eta_minute = '';
228 228
 		$ro->ts = time();
229
-		$ro->id = bindec(substr($_aisdata,0,6));
230
-		$ro->mmsi = bindec(substr($_aisdata,8,30));
229
+		$ro->id = bindec(substr($_aisdata, 0, 6));
230
+		$ro->mmsi = bindec(substr($_aisdata, 8, 30));
231 231
 		if ($ro->id >= 1 && $ro->id <= 3) {
232
-			$ro->cog = bindec(substr($_aisdata,116,12))/10;
233
-			$ro->sog = bindec(substr($_aisdata,50,10))/10;
234
-			$ro->lon = $this->make_lonf(bindec(substr($_aisdata,61,28)));
235
-			$ro->lat = $this->make_latf(bindec(substr($_aisdata,89,27)));
232
+			$ro->cog = bindec(substr($_aisdata, 116, 12))/10;
233
+			$ro->sog = bindec(substr($_aisdata, 50, 10))/10;
234
+			$ro->lon = $this->make_lonf(bindec(substr($_aisdata, 61, 28)));
235
+			$ro->lat = $this->make_latf(bindec(substr($_aisdata, 89, 27)));
236 236
 			$ro->cls = 1; // class A
237 237
 		} else if ($ro->id == 4) {
238
-			$ro->lon = $this->make_lonf(bindec(substr($_aisdata,79,28)));
239
-			$ro->lat = $this->make_latf(bindec(substr($_aisdata,107,27)));
238
+			$ro->lon = $this->make_lonf(bindec(substr($_aisdata, 79, 28)));
239
+			$ro->lat = $this->make_latf(bindec(substr($_aisdata, 107, 27)));
240 240
 			$ro->cls = 1; // class A
241 241
 		} else if ($ro->id == 5) {
242
-			$ro->imo = bindec(substr($_aisdata,40,30));
243
-			$ro->callsign = $this->binchar($_aisdata,70,42);
244
-			$ro->name = $this->binchar($_aisdata,112,120);
245
-			$ro->typeid = bindec(substr($_aisdata,232,8));
242
+			$ro->imo = bindec(substr($_aisdata, 40, 30));
243
+			$ro->callsign = $this->binchar($_aisdata, 70, 42);
244
+			$ro->name = $this->binchar($_aisdata, 112, 120);
245
+			$ro->typeid = bindec(substr($_aisdata, 232, 8));
246 246
 			$ro->type = $this->getShipType($ro->typeid);
247 247
 			//$ro->to_bow = bindec(substr($_aisdata,240,9));
248 248
 			//$ro->to_stern = bindec(substr($_aisdata,249,9));
249 249
 			//$ro->to_port = bindec(substr($_aisdata,258,6));
250 250
 			//$ro->to_starboard = bindec(substr($_aisdata,264,6));
251
-			$ro->eta_month = bindec(substr($_aisdata,274,4));
252
-			$ro->eta_day = bindec(substr($_aisdata,278,5));
253
-			$ro->eta_hour = bindec(substr($_aisdata,283,5));
254
-			$ro->eta_minute = bindec(substr($_aisdata,288,6));
251
+			$ro->eta_month = bindec(substr($_aisdata, 274, 4));
252
+			$ro->eta_day = bindec(substr($_aisdata, 278, 5));
253
+			$ro->eta_hour = bindec(substr($_aisdata, 283, 5));
254
+			$ro->eta_minute = bindec(substr($_aisdata, 288, 6));
255 255
 			//$ro->draught = bindec(substr($_aisdata,294,8));
256
-			$ro->destination = $this->binchar($_aisdata,302,120);
256
+			$ro->destination = $this->binchar($_aisdata, 302, 120);
257 257
 			$ro->cls = 1; // class A
258 258
 		} else if ($ro->id == 9) {
259 259
 			// Search and Rescue aircraft position report
260 260
 		} else if ($ro->id == 18) {
261
-			$ro->cog = bindec(substr($_aisdata,112,12))/10;
262
-			$ro->sog = bindec(substr($_aisdata,46,10))/10;
263
-			$ro->lon = $this->make_lonf(bindec(substr($_aisdata,57,28)));
264
-			$ro->lat = $this->make_latf(bindec(substr($_aisdata,85,27)));
265
-			$ro->heading = bindec(substr($_aisdata,124,9));
261
+			$ro->cog = bindec(substr($_aisdata, 112, 12))/10;
262
+			$ro->sog = bindec(substr($_aisdata, 46, 10))/10;
263
+			$ro->lon = $this->make_lonf(bindec(substr($_aisdata, 57, 28)));
264
+			$ro->lat = $this->make_latf(bindec(substr($_aisdata, 85, 27)));
265
+			$ro->heading = bindec(substr($_aisdata, 124, 9));
266 266
 			if ($ro->heading == 511) $ro->heading = '';
267 267
 			$ro->cls = 2; // class B
268 268
 		} else if ($ro->id == 19) {
269
-			$ro->cog = bindec(substr($_aisdata,112,12))/10;
270
-			$ro->sog = bindec(substr($_aisdata,46,10))/10;
271
-			$ro->lon = $this->make_lonf(bindec(substr($_aisdata,61,28)));
272
-			$ro->lat = $this->make_latf(bindec(substr($_aisdata,89,27)));
273
-			$ro->name = $this->binchar($_aisdata,143,120);
269
+			$ro->cog = bindec(substr($_aisdata, 112, 12))/10;
270
+			$ro->sog = bindec(substr($_aisdata, 46, 10))/10;
271
+			$ro->lon = $this->make_lonf(bindec(substr($_aisdata, 61, 28)));
272
+			$ro->lat = $this->make_latf(bindec(substr($_aisdata, 89, 27)));
273
+			$ro->name = $this->binchar($_aisdata, 143, 120);
274 274
 			$ro->cls = 2; // class B
275
-			$ro->heading = bindec(substr($_aisdata,124,9));
275
+			$ro->heading = bindec(substr($_aisdata, 124, 9));
276 276
 			if ($ro->heading == 511) $ro->heading = '';
277
-			$ro->typeid = bindec(substr($_aisdata,263,8));
277
+			$ro->typeid = bindec(substr($_aisdata, 263, 8));
278 278
 			$ro->type = $this->getShipType($ro->typeid);
279 279
 			//$ro->to_bow = bindec(substr($_aisdata,271,9));
280 280
 			//$ro->to_stern = bindec(substr($_aisdata,280,9));
281 281
 			//$ro->to_port = bindec(substr($_aisdata,289,6));
282 282
 			//$ro->to_starboard = bindec(substr($_aisdata,295,6));
283 283
 		} else if ($ro->id == 21) {
284
-			$ro->lon = $this->make_lonf(bindec(substr($_aisdata,164,28)));
285
-			$ro->lat = $this->make_latf(bindec(substr($_aisdata,192,27)));
286
-			$ro->name = $this->binchar($_aisdata,43,120);
284
+			$ro->lon = $this->make_lonf(bindec(substr($_aisdata, 164, 28)));
285
+			$ro->lat = $this->make_latf(bindec(substr($_aisdata, 192, 27)));
286
+			$ro->name = $this->binchar($_aisdata, 43, 120);
287 287
 			//$ro->to_bow = bindec(substr($_aisdata,219,9));
288 288
 			//$ro->to_stern = bindec(substr($_aisdata,228,9));
289 289
 			//$ro->to_port = bindec(substr($_aisdata,237,6));
290 290
 			//$ro->to_starboard = bindec(substr($_aisdata,243,6));
291 291
 			$ro->cls = 2; // class B
292 292
 		} else if ($ro->id == 24) {
293
-			$pn = bindec(substr($_aisdata,38,2));
293
+			$pn = bindec(substr($_aisdata, 38, 2));
294 294
 			if ($pn == 0) {
295
-				$ro->name = $this->binchar($_aisdata,40,120);
295
+				$ro->name = $this->binchar($_aisdata, 40, 120);
296 296
 			}
297
-			$ro->typeid = bindec(substr($_aisdata,40,8));
297
+			$ro->typeid = bindec(substr($_aisdata, 40, 8));
298 298
 			$ro->type = $this->getShipType($ro->typeid);
299
-			$ro->callsign = $this->binchar($_aisdata,90,42);
299
+			$ro->callsign = $this->binchar($_aisdata, 90, 42);
300 300
 			//$ro->to_bow = bindec(substr($_aisdata,132,9));
301 301
 			//$ro->to_stern = bindec(substr($_aisdata,141,9));
302 302
 			//$ro->to_port = bindec(substr($_aisdata,150,6));
303 303
 			//$ro->to_starboard = bindec(substr($_aisdata,156,6));
304 304
 			$ro->cls = 2; // class B
305 305
 		} else if ($ro->id == 27) {
306
-			$ro->cog = bindec(substr($_aisdata,85,9));
306
+			$ro->cog = bindec(substr($_aisdata, 85, 9));
307 307
 			if ($ro->cog == 511) $ro->cog = 0.0;
308
-			$ro->sog = bindec(substr($_aisdata,79,6));
308
+			$ro->sog = bindec(substr($_aisdata, 79, 6));
309 309
 			if ($ro->sog == 63) $ro->sog = 0.0;
310
-			$ro->lon = $this->make_lonf(bindec(substr($_aisdata,44,18))*10);
311
-			$ro->lat = $this->make_latf(bindec(substr($_aisdata,62,17))*10);
310
+			$ro->lon = $this->make_lonf(bindec(substr($_aisdata, 44, 18))*10);
311
+			$ro->lat = $this->make_latf(bindec(substr($_aisdata, 62, 17))*10);
312 312
 			$ro->cls = 1; // class A
313 313
 		
314 314
 		}
315
-		$ro->statusid = bindec(substr($_aisdata,38,4));
315
+		$ro->statusid = bindec(substr($_aisdata, 38, 4));
316 316
 		$ro->status = $this->getStatus($ro->statusid);
317 317
 		return $ro;
318 318
 	}
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 	}
360 360
 
361 361
 	public function getShipTypeID($type) {
362
-		$typeid = array_search($type,$this->shiptype);
362
+		$typeid = array_search($type, $this->shiptype);
363 363
 		if ($typeid !== FALSE) return $typeid;
364 364
 		else return '';
365 365
 	}
@@ -367,14 +367,14 @@  discard block
 block discarded – undo
367 367
 	public function process_ais_itu($_itu, $_len, $_filler, $aux /*, $ais_ch*/) {
368 368
 		global $port; // tcpip port...
369 369
 		static $debug_counter = 0;
370
-		$aisdata168='';//six bit array of ascii characters
370
+		$aisdata168 = ''; //six bit array of ascii characters
371 371
 		$ais_nmea_array = str_split($_itu); // convert to an array
372 372
 		foreach ($ais_nmea_array as $value) {
373 373
 			$dec = $this->ascii_2_dec($value);
374 374
 			$bit8 = $this->asciidec_2_8bit($dec);
375 375
 			$bit6 = $this->dec_2_6bit($bit8);
376 376
 			//echo $value ."-" .$bit6 ."";
377
-			$aisdata168 .=$bit6;
377
+			$aisdata168 .= $bit6;
378 378
 		}
379 379
 		//echo $aisdata168 . "<br/>";
380 380
 		//return $this->decode_ais($aisdata168, $aux);
@@ -397,24 +397,24 @@  discard block
 block discarded – undo
397 397
 		// calculate checksum after ! till *
398 398
 		// assume 1st ! is valid
399 399
 		// find * ensure that it is at correct position
400
-		$end = strrpos ( $rawdata , '*' );
400
+		$end = strrpos($rawdata, '*');
401 401
 		if ($end === FALSE) return -1; // check for NULLS!!!
402
-		$cs = substr( $rawdata, $end + 1 );
403
-		if ( strlen($cs) != 2 ) return -1; // correct cs length
404
-		$dcs = (int)hexdec( $cs );
405
-		for ( $alias=1; $alias<$end; $alias++) $chksum ^= ord( $rawdata[$alias] ); // perform XOR for NMEA checksum
406
-		if ( $chksum == $dcs ) { // NMEA checksum pass
402
+		$cs = substr($rawdata, $end + 1);
403
+		if (strlen($cs) != 2) return -1; // correct cs length
404
+		$dcs = (int) hexdec($cs);
405
+		for ($alias = 1; $alias < $end; $alias++) $chksum ^= ord($rawdata[$alias]); // perform XOR for NMEA checksum
406
+		if ($chksum == $dcs) { // NMEA checksum pass
407 407
 			$pcs = explode(',', $rawdata);
408 408
 			// !AI??? identifier
409 409
 			if (!isset($pcs[1])) {
410 410
 				echo "ERROR,INVALID_DATA ".time()." $rawdata\n";
411 411
 				return -1;
412 412
 			}
413
-			$num_seq = (int)$pcs[1]; // number of sequences
414
-			$seq = (int)$pcs[2]; // get sequence
413
+			$num_seq = (int) $pcs[1]; // number of sequences
414
+			$seq = (int) $pcs[2]; // get sequence
415 415
 			// get msg sequence id
416 416
 			if ($pcs[3] == '') $msg_sid = -1; // non-multipart message, set to -1
417
-			else $msg_sid = (int)$pcs[3]; // multipart message
417
+			else $msg_sid = (int) $pcs[3]; // multipart message
418 418
 			$ais_ch = $pcs[4]; // get AIS channel
419 419
 			// message sequence checking
420 420
 			if ($num_seq < 1 || $num_seq > 9) {
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
 					}
448 448
 				}
449 449
 				$itu = $itu.$pcs[5]; // get itu message
450
-				$filler += (int)$pcs[6][0]; // get filler
450
+				$filler += (int) $pcs[6][0]; // get filler
451 451
 				if ($num_seq == 1 // valid single message
452 452
 				    || $num_seq == $pseq // valid multi-part message
453 453
 				) {
@@ -469,13 +469,13 @@  discard block
 block discarded – undo
469 469
 		$cbuf = $cbuf.$ibuf;
470 470
 		$last_pos = 0;
471 471
 		$result = new stdClass();
472
-		while ( ($start = strpos($cbuf,"VDM",$last_pos)) !== FALSE) {
472
+		while (($start = strpos($cbuf, "VDM", $last_pos)) !== FALSE) {
473 473
 		//while ( ($start = strpos($cbuf,"!AI",$last_pos)) !== FALSE) {
474 474
 			//DEBUG echo $cbuf;
475
-			if ( ($end = strpos($cbuf,"\r\n", $start)) !== FALSE) { //TBD need to trim?
475
+			if (($end = strpos($cbuf, "\r\n", $start)) !== FALSE) { //TBD need to trim?
476 476
 				$tst = substr($cbuf, $start - 3, ($end - $start + 3));
477 477
 				//DEBUG echo "[$start $end $tst]\n";
478
-				$result = $this->process_ais_raw( $tst, "" );
478
+				$result = $this->process_ais_raw($tst, "");
479 479
 				$last_pos = $end + 1;
480 480
 			} else break;
481 481
 		}
@@ -487,41 +487,41 @@  discard block
 block discarded – undo
487 487
 	// incoming data from serial or IP comms
488 488
 	public function process_ais_line($cbuf) {
489 489
 		$result = new stdClass();
490
-		$start = strpos($cbuf,"VDM");
490
+		$start = strpos($cbuf, "VDM");
491 491
 		$tst = substr($cbuf, $start - 3);
492
-		$result = $this->process_ais_raw( $tst, "" );
492
+		$result = $this->process_ais_raw($tst, "");
493 493
 		return $result;
494 494
 	}
495 495
 
496 496
 	/* AIS Encoding
497 497
 	*/
498
-	private function mk_ais_lat( $lat ) {
498
+	private function mk_ais_lat($lat) {
499 499
 		//$lat = 1.2569;
500
-		if ($lat<0.0) {
500
+		if ($lat < 0.0) {
501 501
 			$lat = -$lat;
502
-			$neg=true;
503
-		} else $neg=false;
502
+			$neg = true;
503
+		} else $neg = false;
504 504
 		$latd = 0x00000000;
505
-		$latd = intval ($lat * 600000.0);
506
-		if ($neg==true) {
505
+		$latd = intval($lat*600000.0);
506
+		if ($neg == true) {
507 507
 			$latd = ~$latd;
508
-			$latd+=1;
508
+			$latd += 1;
509 509
 			$latd &= 0x07FFFFFF;
510 510
 		}
511 511
 		return $latd;
512 512
 	}
513 513
 
514
-	private function mk_ais_lon( $lon ) {
514
+	private function mk_ais_lon($lon) {
515 515
 		//$lon = 103.851;
516
-		if ($lon<0.0) {
516
+		if ($lon < 0.0) {
517 517
 			$lon = -$lon;
518
-			$neg=true;
519
-		} else $neg=false;
518
+			$neg = true;
519
+		} else $neg = false;
520 520
 		$lond = 0x00000000;
521
-		$lond = intval ($lon * 600000.0);
522
-		if ($neg==true) {
521
+		$lond = intval($lon*600000.0);
522
+		if ($neg == true) {
523 523
 			$lond = ~$lond;
524
-			$lond+=1;
524
+			$lond += 1;
525 525
 			$lond &= 0x0FFFFFFF;
526 526
 		}
527 527
 		return $lond;
@@ -529,8 +529,8 @@  discard block
 block discarded – undo
529 529
 
530 530
 	private function char2bin($name, $max_len) {
531 531
 		$len = strlen($name);
532
-		if ($len > $max_len) $name = substr($name,0,$max_len);
533
-		if ($len < $max_len) $pad = str_repeat('0', ($max_len - $len) * 6);
532
+		if ($len > $max_len) $name = substr($name, 0, $max_len);
533
+		if ($len < $max_len) $pad = str_repeat('0', ($max_len - $len)*6);
534 534
 		else $pad = '';
535 535
 		$rv = '';
536 536
 		$ais_chars = array(
@@ -547,26 +547,26 @@  discard block
 block discarded – undo
547 547
 		if ($_a) foreach ($_a as $_1) {
548 548
 			if (isset($ais_chars[$_1])) $dec = $ais_chars[$_1];
549 549
 			else $dec = 0;
550
-			$bin = str_pad(decbin( $dec ), 6, '0', STR_PAD_LEFT);
550
+			$bin = str_pad(decbin($dec), 6, '0', STR_PAD_LEFT);
551 551
 			$rv .= $bin;
552 552
 			//echo "$_1 $dec ($bin)<br/>";
553 553
 		}
554 554
 		return $rv.$pad;
555 555
 	}
556 556
 
557
-	private function mk_ais($_enc, $_part=1,$_total=1,$_seq='',$_ch='A') {
557
+	private function mk_ais($_enc, $_part = 1, $_total = 1, $_seq = '', $_ch = 'A') {
558 558
 		$len_bit = strlen($_enc);
559
-		$rem6 = $len_bit % 6;
559
+		$rem6 = $len_bit%6;
560 560
 		$pad6_len = 0;
561 561
 		if ($rem6) $pad6_len = 6 - $rem6;
562 562
 		//echo  $pad6_len.'<br>';
563 563
 		$_enc .= str_repeat("0", $pad6_len); // pad the text...
564
-		$len_enc = strlen($_enc) / 6;
564
+		$len_enc = strlen($_enc)/6;
565 565
 		//echo $_enc.' '.$len_enc.'<br/>';
566 566
 		$itu = '';
567
-		for ($i=0; $i<$len_enc; $i++) {
568
-			$offset = $i * 6;
569
-			$dec = bindec(substr($_enc,$offset,6));
567
+		for ($i = 0; $i < $len_enc; $i++) {
568
+			$offset = $i*6;
569
+			$dec = bindec(substr($_enc, $offset, 6));
570 570
 			if ($dec < 40) $dec += 48;
571 571
 			else $dec += 56;
572 572
 			//echo chr($dec)." $dec<br/>";
@@ -576,15 +576,15 @@  discard block
 block discarded – undo
576 576
 		$chksum = 0;
577 577
 		$itu = "AIVDM,$_part,$_total,$_seq,$_ch,".$itu.",0";
578 578
 		$len_itu = strlen($itu);
579
-		for ($i=0; $i<$len_itu; $i++) {
580
-			$chksum ^= ord( $itu[$i] );
579
+		for ($i = 0; $i < $len_itu; $i++) {
580
+			$chksum ^= ord($itu[$i]);
581 581
 		}
582
-		$hex_arr = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
583
-		$lsb = $chksum & 0x0F;
584
-		if ($lsb >=0 && $lsb <= 15 ) $lsbc = $hex_arr[$lsb];
582
+		$hex_arr = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F');
583
+		$lsb = $chksum&0x0F;
584
+		if ($lsb >= 0 && $lsb <= 15) $lsbc = $hex_arr[$lsb];
585 585
 		else $lsbc = '0';
586
-		$msb = (($chksum & 0xF0) >> 4) & 0x0F;
587
-		if ($msb >=0 && $msb <= 15 ) $msbc = $hex_arr[$msb];
586
+		$msb = (($chksum&0xF0) >> 4)&0x0F;
587
+		if ($msb >= 0 && $msb <= 15) $msbc = $hex_arr[$msb];
588 588
 		else $msbc = '0';
589 589
 		$itu = '!'.$itu."*{$msbc}{$lsbc}\r\n";
590 590
 		return $itu;
@@ -610,14 +610,14 @@  discard block
 block discarded – undo
610 610
 
611 611
 	public function mmsitype($mmsi) {
612 612
 		if (strlen($mmsi) == 9) {
613
-			if (substr($mmsi,0,3) == '974') return 'EPIRB (Emergency Position Indicating Radio Beacon) AIS';
614
-			elseif (substr($mmsi,0,3) == '972') return 'MOB (Man Overboard) device';
615
-			elseif (substr($mmsi,0,3) == '970') return 'AIS SART (Search and Rescue Transmitter)';
616
-			elseif (substr($mmsi,0,3) == '111') return 'SAR (Search and Rescue) aircraft';
617
-			elseif (substr($mmsi,0,2) == '98') return 'Auxiliary craft associated with a parent ship';
618
-			elseif (substr($mmsi,0,2) == '99') return 'Aids to Navigation';
619
-			elseif (substr($mmsi,0,2) == '00') return 'Coastal stations';
620
-			elseif (substr($mmsi,0,1) == '0') return 'Group of ships';
613
+			if (substr($mmsi, 0, 3) == '974') return 'EPIRB (Emergency Position Indicating Radio Beacon) AIS';
614
+			elseif (substr($mmsi, 0, 3) == '972') return 'MOB (Man Overboard) device';
615
+			elseif (substr($mmsi, 0, 3) == '970') return 'AIS SART (Search and Rescue Transmitter)';
616
+			elseif (substr($mmsi, 0, 3) == '111') return 'SAR (Search and Rescue) aircraft';
617
+			elseif (substr($mmsi, 0, 2) == '98') return 'Auxiliary craft associated with a parent ship';
618
+			elseif (substr($mmsi, 0, 2) == '99') return 'Aids to Navigation';
619
+			elseif (substr($mmsi, 0, 2) == '00') return 'Coastal stations';
620
+			elseif (substr($mmsi, 0, 1) == '0') return 'Group of ships';
621 621
 			else return 'Ship';
622 622
 		}
623 623
 
@@ -627,19 +627,19 @@  discard block
 block discarded – undo
627 627
 	public function parse_line($buffer) {
628 628
 		global $globalDebug;
629 629
 		$result = array();
630
-		$start = strpos($buffer,"VDM");
630
+		$start = strpos($buffer, "VDM");
631 631
 		$tst = substr($buffer, $start - 3);
632
-		$data = $this->process_ais_raw( $tst, "" );
632
+		$data = $this->process_ais_raw($tst, "");
633 633
 		if (!is_object($data)) {
634 634
 			//if ($globalDebug) echo '==== Line format not supported : '.$buffer."\n";
635 635
 			return array();
636 636
 		}
637 637
 		if ($data->lon != 0) $result['longitude'] = $data->lon;
638 638
 		if ($data->lat != 0) $result['latitude'] = $data->lat;
639
-		$result['ident'] = trim(str_replace('@','',$data->name));
639
+		$result['ident'] = trim(str_replace('@', '', $data->name));
640 640
 		$result['timestamp'] = $data->ts;
641 641
 		$result['mmsi'] = $data->mmsi;
642
-		if (strlen($result['mmsi']) == 8 && substr($result['mmsi'],0,3) == '669') $result['mmsi'] = '3'.$result['mmsi'];
642
+		if (strlen($result['mmsi']) == 8 && substr($result['mmsi'], 0, 3) == '669') $result['mmsi'] = '3'.$result['mmsi'];
643 643
 		$result['mmsi_type'] = $this->mmsitype($result['mmsi']);
644 644
 		if ($data->sog != -1.0) $result['speed'] = $data->sog;
645 645
 		if ($data->heading !== '') $result['heading'] = $data->heading;
@@ -649,16 +649,16 @@  discard block
 block discarded – undo
649 649
 		if ($data->type !== '') $result['type'] = $data->type;
650 650
 		if ($data->typeid !== '') $result['typeid'] = $data->typeid;
651 651
 		if ($data->imo !== '') $result['imo'] = $data->imo;
652
-		if ($data->callsign !== '') $result['callsign'] = trim(str_replace('@','',$data->callsign));
652
+		if ($data->callsign !== '') $result['callsign'] = trim(str_replace('@', '', $data->callsign));
653 653
 		if (is_numeric($data->eta_month) && $data->eta_month != 0 && is_numeric($data->eta_day) && $data->eta_day != 0 && $data->eta_hour !== '' && $data->eta_minute !== '') {
654
-			$eta_ts = strtotime(date('Y').'-'.sprintf("%02d",$data->eta_month).'-'.sprintf("%02d",$data->eta_day).' '.sprintf("%02d",$data->eta_hour).':'.sprintf("%02d",$data->eta_minute).':00');
654
+			$eta_ts = strtotime(date('Y').'-'.sprintf("%02d", $data->eta_month).'-'.sprintf("%02d", $data->eta_day).' '.sprintf("%02d", $data->eta_hour).':'.sprintf("%02d", $data->eta_minute).':00');
655 655
 			if ($eta_ts != '') $result['eta_ts'] = $eta_ts;
656 656
 		} elseif (is_numeric($data->eta_hour) && is_numeric($data->eta_minute)) {
657
-			$eta_ts = strtotime(date('Y-m-d').' '.sprintf("%02d",$data->eta_hour).':'.sprintf("%02d",$data->eta_minute).':00');
657
+			$eta_ts = strtotime(date('Y-m-d').' '.sprintf("%02d", $data->eta_hour).':'.sprintf("%02d", $data->eta_minute).':00');
658 658
 			if ($eta_ts != '') $result['eta_ts'] = $eta_ts;
659 659
 		}
660 660
 		if ($data->destination != '') {
661
-			$dest = trim(str_replace('@','',$data->destination));
661
+			$dest = trim(str_replace('@', '', $data->destination));
662 662
 			if ($dest != '') $result['destination'] = $dest;
663 663
 		}
664 664
 		$result['all'] = (array) $data;
Please login to merge, or discard this patch.
Braces   +176 added lines, -65 removed lines patch added patch discarded remove patch
@@ -123,7 +123,9 @@  discard block
 block discarded – undo
123 123
 			$temp += 1;
124 124
 			$flat = (float)($temp / (60.0 * 10000.0));
125 125
 			$flat *= -1.0;
126
-		} else $flat = (float)($temp / (60.0 * 10000.0));
126
+		} else {
127
+			$flat = (float)($temp / (60.0 * 10000.0));
128
+		}
127 129
 		return $flat; // float
128 130
 	}
129 131
 
@@ -135,7 +137,9 @@  discard block
 block discarded – undo
135 137
 			$temp += 1;
136 138
 			$flon = (float)($temp / (60.0 * 10000.0));
137 139
 			$flon *= -1.0;
138
-		} else $flon = (float)($temp / (60.0 * 10000.0));
140
+		} else {
141
+			$flon = (float)($temp / (60.0 * 10000.0));
142
+		}
139 143
 		return $flon;
140 144
 	}
141 145
 
@@ -158,10 +162,8 @@  discard block
 block discarded – undo
158 162
     */
159 163
 	private function asciidec_2_8bit($ascii) {
160 164
 		//only process in the following range: 48-87, 96-119
161
-		if ($ascii < 48) { }
162
-		else {
163
-			if($ascii>119) { }
164
-			else {
165
+		if ($ascii < 48) { } else {
166
+			if($ascii>119) { } else {
165 167
 				if ($ascii>87 && $ascii<96) ;
166 168
 				else {
167 169
 					$ascii=$ascii+40;
@@ -263,7 +265,9 @@  discard block
 block discarded – undo
263 265
 			$ro->lon = $this->make_lonf(bindec(substr($_aisdata,57,28)));
264 266
 			$ro->lat = $this->make_latf(bindec(substr($_aisdata,85,27)));
265 267
 			$ro->heading = bindec(substr($_aisdata,124,9));
266
-			if ($ro->heading == 511) $ro->heading = '';
268
+			if ($ro->heading == 511) {
269
+				$ro->heading = '';
270
+			}
267 271
 			$ro->cls = 2; // class B
268 272
 		} else if ($ro->id == 19) {
269 273
 			$ro->cog = bindec(substr($_aisdata,112,12))/10;
@@ -273,7 +277,9 @@  discard block
 block discarded – undo
273 277
 			$ro->name = $this->binchar($_aisdata,143,120);
274 278
 			$ro->cls = 2; // class B
275 279
 			$ro->heading = bindec(substr($_aisdata,124,9));
276
-			if ($ro->heading == 511) $ro->heading = '';
280
+			if ($ro->heading == 511) {
281
+				$ro->heading = '';
282
+			}
277 283
 			$ro->typeid = bindec(substr($_aisdata,263,8));
278 284
 			$ro->type = $this->getShipType($ro->typeid);
279 285
 			//$ro->to_bow = bindec(substr($_aisdata,271,9));
@@ -304,9 +310,13 @@  discard block
 block discarded – undo
304 310
 			$ro->cls = 2; // class B
305 311
 		} else if ($ro->id == 27) {
306 312
 			$ro->cog = bindec(substr($_aisdata,85,9));
307
-			if ($ro->cog == 511) $ro->cog = 0.0;
313
+			if ($ro->cog == 511) {
314
+				$ro->cog = 0.0;
315
+			}
308 316
 			$ro->sog = bindec(substr($_aisdata,79,6));
309
-			if ($ro->sog == 63) $ro->sog = 0.0;
317
+			if ($ro->sog == 63) {
318
+				$ro->sog = 0.0;
319
+			}
310 320
 			$ro->lon = $this->make_lonf(bindec(substr($_aisdata,44,18))*10);
311 321
 			$ro->lat = $this->make_latf(bindec(substr($_aisdata,62,17))*10);
312 322
 			$ro->cls = 1; // class A
@@ -354,14 +364,20 @@  discard block
 block discarded – undo
354 364
 	}
355 365
 	
356 366
 	public function getShipType($code) {
357
-		if (isset($this->shiptype[$code])) return $this->shiptype[$code];
358
-		else return '';
367
+		if (isset($this->shiptype[$code])) {
368
+			return $this->shiptype[$code];
369
+		} else {
370
+			return '';
371
+		}
359 372
 	}
360 373
 
361 374
 	public function getShipTypeID($type) {
362 375
 		$typeid = array_search($type,$this->shiptype);
363
-		if ($typeid !== FALSE) return $typeid;
364
-		else return '';
376
+		if ($typeid !== FALSE) {
377
+			return $typeid;
378
+		} else {
379
+			return '';
380
+		}
365 381
 	}
366 382
 
367 383
 	public function process_ais_itu($_itu, $_len, $_filler, $aux /*, $ais_ch*/) {
@@ -398,11 +414,20 @@  discard block
 block discarded – undo
398 414
 		// assume 1st ! is valid
399 415
 		// find * ensure that it is at correct position
400 416
 		$end = strrpos ( $rawdata , '*' );
401
-		if ($end === FALSE) return -1; // check for NULLS!!!
417
+		if ($end === FALSE) {
418
+			return -1;
419
+		}
420
+		// check for NULLS!!!
402 421
 		$cs = substr( $rawdata, $end + 1 );
403
-		if ( strlen($cs) != 2 ) return -1; // correct cs length
422
+		if ( strlen($cs) != 2 ) {
423
+			return -1;
424
+		}
425
+		// correct cs length
404 426
 		$dcs = (int)hexdec( $cs );
405
-		for ( $alias=1; $alias<$end; $alias++) $chksum ^= ord( $rawdata[$alias] ); // perform XOR for NMEA checksum
427
+		for ( $alias=1; $alias<$end; $alias++) {
428
+			$chksum ^= ord( $rawdata[$alias] );
429
+		}
430
+		// perform XOR for NMEA checksum
406 431
 		if ( $chksum == $dcs ) { // NMEA checksum pass
407 432
 			$pcs = explode(',', $rawdata);
408 433
 			// !AI??? identifier
@@ -413,8 +438,14 @@  discard block
 block discarded – undo
413 438
 			$num_seq = (int)$pcs[1]; // number of sequences
414 439
 			$seq = (int)$pcs[2]; // get sequence
415 440
 			// get msg sequence id
416
-			if ($pcs[3] == '') $msg_sid = -1; // non-multipart message, set to -1
417
-			else $msg_sid = (int)$pcs[3]; // multipart message
441
+			if ($pcs[3] == '') {
442
+				$msg_sid = -1;
443
+			}
444
+			// non-multipart message, set to -1
445
+			else {
446
+				$msg_sid = (int)$pcs[3];
447
+			}
448
+			// multipart message
418 449
 			$ais_ch = $pcs[4]; // get AIS channel
419 450
 			// message sequence checking
420 451
 			if ($num_seq < 1 || $num_seq > 9) {
@@ -477,10 +508,18 @@  discard block
 block discarded – undo
477 508
 				//DEBUG echo "[$start $end $tst]\n";
478 509
 				$result = $this->process_ais_raw( $tst, "" );
479 510
 				$last_pos = $end + 1;
480
-			} else break;
511
+			} else {
512
+				break;
513
+			}
514
+		}
515
+		if ($last_pos > 0) {
516
+			$cbuf = substr($cbuf, $last_pos);
481 517
 		}
482
-		if ($last_pos > 0) $cbuf = substr($cbuf, $last_pos); // move...
483
-		if (strlen($cbuf) > 1024) $cbuf = ""; // prevent overflow simple mode...
518
+		// move...
519
+		if (strlen($cbuf) > 1024) {
520
+			$cbuf = "";
521
+		}
522
+		// prevent overflow simple mode...
484 523
 		return $result;
485 524
 	}
486 525
 
@@ -500,7 +539,9 @@  discard block
 block discarded – undo
500 539
 		if ($lat<0.0) {
501 540
 			$lat = -$lat;
502 541
 			$neg=true;
503
-		} else $neg=false;
542
+		} else {
543
+			$neg=false;
544
+		}
504 545
 		$latd = 0x00000000;
505 546
 		$latd = intval ($lat * 600000.0);
506 547
 		if ($neg==true) {
@@ -516,7 +557,9 @@  discard block
 block discarded – undo
516 557
 		if ($lon<0.0) {
517 558
 			$lon = -$lon;
518 559
 			$neg=true;
519
-		} else $neg=false;
560
+		} else {
561
+			$neg=false;
562
+		}
520 563
 		$lond = 0x00000000;
521 564
 		$lond = intval ($lon * 600000.0);
522 565
 		if ($neg==true) {
@@ -529,9 +572,14 @@  discard block
 block discarded – undo
529 572
 
530 573
 	private function char2bin($name, $max_len) {
531 574
 		$len = strlen($name);
532
-		if ($len > $max_len) $name = substr($name,0,$max_len);
533
-		if ($len < $max_len) $pad = str_repeat('0', ($max_len - $len) * 6);
534
-		else $pad = '';
575
+		if ($len > $max_len) {
576
+			$name = substr($name,0,$max_len);
577
+		}
578
+		if ($len < $max_len) {
579
+			$pad = str_repeat('0', ($max_len - $len) * 6);
580
+		} else {
581
+			$pad = '';
582
+		}
535 583
 		$rv = '';
536 584
 		$ais_chars = array(
537 585
 		    '@'=>0, 'A'=>1, 'B'=>2, 'C'=>3, 'D'=>4, 'E'=>5, 'F'=>6, 'G'=>7, 'H'=>8, 'I'=>9,
@@ -544,9 +592,12 @@  discard block
 block discarded – undo
544 592
 		);
545 593
 		// "
546 594
 		$_a = str_split($name);
547
-		if ($_a) foreach ($_a as $_1) {
595
+		if ($_a) {
596
+			foreach ($_a as $_1) {
548 597
 			if (isset($ais_chars[$_1])) $dec = $ais_chars[$_1];
549
-			else $dec = 0;
598
+		} else {
599
+				$dec = 0;
600
+			}
550 601
 			$bin = str_pad(decbin( $dec ), 6, '0', STR_PAD_LEFT);
551 602
 			$rv .= $bin;
552 603
 			//echo "$_1 $dec ($bin)<br/>";
@@ -558,7 +609,9 @@  discard block
 block discarded – undo
558 609
 		$len_bit = strlen($_enc);
559 610
 		$rem6 = $len_bit % 6;
560 611
 		$pad6_len = 0;
561
-		if ($rem6) $pad6_len = 6 - $rem6;
612
+		if ($rem6) {
613
+			$pad6_len = 6 - $rem6;
614
+		}
562 615
 		//echo  $pad6_len.'<br>';
563 616
 		$_enc .= str_repeat("0", $pad6_len); // pad the text...
564 617
 		$len_enc = strlen($_enc) / 6;
@@ -567,8 +620,11 @@  discard block
 block discarded – undo
567 620
 		for ($i=0; $i<$len_enc; $i++) {
568 621
 			$offset = $i * 6;
569 622
 			$dec = bindec(substr($_enc,$offset,6));
570
-			if ($dec < 40) $dec += 48;
571
-			else $dec += 56;
623
+			if ($dec < 40) {
624
+				$dec += 48;
625
+			} else {
626
+				$dec += 56;
627
+			}
572 628
 			//echo chr($dec)." $dec<br/>";
573 629
 			$itu .= chr($dec);
574 630
 		}
@@ -581,26 +637,42 @@  discard block
 block discarded – undo
581 637
 		}
582 638
 		$hex_arr = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
583 639
 		$lsb = $chksum & 0x0F;
584
-		if ($lsb >=0 && $lsb <= 15 ) $lsbc = $hex_arr[$lsb];
585
-		else $lsbc = '0';
640
+		if ($lsb >=0 && $lsb <= 15 ) {
641
+			$lsbc = $hex_arr[$lsb];
642
+		} else {
643
+			$lsbc = '0';
644
+		}
586 645
 		$msb = (($chksum & 0xF0) >> 4) & 0x0F;
587
-		if ($msb >=0 && $msb <= 15 ) $msbc = $hex_arr[$msb];
588
-		else $msbc = '0';
646
+		if ($msb >=0 && $msb <= 15 ) {
647
+			$msbc = $hex_arr[$msb];
648
+		} else {
649
+			$msbc = '0';
650
+		}
589 651
 		$itu = '!'.$itu."*{$msbc}{$lsbc}\r\n";
590 652
 		return $itu;
591 653
 	}
592 654
 
593 655
 	public function parse($buffer) {
594 656
 		$data = $this->process_ais_buf($buffer);
595
-		if (!is_object($data)) return array();
657
+		if (!is_object($data)) {
658
+			return array();
659
+		}
596 660
 		$result = array();
597
-		if ($data->lon != 0) $result['longitude'] = $data->lon;
598
-		if ($data->lat != 0) $result['latitude'] = $data->lat;
661
+		if ($data->lon != 0) {
662
+			$result['longitude'] = $data->lon;
663
+		}
664
+		if ($data->lat != 0) {
665
+			$result['latitude'] = $data->lat;
666
+		}
599 667
 		$result['ident'] = trim($data->name);
600 668
 		$result['timestamp'] = $data->ts;
601 669
 		$result['mmsi'] = $data->mmsi;
602
-		if ($data->sog != -1.0) $result['speed'] = $data->sog;
603
-		if ($data->cog != 0) $result['heading'] = $data->cog;
670
+		if ($data->sog != -1.0) {
671
+			$result['speed'] = $data->sog;
672
+		}
673
+		if ($data->cog != 0) {
674
+			$result['heading'] = $data->cog;
675
+		}
604 676
 		/*
605 677
 		    $ro->cls = 0; // AIS class undefined, also indicate unparsed msg
606 678
 		    $ro->id = bindec(substr($_aisdata,0,6));
@@ -610,15 +682,25 @@  discard block
 block discarded – undo
610 682
 
611 683
 	public function mmsitype($mmsi) {
612 684
 		if (strlen($mmsi) == 9) {
613
-			if (substr($mmsi,0,3) == '974') return 'EPIRB (Emergency Position Indicating Radio Beacon) AIS';
614
-			elseif (substr($mmsi,0,3) == '972') return 'MOB (Man Overboard) device';
615
-			elseif (substr($mmsi,0,3) == '970') return 'AIS SART (Search and Rescue Transmitter)';
616
-			elseif (substr($mmsi,0,3) == '111') return 'SAR (Search and Rescue) aircraft';
617
-			elseif (substr($mmsi,0,2) == '98') return 'Auxiliary craft associated with a parent ship';
618
-			elseif (substr($mmsi,0,2) == '99') return 'Aids to Navigation';
619
-			elseif (substr($mmsi,0,2) == '00') return 'Coastal stations';
620
-			elseif (substr($mmsi,0,1) == '0') return 'Group of ships';
621
-			else return 'Ship';
685
+			if (substr($mmsi,0,3) == '974') {
686
+				return 'EPIRB (Emergency Position Indicating Radio Beacon) AIS';
687
+			} elseif (substr($mmsi,0,3) == '972') {
688
+				return 'MOB (Man Overboard) device';
689
+			} elseif (substr($mmsi,0,3) == '970') {
690
+				return 'AIS SART (Search and Rescue Transmitter)';
691
+			} elseif (substr($mmsi,0,3) == '111') {
692
+				return 'SAR (Search and Rescue) aircraft';
693
+			} elseif (substr($mmsi,0,2) == '98') {
694
+				return 'Auxiliary craft associated with a parent ship';
695
+			} elseif (substr($mmsi,0,2) == '99') {
696
+				return 'Aids to Navigation';
697
+			} elseif (substr($mmsi,0,2) == '00') {
698
+				return 'Coastal stations';
699
+			} elseif (substr($mmsi,0,1) == '0') {
700
+				return 'Group of ships';
701
+			} else {
702
+				return 'Ship';
703
+			}
622 704
 		}
623 705
 
624 706
 	
@@ -634,32 +716,61 @@  discard block
 block discarded – undo
634 716
 			//if ($globalDebug) echo '==== Line format not supported : '.$buffer."\n";
635 717
 			return array();
636 718
 		}
637
-		if ($data->lon != 0) $result['longitude'] = $data->lon;
638
-		if ($data->lat != 0) $result['latitude'] = $data->lat;
719
+		if ($data->lon != 0) {
720
+			$result['longitude'] = $data->lon;
721
+		}
722
+		if ($data->lat != 0) {
723
+			$result['latitude'] = $data->lat;
724
+		}
639 725
 		$result['ident'] = trim(str_replace('@','',$data->name));
640 726
 		$result['timestamp'] = $data->ts;
641 727
 		$result['mmsi'] = $data->mmsi;
642
-		if (strlen($result['mmsi']) == 8 && substr($result['mmsi'],0,3) == '669') $result['mmsi'] = '3'.$result['mmsi'];
728
+		if (strlen($result['mmsi']) == 8 && substr($result['mmsi'],0,3) == '669') {
729
+			$result['mmsi'] = '3'.$result['mmsi'];
730
+		}
643 731
 		$result['mmsi_type'] = $this->mmsitype($result['mmsi']);
644
-		if ($data->sog != -1.0) $result['speed'] = $data->sog;
645
-		if ($data->heading !== '') $result['heading'] = $data->heading;
646
-		elseif ($data->cog != 0) $result['heading'] = $data->cog;
647
-		if ($data->status != '') $result['status'] = $data->status;
648
-		if ($data->statusid !== '') $result['statusid'] = $data->statusid;
649
-		if ($data->type !== '') $result['type'] = $data->type;
650
-		if ($data->typeid !== '') $result['typeid'] = $data->typeid;
651
-		if ($data->imo !== '') $result['imo'] = $data->imo;
652
-		if ($data->callsign !== '') $result['callsign'] = trim(str_replace('@','',$data->callsign));
732
+		if ($data->sog != -1.0) {
733
+			$result['speed'] = $data->sog;
734
+		}
735
+		if ($data->heading !== '') {
736
+			$result['heading'] = $data->heading;
737
+		} elseif ($data->cog != 0) {
738
+			$result['heading'] = $data->cog;
739
+		}
740
+		if ($data->status != '') {
741
+			$result['status'] = $data->status;
742
+		}
743
+		if ($data->statusid !== '') {
744
+			$result['statusid'] = $data->statusid;
745
+		}
746
+		if ($data->type !== '') {
747
+			$result['type'] = $data->type;
748
+		}
749
+		if ($data->typeid !== '') {
750
+			$result['typeid'] = $data->typeid;
751
+		}
752
+		if ($data->imo !== '') {
753
+			$result['imo'] = $data->imo;
754
+		}
755
+		if ($data->callsign !== '') {
756
+			$result['callsign'] = trim(str_replace('@','',$data->callsign));
757
+		}
653 758
 		if (is_numeric($data->eta_month) && $data->eta_month != 0 && is_numeric($data->eta_day) && $data->eta_day != 0 && $data->eta_hour !== '' && $data->eta_minute !== '') {
654 759
 			$eta_ts = strtotime(date('Y').'-'.sprintf("%02d",$data->eta_month).'-'.sprintf("%02d",$data->eta_day).' '.sprintf("%02d",$data->eta_hour).':'.sprintf("%02d",$data->eta_minute).':00');
655
-			if ($eta_ts != '') $result['eta_ts'] = $eta_ts;
760
+			if ($eta_ts != '') {
761
+				$result['eta_ts'] = $eta_ts;
762
+			}
656 763
 		} elseif (is_numeric($data->eta_hour) && is_numeric($data->eta_minute)) {
657 764
 			$eta_ts = strtotime(date('Y-m-d').' '.sprintf("%02d",$data->eta_hour).':'.sprintf("%02d",$data->eta_minute).':00');
658
-			if ($eta_ts != '') $result['eta_ts'] = $eta_ts;
765
+			if ($eta_ts != '') {
766
+				$result['eta_ts'] = $eta_ts;
767
+			}
659 768
 		}
660 769
 		if ($data->destination != '') {
661 770
 			$dest = trim(str_replace('@','',$data->destination));
662
-			if ($dest != '') $result['destination'] = $dest;
771
+			if ($dest != '') {
772
+				$result['destination'] = $dest;
773
+			}
663 774
 		}
664 775
 		$result['all'] = (array) $data;
665 776
 		/*
Please login to merge, or discard this patch.
marine-type-detailed.php 3 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -62,12 +62,12 @@
 block discarded – undo
62 62
 	*/
63 63
 		//if ($aircraft_type != "NA")
64 64
 		//{
65
-	    		print '<div class="info column">';
66
-	      		print '<h1>'.$spotter_array[0]['type'].'</h1>';
67
-	      		//print '<div><span class="label">'._("Name").'</span>'.$spotter_array[0]['aircraft_name'].'</div>';
68
-	      		//print '<div><span class="label">'._("ICAO").'</span>'.$spotter_array[0]['aircraft_type'].'</div>'; 
69
-	      		//if (isset($spotter_array[0]['aircraft_manufacturer'])) print '<div><span class="label">'._("Manufacturer").'</span><a href="'.$globalURL.'/manufacturer/'.strtolower(str_replace(" ", "-", $spotter_array[0]['aircraft_manufacturer'])).'">'.$spotter_array[0]['aircraft_manufacturer'].'</a></div>';
70
-	    		print '</div>';
65
+				print '<div class="info column">';
66
+		  		print '<h1>'.$spotter_array[0]['type'].'</h1>';
67
+		  		//print '<div><span class="label">'._("Name").'</span>'.$spotter_array[0]['aircraft_name'].'</div>';
68
+		  		//print '<div><span class="label">'._("ICAO").'</span>'.$spotter_array[0]['aircraft_type'].'</div>'; 
69
+		  		//if (isset($spotter_array[0]['aircraft_manufacturer'])) print '<div><span class="label">'._("Manufacturer").'</span><a href="'.$globalURL.'/manufacturer/'.strtolower(str_replace(" ", "-", $spotter_array[0]['aircraft_manufacturer'])).'">'.$spotter_array[0]['aircraft_manufacturer'].'</a></div>';
70
+				print '</div>';
71 71
 		//} else {
72 72
 		//	print '<div class="alert alert-warning">'._("This special aircraft profile shows all flights in where the aircraft type is unknown.").'</div>';
73 73
 		//}
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -5,16 +5,16 @@  discard block
 block discarded – undo
5 5
 require_once('require/class.Language.php');
6 6
 $Marine = new Marine();
7 7
 $type = 'marine';
8
-if (!isset($_GET['type'])){
8
+if (!isset($_GET['type'])) {
9 9
 	header('Location: '.$globalURL.'/');
10 10
 } else {
11 11
 	//calculuation for the pagination
12
-	if(!isset($_GET['limit']) || count(explode(",", $_GET['limit'])) < 2)
12
+	if (!isset($_GET['limit']) || count(explode(",", $_GET['limit'])) < 2)
13 13
 	{
14 14
 		$limit_start = 0;
15 15
 		$limit_end = 25;
16 16
 		$absolute_difference = 25;
17
-	}  else {
17
+	} else {
18 18
 		$limit_explode = explode(",", $_GET['limit']);
19 19
 		$limit_start = $limit_explode[0];
20 20
 		$limit_end = $limit_explode[1];
@@ -28,14 +28,14 @@  discard block
 block discarded – undo
28 28
 	$limit_previous_1 = $limit_start - $absolute_difference;
29 29
 	$limit_previous_2 = $limit_end - $absolute_difference;
30 30
 	
31
-	$marine_type = filter_input(INPUT_GET,'type',FILTER_SANITIZE_STRING);
31
+	$marine_type = filter_input(INPUT_GET, 'type', FILTER_SANITIZE_STRING);
32 32
 	$page_url = $globalURL.'/marine/type/'.$marine_type;
33
-	$sort = htmlspecialchars(filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING));
34
-	$spotter_array = $Marine->getMarineDataByType($marine_type,$limit_start.",".$absolute_difference, $sort);
33
+	$sort = htmlspecialchars(filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING));
34
+	$spotter_array = $Marine->getMarineDataByType($marine_type, $limit_start.",".$absolute_difference, $sort);
35 35
 	
36 36
 	if (!empty($spotter_array))
37 37
 	{
38
-		$title = sprintf(_("Detailed View for %s"),$spotter_array[0]['type']);
38
+		$title = sprintf(_("Detailed View for %s"), $spotter_array[0]['type']);
39 39
 		require_once('header.php');
40 40
 	
41 41
 	/*    
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 		//include('aircraft-sub-menu.php');
76 76
 	        
77 77
 		print '<div class="table column">';
78
-		print '<p>'.sprintf(_("The table below shows the detailed information of all marine of type <strong>%s</strong>."),$spotter_array[0]['type']).'</p>';
78
+		print '<p>'.sprintf(_("The table below shows the detailed information of all marine of type <strong>%s</strong>."), $spotter_array[0]['type']).'</p>';
79 79
 		  
80 80
 		include('table-output.php');
81 81
 		  
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 		$limit_start = 0;
15 15
 		$limit_end = 25;
16 16
 		$absolute_difference = 25;
17
-	}  else {
17
+	} else {
18 18
 		$limit_explode = explode(",", $_GET['limit']);
19 19
 		$limit_start = $limit_explode[0];
20 20
 		$limit_end = $limit_explode[1];
Please login to merge, or discard this patch.