Completed
Push — master ( 7332ae...d8eaa0 )
by Yannick
177:55 queued 153:21
created
require/class.Elevation.php 3 patches
Doc Comments   +11 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,6 +52,10 @@  discard block
 block discarded – undo
52 52
 		$this->openedFiles = [];
53 53
 	}
54 54
 
55
+	/**
56
+	 * @param double $row
57
+	 * @param double $column
58
+	 */
55 59
 	private function getElevationAtPosition($fileName, $row, $column) {
56 60
 		if (!array_key_exists($fileName, $this->openedFiles)) {
57 61
 			if (!file_exists($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName)) {
@@ -85,7 +89,7 @@  discard block
 block discarded – undo
85 89
 	 * @param float $lon
86 90
 	 * @param null  $fName
87 91
 	 *
88
-	 * @return mixed
92
+	 * @return double
89 93
 	 * @throws \Exception
90 94
 	 */
91 95
 	public function getElevation($lat, $lon, &$fName = null) {
@@ -142,6 +146,9 @@  discard block
 block discarded – undo
142 146
 		return $zN;
143 147
 	}
144 148
 
149
+	/**
150
+	 * @param integer $numPrefix
151
+	 */
145 152
 	private function getDeg($deg, $numPrefix) {
146 153
 		$deg = abs($deg);
147 154
 		$d   = floor($deg);     // round degrees
@@ -156,6 +163,9 @@  discard block
 block discarded – undo
156 163
 		return $d;
157 164
 	}
158 165
 
166
+	/**
167
+	 * @param double $deg
168
+	 */
159 169
 	private function getSec($deg) {
160 170
 		$deg = abs($deg);
161 171
 		$sec = round($deg * 3600, 4);
Please login to merge, or discard this patch.
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 			default:
42 42
 				throw new \Exception("bad resolution can be only one of 1,3");
43 43
 		}
44
-		register_shutdown_function(function () {
44
+		register_shutdown_function(function() {
45 45
 			$this->closeAllFiles();
46 46
 		});
47 47
 	}
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
 
56 56
 	private function getElevationAtPosition($fileName, $row, $column) {
57 57
 		if (!array_key_exists($fileName, $this->openedFiles)) {
58
-			if (!file_exists($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName)) {
58
+			if (!file_exists($this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName)) {
59 59
 				throw new \Exception("File '{$fileName}' not exists.");
60 60
 			}
61
-			$file = fopen($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName, "r");
61
+			$file = fopen($this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName, "r");
62 62
 			if ($file === false) {
63 63
 				throw new \Exception("Cant open file '{$fileName}' for reading.");
64 64
 			}
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 			throw new \Exception("Not implemented yet");
73 73
 		}
74 74
 		$aRow     = $this->measPerDeg - $row;
75
-		$position = ($this->measPerDeg * ($aRow - 1)) + $column;
75
+		$position = ($this->measPerDeg*($aRow - 1)) + $column;
76 76
 		$position *= 2;
77 77
 		fseek($file, $position);
78 78
 		$short  = fread($file, 2);
@@ -100,8 +100,8 @@  discard block
 block discarded – undo
100 100
 		$latSec = $this->getSec($lat);
101 101
 		$lonSec = $this->getSec($lon);
102 102
 
103
-		$Xn = round($latSec / $this->resolution, 3);
104
-		$Yn = round($lonSec / $this->resolution, 3);
103
+		$Xn = round($latSec/$this->resolution, 3);
104
+		$Yn = round($lonSec/$this->resolution, 3);
105 105
 
106 106
 		$a1 = round($Xn);
107 107
 		$a2 = round($Yn);
@@ -133,55 +133,55 @@  discard block
 block discarded – undo
133 133
 		$b3 = $this->getElevationAtPosition($fName, $b1, $b2);
134 134
 		$c3 = $this->getElevationAtPosition($fName, $c1, $c2);
135 135
 
136
-		$n1 = ($c2 - $a2) * ($b3 - $a3) - ($c3 - $a3) * ($b2 - $a2);
137
-		$n2 = ($c3 - $a3) * ($b1 - $a1) - ($c1 - $a1) * ($b3 - $a3);
138
-		$n3 = ($c1 - $a1) * ($b2 - $a2) - ($c2 - $a2) * ($b1 - $a1);
136
+		$n1 = ($c2 - $a2)*($b3 - $a3) - ($c3 - $a3)*($b2 - $a2);
137
+		$n2 = ($c3 - $a3)*($b1 - $a1) - ($c1 - $a1)*($b3 - $a3);
138
+		$n3 = ($c1 - $a1)*($b2 - $a2) - ($c2 - $a2)*($b1 - $a1);
139 139
 
140
-		$d  = -$n1 * $a1 - $n2 * $a2 - $n3 * $a3;
141
-		$zN = (-$n1 * $Xn - $n2 * $Yn - $d) / $n3;
140
+		$d  = -$n1*$a1 - $n2*$a2 - $n3*$a3;
141
+		$zN = (-$n1*$Xn - $n2*$Yn - $d)/$n3;
142 142
 
143 143
 		return $zN;
144 144
 	}
145 145
 
146 146
 	private function getDeg($deg, $numPrefix) {
147 147
 		$deg = abs($deg);
148
-		$d   = floor($deg);     // round degrees
148
+		$d   = floor($deg); // round degrees
149 149
 		if ($numPrefix >= 3) {
150 150
 			if ($d < 100) {
151
-				$d = '0' . $d;
151
+				$d = '0'.$d;
152 152
 			}
153 153
 		} // pad with leading zeros
154 154
 		if ($d < 10) {
155
-			$d = '0' . $d;
155
+			$d = '0'.$d;
156 156
 		}
157 157
 		return $d;
158 158
 	}
159 159
 
160 160
 	private function getSec($deg) {
161 161
 		$deg = abs($deg);
162
-		$sec = round($deg * 3600, 4);
163
-		$m   = fmod(floor($sec / 60), 60);
162
+		$sec = round($deg*3600, 4);
163
+		$m   = fmod(floor($sec/60), 60);
164 164
 		$s   = round(fmod($sec, 60), 4);
165
-		return ($m * 60) + $s;
165
+		return ($m*60) + $s;
166 166
 	}
167 167
 
168
-	public function download($lat,$lon, $debug = false) {
168
+	public function download($lat, $lon, $debug = false) {
169 169
 		$N      = $this->getDeg($lat, 2);
170 170
 		$E      = $this->getDeg($lon, 3);
171
-		$fileName  = "N{$N}E{$E}.hgt";
172
-		if (!file_exists($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName)) {
171
+		$fileName = "N{$N}E{$E}.hgt";
172
+		if (!file_exists($this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName)) {
173 173
 			$Common = new Common();
174 174
 			if ($debug) echo 'Downloading '.$fileName.'.gz ...';
175
-			$Common->download('https://s3.amazonaws.com/elevation-tiles-prod/skadi/N'.$N.'/'.$fileName.'.gz',$this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz');
176
-			if (!file_exists($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz')) {
175
+			$Common->download('https://s3.amazonaws.com/elevation-tiles-prod/skadi/N'.$N.'/'.$fileName.'.gz', $this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName.'.gz');
176
+			if (!file_exists($this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName.'.gz')) {
177 177
 				if ($debug) echo "File '{$fileName}.gz' not exists.";
178 178
 				return false;
179 179
 			}
180 180
 			if ($debug) echo 'Done'."\n";
181 181
 			if ($debug) echo 'Decompress '.$fileName.' ....';
182
-			$Common->gunzip($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz',$this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName);
182
+			$Common->gunzip($this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName.'.gz', $this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName);
183 183
 			if ($debug) echo 'Done'."\n";
184
-			unlink($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz');
184
+			unlink($this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName.'.gz');
185 185
 		}
186 186
 		return true;
187 187
 	}
@@ -194,11 +194,11 @@  discard block
 block discarded – undo
194 194
 		try {
195 195
 			$sth = $db->prepare($query);
196 196
 			$sth->execute($query_values);
197
-		} catch(PDOException $e) {
197
+		} catch (PDOException $e) {
198 198
 			return "error : ".$e->getMessage();
199 199
 		}
200 200
 		while ($data = $sth->fetch(PDO::FETCH_ASSOC)) {
201
-			$this->download($data['latitude'],$data['longitude'],true);
201
+			$this->download($data['latitude'], $data['longitude'], true);
202 202
 		}
203 203
 		$db = $Connection->db;
204 204
 		$query = 'SELECT latitude, longitude FROM tracker_output WHERE latitude <> 0 AND longitude <> 0 ORDER BY date DESC LIMIT 100';
@@ -206,11 +206,11 @@  discard block
 block discarded – undo
206 206
 		try {
207 207
 			$sth = $db->prepare($query);
208 208
 			$sth->execute($query_values);
209
-		} catch(PDOException $e) {
209
+		} catch (PDOException $e) {
210 210
 			return "error : ".$e->getMessage();
211 211
 		}
212 212
 		while ($data = $sth->fetch(PDO::FETCH_ASSOC)) {
213
-			$this->download($data['latitude'],$data['longitude'],true);
213
+			$this->download($data['latitude'], $data['longitude'], true);
214 214
 		}
215 215
 	}
216 216
 }
Please login to merge, or discard this patch.
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -28,7 +28,9 @@  discard block
 block discarded – undo
28 28
 	private $openedFiles = [];
29 29
 
30 30
 	public function __construct($htgFilesDestination = '', $resolution = 3) {
31
-		if ($htgFilesDestination == '') $htgFilesDestination = dirname(__FILE__).'/../data/';
31
+		if ($htgFilesDestination == '') {
32
+			$htgFilesDestination = dirname(__FILE__).'/../data/';
33
+		}
32 34
 		$this->htgFilesDestination = $htgFilesDestination;
33 35
 		$this->resolution          = $resolution;
34 36
 		switch ($resolution) {
@@ -171,16 +173,26 @@  discard block
 block discarded – undo
171 173
 		$fileName  = "N{$N}E{$E}.hgt";
172 174
 		if (!file_exists($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName)) {
173 175
 			$Common = new Common();
174
-			if ($debug) echo 'Downloading '.$fileName.'.gz ...';
176
+			if ($debug) {
177
+				echo 'Downloading '.$fileName.'.gz ...';
178
+			}
175 179
 			$Common->download('https://s3.amazonaws.com/elevation-tiles-prod/skadi/N'.$N.'/'.$fileName.'.gz',$this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz');
176 180
 			if (!file_exists($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz')) {
177
-				if ($debug) echo "File '{$fileName}.gz' not exists.";
181
+				if ($debug) {
182
+					echo "File '{$fileName}.gz' not exists.";
183
+				}
178 184
 				return false;
179 185
 			}
180
-			if ($debug) echo 'Done'."\n";
181
-			if ($debug) echo 'Decompress '.$fileName.' ....';
186
+			if ($debug) {
187
+				echo 'Done'."\n";
188
+			}
189
+			if ($debug) {
190
+				echo 'Decompress '.$fileName.' ....';
191
+			}
182 192
 			$Common->gunzip($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz',$this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName);
183
-			if ($debug) echo 'Done'."\n";
193
+			if ($debug) {
194
+				echo 'Done'."\n";
195
+			}
184 196
 			unlink($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz');
185 197
 		}
186 198
 		return true;
Please login to merge, or discard this patch.
aircraft-data.php 2 patches
Braces   +51 added lines, -20 removed lines patch added patch discarded remove patch
@@ -57,7 +57,9 @@  discard block
 block discarded – undo
57 57
 {
58 58
 	if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') {
59 59
 		$image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
60
-	} else $image = $spotter_item['image_thumbnail'];
60
+	} else {
61
+		$image = $spotter_item['image_thumbnail'];
62
+	}
61 63
 
62 64
 }
63 65
 /* else {
@@ -70,8 +72,12 @@  discard block
 block discarded – undo
70 72
 }
71 73
 print '<div class="right">';
72 74
 print '<div class="callsign-details">';
73
-if ($spotter_item['ident'] != 'Not Available') print '<div class="callsign"><a href="'.$globalURL.'/redirect/'.$spotter_item['flightaware_id'].'" target="_blank">'.$spotter_item['ident'].'</a></div>';
74
-if (isset($spotter_item['airline_name']) && $spotter_item['airline_name'] != 'Not Available') print '<div class="airline">'.$spotter_item['airline_name'].'</div>';
75
+if ($spotter_item['ident'] != 'Not Available') {
76
+	print '<div class="callsign"><a href="'.$globalURL.'/redirect/'.$spotter_item['flightaware_id'].'" target="_blank">'.$spotter_item['ident'].'</a></div>';
77
+}
78
+if (isset($spotter_item['airline_name']) && $spotter_item['airline_name'] != 'Not Available') {
79
+	print '<div class="airline">'.$spotter_item['airline_name'].'</div>';
80
+}
75 81
 print '</div>';
76 82
 if ($spotter_item['departure_airport'] != 'NA' && $spotter_item['arrival_airport'] != 'NA') {
77 83
 	print '<div class="nomobile airports"><div class="airport"><span class="code"><a href="'.$globalURL.'/airport/'.$spotter_item['departure_airport'].'" target="_blank">'.$spotter_item['departure_airport'].'</a></span>'.$spotter_item['departure_airport_city'].' '.$spotter_item['departure_airport_country'];
@@ -103,10 +109,16 @@  discard block
 block discarded – undo
103 109
 print '</div>';
104 110
 print '<div id="aircraft">';
105 111
 print '<span>'._("Aircraft").'</span>';
106
-if (isset($spotter_item['aircraft_wiki'])) print '<a href="'.$spotter_item['aircraft_wiki'].'">'.$spotter_item['aircraft_name'].'</a>';
107
-if (isset($spotter_item['aircraft_type']) && isset($spotter_item['aircraft_manufacturer']) && $spotter_item['aircraft_manufacturer'] != 'N/A' && isset($spotter_item['aircraft_name']) && $spotter_item['aircraft_name'] != 'N/A') print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')</a>';
108
-elseif (isset($spotter_item['aircraft_type'])) print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_type'].'</a>';
109
-else print $spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'];
112
+if (isset($spotter_item['aircraft_wiki'])) {
113
+	print '<a href="'.$spotter_item['aircraft_wiki'].'">'.$spotter_item['aircraft_name'].'</a>';
114
+}
115
+if (isset($spotter_item['aircraft_type']) && isset($spotter_item['aircraft_manufacturer']) && $spotter_item['aircraft_manufacturer'] != 'N/A' && isset($spotter_item['aircraft_name']) && $spotter_item['aircraft_name'] != 'N/A') {
116
+	print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')</a>';
117
+} elseif (isset($spotter_item['aircraft_type'])) {
118
+	print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_type'].'</a>';
119
+} else {
120
+	print $spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'];
121
+}
110 122
 print '</div>';
111 123
 print '<div id ="altitude"><span>'._("Altitude").'</span>';
112 124
 if (isset($globalGroundAltitude) && $globalGroundAltitude) {
@@ -117,12 +129,18 @@  discard block
 block discarded – undo
117 129
 }
118 130
 
119 131
 if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) {
120
-	if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') print $spotter_item['real_altitude'].' feet (FL'.$spotter_item['altitude'].')';
121
-	else print $spotter_item['altitude'].'00 feet (FL'.$spotter_item['altitude'].')';
122
-} else {
123
-	if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') print round($spotter_item['real_altitude']*0.3048).' m (FL'.$spotter_item['altitude'].')';
124
-	else print round($spotter_item['altitude']*30.48).' m (FL'.$spotter_item['altitude'].')';
125
-}
132
+	if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') {
133
+		print $spotter_item['real_altitude'].' feet (FL'.$spotter_item['altitude'].')';
134
+	} else {
135
+		print $spotter_item['altitude'].'00 feet (FL'.$spotter_item['altitude'].')';
136
+	}
137
+	} else {
138
+	if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') {
139
+		print round($spotter_item['real_altitude']*0.3048).' m (FL'.$spotter_item['altitude'].')';
140
+	} else {
141
+		print round($spotter_item['altitude']*30.48).' m (FL'.$spotter_item['altitude'].')';
142
+	}
143
+	}
126 144
 
127 145
 if (isset($groundAltitude) && $groundAltitude < $spotter_item['altitude']*30.48) {
128 146
 	print '<br>';
@@ -136,7 +154,9 @@  discard block
 block discarded – undo
136 154
 }
137 155
 
138 156
 print '</div>';
139
-if (isset($spotter_item['registration']) && $spotter_item['registration'] != '') print '<div><span>'._("Registration").'</span><a href="'.$globalURL.'/registration/'.$spotter_item['registration'].'" target="_blank">'.$spotter_item['registration'].'</a></div>';
157
+if (isset($spotter_item['registration']) && $spotter_item['registration'] != '') {
158
+	print '<div><span>'._("Registration").'</span><a href="'.$globalURL.'/registration/'.$spotter_item['registration'].'" target="_blank">'.$spotter_item['registration'].'</a></div>';
159
+}
140 160
 print '<div id="speed"><span>'._("Speed").'</span>';
141 161
 if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) {
142 162
 	print round($spotter_item['ground_speed']*1.15078).' mph';
@@ -150,8 +170,11 @@  discard block
 block discarded – undo
150 170
 print '<div id="heading"><span>'._("Heading").'</span>'.$spotter_item['heading'].'°</div>';
151 171
 if (isset($spotter_item['pilot_name']) && $spotter_item['pilot_name'] != '') {
152 172
 	print '<div id="pilot"><span>'._("Pilot").'</span>';
153
-	if (isset($spotter_item['pilot_id'])) print $spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')';
154
-	else print $spotter_item['pilot_name'];
173
+	if (isset($spotter_item['pilot_id'])) {
174
+		print $spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')';
175
+	} else {
176
+		print $spotter_item['pilot_name'];
177
+	}
155 178
 	print '</div>';
156 179
 }
157 180
 
@@ -179,10 +202,18 @@  discard block
 block discarded – undo
179 202
 print '</div>';
180 203
 print '</div>';
181 204
 
182
-if (isset($globalVA) && $globalVA && isset($globalphpVMS) && $globalphpVMS && isset($globalVATSIM) && $globalVATSIM && isset($globalIVAO) && $globalIVAO && isset($spotter_item['format_source']) && $spotter_item['format_source'] != '' && $spotter_item['format_source'] != 'pireps') print '<div class="waypoints"><span>'._("Source").'</span>'.$spotter_item['format_source'].'</div>';
183
-if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>';
184
-if (isset($spotter_item['acars']['message'])) print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'<br/>',$spotter_item['acars']['message'])).'</div>';
185
-if (isset($spotter_item['squawk']) && $spotter_item['squawk'] != '' && $spotter_item['squawk'] != 0) print '<div class="bottom">'._("Squawk:").' '.$spotter_item['squawk'].' - '.$spotter_item['squawk_usage'].'</div>';
205
+if (isset($globalVA) && $globalVA && isset($globalphpVMS) && $globalphpVMS && isset($globalVATSIM) && $globalVATSIM && isset($globalIVAO) && $globalIVAO && isset($spotter_item['format_source']) && $spotter_item['format_source'] != '' && $spotter_item['format_source'] != 'pireps') {
206
+	print '<div class="waypoints"><span>'._("Source").'</span>'.$spotter_item['format_source'].'</div>';
207
+}
208
+if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') {
209
+	print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>';
210
+}
211
+if (isset($spotter_item['acars']['message'])) {
212
+	print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'<br/>',$spotter_item['acars']['message'])).'</div>';
213
+}
214
+if (isset($spotter_item['squawk']) && $spotter_item['squawk'] != '' && $spotter_item['squawk'] != 0) {
215
+	print '<div class="bottom">'._("Squawk:").' '.$spotter_item['squawk'].' - '.$spotter_item['squawk_usage'].'</div>';
216
+}
186 217
 print '</div>';
187 218
 ?>
188 219
 </div>
189 220
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -11,14 +11,14 @@  discard block
 block discarded – undo
11 11
 
12 12
 $from_archive = false;
13 13
 if (isset($_GET['ident'])) {
14
-	$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
14
+	$ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING);
15 15
 	if (isset($_GET['currenttime'])) {
16
-		$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
16
+		$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT);
17 17
 		$currenttime = round($currenttime/1000);
18
-		$spotter_array = $SpotterLive->getDateLiveSpotterDataByIdent($ident,$currenttime);
18
+		$spotter_array = $SpotterLive->getDateLiveSpotterDataByIdent($ident, $currenttime);
19 19
 		if (empty($spotter_array)) {
20 20
 			$from_archive = true;
21
-			$spotter_array = $SpotterArchive->getDateArchiveSpotterDataByIdent($ident,$currenttime);
21
+			$spotter_array = $SpotterArchive->getDateArchiveSpotterDataByIdent($ident, $currenttime);
22 22
 		}
23 23
 	} else {
24 24
 		$spotter_array = $SpotterLive->getLastLiveSpotterDataByIdent($ident);
@@ -29,15 +29,15 @@  discard block
 block discarded – undo
29 29
 	}
30 30
 }
31 31
 if (isset($_GET['flightaware_id'])) {
32
-	$flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
32
+	$flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING);
33 33
 	if (isset($_GET['currenttime'])) {
34
-		$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
34
+		$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT);
35 35
 		$currenttime = round($currenttime/1000);
36
-		$spotter_array = $SpotterLive->getDateLiveSpotterDataById($flightaware_id,$currenttime);
36
+		$spotter_array = $SpotterLive->getDateLiveSpotterDataById($flightaware_id, $currenttime);
37 37
 		if (empty($spotter_array)) {
38 38
 			$from_archive = true;
39 39
 //			$spotter_array = $SpotterArchive->getLastArchiveSpotterDataById($flightaware_id);
40
-			$spotter_array = $SpotterArchive->getDateArchiveSpotterDataById($flightaware_id,$currenttime);
40
+			$spotter_array = $SpotterArchive->getDateArchiveSpotterDataById($flightaware_id, $currenttime);
41 41
 		}
42 42
 	} else {
43 43
 		$spotter_array = $SpotterLive->getLastLiveSpotterDataById($flightaware_id);
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 if (isset($spotter_item['image_thumbnail']) && $spotter_item['image_thumbnail'] != "")
57 57
 {
58 58
 	if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') {
59
-		$image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
59
+		$image = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']);
60 60
 	} else $image = $spotter_item['image_thumbnail'];
61 61
 
62 62
 }
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	print '<div class="nomobile airports"><div class="airport"><span class="code"><a href="'.$globalURL.'/airport/'.$spotter_item['departure_airport'].'" target="_blank">'.$spotter_item['departure_airport'].'</a></span>'.$spotter_item['departure_airport_city'].' '.$spotter_item['departure_airport_country'];
78 78
 	if (isset($spotter_item['departure_airport_time']) && $spotter_item['departure_airport_time'] != 'NULL') {
79 79
 		if ($spotter_item['departure_airport_time'] > 2460) {
80
-			print '<br /><span class="time">'.date('H:m',$spotter_item['departure_airport_time']).'</span>';
80
+			print '<br /><span class="time">'.date('H:m', $spotter_item['departure_airport_time']).'</span>';
81 81
 		} else {
82 82
 			print '<br /><span class="time">'.$spotter_item['departure_airport_time'].'</span>';
83 83
 		}
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	print '<span class="code"><a href="'.$globalURL.'/airport/'.$spotter_item['arrival_airport'].'" target="_blank">'.$spotter_item['arrival_airport'].'</a></span>'.$spotter_item['arrival_airport_city'].' '.$spotter_item['arrival_airport_country'];
87 87
 	if (isset($spotter_item['arrival_airport_time']) && $spotter_item['arrival_airport_time'] != 'NULL') {
88 88
 		if ($spotter_item['arrival_airport_time'] > 2460) {
89
-			print '<br /><span class="time">'.date('H:m',$spotter_item['arrival_airport_time']).'</span>';
89
+			print '<br /><span class="time">'.date('H:m', $spotter_item['arrival_airport_time']).'</span>';
90 90
 		} else {
91 91
 			print '<br /><span class="time">'.$spotter_item['arrival_airport_time'].'</span>';
92 92
 		}
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
 print '<div id ="altitude"><span>'._("Altitude").'</span>';
112 112
 if (isset($globalGroundAltitude) && $globalGroundAltitude) {
113 113
 	try {
114
-		$groundAltitude = $Elevation->getElevation($spotter_item['latitude'],$spotter_item['longitude']);
115
-	} catch(Exception $e) {
114
+		$groundAltitude = $Elevation->getElevation($spotter_item['latitude'], $spotter_item['longitude']);
115
+	} catch (Exception $e) {
116 116
 		// If catched not exist
117 117
 	}
118 118
 }
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 
183 183
 if (isset($globalVA) && $globalVA && isset($globalphpVMS) && $globalphpVMS && isset($globalVATSIM) && $globalVATSIM && isset($globalIVAO) && $globalIVAO && isset($spotter_item['format_source']) && $spotter_item['format_source'] != '' && $spotter_item['format_source'] != 'pireps') print '<div class="waypoints"><span>'._("Source").'</span>'.$spotter_item['format_source'].'</div>';
184 184
 if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>';
185
-if (isset($spotter_item['acars']['message'])) print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'<br/>',$spotter_item['acars']['message'])).'</div>';
185
+if (isset($spotter_item['acars']['message'])) print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '<br/>', $spotter_item['acars']['message'])).'</div>';
186 186
 if (isset($spotter_item['squawk']) && $spotter_item['squawk'] != '' && $spotter_item['squawk'] != 0) print '<div class="bottom">'._("Squawk:").' '.$spotter_item['squawk'].' - '.$spotter_item['squawk_usage'].'</div>';
187 187
 print '</div>';
188 188
 ?>
Please login to merge, or discard this patch.
require/class.GeoidHeight.php 3 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -91,6 +91,10 @@
 block discarded – undo
91 91
 		$this->rlatres = (($this->height - 1) / 180.0);
92 92
 	}
93 93
 
94
+	/**
95
+	 * @param integer $ix
96
+	 * @param integer $iy
97
+	 */
94 98
 	private function _rawval($ix,$iy) {
95 99
 		if (($iy < 0)) {
96 100
 			$iy = -$iy;
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 * Translated to PHP of GeographicLib/src/Geoid.cpp
12 12
 * by Ycarus <[email protected]> in 2017
13 13
 */
14
-class GeoidHeight  {
14
+class GeoidHeight {
15 15
 	private $c0 = 240;
16 16
 	private $c3 = [[9, -18, -88, 0, 96, 90, 0, 0, -60, -20], [-9, 18, 8, 0, -96, 30, 0, 0, 60, -20], [9, -88, -18, 90, 96, 0, -20, -60, 0, 0], [186, -42, -42, -150, -96, -150, 60, 60, 60, 60], [54, 162, -78, 30, -24, -90, -60, 60, -60, 60], [-9, -32, 18, 30, 24, 0, 20, -60, 0, 0], [-9, 8, 18, 30, -96, 0, -20, 60, 0, 0], [54, -78, 162, -90, -24, 30, 60, -60, 60, -60], [-54, 78, 78, 90, 144, 90, -60, -60, -60, -60], [9, -8, -18, -30, -24, 0, 20, 60, 0, 0], [-9, 18, -32, 0, 24, 30, 0, 0, -60, 20], [9, -18, -8, 0, -24, -30, 0, 0, 60, 20]];
17 17
 	private $c0n = 372;
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	private $v10 = null;
35 35
 	private $v11 = null;
36 36
 
37
-	public function __construct($name='') {
37
+	public function __construct($name = '') {
38 38
 		global $globalGeoidSource;
39 39
 		//if ($name == '') $name = dirname(__FILE__).'/../install/tmp/egm2008-1.pgm';
40 40
 		if ($name == '') {
@@ -42,35 +42,35 @@  discard block
 block discarded – undo
42 42
 			else $name = dirname(__FILE__).'/../data/egm96-15.pgm';
43 43
 		}
44 44
 
45
-		$f = @fopen($name,"r");
45
+		$f = @fopen($name, "r");
46 46
 		if ($f === FALSE) {
47 47
 			throw new Exception("Can't open ".$name);
48 48
 		}
49
-		$line = fgets($f,4096);
49
+		$line = fgets($f, 4096);
50 50
 		if (trim($line) != 'P5') {
51 51
 			throw new Exception('No PGM header');
52 52
 		}
53 53
 		$headerlen = strlen($line);
54 54
 		while (true) {
55
-			$line = fgets($f,4096);
55
+			$line = fgets($f, 4096);
56 56
 			if ((strlen($line) == 0)) {
57 57
 				throw new Exception('EOF before end of file header');
58 58
 			}
59 59
 			$headerlen += strlen($line);
60
-			if (strpos($line,'# Offset ') !== FALSE) {
60
+			if (strpos($line, '# Offset ') !== FALSE) {
61 61
 				$this->offset = substr($line, 9);
62
-			} else if (strpos($line,'# Scale ') !== FALSE) {
62
+			} else if (strpos($line, '# Scale ') !== FALSE) {
63 63
 				$this->scale = substr($line, 8);
64
-			} else if ((strpos($line,'#') === FALSE)) {
65
-				list($this->width, $this->height) = preg_split('/\s+/',$line);
64
+			} else if ((strpos($line, '#') === FALSE)) {
65
+				list($this->width, $this->height) = preg_split('/\s+/', $line);
66 66
 				break;
67 67
 			}
68 68
 		}
69
-		$line = fgets($f,4096);
69
+		$line = fgets($f, 4096);
70 70
 		$headerlen += strlen($line);
71
-		$levels = (int)$line;
72
-		$this->width = (int)$this->width;
73
-		$this->height = (int)$this->height;
71
+		$levels = (int) $line;
72
+		$this->width = (int) $this->width;
73
+		$this->height = (int) $this->height;
74 74
 		if (($levels != 65535)) {
75 75
 			throw new Exception('PGM file must have 65535 gray levels ('.$levels.')');
76 76
 		}
@@ -85,42 +85,42 @@  discard block
 block discarded – undo
85 85
 		}
86 86
 
87 87
 		$fullsize = filesize($name);
88
-		if ((($fullsize - $headerlen) != (($this->width * $this->height) * 2))) {
88
+		if ((($fullsize - $headerlen) != (($this->width*$this->height)*2))) {
89 89
 			throw new Exception('File has the wrong length');
90 90
 		}
91 91
 
92 92
 		$this->headerlen = $headerlen;
93
-		$this->raw= $f;
94
-		$this->rlonres = ($this->width / 360.0);
95
-		$this->rlatres = (($this->height - 1) / 180.0);
93
+		$this->raw = $f;
94
+		$this->rlonres = ($this->width/360.0);
95
+		$this->rlatres = (($this->height - 1)/180.0);
96 96
 	}
97 97
 
98
-	private function _rawval($ix,$iy) {
98
+	private function _rawval($ix, $iy) {
99 99
 		if (($iy < 0)) {
100 100
 			$iy = -$iy;
101
-			$ix += ($this->width / 2);
101
+			$ix += ($this->width/2);
102 102
 		} else if (($iy >= $this->height)) {
103
-			$iy = ((2 * ($this->height - 1)) - $iy);
104
-			$ix += ($this->width / 2);
103
+			$iy = ((2*($this->height - 1)) - $iy);
104
+			$ix += ($this->width/2);
105 105
 		}
106 106
 		if (($ix < 0)) {
107 107
 			$ix += $this->width;
108 108
 		} else if (($ix >= $this->width)) {
109 109
 			$ix -= $this->width;
110 110
 		}
111
-		$k = ((($iy * $this->width) + $ix) * 2) + $this->headerlen;
112
-		fseek($this->raw,$k);
113
-		return unpack('n',fread($this->raw,2))[1];
111
+		$k = ((($iy*$this->width) + $ix)*2) + $this->headerlen;
112
+		fseek($this->raw, $k);
113
+		return unpack('n', fread($this->raw, 2))[1];
114 114
 	}
115 115
 
116
-	public function get($lat,$lon,$cubic=true) {
116
+	public function get($lat, $lon, $cubic = true) {
117 117
 		if (($lon < 0)) {
118 118
 			$lon += 360;
119 119
 		}
120
-		$fy = ((90 - $lat) * $this->rlatres);
121
-		$fx = ($lon * $this->rlonres);
122
-		$iy = (int)$fy;
123
-		$ix = (int)$fx;
120
+		$fy = ((90 - $lat)*$this->rlatres);
121
+		$fx = ($lon*$this->rlonres);
122
+		$iy = (int) $fy;
123
+		$ix = (int) $fx;
124 124
 		$fx -= $ix;
125 125
 		$fy -= $iy;
126 126
 		$t = array();
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 					$c3x = $this->c3;
148 148
 					$c0x = $this->c0;
149 149
 				}
150
-				for ($i = 0; $i < 10;++$i) {
150
+				for ($i = 0; $i < 10; ++$i) {
151 151
 					$t[$i] = 0;
152 152
 					for ($j = 0; $j < 12; ++$j) {
153 153
 						$t[$i] += $v[$j]*$c3x[$j][$i];
@@ -158,13 +158,13 @@  discard block
 block discarded – undo
158 158
 			$this->t = $t;
159 159
 		} else $t = $this->t;
160 160
 		if (!($cubic)) {
161
-			$a = (((1 - $fx) * $this->v00) + ($fx * $this->v01));
162
-			$b = (((1 - $fx) * $this->v10) + ($fx * $this->v11));
163
-			$h = (((1 - $fy) * $a) + ($fy * $b));
161
+			$a = (((1 - $fx)*$this->v00) + ($fx*$this->v01));
162
+			$b = (((1 - $fx)*$this->v10) + ($fx*$this->v11));
163
+			$h = (((1 - $fy)*$a) + ($fy*$b));
164 164
 		} else {
165
-			$h = (($t[0] + ($fx * ($t[1] + ($fx * ($t[3] + ($fx * $t[6])))))) + ($fy * (($t[2] + ($fx * ($t[4] + ($fx * $t[7])))) + ($fy * (($t[5] + ($fx * $t[8])) + ($fy * $t[9]))))));
165
+			$h = (($t[0] + ($fx*($t[1] + ($fx*($t[3] + ($fx*$t[6])))))) + ($fy*(($t[2] + ($fx*($t[4] + ($fx*$t[7])))) + ($fy*(($t[5] + ($fx*$t[8])) + ($fy*$t[9]))))));
166 166
 		}
167
-		return ((float)$this->offset + ((float)$this->scale * (float)$h));
167
+		return ((float) $this->offset + ((float) $this->scale*(float) $h));
168 168
 	}
169 169
 }
170 170
 /*
Please login to merge, or discard this patch.
Braces   +8 added lines, -3 removed lines patch added patch discarded remove patch
@@ -38,8 +38,11 @@  discard block
 block discarded – undo
38 38
 		global $globalGeoidSource;
39 39
 		//if ($name == '') $name = dirname(__FILE__).'/../install/tmp/egm2008-1.pgm';
40 40
 		if ($name == '') {
41
-			if (isset($globalGeoidSource) && $globalGeoidSource != '') $name = dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm';
42
-			else $name = dirname(__FILE__).'/../data/egm96-15.pgm';
41
+			if (isset($globalGeoidSource) && $globalGeoidSource != '') {
42
+				$name = dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm';
43
+			} else {
44
+				$name = dirname(__FILE__).'/../data/egm96-15.pgm';
45
+			}
43 46
 		}
44 47
 
45 48
 		$f = @fopen($name,"r");
@@ -156,7 +159,9 @@  discard block
 block discarded – undo
156 159
 				}
157 160
 			}
158 161
 			$this->t = $t;
159
-		} else $t = $this->t;
162
+		} else {
163
+			$t = $this->t;
164
+		}
160 165
 		if (!($cubic)) {
161 166
 			$a = (((1 - $fx) * $this->v00) + ($fx * $this->v01));
162 167
 			$b = (((1 - $fx) * $this->v10) + ($fx * $this->v11));
Please login to merge, or discard this patch.
require/settings.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 $globalLongitudeMin = '1.0'; //the minimum longitude (east)
43 43
 
44 44
 $globalCenterLatitude = '46.38'; //the latitude center of your coverage area
45
-$globalCenterLongitude = '5.29';//the longitude center of your coverage area
45
+$globalCenterLongitude = '5.29'; //the longitude center of your coverage area
46 46
 
47 47
 $globalLiveZoom = '9'; //default zoom on Live Map
48 48
 $globalAirportZoom = '7'; //default zoom to begin to display airports icons
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 $globalACARS = FALSE;
152 152
 $globalACARSHost = '0.0.0.0'; // Local IP to listen
153 153
 $globalACARSPort = '9999';
154
-$globalACARSArchive = array('10','80','81','82','3F'); // labels of messages to archive
154
+$globalACARSArchive = array('10', '80', '81', '82', '3F'); // labels of messages to archive
155 155
 $globalACARSArchiveKeepMonths = '0';
156 156
 
157 157
 //APRS configuration (for glidernet)
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 //Check by aircraft ICAO if image is not found by registration
249 249
 $globalAircraftImageCheckICAO = TRUE;
250 250
 //Sources for Aircraft image
251
-$globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters','customsources');
251
+$globalAircraftImageSources = array('ivaomtl', 'wikimedia', 'airportdata', 'deviantart', 'flickr', 'bing', 'jetphotos', 'planepictures', 'planespotters', 'customsources');
252 252
 // Custom source configuration {registration} will be replaced by aircraft registration (exif get copyright from exif data for each pic)
253 253
 // example of config : $globalAircraftImageCustomSources = array('thumbnail' => 'http://pics.myurl.com/thumbnail/{registration}.jpg','original' => 'http://myurl/original/{registration}.jpg','source_website' => 'https://www.myurl.com', 'source' => 'customsite', 'copyright' => 'myself','exif' => true);
254 254
 // ************************
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 //Retrieve Image from externals sources
258 258
 $globalMarineImageFetch = TRUE;
259 259
 //Sources for Marine image
260
-$globalMarineImageSources = array('wikimedia','flickr','deviantart','bing','customsources');
260
+$globalMarineImageSources = array('wikimedia', 'flickr', 'deviantart', 'bing', 'customsources');
261 261
 // Custom source configuration {mmsi} will be replaced by vessel mmsi, {name} by it's name (exif get copyright from exif data for each pic)
262 262
 // example of config : $globalMarineImageCustomSources = array('thumbnail' => 'http://pics.myurl.com/thumbnail/{name}.jpg','original' => 'http://myurl/original/{name}.jpg','source_website' => 'https://www.myurl.com', 'source' => 'customsite', 'copyright' => 'myself','exif' => true);
263 263
 // ************************
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 //Retrieve schedules from externals sources (set to FALSE for IVAO or if $globalFork = FALSE)
266 266
 $globalSchedulesFetch = TRUE;
267 267
 //Sources for airline schedule if not official airline site
268
-$globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware');
268
+$globalSchedulesSources = array('flightmapper', 'costtotravel', 'flightradar24', 'flightaware');
269 269
 
270 270
 //Retrieve translation from external sources (set to FALSE for IVAO)
271 271
 $globalTranslationFetch = TRUE;
Please login to merge, or discard this patch.
index.php 3 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 require_once('require/class.Language.php');
5 5
 require_once('require/class.Satellite.php');
6 6
 
7
-$trackident = filter_input(INPUT_GET,'trackid',FILTER_SANITIZE_STRING);
7
+$trackident = filter_input(INPUT_GET, 'trackid', FILTER_SANITIZE_STRING);
8 8
 if ($trackident != '') {
9 9
 	require_once('require/class.SpotterLive.php');
10 10
 	$SpotterLive = new SpotterLive();
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 		$spotterid = $Spotter->getSpotterIDBasedOnFlightAwareID($trackident);
15 15
 		header('Location: '.$globalURL.'/flightid/'.$spotterid);
16 16
 	} else {
17
-		setcookie('MapTrack',$resulttrackident[0]['flightaware_id']);
17
+		setcookie('MapTrack', $resulttrackident[0]['flightaware_id']);
18 18
 	}
19 19
 } else {
20 20
 	unset($_COOKIE['MapTrack']);
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 		        <div class="form-group">
190 190
 			    <label>From (UTC):</label>
191 191
 		            <div class='input-group date' id='datetimepicker1'>
192
-            			<input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) print $_POST['start_date']; elseif (isset($_COOKIE['archive_begin'])) print date("m/d/Y h:i a",$_COOKIE['archive_begin']); ?>" required />
192
+            			<input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) print $_POST['start_date']; elseif (isset($_COOKIE['archive_begin'])) print date("m/d/Y h:i a", $_COOKIE['archive_begin']); ?>" required />
193 193
 		                <span class="input-group-addon">
194 194
             			    <span class="glyphicon glyphicon-calendar"></span>
195 195
 		                </span>
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 		        <div class="form-group">
199 199
 			    <label>To (UTC):</label>
200 200
 		            <div class='input-group date' id='datetimepicker2'>
201
-		                <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) print $_POST['end_date']; elseif (isset($_COOKIE['archive_end'])) print date("m/d/Y h:i a",$_COOKIE['archive_end']); ?>" />
201
+		                <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) print $_POST['end_date']; elseif (isset($_COOKIE['archive_end'])) print date("m/d/Y h:i a", $_COOKIE['archive_end']); ?>" />
202 202
             			<span class="input-group-addon">
203 203
 		                    <span class="glyphicon glyphicon-calendar"></span>
204 204
             			</span>
@@ -323,9 +323,9 @@  discard block
 block discarded – undo
323 323
 		    <li><?php echo _("Type of Terrain:"); ?>
324 324
 			<select  class="selectpicker" onchange="terrainType(this);">
325 325
 			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option>
326
-			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option>
327
-			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option>
328
-			    <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected';?>>ArticDEM</option>
326
+			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected'; ?>>ellipsoid</option>
327
+			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected'; ?>>vr terrain</option>
328
+			    <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected'; ?>>ArticDEM</option>
329 329
 			</select>
330 330
 		    </li>
331 331
 <?php
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 		    <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) print 'checked'; ?> ><?php echo _("Show mini-map"); ?></label></div></li>
352 352
 <?php
353 353
     }
354
-    if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
354
+    if (time() > mktime(0, 0, 0, 12, 1, date("Y")) && time() < mktime(0, 0, 0, 12, 31, date("Y"))) {
355 355
 ?>
356 356
 		    <li><div class="checkbox"><label><input type="checkbox" name="displaysanta" value="1" onclick="clickSanta(this)"><i class="fa fa-snowflake-o" aria-hidden="true"></i> <?php echo _("Show Santa Claus now"); ?> <i class="fa fa-snowflake-o" aria-hidden="true"></i></label></div></li>
357 357
 <?php
@@ -507,10 +507,10 @@  discard block
 block discarded – undo
507 507
 					$Spotter = new Spotter();
508 508
 					$allairlinenames = $Spotter->getAllAirlineNames();
509 509
 				}
510
-				foreach($allairlinenames as $airline) {
510
+				foreach ($allairlinenames as $airline) {
511 511
 					$airline_name = $airline['airline_name'];
512
-					if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...';
513
-					if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['filter_Airlines']))) {
512
+					if (strlen($airline_name) > 30) $airline_name = substr($airline_name, 0, 30).'...';
513
+					if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'], explode(',', $_COOKIE['filter_Airlines']))) {
514 514
 						echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>';
515 515
 					} else {
516 516
 						echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>';
@@ -529,7 +529,7 @@  discard block
 block discarded – undo
529 529
 			<select class="selectpicker" onchange="alliance(this);" id="display_alliance">
530 530
 			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
531 531
 			    <?php
532
-				foreach($allalliancenames as $alliance) {
532
+				foreach ($allalliancenames as $alliance) {
533 533
 					$alliance_name = $alliance['alliance'];
534 534
 					if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] == $alliance_name) {
535 535
 						echo '<option value="'.$alliance_name.'" selected>'.$alliance_name.'</option>';
@@ -553,8 +553,8 @@  discard block
 block discarded – undo
553 553
 			<select class="selectpicker" multiple onchange="sources(this);">
554 554
 			    <?php
555 555
 				$Spotter = new Spotter();
556
-				foreach($Spotter->getAllSourceName('aprs') as $source) {
557
-					if (isset($_COOKIE['filter_Sources']) && in_array($source['source_name'],explode(',',$_COOKIE['filter_Sources']))) {
556
+				foreach ($Spotter->getAllSourceName('aprs') as $source) {
557
+					if (isset($_COOKIE['filter_Sources']) && in_array($source['source_name'], explode(',', $_COOKIE['filter_Sources']))) {
558 558
 						echo '<option value="'.$source['source_name'].'" selected>'.$source['source_name'].'</option>';
559 559
 					} else {
560 560
 						echo '<option value="'.$source['source_name'].'">'.$source['source_name'].'</option>';
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
 					else if ($type_name == 'radar') $type_name = 'Radar Calibration';
633 633
 					else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches';
634 634
 					
635
-					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) {
635
+					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'], explode(',', $_COOKIE['sattypes']))) {
636 636
 						print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>';
637 637
 					} else {
638 638
 						print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>';
Please login to merge, or discard this patch.
Braces   +433 added lines, -109 removed lines patch added patch discarded remove patch
@@ -157,11 +157,26 @@  discard block
 block discarded – undo
157 157
 				<li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam();" /><?php echo _("Display NOTAM"); ?></label></div></li>
158 158
 				<li><?php echo _("NOTAM scope:"); ?>
159 159
 					<select class="selectpicker" onchange="notamscope(this);">
160
-						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') print ' selected'; ?>>All</option>
161
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') print ' selected'; ?>>Airport/Enroute warning</option>
162
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') print ' selected'; ?>>Airport warning</option>
163
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') print ' selected'; ?>>Navigation warning</option>
164
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') print ' selected'; ?>>Enroute warning</option>
160
+						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') {
161
+	print ' selected';
162
+}
163
+?>>All</option>
164
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') {
165
+	print ' selected';
166
+}
167
+?>>Airport/Enroute warning</option>
168
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') {
169
+	print ' selected';
170
+}
171
+?>>Airport warning</option>
172
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') {
173
+	print ' selected';
174
+}
175
+?>>Navigation warning</option>
176
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') {
177
+	print ' selected';
178
+}
179
+?>>Enroute warning</option>
165 180
 					</select
166 181
 				</li>
167 182
 			</ul>
@@ -189,7 +204,12 @@  discard block
 block discarded – undo
189 204
 		        <div class="form-group">
190 205
 			    <label>From (UTC):</label>
191 206
 		            <div class='input-group date' id='datetimepicker1'>
192
-            			<input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) print $_POST['start_date']; elseif (isset($_COOKIE['archive_begin'])) print date("m/d/Y h:i a",$_COOKIE['archive_begin']); ?>" required />
207
+            			<input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) {
208
+	print $_POST['start_date'];
209
+} elseif (isset($_COOKIE['archive_begin'])) {
210
+	print date("m/d/Y h:i a",$_COOKIE['archive_begin']);
211
+}
212
+?>" required />
193 213
 		                <span class="input-group-addon">
194 214
             			    <span class="glyphicon glyphicon-calendar"></span>
195 215
 		                </span>
@@ -198,7 +218,12 @@  discard block
 block discarded – undo
198 218
 		        <div class="form-group">
199 219
 			    <label>To (UTC):</label>
200 220
 		            <div class='input-group date' id='datetimepicker2'>
201
-		                <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) print $_POST['end_date']; elseif (isset($_COOKIE['archive_end'])) print date("m/d/Y h:i a",$_COOKIE['archive_end']); ?>" />
221
+		                <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) {
222
+	print $_POST['end_date'];
223
+} elseif (isset($_COOKIE['archive_end'])) {
224
+	print date("m/d/Y h:i a",$_COOKIE['archive_end']);
225
+}
226
+?>" />
202 227
             			<span class="input-group-addon">
203 228
 		                    <span class="glyphicon glyphicon-calendar"></span>
204 229
             			</span>
@@ -224,8 +249,20 @@  discard block
 block discarded – undo
224 249
 
225 250
 		    <li><?php echo _("Playback speed:"); ?>
226 251
 			<div class="range">
227
-			    <input type="range" min="0" max="50" step="1" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php  if (isset($_POST['archivespeed'])) print $_POST['archivespeed']; elseif (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?>">
228
-			    <output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?></output>
252
+			    <input type="range" min="0" max="50" step="1" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php  if (isset($_POST['archivespeed'])) {
253
+	print $_POST['archivespeed'];
254
+} elseif (isset($_COOKIE['archive_speed'])) {
255
+	print $_COOKIE['archive_speed'];
256
+} else {
257
+	print '1';
258
+}
259
+?>">
260
+			    <output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) {
261
+	print $_COOKIE['archive_speed'];
262
+} else {
263
+	print '1';
264
+}
265
+?></output>
229 266
 			</div>
230 267
 		    </li>
231 268
 		    <li><input type="submit" name="archive" value="Show archive" class="btn btn-primary" /></li>
@@ -247,15 +284,27 @@  discard block
 block discarded – undo
247 284
 		    <li><?php echo _("Type of Map:"); ?>
248 285
 			<select  class="selectpicker" onchange="mapType(this);">
249 286
 			    <?php
250
-				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider;
251
-				else $MapType = $_COOKIE['MapType'];
287
+				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') {
288
+					$MapType = $globalMapProvider;
289
+				} else {
290
+					$MapType = $_COOKIE['MapType'];
291
+				}
252 292
 			    ?>
253 293
 			    <?php
254 294
 				if (isset($globalBingMapKey) && $globalBingMapKey != '') {
255 295
 			    ?>
256
-			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option>
257
-			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option>
258
-			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option>
296
+			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') {
297
+	print ' selected';
298
+}
299
+?>>Bing-Aerial</option>
300
+			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') {
301
+	print ' selected';
302
+}
303
+?>>Bing-Hybrid</option>
304
+			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') {
305
+	print ' selected';
306
+}
307
+?>>Bing-Road</option>
259 308
 			    <?php
260 309
 				}
261 310
 			    ?>
@@ -265,56 +314,131 @@  discard block
 block discarded – undo
265 314
 			    <?php
266 315
 				    if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
267 316
 			    ?>
268
-			    <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option>
269
-			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option>
270
-			    <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option>
317
+			    <option value="Here-Aerial"<?php if ($MapType == 'Here') {
318
+	print ' selected';
319
+}
320
+?>>Here-Aerial</option>
321
+			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') {
322
+	print ' selected';
323
+}
324
+?>>Here-Hybrid</option>
325
+			    <option value="Here-Road"<?php if ($MapType == 'Here') {
326
+	print ' selected';
327
+}
328
+?>>Here-Road</option>
271 329
 			    <?php
272 330
 				    }
273 331
 			    ?>
274 332
 			    <?php
275 333
 				    if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
276 334
 			    ?>
277
-			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option>
278
-			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option>
279
-			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option>
280
-			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option>
335
+			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') {
336
+	print ' selected';
337
+}
338
+?>>Google Roadmap</option>
339
+			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') {
340
+	print ' selected';
341
+}
342
+?>>Google Satellite</option>
343
+			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') {
344
+	print ' selected';
345
+}
346
+?>>Google Hybrid</option>
347
+			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') {
348
+	print ' selected';
349
+}
350
+?>>Google Terrain</option>
281 351
 			    <?php
282 352
 				    }
283 353
 			    ?>
284 354
 			    <?php
285 355
 				    if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
286 356
 			    ?>
287
-			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option>
288
-			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option>
289
-			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option>
357
+			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') {
358
+	print ' selected';
359
+}
360
+?>>MapQuest-OSM</option>
361
+			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') {
362
+	print ' selected';
363
+}
364
+?>>MapQuest-Aerial</option>
365
+			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') {
366
+	print ' selected';
367
+}
368
+?>>MapQuest-Hybrid</option>
290 369
 			    <?php
291 370
 				    }
292 371
 			    ?>
293
-			    <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option>
372
+			    <option value="Yandex"<?php if ($MapType == 'Yandex') {
373
+	print ' selected';
374
+}
375
+?>>Yandex</option>
294 376
 			    <?php
295 377
 				}
296 378
 			    ?>
297 379
 			    <?php
298 380
 				    if (isset($globalMapboxToken) && $globalMapboxToken != '') {
299
-					if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default';
300
-					else $MapBoxId = $_COOKIE['MapTypeId'];
381
+					if (!isset($_COOKIE['MapTypeId'])) {
382
+						$MapBoxId = 'default';
383
+					} else {
384
+						$MapBoxId = $_COOKIE['MapTypeId'];
385
+					}
301 386
 			    ?>
302
-			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option>
303
-			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option>
304
-			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option>
305
-			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') print ' selected'; ?>>Mapbox dark</option>
306
-			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') print ' selected'; ?>>Mapbox satellite</option>
307
-			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') print ' selected'; ?>>Mapbox streets-satellite</option>
308
-			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') print ' selected'; ?>>Mapbox streets-basic</option>
309
-			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') print ' selected'; ?>>Mapbox comic</option>
310
-			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') print ' selected'; ?>>Mapbox outdoors</option>
311
-			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') print ' selected'; ?>>Mapbox pencil</option>
312
-			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option>
313
-			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option>
387
+			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') {
388
+	print ' selected';
389
+}
390
+?>>Mapbox default</option>
391
+			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') {
392
+	print ' selected';
393
+}
394
+?>>Mapbox streets</option>
395
+			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') {
396
+	print ' selected';
397
+}
398
+?>>Mapbox light</option>
399
+			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') {
400
+	print ' selected';
401
+}
402
+?>>Mapbox dark</option>
403
+			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') {
404
+	print ' selected';
405
+}
406
+?>>Mapbox satellite</option>
407
+			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') {
408
+	print ' selected';
409
+}
410
+?>>Mapbox streets-satellite</option>
411
+			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') {
412
+	print ' selected';
413
+}
414
+?>>Mapbox streets-basic</option>
415
+			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') {
416
+	print ' selected';
417
+}
418
+?>>Mapbox comic</option>
419
+			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') {
420
+	print ' selected';
421
+}
422
+?>>Mapbox outdoors</option>
423
+			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') {
424
+	print ' selected';
425
+}
426
+?>>Mapbox pencil</option>
427
+			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') {
428
+	print ' selected';
429
+}
430
+?>>Mapbox pirates</option>
431
+			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') {
432
+	print ' selected';
433
+}
434
+?>>Mapbox emerald</option>
314 435
 			    <?php
315 436
 				    }
316 437
 			    ?>
317
-			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option>
438
+			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') {
439
+	print ' selected';
440
+}
441
+?>>OpenStreetMap</option>
318 442
 			</select>
319 443
 		    </li>
320 444
 <?php
@@ -322,10 +446,22 @@  discard block
 block discarded – undo
322 446
 ?>
323 447
 		    <li><?php echo _("Type of Terrain:"); ?>
324 448
 			<select  class="selectpicker" onchange="terrainType(this);">
325
-			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option>
326
-			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option>
327
-			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option>
328
-			    <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected';?>>ArticDEM</option>
449
+			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') {
450
+	print ' selected';
451
+}
452
+?>>stk terrain</option>
453
+			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') {
454
+	print ' selected';
455
+}
456
+?>>ellipsoid</option>
457
+			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') {
458
+	print ' selected';
459
+}
460
+?>>vr terrain</option>
461
+			    <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') {
462
+	print ' selected';
463
+}
464
+?>>ArticDEM</option>
329 465
 			</select>
330 466
 		    </li>
331 467
 <?php
@@ -335,22 +471,52 @@  discard block
 block discarded – undo
335 471
     if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
336 472
 ?>
337 473
 		    
338
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') print 'checked'; ?> ><?php echo _("Display flight info as popup"); ?></label></div></li>
339
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true')) print 'checked'; ?> ><?php echo _("Display flight path"); ?></label></div></li>
340
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || (isset($globalMapRoute) && $globalMapRoute)) print 'checked'; ?> ><?php echo _("Display flight route on click"); ?></label></div></li>
341
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightremainingroute" value="1" onclick="clickFlightRemainingRoute(this)" <?php if ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == 'true') || !isset($_COOKIE['MapRemainingRoute']) || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)) print 'checked'; ?> ><?php echo _("Display flight remaining route on click"); ?></label></div></li>
342
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Planes animate between updates"); ?></label></div></li>
474
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') {
475
+	print 'checked';
476
+}
477
+?> ><?php echo _("Display flight info as popup"); ?></label></div></li>
478
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true')) {
479
+	print 'checked';
480
+}
481
+?> ><?php echo _("Display flight path"); ?></label></div></li>
482
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || (isset($globalMapRoute) && $globalMapRoute)) {
483
+	print 'checked';
484
+}
485
+?> ><?php echo _("Display flight route on click"); ?></label></div></li>
486
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightremainingroute" value="1" onclick="clickFlightRemainingRoute(this)" <?php if ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == 'true') || !isset($_COOKIE['MapRemainingRoute']) || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)) {
487
+	print 'checked';
488
+}
489
+?> ><?php echo _("Display flight remaining route on click"); ?></label></div></li>
490
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) {
491
+	print 'checked';
492
+}
493
+?> ><?php echo _("Planes animate between updates"); ?></label></div></li>
343 494
 <?php
344 495
     }
345 496
 ?>
346
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true' || !isset($_COOKIE['displayairports'])) print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li>
347
-		    <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (!isset($globalMapGroundStation) || $globalMapGroundStation === TRUE))) print 'checked'; ?> ><?php echo _("Display ground station on map"); ?></label></div></li>
348
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayweatherstation" value="1" onclick="clickDisplayWeatherStation(this)" <?php if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') || (!isset($_COOKIE['show_WeatherStation']) && (!isset($globalMapWeatherStation) || $globalMapWeatherStation === TRUE))) print 'checked'; ?> ><?php echo _("Display weather station on map"); ?></label></div></li>
349
-		    <li><div class="checkbox"><label><input type="checkbox" name="displaylightning" value="1" onclick="clickDisplayLightning(this)" <?php if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') || (!isset($_COOKIE['show_Lightning']) && (!isset($globalMapLightning) || $globalMapLightning === TRUE))) print 'checked'; ?> ><?php echo _("Display lightning on map"); ?></label></div></li>
497
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true' || !isset($_COOKIE['displayairports'])) {
498
+	print 'checked';
499
+}
500
+?> ><?php echo _("Display airports on map"); ?></label></div></li>
501
+		    <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (!isset($globalMapGroundStation) || $globalMapGroundStation === TRUE))) {
502
+	print 'checked';
503
+}
504
+?> ><?php echo _("Display ground station on map"); ?></label></div></li>
505
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayweatherstation" value="1" onclick="clickDisplayWeatherStation(this)" <?php if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') || (!isset($_COOKIE['show_WeatherStation']) && (!isset($globalMapWeatherStation) || $globalMapWeatherStation === TRUE))) {
506
+	print 'checked';
507
+}
508
+?> ><?php echo _("Display weather station on map"); ?></label></div></li>
509
+		    <li><div class="checkbox"><label><input type="checkbox" name="displaylightning" value="1" onclick="clickDisplayLightning(this)" <?php if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') || (!isset($_COOKIE['show_Lightning']) && (!isset($globalMapLightning) || $globalMapLightning === TRUE))) {
510
+	print 'checked';
511
+}
512
+?> ><?php echo _("Display lightning on map"); ?></label></div></li>
350 513
 <?php
351 514
     if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
352 515
 ?>
353
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) print 'checked'; ?> ><?php echo _("Show mini-map"); ?></label></div></li>
516
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) {
517
+	print 'checked';
518
+}
519
+?> ><?php echo _("Show mini-map"); ?></label></div></li>
354 520
 <?php
355 521
     }
356 522
     if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
@@ -364,17 +530,25 @@  discard block
 block discarded – undo
364 530
 			if (function_exists('array_column')) {
365 531
 			    if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
366 532
 		    ?>
367
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
533
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
534
+	print 'checked';
535
+}
536
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
368 537
 		    <?php
369 538
 			    }
370 539
 			} elseif (isset($globalSources)) {
371 540
 			    $dispolar = false;
372 541
 			    foreach ($globalSources as $testsource) {
373
-			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
542
+			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) {
543
+			        	$dispolar = true;
544
+			        }
374 545
 			    }
375 546
 			    if ($dispolar) {
376 547
 		    ?>
377
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
548
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
549
+	print 'checked';
550
+}
551
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
378 552
 		    <?php
379 553
 			    }
380 554
 		        }
@@ -387,12 +561,22 @@  discard block
 block discarded – undo
387 561
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
388 562
 		    	    if (extension_loaded('gd') && function_exists('gd_info')) {
389 563
 		    ?>
390
-		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') print 'checked'; ?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
564
+		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') {
565
+	print 'checked';
566
+}
567
+?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
391 568
 		    <?php 
392 569
 				if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') {
393 570
 		    ?>
394 571
 		    <li><?php echo _("Aircraft icon color:"); ?>
395
-			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print '1a3151'; ?>">
572
+			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) {
573
+	print $_COOKIE['IconColor'];
574
+} elseif (isset($globalAircraftIconColor)) {
575
+	print $globalAircraftIconColor;
576
+} else {
577
+	print '1a3151';
578
+}
579
+?>">
396 580
 		    </li>
397 581
 		    <?php
398 582
 				}
@@ -404,7 +588,14 @@  discard block
 block discarded – undo
404 588
 			    if (extension_loaded('gd') && function_exists('gd_info')) {
405 589
 		    ?>
406 590
 		    <li><?php echo _("Marine icon color:"); ?>
407
-			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print '1a3151'; ?>">
591
+			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) {
592
+	print $_COOKIE['MarineIconColor'];
593
+} elseif (isset($globalMarineIconColor)) {
594
+	print $globalMarineIconColor;
595
+} else {
596
+	print '1a3151';
597
+}
598
+?>">
408 599
 		    </li>
409 600
 		    <?php
410 601
 			    }
@@ -415,7 +606,14 @@  discard block
 block discarded – undo
415 606
 			    if (extension_loaded('gd') && function_exists('gd_info')) {
416 607
 		    ?>
417 608
 		    <li><?php echo _("Tracker icon color:"); ?>
418
-			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) print $_COOKIE['TrackerIconColor']; elseif (isset($globalTrackerIconColor)) print $globalTrackerIconColor; else print '1a3151'; ?>">
609
+			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) {
610
+	print $_COOKIE['TrackerIconColor'];
611
+} elseif (isset($globalTrackerIconColor)) {
612
+	print $globalTrackerIconColor;
613
+} else {
614
+	print '1a3151';
615
+}
616
+?>">
419 617
 		    </li>
420 618
 		    <?php
421 619
 			    }
@@ -426,8 +624,22 @@  discard block
 block discarded – undo
426 624
 		    ?>
427 625
 		    <li><?php echo _("Show airport icon at zoom level:"); ?>
428 626
 			<div class="range">
429
-			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?>">
430
-			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?></output>
627
+			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) {
628
+	print $_COOKIE['AirportZoom'];
629
+} elseif (isset($globalAirportZoom)) {
630
+	print $globalAirportZoom;
631
+} else {
632
+	print '7';
633
+}
634
+?>">
635
+			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) {
636
+	print $_COOKIE['AirportZoom'];
637
+} elseif (isset($globalAirportZoom)) {
638
+	print $globalAirportZoom;
639
+} else {
640
+	print '7';
641
+}
642
+?></output>
431 643
 			</div>
432 644
 		    </li>
433 645
 		    <?php
@@ -439,9 +651,19 @@  discard block
 block discarded – undo
439 651
 <?php
440 652
 	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
441 653
 ?>
442
-		    <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Aircraft color"); ?></li>
654
+		    <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') {
655
+	print 'checked';
656
+}
657
+?> ><?php echo _("Force Aircraft color"); ?></li>
443 658
 		    <li><?php echo _("Aircraft icon color:"); ?>
444
-			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print 'ff0000'; ?>">
659
+			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) {
660
+	print $_COOKIE['IconColor'];
661
+} elseif (isset($globalAircraftIconColor)) {
662
+	print $globalAircraftIconColor;
663
+} else {
664
+	print 'ff0000';
665
+}
666
+?>">
445 667
 		    </li>
446 668
 <?php
447 669
 	}
@@ -449,9 +671,19 @@  discard block
 block discarded – undo
449 671
 <?php
450 672
 	if (isset($globalMarine) && $globalMarine === TRUE) {
451 673
 ?>
452
-		    <li><input type="checkbox" name="marinecolorforce" value="1" onclick="MarineiconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Marine color"); ?></li>
674
+		    <li><input type="checkbox" name="marinecolorforce" value="1" onclick="MarineiconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') {
675
+	print 'checked';
676
+}
677
+?> ><?php echo _("Force Marine color"); ?></li>
453 678
 		    <li><?php echo _("Marine icon color:"); ?>
454
-			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print 'ff0000'; ?>">
679
+			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) {
680
+	print $_COOKIE['MarineIconColor'];
681
+} elseif (isset($globalMarineIconColor)) {
682
+	print $globalMarineIconColor;
683
+} else {
684
+	print 'ff0000';
685
+}
686
+?>">
455 687
 		    </li>
456 688
 <?php
457 689
 	}
@@ -459,9 +691,19 @@  discard block
 block discarded – undo
459 691
 <?php
460 692
 	if (isset($globalTracker) && $globalTracker === TRUE) {
461 693
 ?>
462
-		    <li><input type="checkbox" name="trackercolorforce" value="1" onclick="TrackericonColorForce(this)" <?php if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Tracker color"); ?></li>
694
+		    <li><input type="checkbox" name="trackercolorforce" value="1" onclick="TrackericonColorForce(this)" <?php if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true') {
695
+	print 'checked';
696
+}
697
+?> ><?php echo _("Force Tracker color"); ?></li>
463 698
 		    <li><?php echo _("Tracker icon color:"); ?>
464
-			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) print $_COOKIE['TrackerIconColor']; elseif (isset($globalTrackerIconColor)) print $globalTrackerIconColor; else print 'ff0000'; ?>">
699
+			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) {
700
+	print $_COOKIE['TrackerIconColor'];
701
+} elseif (isset($globalTrackerIconColor)) {
702
+	print $globalTrackerIconColor;
703
+} else {
704
+	print 'ff0000';
705
+}
706
+?>">
465 707
 		    </li>
466 708
 <?php
467 709
 	}
@@ -469,22 +711,46 @@  discard block
 block discarded – undo
469 711
 ?>
470 712
 		    <li><?php echo _("Distance unit:"); ?>
471 713
 			<select class="selectpicker" onchange="unitdistance(this);">
472
-			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) echo ' selected'; ?>>km</option>
473
-			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) echo ' selected'; ?>>nm</option>
474
-			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) echo ' selected'; ?>>mi</option>
714
+			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) {
715
+	echo ' selected';
716
+}
717
+?>>km</option>
718
+			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
719
+	echo ' selected';
720
+}
721
+?>>nm</option>
722
+			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
723
+	echo ' selected';
724
+}
725
+?>>mi</option>
475 726
 		        </select>
476 727
 		    </li>
477 728
 		    <li><?php echo _("Altitude unit:"); ?>
478 729
 			<select class="selectpicker" onchange="unitaltitude(this);">
479
-			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) echo ' selected'; ?>>m</option>
480
-			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) echo ' selected'; ?>>feet</option>
730
+			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) {
731
+	echo ' selected';
732
+}
733
+?>>m</option>
734
+			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) {
735
+	echo ' selected';
736
+}
737
+?>>feet</option>
481 738
 		        </select>
482 739
 		    </li>
483 740
 		    <li><?php echo _("Speed unit:"); ?>
484 741
 			<select class="selectpicker" onchange="unitspeed(this);">
485
-			    <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) echo ' selected'; ?>>km/h</option>
486
-			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) echo ' selected'; ?>>mph</option>
487
-			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) echo ' selected'; ?>>knots</option>
742
+			    <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) {
743
+	echo ' selected';
744
+}
745
+?>>km/h</option>
746
+			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) {
747
+	echo ' selected';
748
+}
749
+?>>mph</option>
750
+			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) {
751
+	echo ' selected';
752
+}
753
+?>>knots</option>
488 754
 		        </select>
489 755
 		    </li>
490 756
 
@@ -502,9 +768,18 @@  discard block
 block discarded – undo
502 768
 		    <?php
503 769
 			if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) {
504 770
 		    ?>
505
-			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) print 'checked'; ?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
506
-			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) print 'checked'; ?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
507
-			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) print 'checked'; ?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
771
+			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) {
772
+	print 'checked';
773
+}
774
+?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
775
+			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) {
776
+	print 'checked';
777
+}
778
+?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
779
+			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) {
780
+	print 'checked';
781
+}
782
+?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
508 783
 		    <?php
509 784
 			}
510 785
 		    ?>
@@ -512,10 +787,16 @@  discard block
 block discarded – undo
512 787
 			if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) {
513 788
 		    ?>
514 789
 			<?php if (isset($globalSBS1) && $globalSBS1) { ?>
515
-			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) print 'checked'; ?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
790
+			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) {
791
+	print 'checked';
792
+}
793
+?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
516 794
 			<?php } ?>
517 795
 			<?php if (isset($globalAPRS) && $globalAPRS) { ?>
518
-			    <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') || !isset($_COOKIE['ShowAPRS'])) print 'checked'; ?> ><?php echo _("Display APRS data"); ?></label></div></li>
796
+			    <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') || !isset($_COOKIE['ShowAPRS'])) {
797
+	print 'checked';
798
+}
799
+?> ><?php echo _("Display APRS data"); ?></label></div></li>
519 800
 			<?php } ?>
520 801
 		    <?php
521 802
 			}
@@ -532,7 +813,9 @@  discard block
 block discarded – undo
532 813
 				}
533 814
 				foreach($allairlinenames as $airline) {
534 815
 					$airline_name = $airline['airline_name'];
535
-					if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...';
816
+					if (strlen($airline_name) > 30) {
817
+						$airline_name = substr($airline_name,0,30).'...';
818
+					}
536 819
 					if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['filter_Airlines']))) {
537 820
 						echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>';
538 821
 					} else {
@@ -550,7 +833,10 @@  discard block
 block discarded – undo
550 833
 		    <li><?php echo _("Display alliance:"); ?>
551 834
 		    <br/>
552 835
 			<select class="selectpicker" onchange="alliance(this);" id="display_alliance">
553
-			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
836
+			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') {
837
+	echo ' selected';
838
+}
839
+?>><?php echo _("All"); ?></option>
554 840
 			    <?php
555 841
 				foreach($allalliancenames as $alliance) {
556 842
 					$alliance_name = $alliance['alliance'];
@@ -597,10 +883,22 @@  discard block
 block discarded – undo
597 883
 		    ?>
598 884
 		    <li><?php echo _("Display airlines of type:"); ?><br/>
599 885
 			<select class="selectpicker" onchange="airlinestype(this);">
600
-			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
601
-			    <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') echo ' selected'; ?>><?php echo _("Passenger"); ?></option>
602
-			    <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') echo ' selected'; ?>><?php echo _("Cargo"); ?></option>
603
-			    <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') echo ' selected'; ?>><?php echo _("Military"); ?></option>
886
+			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') {
887
+	echo ' selected';
888
+}
889
+?>><?php echo _("All"); ?></option>
890
+			    <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') {
891
+	echo ' selected';
892
+}
893
+?>><?php echo _("Passenger"); ?></option>
894
+			    <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') {
895
+	echo ' selected';
896
+}
897
+?>><?php echo _("Cargo"); ?></option>
898
+			    <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') {
899
+	echo ' selected';
900
+}
901
+?>><?php echo _("Military"); ?></option>
604 902
 			</select>
605 903
 		    </li>
606 904
 		    <?php
@@ -608,7 +906,10 @@  discard block
 block discarded – undo
608 906
 		    ?>
609 907
 		    <li>
610 908
 			<?php echo _("Display flight with ident:"); ?>
611
-			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" />
909
+			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) {
910
+	print $_COOKIE['filter_ident'];
911
+}
912
+?>" />
612 913
 		    </li>
613 914
 		    <?php
614 915
 			}
@@ -627,7 +928,10 @@  discard block
 block discarded – undo
627 928
 	    <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
628 929
 	    <form>
629 930
 		<ul>
630
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if (isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') print 'checked'; ?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li>
931
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if (isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') {
932
+	print 'checked';
933
+}
934
+?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li>
631 935
 		    <li><?php echo _("Type:"); ?>
632 936
 			<select class="selectpicker" multiple onchange="sattypes(this);">
633 937
 			    <?php
@@ -635,25 +939,45 @@  discard block
 block discarded – undo
635 939
 				$types = $Satellite->get_tle_types();
636 940
 				foreach ($types as $type) {
637 941
 					$type_name = $type['tle_type'];
638
-					if ($type_name == 'musson') $type_name = 'Russian LEO Navigation';
639
-					else if ($type_name == 'nnss') $type_name = 'Navi Navigation Satellite System';
640
-					else if ($type_name == 'sbas') $type_name = 'Satellite-Based Augmentation System';
641
-					else if ($type_name == 'glo-ops') $type_name = 'Glonass Operational';
642
-					else if ($type_name == 'gps-ops') $type_name = 'GPS Operational';
643
-					else if ($type_name == 'argos') $type_name = 'ARGOS Data Collection System';
644
-					else if ($type_name == 'tdrss') $type_name = 'Tracking and Data Relay Satellite System';
645
-					else if ($type_name == 'sarsat') $type_name = 'Search & Rescue';
646
-					else if ($type_name == 'dmc') $type_name = 'Disaster Monitoring';
647
-					else if ($type_name == 'resource') $type_name = 'Earth Resources';
648
-					else if ($type_name == 'stations') $type_name = 'Space Stations';
649
-					else if ($type_name == 'geo') $type_name = 'Geostationary';
650
-					else if ($type_name == 'amateur') $type_name = 'Amateur Radio';
651
-					else if ($type_name == 'x-comm') $type_name = 'Experimental';
652
-					else if ($type_name == 'other-comm') $type_name = 'Other Comm';
653
-					else if ($type_name == 'science') $type_name = 'Space & Earth Science';
654
-					else if ($type_name == 'military') $type_name = 'Miscellaneous Military';
655
-					else if ($type_name == 'radar') $type_name = 'Radar Calibration';
656
-					else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches';
942
+					if ($type_name == 'musson') {
943
+						$type_name = 'Russian LEO Navigation';
944
+					} else if ($type_name == 'nnss') {
945
+						$type_name = 'Navi Navigation Satellite System';
946
+					} else if ($type_name == 'sbas') {
947
+						$type_name = 'Satellite-Based Augmentation System';
948
+					} else if ($type_name == 'glo-ops') {
949
+						$type_name = 'Glonass Operational';
950
+					} else if ($type_name == 'gps-ops') {
951
+						$type_name = 'GPS Operational';
952
+					} else if ($type_name == 'argos') {
953
+						$type_name = 'ARGOS Data Collection System';
954
+					} else if ($type_name == 'tdrss') {
955
+						$type_name = 'Tracking and Data Relay Satellite System';
956
+					} else if ($type_name == 'sarsat') {
957
+						$type_name = 'Search & Rescue';
958
+					} else if ($type_name == 'dmc') {
959
+						$type_name = 'Disaster Monitoring';
960
+					} else if ($type_name == 'resource') {
961
+						$type_name = 'Earth Resources';
962
+					} else if ($type_name == 'stations') {
963
+						$type_name = 'Space Stations';
964
+					} else if ($type_name == 'geo') {
965
+						$type_name = 'Geostationary';
966
+					} else if ($type_name == 'amateur') {
967
+						$type_name = 'Amateur Radio';
968
+					} else if ($type_name == 'x-comm') {
969
+						$type_name = 'Experimental';
970
+					} else if ($type_name == 'other-comm') {
971
+						$type_name = 'Other Comm';
972
+					} else if ($type_name == 'science') {
973
+						$type_name = 'Space & Earth Science';
974
+					} else if ($type_name == 'military') {
975
+						$type_name = 'Miscellaneous Military';
976
+					} else if ($type_name == 'radar') {
977
+						$type_name = 'Radar Calibration';
978
+					} else if ($type_name == 'tle-new') {
979
+						$type_name = 'Last 30 days launches';
980
+					}
657 981
 					
658 982
 					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) {
659 983
 						print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>';
Please login to merge, or discard this patch.
Indentation   +94 added lines, -94 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
     <?php }; if (isset($globalSatellite) && $globalSatellite) { ?><td><div id="ibxsatellite"><h4><?php echo _("Satellites Displayed"); ?></h4><br /><i class="fa fa-spinner fa-pulse fa-fw"></i></div></td><?php } ?>
47 47
 </tr></table></div>
48 48
 <?php
49
-    if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
49
+	if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
50 50
 ?>
51 51
 <script src="<?php echo $globalURL; ?>/js/map.3d.js.php"></script>
52 52
 <?php
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 <script src="<?php echo $globalURL; ?>/js/map-marine.3d.js.php"></script>
71 71
 <?php
72 72
 	}
73
-    }
73
+	}
74 74
 ?>
75 75
 
76 76
 <div id="sidebar" class="sidebar collapsed">
@@ -81,34 +81,34 @@  discard block
 block discarded – undo
81 81
 	<li><a href="#" onclick="getUserLocation(); return false;" title="<?php echo _("Plot your Location"); ?>"><i class="fa fa-map-marker"></i></a></li>
82 82
 	<li><a href="#" onclick="getCompassDirection(); return false;" title="<?php echo _("Compass Mode"); ?>"><i class="fa fa-compass"></i></a></li>
83 83
 <?php
84
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
84
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
85 85
 	if (isset($globalArchive) && $globalArchive == TRUE) {
86 86
 ?>
87 87
 	<li><a href="#archive" role="tab" title="<?php echo _("Archive"); ?>"><i class="fa fa-archive"></i></a></li>
88 88
 <?php
89 89
 	}
90
-    }
90
+	}
91 91
 ?>
92 92
 	<li><a href="#home" role="tab" title="<?php echo _("Layers"); ?>"><i class="fa fa-map"></i></a></li>
93 93
 	<li><a href="#filters" role="tab" title="<?php echo _("Filters"); ?>"><i class="fa fa-filter"></i></a></li>
94 94
 	<li><a href="#settings" role="tab" title="<?php echo _("Settings"); ?>"><i class="fa fa-gears"></i></a></li>
95 95
 <?php
96
-    if (isset($globalMap3D) && $globalMap3D) {
96
+	if (isset($globalMap3D) && $globalMap3D) {
97 97
 	if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
98 98
 ?>
99 99
 	<li><a href="#" onclick="show3D(); return false;" role="tab" title="3D"><b>3D</b></a></li>
100 100
 <?php
101
-        } else {
102
-    	    if (isset($globalSatellite) && $globalSatellite) {
101
+		} else {
102
+			if (isset($globalSatellite) && $globalSatellite) {
103 103
 ?>
104 104
 	<li><a href="#satellites" role="tab" title="<?php echo _("Satellites"); ?>"><i class="satellite"></i></a></li>
105 105
 <?php
106
-	    }
106
+		}
107 107
 ?>
108 108
 	<li><a href="#" onclick="show2D(); return false;" role="tab" title="2D"><b>2D</b></a></li>
109 109
 <?php
110 110
 	}
111
-    }
111
+	}
112 112
 ?>
113 113
     </ul>
114 114
 
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 ?>
184 184
         </div>
185 185
 <?php
186
-    if (isset($globalArchive) && $globalArchive == TRUE) {
186
+	if (isset($globalArchive) && $globalArchive == TRUE) {
187 187
 ?>
188 188
         <div class="sidebar-pane" id="archive">
189 189
 	    <h1 class="sidebar-header"><?php echo _("Playback"); ?> <i>Bêta</i><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 	    </form>
244 244
 	</div>
245 245
 <?php
246
-    }
246
+	}
247 247
 ?>
248 248
         <div class="sidebar-pane" id="settings">
249 249
 	    <h1 class="sidebar-header"><?php echo _("Settings"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
@@ -254,56 +254,56 @@  discard block
 block discarded – undo
254 254
 			    <?php
255 255
 				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider;
256 256
 				else $MapType = $_COOKIE['MapType'];
257
-			    ?>
257
+				?>
258 258
 			    <?php
259 259
 				if (isset($globalBingMapKey) && $globalBingMapKey != '') {
260
-			    ?>
260
+				?>
261 261
 			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option>
262 262
 			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option>
263 263
 			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option>
264 264
 			    <?php
265 265
 				}
266
-			    ?>
266
+				?>
267 267
 			    <?php
268
-			        if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
269
-			    ?>
268
+					if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
269
+				?>
270 270
 			    <?php
271
-				    if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
272
-			    ?>
271
+					if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
272
+				?>
273 273
 			    <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option>
274 274
 			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option>
275 275
 			    <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option>
276 276
 			    <?php
277
-				    }
278
-			    ?>
277
+					}
278
+				?>
279 279
 			    <?php
280
-				    if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
281
-			    ?>
280
+					if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
281
+				?>
282 282
 			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option>
283 283
 			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option>
284 284
 			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option>
285 285
 			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option>
286 286
 			    <?php
287
-				    }
288
-			    ?>
287
+					}
288
+				?>
289 289
 			    <?php
290
-				    if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
291
-			    ?>
290
+					if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
291
+				?>
292 292
 			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option>
293 293
 			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option>
294 294
 			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option>
295 295
 			    <?php
296
-				    }
297
-			    ?>
296
+					}
297
+				?>
298 298
 			    <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option>
299 299
 			    <?php
300 300
 				}
301
-			    ?>
301
+				?>
302 302
 			    <?php
303
-				    if (isset($globalMapboxToken) && $globalMapboxToken != '') {
303
+					if (isset($globalMapboxToken) && $globalMapboxToken != '') {
304 304
 					if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default';
305 305
 					else $MapBoxId = $_COOKIE['MapTypeId'];
306
-			    ?>
306
+				?>
307 307
 			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option>
308 308
 			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option>
309 309
 			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option>
@@ -317,13 +317,13 @@  discard block
 block discarded – undo
317 317
 			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option>
318 318
 			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option>
319 319
 			    <?php
320
-				    }
321
-			    ?>
320
+					}
321
+				?>
322 322
 			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option>
323 323
 			</select>
324 324
 		    </li>
325 325
 <?php
326
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
326
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
327 327
 ?>
328 328
 		    <li><?php echo _("Type of Terrain:"); ?>
329 329
 			<select  class="selectpicker" onchange="terrainType(this);">
@@ -334,10 +334,10 @@  discard block
 block discarded – undo
334 334
 			</select>
335 335
 		    </li>
336 336
 <?php
337
-    }
337
+	}
338 338
 ?>
339 339
 <?php
340
-    if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
340
+	if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
341 341
 ?>
342 342
 		    
343 343
 		    <li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') print 'checked'; ?> ><?php echo _("Display flight info as popup"); ?></label></div></li>
@@ -346,89 +346,89 @@  discard block
 block discarded – undo
346 346
 		    <li><div class="checkbox"><label><input type="checkbox" name="flightremainingroute" value="1" onclick="clickFlightRemainingRoute(this)" <?php if ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == 'true') || !isset($_COOKIE['MapRemainingRoute']) || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)) print 'checked'; ?> ><?php echo _("Display flight remaining route on click"); ?></label></div></li>
347 347
 		    <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Planes animate between updates"); ?></label></div></li>
348 348
 <?php
349
-    }
349
+	}
350 350
 ?>
351 351
 		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true' || !isset($_COOKIE['displayairports'])) print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li>
352 352
 		    <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (!isset($globalMapGroundStation) || $globalMapGroundStation === TRUE))) print 'checked'; ?> ><?php echo _("Display ground station on map"); ?></label></div></li>
353 353
 		    <li><div class="checkbox"><label><input type="checkbox" name="displayweatherstation" value="1" onclick="clickDisplayWeatherStation(this)" <?php if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') || (!isset($_COOKIE['show_WeatherStation']) && (!isset($globalMapWeatherStation) || $globalMapWeatherStation === TRUE))) print 'checked'; ?> ><?php echo _("Display weather station on map"); ?></label></div></li>
354 354
 		    <li><div class="checkbox"><label><input type="checkbox" name="displaylightning" value="1" onclick="clickDisplayLightning(this)" <?php if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') || (!isset($_COOKIE['show_Lightning']) && (!isset($globalMapLightning) || $globalMapLightning === TRUE))) print 'checked'; ?> ><?php echo _("Display lightning on map"); ?></label></div></li>
355 355
 <?php
356
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
356
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
357 357
 ?>
358 358
 		    <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) print 'checked'; ?> ><?php echo _("Show mini-map"); ?></label></div></li>
359 359
 <?php
360
-    }
361
-    if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
360
+	}
361
+	if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
362 362
 ?>
363 363
 		    <li><div class="checkbox"><label><input type="checkbox" name="displaysanta" value="1" onclick="clickSanta(this)"><i class="fa fa-snowflake-o" aria-hidden="true"></i> <?php echo _("Show Santa Claus now"); ?> <i class="fa fa-snowflake-o" aria-hidden="true"></i></label></div></li>
364 364
 <?php
365
-    }
365
+	}
366 366
 ?>
367 367
 
368 368
 		    <?php
369 369
 			if (function_exists('array_column')) {
370
-			    if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
371
-		    ?>
370
+				if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
371
+			?>
372 372
 		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
373 373
 		    <?php
374
-			    }
374
+				}
375 375
 			} elseif (isset($globalSources)) {
376
-			    $dispolar = false;
377
-			    foreach ($globalSources as $testsource) {
378
-			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
379
-			    }
380
-			    if ($dispolar) {
381
-		    ?>
376
+				$dispolar = false;
377
+				foreach ($globalSources as $testsource) {
378
+					if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
379
+				}
380
+				if ($dispolar) {
381
+			?>
382 382
 		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
383 383
 		    <?php
384
-			    }
385
-		        }
386
-		    ?>
384
+				}
385
+				}
386
+			?>
387 387
 <?php
388
-    if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
388
+	if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
389 389
 ?>
390 390
 
391 391
 		    <?php
392 392
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
393
-		    	    if (extension_loaded('gd') && function_exists('gd_info')) {
394
-		    ?>
393
+					if (extension_loaded('gd') && function_exists('gd_info')) {
394
+			?>
395 395
 		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') print 'checked'; ?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
396 396
 		    <?php 
397 397
 				if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') {
398
-		    ?>
398
+			?>
399 399
 		    <li><?php echo _("Aircraft icon color:"); ?>
400 400
 			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print '1a3151'; ?>">
401 401
 		    </li>
402 402
 		    <?php
403 403
 				}
404
-			    }
405
-		        }
406
-		    ?>
404
+				}
405
+				}
406
+			?>
407 407
 		    <?php
408 408
 			if (isset($globalMarine) && $globalMarine === TRUE) {
409
-			    if (extension_loaded('gd') && function_exists('gd_info')) {
410
-		    ?>
409
+				if (extension_loaded('gd') && function_exists('gd_info')) {
410
+			?>
411 411
 		    <li><?php echo _("Marine icon color:"); ?>
412 412
 			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print '1a3151'; ?>">
413 413
 		    </li>
414 414
 		    <?php
415
-			    }
416
-		        }
417
-		    ?>
415
+				}
416
+				}
417
+			?>
418 418
 		    <?php
419 419
 			if (isset($globalTracker) && $globalTracker === TRUE) {
420
-			    if (extension_loaded('gd') && function_exists('gd_info')) {
421
-		    ?>
420
+				if (extension_loaded('gd') && function_exists('gd_info')) {
421
+			?>
422 422
 		    <li><?php echo _("Tracker icon color:"); ?>
423 423
 			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) print $_COOKIE['TrackerIconColor']; elseif (isset($globalTrackerIconColor)) print $globalTrackerIconColor; else print '1a3151'; ?>">
424 424
 		    </li>
425 425
 		    <?php
426
-			    }
427
-		        }
428
-		    ?>
426
+				}
427
+				}
428
+			?>
429 429
 		    <?php
430 430
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
431
-		    ?>
431
+			?>
432 432
 		    <li><?php echo _("Show airport icon at zoom level:"); ?>
433 433
 			<div class="range">
434 434
 			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?>">
@@ -437,9 +437,9 @@  discard block
 block discarded – undo
437 437
 		    </li>
438 438
 		    <?php
439 439
 			}
440
-		    ?>
440
+			?>
441 441
 <?php
442
-    } elseif (isset($_COOKIE['MapFormat']) || $_COOKIE['MapFOrmat'] == '3d') {
442
+	} elseif (isset($_COOKIE['MapFormat']) || $_COOKIE['MapFOrmat'] == '3d') {
443 443
 ?>
444 444
 <?php
445 445
 	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
 		    </li>
471 471
 <?php
472 472
 	}
473
-    }
473
+	}
474 474
 ?>
475 475
 		    <li><?php echo _("Distance unit:"); ?>
476 476
 			<select class="selectpicker" onchange="unitdistance(this);">
@@ -503,19 +503,19 @@  discard block
 block discarded – undo
503 503
 		    <ul>
504 504
 		    <?php
505 505
 			if (!isset($globalAircraft) || $globalAircraft) {
506
-		    ?>
506
+			?>
507 507
 		    <?php
508 508
 			if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) {
509
-		    ?>
509
+			?>
510 510
 			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) print 'checked'; ?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
511 511
 			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) print 'checked'; ?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
512 512
 			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) print 'checked'; ?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
513 513
 		    <?php
514 514
 			}
515
-		    ?>
515
+			?>
516 516
 		    <?php
517 517
 			if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) {
518
-		    ?>
518
+			?>
519 519
 			<?php if (isset($globalSBS1) && $globalSBS1) { ?>
520 520
 			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) print 'checked'; ?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
521 521
 			<?php } ?>
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
 			<?php } ?>
525 525
 		    <?php
526 526
 			}
527
-		    ?>
527
+			?>
528 528
 		    <li><?php echo _("Display airlines:"); ?>
529 529
 		    <br/>
530 530
 			<select class="selectpicker" multiple onchange="airlines(this);" id="display_airlines">
@@ -544,14 +544,14 @@  discard block
 block discarded – undo
544 544
 						echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>';
545 545
 					}
546 546
 				}
547
-			    ?>
547
+				?>
548 548
 			</select>
549 549
 		    </li>
550 550
 		    <?php
551 551
 			$Spotter = new Spotter();
552 552
 			$allalliancenames = $Spotter->getAllAllianceNames();
553 553
 			if (!empty($allalliancenames)) {
554
-		    ?>
554
+			?>
555 555
 		    <li><?php echo _("Display alliance:"); ?>
556 556
 		    <br/>
557 557
 			<select class="selectpicker" onchange="alliance(this);" id="display_alliance">
@@ -565,18 +565,18 @@  discard block
 block discarded – undo
565 565
 						echo '<option value="'.$alliance_name.'">'.$alliance_name.'</option>';
566 566
 					}
567 567
 				}
568
-			    ?>
568
+				?>
569 569
 			</select>
570 570
 		    </li>
571 571
 		    <?php
572 572
 			}
573
-		    ?>
573
+			?>
574 574
 		    <?php
575 575
 			}
576
-		    ?>
576
+			?>
577 577
 		    <?php
578 578
 			if (isset($globalAPRS) && $globalAPRS) {
579
-		    ?>
579
+			?>
580 580
 		    <li><?php echo _("Display APRS sources name:"); ?>
581 581
 			<select class="selectpicker" multiple onchange="sources(this);">
582 582
 			    <?php
@@ -588,18 +588,18 @@  discard block
 block discarded – undo
588 588
 						echo '<option value="'.$source['source_name'].'">'.$source['source_name'].'</option>';
589 589
 					}
590 590
 				}
591
-			    ?>
591
+				?>
592 592
 			</select>
593 593
 		    </li>
594 594
 		    <?php
595 595
 			}
596
-		    ?>
596
+			?>
597 597
 		    <?php
598 598
 			if (!isset($globalAircraft) && $globalAircraft) {
599
-		    ?>
599
+			?>
600 600
 		    <?php
601 601
 			if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS)) {
602
-		    ?>
602
+			?>
603 603
 		    <li><?php echo _("Display airlines of type:"); ?><br/>
604 604
 			<select class="selectpicker" onchange="airlinestype(this);">
605 605
 			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
@@ -610,14 +610,14 @@  discard block
 block discarded – undo
610 610
 		    </li>
611 611
 		    <?php
612 612
 			}
613
-		    ?>
613
+			?>
614 614
 		    <li>
615 615
 			<?php echo _("Display flight with ident:"); ?>
616 616
 			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" />
617 617
 		    </li>
618 618
 		    <?php
619 619
 			}
620
-		    ?>
620
+			?>
621 621
 		</ul>
622 622
 	    </form>
623 623
 	    <form method="post">
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
626 626
 	    </form>
627 627
     	</div>
628 628
 <?php
629
-    if (isset($globalSatellite) && $globalSatellite && isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
629
+	if (isset($globalSatellite) && $globalSatellite && isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
630 630
 ?>
631 631
         <div class="sidebar-pane" id="satellites">
632 632
 	    <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
@@ -666,14 +666,14 @@  discard block
 block discarded – undo
666 666
 						print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>';
667 667
 					}
668 668
 				}
669
-			    ?>
669
+				?>
670 670
 			</select>
671 671
 		    </li>
672 672
 		</ul>
673 673
 	    </form>
674 674
 	</div>
675 675
 <?php
676
-    }
676
+	}
677 677
 ?>
678 678
     </div>
679 679
 </div>
Please login to merge, or discard this patch.
import/callback.php 2 patches
Braces   +39 added lines, -13 removed lines patch added patch discarded remove patch
@@ -27,15 +27,21 @@  discard block
 block discarded – undo
27 27
 		}
28 28
 	}
29 29
 }
30
-if ($authorize === false) die;
30
+if ($authorize === false) {
31
+	die;
32
+}
31 33
 
32
-if (isset($globalTracker) && $globalTracker) require_once(dirname(__FILE__).'/../require/class.TrackerImport.php');
34
+if (isset($globalTracker) && $globalTracker) {
35
+	require_once(dirname(__FILE__).'/../require/class.TrackerImport.php');
36
+}
33 37
 if (isset($globalMarine) && $globalMarine) {
34 38
 	require_once(dirname(__FILE__).'/../require/class.AIS.php');
35 39
 	require_once(dirname(__FILE__).'/../require/class.MarineImport.php');
36 40
 }
37 41
 
38
-if (!isset($globalDebug)) $globalDebug = FALSE;
42
+if (!isset($globalDebug)) {
43
+	$globalDebug = FALSE;
44
+}
39 45
 
40 46
 // Check if schema is at latest version
41 47
 $Connection = new Connection();
@@ -45,10 +51,16 @@  discard block
 block discarded – undo
45 51
 }
46 52
 
47 53
 if (isset($globalServer) && $globalServer) {
48
-	if ($globalDebug) echo "Using Server Mode\n";
54
+	if ($globalDebug) {
55
+		echo "Using Server Mode\n";
56
+	}
49 57
 	$SI=new SpotterServer();
50
-} else $SI=new SpotterImport($Connection->db);
51
-if (isset($globalTracker) && $globalTracker) $TI = new TrackerImport($Connection->db);
58
+} else {
59
+	$SI=new SpotterImport($Connection->db);
60
+}
61
+if (isset($globalTracker) && $globalTracker) {
62
+	$TI = new TrackerImport($Connection->db);
63
+}
52 64
 if (isset($globalMarine) && $globalMarine) {
53 65
 	$AIS = new AIS();
54 66
 	$MI = new MarineImport($Connection->db);
@@ -57,7 +69,9 @@  discard block
 block discarded – undo
57 69
 date_default_timezone_set('UTC');
58 70
 
59 71
 $buffer = '';
60
-if (isset($_POST)) $buffer = $_POST;
72
+if (isset($_POST)) {
73
+	$buffer = $_POST;
74
+}
61 75
 $data = array();
62 76
 if (isset($buffer['type_event']) && isset($buffer['lat']) && isset($buffer['lon'])) {
63 77
 	$data['ident'] = $buffer['device_id'];
@@ -68,15 +82,27 @@  discard block
 block discarded – undo
68 82
 	//$data['heading'] = $buffer['cap']; // Only N/S/E/W
69 83
 	$data['datetime'] = date('Y-m-d H:i:s',$buffer['timestamp']);
70 84
 	$data['comment'] = '';
71
-	if (isset($buffer['battery']) && $buffer['battery'] != '') $data['comment'] .= 'Battery: '.$buffer['battery'].'% ';
85
+	if (isset($buffer['battery']) && $buffer['battery'] != '') {
86
+		$data['comment'] .= 'Battery: '.$buffer['battery'].'% ';
87
+	}
72 88
 	//if (isset($buffer['snr']) && $buffer['snr'] != '') $data['comment'] .= 'SNR: '.$buffer['snr'].' ';
73
-	if (isset($buffer['temp']) && $buffer['temp'] != '') $data['comment'] .= 'Temperature: '.$buffer['temp'].'°C ';
74
-	if (isset($buffer['press']) && $buffer['press'] != '') $data['comment'] .= 'Pressure: '.$buffer['press'].'hPa ';
89
+	if (isset($buffer['temp']) && $buffer['temp'] != '') {
90
+		$data['comment'] .= 'Temperature: '.$buffer['temp'].'°C ';
91
+	}
92
+	if (isset($buffer['press']) && $buffer['press'] != '') {
93
+		$data['comment'] .= 'Pressure: '.$buffer['press'].'hPa ';
94
+	}
75 95
 	$TI->add($data);
76 96
 	unset($data);
77 97
 }
78
-if (isset($SI)) $SI->checkAll();
79
-if (isset($MI)) $MI->checkAll();
80
-if (isset($TI)) $TI->checkAll();
98
+if (isset($SI)) {
99
+	$SI->checkAll();
100
+}
101
+if (isset($MI)) {
102
+	$MI->checkAll();
103
+}
104
+if (isset($TI)) {
105
+	$TI->checkAll();
106
+}
81 107
 
82 108
 ?>
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 require_once(dirname(__FILE__).'/../require/class.Source.php');
10 10
 require_once(dirname(__FILE__).'/../require/class.Connection.php');
11 11
 require_once(dirname(__FILE__).'/../require/class.Common.php');
12
-$Common=new Common();
12
+$Common = new Common();
13 13
 $authorize = false;
14 14
 $params = array();
15 15
 $userip = $Common->getUserIP();
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 			$authorize = true;
21 21
 			break;
22 22
 		}
23
-		if ($userip != '' && isset($cb['host']) && in_array($userip,explode(',',$cb['host']))) {
23
+		if ($userip != '' && isset($cb['host']) && in_array($userip, explode(',', $cb['host']))) {
24 24
 			$params = $globalSources[$key];
25 25
 			$authorize = true;
26 26
 			break;
@@ -46,14 +46,14 @@  discard block
 block discarded – undo
46 46
 
47 47
 if (isset($globalServer) && $globalServer) {
48 48
 	if ($globalDebug) echo "Using Server Mode\n";
49
-	$SI=new SpotterServer();
50
-} else $SI=new SpotterImport($Connection->db);
49
+	$SI = new SpotterServer();
50
+} else $SI = new SpotterImport($Connection->db);
51 51
 if (isset($globalTracker) && $globalTracker) $TI = new TrackerImport($Connection->db);
52 52
 if (isset($globalMarine) && $globalMarine) {
53 53
 	$AIS = new AIS();
54 54
 	$MI = new MarineImport($Connection->db);
55 55
 }
56
-$Source=new Source($Connection->db);
56
+$Source = new Source($Connection->db);
57 57
 date_default_timezone_set('UTC');
58 58
 
59 59
 $buffer = '';
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 	$data['altitude'] = round($buffer['altitude']*3.28084);
67 67
 	$data['speed'] = $buffer['speed'];
68 68
 	//$data['heading'] = $buffer['cap']; // Only N/S/E/W
69
-	$data['datetime'] = date('Y-m-d H:i:s',$buffer['timestamp']);
69
+	$data['datetime'] = date('Y-m-d H:i:s', $buffer['timestamp']);
70 70
 	$data['comment'] = '';
71 71
 	if (isset($buffer['battery']) && $buffer['battery'] != '') $data['comment'] .= 'Battery: '.$buffer['battery'].'% ';
72 72
 	//if (isset($buffer['snr']) && $buffer['snr'] != '') $data['comment'] .= 'SNR: '.$buffer['snr'].' ';
Please login to merge, or discard this patch.
require/class.APRS.php 4 patches
Doc Comments   +7 added lines patch added patch discarded remove patch
@@ -165,6 +165,10 @@  discard block
 block discarded – undo
165 165
 	'\~' => 'TNC Stream SW');
166 166
 	
167 167
 
168
+    /**
169
+     * @param integer $n
170
+     * @param integer $s
171
+     */
168 172
     private function urshift($n, $s) {
169 173
 	return ($n >= 0) ? ($n >> $s) :
170 174
 	    (($n & 0x7fffffff) >> $s) | 
@@ -565,6 +569,9 @@  discard block
 block discarded – undo
565 569
 	socket_close($this->socket);
566 570
     }
567 571
     
572
+    /**
573
+     * @param string $data
574
+     */
568 575
     public function send($data) {
569 576
 	global $globalDebug;
570 577
 	if ($this->connected === false) $this->connect();
Please login to merge, or discard this patch.
Indentation   +165 added lines, -165 removed lines patch added patch discarded remove patch
@@ -3,10 +3,10 @@  discard block
 block discarded – undo
3 3
 require_once(dirname(__FILE__).'/class.Common.php');
4 4
 require_once(dirname(__FILE__).'/class.GeoidHeight.php');
5 5
 class aprs {
6
-    private $socket;
7
-    private $connected = false;
6
+	private $socket;
7
+	private $connected = false;
8 8
 
9
-    protected $symbols = array('/!' => 'Police',
9
+	protected $symbols = array('/!' => 'Police',
10 10
 	'/#' => 'DIGI',
11 11
 	'/$' => 'Phone',
12 12
 	'/%' => 'DX Cluster',
@@ -166,13 +166,13 @@  discard block
 block discarded – undo
166 166
 	'\~' => 'TNC Stream SW');
167 167
 	
168 168
 
169
-    private function urshift($n, $s) {
169
+	private function urshift($n, $s) {
170 170
 	return ($n >= 0) ? ($n >> $s) :
171
-	    (($n & 0x7fffffff) >> $s) | 
171
+		(($n & 0x7fffffff) >> $s) | 
172 172
 		(0x40000000 >> ($s - 1));
173
-    }
173
+	}
174 174
 
175
-    public function parse($input) {
175
+	public function parse($input) {
176 176
 	global $globalDebug;
177 177
 	$debug = false;
178 178
 	$result = array();
@@ -184,8 +184,8 @@  discard block
 block discarded – undo
184 184
 	
185 185
 	/* Check that end was found and body has at least one byte. */
186 186
 	if ($splitpos == 0 || $splitpos + 1 == $input_len || $splitpos === FALSE) {
187
-	    if ($globalDebug) echo '!!! APRS invalid : '.$input."\n";
188
-	    return false;
187
+		if ($globalDebug) echo '!!! APRS invalid : '.$input."\n";
188
+		return false;
189 189
 	}
190 190
 	
191 191
 	if ($debug) echo 'input : '.$input."\n";
@@ -199,34 +199,34 @@  discard block
 block discarded – undo
199 199
 	/* Parse source, target and path. */
200 200
 	//FLRDF0A52>APRS,qAS,LSTB
201 201
 	if (preg_match('/^([A-Z0-9\\-]{1,9})>(.*)$/',$header,$matches)) {
202
-	    $ident = $matches[1];
203
-	    $all_elements = $matches[2];
204
-	    if ($ident == 'AIRCRAFT') {
202
+		$ident = $matches[1];
203
+		$all_elements = $matches[2];
204
+		if ($ident == 'AIRCRAFT') {
205 205
 		$result['format_source'] = 'famaprs';
206 206
 		$result['source_type'] = 'modes';
207
-	    } elseif ($ident == 'MARINE') {
207
+		} elseif ($ident == 'MARINE') {
208 208
 		$result['format_source'] = 'famaprs';
209 209
 		$result['source_type'] = 'ais';
210
-	    } else {
210
+		} else {
211 211
 		if ($debug) echo 'ident : '.$ident."\n";
212 212
 		$result['ident'] = $ident;
213
-	    }
213
+		}
214 214
 	} else {
215
-	    if ($debug) 'No ident'."\n";
216
-	    return false;
215
+		if ($debug) 'No ident'."\n";
216
+		return false;
217 217
 	}
218 218
 	$elements = explode(',',$all_elements);
219 219
 	$source = end($elements);
220 220
 	$result['source'] = $source;
221 221
 	foreach ($elements as $element) {
222
-	    if (preg_match('/^([a-zA-Z0-9-]{1,9})([*]?)$/',$element)) {
223
-	        //echo "ok";
224
-	        //if ($element == 'TCPIP*') return false;
225
-	    } elseif (!preg_match('/^([0-9A-F]{32})$/',$element)) {
222
+		if (preg_match('/^([a-zA-Z0-9-]{1,9})([*]?)$/',$element)) {
223
+			//echo "ok";
224
+			//if ($element == 'TCPIP*') return false;
225
+		} elseif (!preg_match('/^([0-9A-F]{32})$/',$element)) {
226 226
 		if ($debug) echo 'element : '.$element."\n";
227 227
 		return false;
228
-	    }
229
-	    /*
228
+		}
229
+		/*
230 230
 	    } elseif (preg_match('/^([0-9A-F]{32})$/',$element)) {
231 231
 		//echo "ok";
232 232
 	    } else {
@@ -253,48 +253,48 @@  discard block
 block discarded – undo
253 253
 	$body_parse = substr($body,1);
254 254
 	//echo 'Body : '.$body."\n";
255 255
 	if (preg_match('/^;(.){9}\*/',$body,$matches)) {
256
-	    $body_parse = substr($body_parse,10);
257
-	    $find = true;
258
-	    //echo $body_parse."\n";
256
+		$body_parse = substr($body_parse,10);
257
+		$find = true;
258
+		//echo $body_parse."\n";
259 259
 	}
260 260
 	if (preg_match('/^`(.*)\//',$body,$matches)) {
261
-	    $body_parse = substr($body_parse,strlen($matches[1])-1);
262
-	    $find = true;
263
-	    //echo $body_parse."\n";
261
+		$body_parse = substr($body_parse,strlen($matches[1])-1);
262
+		$find = true;
263
+		//echo $body_parse."\n";
264 264
 	}
265 265
 	if (preg_match("/^'(.*)\//",$body,$matches)) {
266
-	    $body_parse = substr($body_parse,strlen($matches[1])-1);
267
-	    $find = true;
268
-	    //echo $body_parse."\n";
266
+		$body_parse = substr($body_parse,strlen($matches[1])-1);
267
+		$find = true;
268
+		//echo $body_parse."\n";
269 269
 	}
270 270
 	if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([zh\\/])/',$body_parse,$matches)) {
271
-	    $find = true;
272
-	    //print_r($matches);
273
-	    $timestamp = $matches[0];
274
-	    if ($matches[4] == 'h') {
271
+		$find = true;
272
+		//print_r($matches);
273
+		$timestamp = $matches[0];
274
+		if ($matches[4] == 'h') {
275 275
 		$timestamp = strtotime(date('Ymd').' '.$matches[1].':'.$matches[2].':'.$matches[3]);
276 276
 		//echo 'timestamp : '.$timestamp.' - now : '.time()."\n";
277 277
 		/*
278 278
 		if (time() + 3900 < $timestamp) $timestamp -= 86400;
279 279
 		elseif (time() - 82500 > $timestamp) $timestamp += 86400;
280 280
 		*/
281
-	    } elseif ($matches[4] == 'z' || $matches[4] == '/') {
281
+		} elseif ($matches[4] == 'z' || $matches[4] == '/') {
282 282
 		// This work or not ?
283 283
 		$timestamp = strtotime(date('Ym').$matches[1].' '.$matches[2].':'.$matches[3]);
284
-	    }
285
-	    $body_parse = substr($body_parse,7);
286
-	    $result['timestamp'] = $timestamp;
287
-	    //echo date('Ymd H:i:s',$timestamp);
284
+		}
285
+		$body_parse = substr($body_parse,7);
286
+		$result['timestamp'] = $timestamp;
287
+		//echo date('Ymd H:i:s',$timestamp);
288 288
 	}
289 289
 	if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})/',$body_parse,$matches)) {
290
-	    $find = true;
291
-	    $timestamp = strtotime(date('Y').$matches[1].$matches[2].' '.$matches[3].':'.$matches[4]);
292
-	    $body_parse = substr($body_parse,8);
293
-	    $result['timestamp'] = $timestamp;
294
-	    //echo date('Ymd H:i:s',$timestamp);
290
+		$find = true;
291
+		$timestamp = strtotime(date('Y').$matches[1].$matches[2].' '.$matches[3].':'.$matches[4]);
292
+		$body_parse = substr($body_parse,8);
293
+		$result['timestamp'] = $timestamp;
294
+		//echo date('Ymd H:i:s',$timestamp);
295 295
 	}
296 296
 	//if (strlen($body_parse) > 19) {
297
-	    if (preg_match('/^([0-9]{2})([0-7 ][0-9 ]\\.[0-9 ]{2})([NnSs])(.)([0-9]{3})([0-7 ][0-9 ]\\.[0-9 ]{2})([EeWw])(.)/',$body_parse,$matches)) {
297
+		if (preg_match('/^([0-9]{2})([0-7 ][0-9 ]\\.[0-9 ]{2})([NnSs])(.)([0-9]{3})([0-7 ][0-9 ]\\.[0-9 ]{2})([EeWw])(.)/',$body_parse,$matches)) {
298 298
 		$find = true;
299 299
 		// 4658.70N/00707.78Ez
300 300
 		//print_r(str_split($body_parse));
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 		$lon = intval($lon_deg);
314 314
 		if ($lat > 89 || $lon > 179) return false;
315 315
 	    
316
-	    /*
316
+		/*
317 317
 	    $tmp_5b = str_replace('.','',$lat_min);
318 318
 	    if (preg_match('/^([0-9]{0,4})( {0,4})$/',$tmp_5b,$matches)) {
319 319
 	        print_r($matches);
@@ -327,9 +327,9 @@  discard block
 block discarded – undo
327 327
 		$result['longitude'] = $longitude;
328 328
 		$body_parse = substr($body_parse,18);
329 329
 		$body_parse_len = strlen($body_parse);
330
-	    }
331
-	    $body_parse_len = strlen($body_parse);
332
-	    if ($body_parse_len > 0) {
330
+		}
331
+		$body_parse_len = strlen($body_parse);
332
+		if ($body_parse_len > 0) {
333 333
 		/*
334 334
 		if (!isset($result['timestamp']) && !isset($result['latitude'])) {
335 335
 			$body_split = str_split($body);
@@ -363,95 +363,95 @@  discard block
 block discarded – undo
363 363
 			if (isset($this->symbols[$symbol_code])) $result['symbol'] = $this->symbols[$symbol_code];
364 364
 			if ($symbol_code != '_') {
365 365
 			}
366
-		    //$body_parse = substr($body_parse,1);
367
-		    //$body_parse = trim($body_parse);
368
-		    //$body_parse_len = strlen($body_parse);
369
-		    if ($body_parse_len >= 7) {
366
+			//$body_parse = substr($body_parse,1);
367
+			//$body_parse = trim($body_parse);
368
+			//$body_parse_len = strlen($body_parse);
369
+			if ($body_parse_len >= 7) {
370 370
 			
371
-		        if (preg_match('/^([0-9\\. ]{3})\\/([0-9\\. ]{3})/',$body_parse)) {
372
-		    	    $course = substr($body_parse,0,3);
373
-		    	    $tmp_s = intval($course);
374
-		    	    if ($tmp_s >= 1 && $tmp_s <= 360) $result['heading'] = intval($course);
375
-		    	    $speed = substr($body_parse,4,3);
376
-		    	    if ($speed != '...') {
377
-		    		//$result['speed'] = round($speed*1.852);
378
-		    		$result['speed'] = intval($speed);
379
-		    	    }
380
-		    	    $body_parse = substr($body_parse,7);
381
-		        }
382
-		        // Check PHGR, PHG, RNG
383
-		    } 
384
-		    /*
371
+				if (preg_match('/^([0-9\\. ]{3})\\/([0-9\\. ]{3})/',$body_parse)) {
372
+					$course = substr($body_parse,0,3);
373
+					$tmp_s = intval($course);
374
+					if ($tmp_s >= 1 && $tmp_s <= 360) $result['heading'] = intval($course);
375
+					$speed = substr($body_parse,4,3);
376
+					if ($speed != '...') {
377
+					//$result['speed'] = round($speed*1.852);
378
+					$result['speed'] = intval($speed);
379
+					}
380
+					$body_parse = substr($body_parse,7);
381
+				}
382
+				// Check PHGR, PHG, RNG
383
+			} 
384
+			/*
385 385
 		    else if ($body_parse_len > 0) {
386 386
 			$rest = $body_parse;
387 387
 		    }
388 388
 		    */
389
-		    if (strlen($body_parse) > 0) {
390
-		        if (preg_match('/\\/A=(-[0-9]{5}|[0-9]{6})/',$body_parse,$matches)) {
391
-		            $altitude = intval($matches[1]);
392
-		            //$result['altitude'] = round($altitude*0.3048);
393
-		            $result['altitude'] = $altitude;
394
-		            //$body_parse = trim(substr($body_parse,strlen($matches[0])));
395
-		            $body_parse = trim(preg_replace('/\\/A=(-[0-9]{5}|[0-9]{6})/','',$body_parse));
396
-		        }
397
-		    }
389
+			if (strlen($body_parse) > 0) {
390
+				if (preg_match('/\\/A=(-[0-9]{5}|[0-9]{6})/',$body_parse,$matches)) {
391
+					$altitude = intval($matches[1]);
392
+					//$result['altitude'] = round($altitude*0.3048);
393
+					$result['altitude'] = $altitude;
394
+					//$body_parse = trim(substr($body_parse,strlen($matches[0])));
395
+					$body_parse = trim(preg_replace('/\\/A=(-[0-9]{5}|[0-9]{6})/','',$body_parse));
396
+				}
397
+			}
398 398
 		    
399
-		    // Telemetry
400
-		    /*
399
+			// Telemetry
400
+			/*
401 401
 		    if (preg_match('/^([0-9]+),(-?)([0-9]{1,6}|[0-9]+\\.[0-9]+|\\.[0-9]+)?,(-?)([0-9]{1,6}|[0-9]+\\.[0-9]+|\\.[0-9]+)?,(-?)([0-9]{1,6}|[0-9]+\\.[0-9]+|\\.[0-9]+)?,(-?)([0-9]{1,6}|[0-9]+\\.[0-9]+|\\.[0-9]+)?,(-?)([0-9]{1,6}|[0-9]+\\.[0-9]+|\\.[0-9]+)?,([01]{0,8})/',$body_parse,$matches)) {
402 402
 		        // Nothing yet...
403 403
 		    }
404 404
 		    */
405
-		    // DAO
405
+			// DAO
406 406
 		    
407
-		    if (preg_match('/^!([0-9A-Z]{3})/',$body_parse,$matches)) {
407
+			if (preg_match('/^!([0-9A-Z]{3})/',$body_parse,$matches)) {
408 408
 			    
409
-			    $dao = $matches[1];
410
-			    if (preg_match('/^([A-Z])([0-9]{2})/',$dao)) {
409
+				$dao = $matches[1];
410
+				if (preg_match('/^([A-Z])([0-9]{2})/',$dao)) {
411 411
 				$dao_split = str_split($dao);
412
-			        $lat_off = (($dao_split[1])-48.0)*0.001/60.0;
413
-			        $lon_off = (($dao_split[2])-48.0)*0.001/60.0;
412
+					$lat_off = (($dao_split[1])-48.0)*0.001/60.0;
413
+					$lon_off = (($dao_split[2])-48.0)*0.001/60.0;
414 414
 			    
415 415
 				if ($result['latitude'] < 0) $result['latitude'] -= $lat_off;
416 416
 				else $result['latitude'] += $lat_off;
417 417
 				if ($result['longitude'] < 0) $result['longitude'] -= $lon_off;
418 418
 				else $result['longitude'] += $lon_off;
419
-			    }
419
+				}
420 420
 			    
421
-		            $body_parse = substr($body_parse,6);
422
-		    }
421
+					$body_parse = substr($body_parse,6);
422
+			}
423 423
 		    
424
-		    if (preg_match('/CS=([0-9A-Z_]*)/',$body_parse,$matches)) {
424
+			if (preg_match('/CS=([0-9A-Z_]*)/',$body_parse,$matches)) {
425 425
 			$result['ident'] = str_replace('_',' ',$matches[1]);
426
-		    }
427
-		    if (preg_match('/SQ=([0-9]{4})/',$body_parse,$matches)) {
426
+			}
427
+			if (preg_match('/SQ=([0-9]{4})/',$body_parse,$matches)) {
428 428
 			$result['squawk'] = $matches[1];
429
-		    }
430
-		    if (preg_match('/AI=([0-9A-Z]{4})/',$body_parse,$matches)) {
429
+			}
430
+			if (preg_match('/AI=([0-9A-Z]{4})/',$body_parse,$matches)) {
431 431
 			$result['aircraft_icao'] = $matches[1];
432
-		    }
433
-		    if (preg_match('/VR=([0-9]*)/',$body_parse,$matches)) {
432
+			}
433
+			if (preg_match('/VR=([0-9]*)/',$body_parse,$matches)) {
434 434
 			$result['verticalrate'] = $matches[1];
435
-		    }
436
-		    if (preg_match('/TI=([0-9]*)/',$body_parse,$matches)) {
435
+			}
436
+			if (preg_match('/TI=([0-9]*)/',$body_parse,$matches)) {
437 437
 			$result['typeid'] = $matches[1];
438
-		    }
439
-		    if (preg_match('/SI=([0-9]*)/',$body_parse,$matches)) {
438
+			}
439
+			if (preg_match('/SI=([0-9]*)/',$body_parse,$matches)) {
440 440
 			$result['statusid'] = $matches[1];
441
-		    }
442
-		    if (preg_match('/IMO=([0-9]{7})/',$body_parse,$matches)) {
441
+			}
442
+			if (preg_match('/IMO=([0-9]{7})/',$body_parse,$matches)) {
443 443
 			$result['imo'] = $matches[1];
444
-		    }
445
-		    if (preg_match('/AD=([0-9]*)/',$body_parse,$matches)) {
444
+			}
445
+			if (preg_match('/AD=([0-9]*)/',$body_parse,$matches)) {
446 446
 			$result['arrival_date'] = $matches[1];
447
-		    }
448
-		    if (preg_match('/AC=([0-9A-Z_]*)/',$body_parse,$matches)) {
447
+			}
448
+			if (preg_match('/AC=([0-9A-Z_]*)/',$body_parse,$matches)) {
449 449
 			$result['arrival_code'] = str_replace('_',' ',$matches[1]);
450
-		    }
451
-		    // OGN comment
450
+			}
451
+			// OGN comment
452 452
 		   // echo "Before OGN : ".$body_parse."\n";
453
-		    //if (preg_match('/^id([0-9A-F]{8}) ([+-])([0-9]{3,4})fpm ([+-])([0-9.]{3,4})rot (.*)$/',$body_parse,$matches)) {
454
-		    if (preg_match('/^id([0-9A-F]{8})/',$body_parse,$matches)) {
453
+			//if (preg_match('/^id([0-9A-F]{8}) ([+-])([0-9]{3,4})fpm ([+-])([0-9.]{3,4})rot (.*)$/',$body_parse,$matches)) {
454
+			if (preg_match('/^id([0-9A-F]{8})/',$body_parse,$matches)) {
455 455
 			$id = $matches[1];
456 456
 			//$mode = substr($id,0,2);
457 457
 			$address = substr($id,2);
@@ -481,42 +481,42 @@  discard block
 block discarded – undo
481 481
 			$stealth = (intval(substr($id,0,2), 16) & 0b10000000) != 0;
482 482
 			$result['stealth'] = $stealth;
483 483
 			$result['address'] = $address;
484
-		    }
484
+			}
485 485
 		    
486
-		    //Comment
487
-		    $result['comment'] = trim($body_parse);
486
+			//Comment
487
+			$result['comment'] = trim($body_parse);
488 488
 		//} else {
489
-		    // parse weather
490
-		    //$body_parse = substr($body_parse,1);
491
-		    //$body_parse_len = strlen($body_parse);
492
-		    //echo 'weather'."\n";
493
-		    if (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
494
-			    $result['wind_dir'] = intval($matches[1]);
495
-			    $result['wind_speed'] = round(intval($matches[2])*1.60934,1);
496
-			    $result['wind_gust'] = round(intval($matches[3])*1.60934,1);
497
-			    $result['temp'] = round(5/9*((intval($matches[4]))-32),1);
498
-		    	    $body_parse = substr($body_parse,strlen($matches[0])+1);
499
-		    } elseif (preg_match('/^_{0,1}c([0-9 \\.\\-]{3})s([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
489
+			// parse weather
490
+			//$body_parse = substr($body_parse,1);
491
+			//$body_parse_len = strlen($body_parse);
492
+			//echo 'weather'."\n";
493
+			if (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
494
+				$result['wind_dir'] = intval($matches[1]);
495
+				$result['wind_speed'] = round(intval($matches[2])*1.60934,1);
496
+				$result['wind_gust'] = round(intval($matches[3])*1.60934,1);
497
+				$result['temp'] = round(5/9*((intval($matches[4]))-32),1);
498
+					$body_parse = substr($body_parse,strlen($matches[0])+1);
499
+			} elseif (preg_match('/^_{0,1}c([0-9 \\.\\-]{3})s([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
500 500
 			$result['wind_dir'] = intval($matches[1]);
501 501
 			$result['wind_speed'] = round($matches[2]*1.60934,1);
502 502
 			$result['wind_gust'] = round($matches[3]*1.60934,1);
503 503
 			$result['temp'] = round(5/9*(($matches[4])-32),1);
504
-		        $body_parse = substr($body_parse,strlen($matches[0])+1);
505
-		    } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
504
+				$body_parse = substr($body_parse,strlen($matches[0])+1);
505
+			} elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
506 506
 			$result['wind_dir'] = intval($matches[1]);
507 507
 			$result['wind_speed'] = round($matches[2]*1.60934,1);
508 508
 			$result['wind_gust'] = round($matches[3]*1.60934,1);
509
-		        $body_parse = substr($body_parse,strlen($matches[0])+1);
510
-		    } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)/',$body_parse,$matches)) {
509
+				$body_parse = substr($body_parse,strlen($matches[0])+1);
510
+			} elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)/',$body_parse,$matches)) {
511 511
 			$result['wind_dir'] = intval($matches[1]);
512 512
 			$result['wind_speed'] = round($matches[2]*1.60934,1);
513 513
 			$result['wind_gust'] = round($matches[3]*1.60934,1);
514
-		        $body_parse = substr($body_parse,strlen($matches[0])+1);
515
-		    }
516
-		    //if (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9]+)t(-?[0-9 \\.]{1,3})/',$body_parse,$matches)) {
517
-		    //g012t088r000p000P000h38b10110
518
-		    //g011t086r000p000P000h29b10198
519
-		    if (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3,4})r([0-9 \\.]{3})p([0-9 \\.]{3})P([0-9 \\.]{3})h([0-9 \\.]{2,3})b([0-9 \\.]{5})/',$body_parse,$matches)) {
514
+				$body_parse = substr($body_parse,strlen($matches[0])+1);
515
+			}
516
+			//if (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9]+)t(-?[0-9 \\.]{1,3})/',$body_parse,$matches)) {
517
+			//g012t088r000p000P000h38b10110
518
+			//g011t086r000p000P000h29b10198
519
+			if (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3,4})r([0-9 \\.]{3})p([0-9 \\.]{3})P([0-9 \\.]{3})h([0-9 \\.]{2,3})b([0-9 \\.]{5})/',$body_parse,$matches)) {
520 520
 			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
521 521
 			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
522 522
 			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
@@ -524,8 +524,8 @@  discard block
 block discarded – undo
524 524
 			if ($matches[5] != '...') $result['precipitation24h'] = round((intval($matches[5])/100)*25.1,1);
525 525
 			if ($matches[6] != '...') $result['humidity'] = intval($matches[6]);
526 526
 			if ($matches[7] != '...') $result['pressure'] = round((intval($matches[7])/10),1);
527
-		        $body_parse = substr($body_parse,strlen($matches[0]));
528
-		    } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3,4})r([0-9 \\.]{3})P([0-9 \\.]{3})p([0-9 \\.]{3})h([0-9 \\.]{2,3})b([0-9 \\.]{5})/',$body_parse,$matches)) {
527
+				$body_parse = substr($body_parse,strlen($matches[0]));
528
+			} elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3,4})r([0-9 \\.]{3})P([0-9 \\.]{3})p([0-9 \\.]{3})h([0-9 \\.]{2,3})b([0-9 \\.]{5})/',$body_parse,$matches)) {
529 529
 			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
530 530
 			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
531 531
 			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
@@ -533,8 +533,8 @@  discard block
 block discarded – undo
533 533
 			if ($matches[4] != '...') $result['precipitation24h'] = round((intval($matches[4])/100)*25.1,1);
534 534
 			if ($matches[6] != '...') $result['humidity'] = intval($matches[6]);
535 535
 			if ($matches[7] != '...') $result['pressure'] = round((intval($matches[7])/10),1);
536
-		        $body_parse = substr($body_parse,strlen($matches[0]));
537
-		    } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})P([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) {
536
+				$body_parse = substr($body_parse,strlen($matches[0]));
537
+			} elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})P([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) {
538 538
 			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
539 539
 			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
540 540
 			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
@@ -542,58 +542,58 @@  discard block
 block discarded – undo
542 542
 			if ($matches[5] != '...') $result['precipitation24h'] = round((intval($matches[5])/100)*25.1,1);
543 543
 			if ($matches[7] != '...') $result['humidity'] = intval($matches[7]);
544 544
 			if ($matches[6] != '...') $result['pressure'] = round((intval($matches[6])/10),1);
545
-		        $body_parse = substr($body_parse,strlen($matches[0]));
546
-		    } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})P([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) {
545
+				$body_parse = substr($body_parse,strlen($matches[0]));
546
+			} elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})P([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) {
547 547
 			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
548 548
 			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
549 549
 			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
550 550
 			if ($matches[4] != '...') $result['precipitation24h'] = round((intval($matches[4])/100)*25.1,1);
551 551
 			if ($matches[6] != '...') $result['humidity'] = intval($matches[6]);
552 552
 			if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1);
553
-		        $body_parse = substr($body_parse,strlen($matches[0]));
554
-		    } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) {
553
+				$body_parse = substr($body_parse,strlen($matches[0]));
554
+			} elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) {
555 555
 			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
556 556
 			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
557 557
 			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
558 558
 			if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1);
559 559
 			if ($matches[6] != '...') $result['humidity'] = intval($matches[6]);
560 560
 			if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1);
561
-		        $body_parse = substr($body_parse,strlen($matches[0]));
562
-		    } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) {
561
+				$body_parse = substr($body_parse,strlen($matches[0]));
562
+			} elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) {
563 563
 			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
564 564
 			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
565 565
 			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
566 566
 			if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1);
567 567
 			if ($matches[5] != '...') $result['humidity'] = intval($matches[5]);
568 568
 			if ($matches[6] != '...') $result['pressure'] = round((intval($matches[6])/10),1);
569
-		        $body_parse = substr($body_parse,strlen($matches[0]));
570
-		    } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) {
569
+				$body_parse = substr($body_parse,strlen($matches[0]));
570
+			} elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) {
571 571
 			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
572 572
 			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
573 573
 			if ($matches[2] != '...') $result['humidity'] = intval($matches[3]);
574 574
 			if ($matches[4] != '...') $result['pressure'] = round((intval($matches[4])/10),1);
575
-		        $body_parse = substr($body_parse,strlen($matches[0]));
576
-		    } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{2,3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) {
575
+				$body_parse = substr($body_parse,strlen($matches[0]));
576
+			} elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{2,3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) {
577 577
 			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
578 578
 			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
579 579
 			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
580 580
 			if ($matches[4] != '...') $result['humidity'] = intval($matches[4]);
581 581
 			if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1);
582
-		        $body_parse = substr($body_parse,strlen($matches[0]));
583
-		    }
584
-		    $result['comment'] = trim($body_parse);
582
+				$body_parse = substr($body_parse,strlen($matches[0]));
583
+			}
584
+			$result['comment'] = trim($body_parse);
585 585
 		}
586 586
 		} else $result['comment'] = trim($body_parse);
587 587
 
588
-	    }
588
+		}
589 589
 	//}
590 590
 	if (isset($result['latitude'])) $result['latitude'] = round($result['latitude'],4);
591 591
 	if (isset($result['longitude'])) $result['longitude'] = round($result['longitude'],4);
592 592
 	if ($debug) print_r($result);
593 593
 	return $result;
594
-    }
594
+	}
595 595
     
596
-    public function connect() {
596
+	public function connect() {
597 597
 	global $globalAPRSversion, $globalServerAPRSssid, $globalServerAPRSpass,$globalName, $globalServerAPRShost, $globalServerAPRSport;
598 598
 	$aprs_connect = 0;
599 599
 	$aprs_keep = 120;
@@ -617,24 +617,24 @@  discard block
 block discarded – undo
617 617
 		socket_set_option($this->socket,SOL_SOCKET,SO_KEEPALIVE,1);
618 618
 		while ($msgin = socket_read($this->socket, 1000,PHP_NORMAL_READ)) {
619 619
 			if (strpos($msgin, "$aprs_ssid verified") !== FALSE) {
620
-			    echo 'APRS user verified !'."\n";
621
-			    $this->connected = true;
622
-			    return true;
623
-			    break;
620
+				echo 'APRS user verified !'."\n";
621
+				$this->connected = true;
622
+				return true;
623
+				break;
624 624
 			}
625 625
 			if (time()-$authstart > 5) {
626
-			    echo 'APRS timeout'."\n";
627
-			    break;
626
+				echo 'APRS timeout'."\n";
627
+				break;
628 628
 			}
629 629
 		}
630 630
 	}
631
-    }
631
+	}
632 632
 
633
-    public function disconnect() {
633
+	public function disconnect() {
634 634
 	socket_close($this->socket);
635
-    }
635
+	}
636 636
     
637
-    public function send($data) {
637
+	public function send($data) {
638 638
 	global $globalDebug;
639 639
 	if ($this->connected === false) $this->connect();
640 640
 	$send = socket_send( $this->socket  , $data , strlen($data),0);
@@ -643,7 +643,7 @@  discard block
 block discarded – undo
643 643
 		socket_close($this->socket);
644 644
 		$this->connect();
645 645
 	}
646
-    }
646
+	}
647 647
 }
648 648
 
649 649
 class APRSSpotter extends APRS {
Please login to merge, or discard this patch.
Spacing   +157 added lines, -158 removed lines patch added patch discarded remove patch
@@ -167,8 +167,7 @@  discard block
 block discarded – undo
167 167
 	
168 168
 
169 169
     private function urshift($n, $s) {
170
-	return ($n >= 0) ? ($n >> $s) :
171
-	    (($n & 0x7fffffff) >> $s) | 
170
+	return ($n >= 0) ? ($n >> $s) : (($n&0x7fffffff) >> $s)| 
172 171
 		(0x40000000 >> ($s - 1));
173 172
     }
174 173
 
@@ -180,7 +179,7 @@  discard block
 block discarded – undo
180 179
 	//$split_input = str_split($input);
181 180
 
182 181
 	/* Find the end of header checking for NULL bytes while doing it. */
183
-	$splitpos = strpos($input,':');
182
+	$splitpos = strpos($input, ':');
184 183
 	
185 184
 	/* Check that end was found and body has at least one byte. */
186 185
 	if ($splitpos == 0 || $splitpos + 1 == $input_len || $splitpos === FALSE) {
@@ -190,15 +189,15 @@  discard block
 block discarded – undo
190 189
 	
191 190
 	if ($debug) echo 'input : '.$input."\n";
192 191
 	/* Save header and body. */
193
-	$body = substr($input,$splitpos+1,$input_len);
192
+	$body = substr($input, $splitpos + 1, $input_len);
194 193
 	$body_len = strlen($body);
195
-	$header = substr($input,0,$splitpos);
194
+	$header = substr($input, 0, $splitpos);
196 195
 	//$header_len = strlen($header);
197 196
 	if ($debug) echo 'header : '.$header."\n";
198 197
 	
199 198
 	/* Parse source, target and path. */
200 199
 	//FLRDF0A52>APRS,qAS,LSTB
201
-	if (preg_match('/^([A-Z0-9\\-]{1,9})>(.*)$/',$header,$matches)) {
200
+	if (preg_match('/^([A-Z0-9\\-]{1,9})>(.*)$/', $header, $matches)) {
202 201
 	    $ident = $matches[1];
203 202
 	    $all_elements = $matches[2];
204 203
 	    if ($ident == 'AIRCRAFT') {
@@ -215,14 +214,14 @@  discard block
 block discarded – undo
215 214
 	    if ($debug) 'No ident'."\n";
216 215
 	    return false;
217 216
 	}
218
-	$elements = explode(',',$all_elements);
217
+	$elements = explode(',', $all_elements);
219 218
 	$source = end($elements);
220 219
 	$result['source'] = $source;
221 220
 	foreach ($elements as $element) {
222
-	    if (preg_match('/^([a-zA-Z0-9-]{1,9})([*]?)$/',$element)) {
221
+	    if (preg_match('/^([a-zA-Z0-9-]{1,9})([*]?)$/', $element)) {
223 222
 	        //echo "ok";
224 223
 	        //if ($element == 'TCPIP*') return false;
225
-	    } elseif (!preg_match('/^([0-9A-F]{32})$/',$element)) {
224
+	    } elseif (!preg_match('/^([0-9A-F]{32})$/', $element)) {
226 225
 		if ($debug) echo 'element : '.$element."\n";
227 226
 		return false;
228 227
 	    }
@@ -235,14 +234,14 @@  discard block
 block discarded – undo
235 234
 	    */
236 235
 	}
237 236
 	
238
-	$type = substr($body,0,1);
237
+	$type = substr($body, 0, 1);
239 238
 	if ($debug) echo 'type : '.$type."\n";
240 239
 	if ($type == ';') {
241 240
 		if (isset($result['source_type']) && $result['source_type'] == 'modes') {
242
-			$result['address'] = trim(substr($body,1,9));
241
+			$result['address'] = trim(substr($body, 1, 9));
243 242
 		} elseif (isset($result['source_type']) && $result['source_type'] == 'ais') {
244
-			$result['mmsi'] = trim(substr($body,1,9));
245
-		} else $result['ident'] = trim(substr($body,1,9));
243
+			$result['mmsi'] = trim(substr($body, 1, 9));
244
+		} else $result['ident'] = trim(substr($body, 1, 9));
246 245
 	} elseif ($type == ',') {
247 246
 		// Invalid data or test data
248 247
 		return false;
@@ -250,24 +249,24 @@  discard block
 block discarded – undo
250 249
 	
251 250
 	// Check for Timestamp
252 251
 	$find = false;
253
-	$body_parse = substr($body,1);
252
+	$body_parse = substr($body, 1);
254 253
 	//echo 'Body : '.$body."\n";
255
-	if (preg_match('/^;(.){9}\*/',$body,$matches)) {
256
-	    $body_parse = substr($body_parse,10);
254
+	if (preg_match('/^;(.){9}\*/', $body, $matches)) {
255
+	    $body_parse = substr($body_parse, 10);
257 256
 	    $find = true;
258 257
 	    //echo $body_parse."\n";
259 258
 	}
260
-	if (preg_match('/^`(.*)\//',$body,$matches)) {
261
-	    $body_parse = substr($body_parse,strlen($matches[1])-1);
259
+	if (preg_match('/^`(.*)\//', $body, $matches)) {
260
+	    $body_parse = substr($body_parse, strlen($matches[1]) - 1);
262 261
 	    $find = true;
263 262
 	    //echo $body_parse."\n";
264 263
 	}
265
-	if (preg_match("/^'(.*)\//",$body,$matches)) {
266
-	    $body_parse = substr($body_parse,strlen($matches[1])-1);
264
+	if (preg_match("/^'(.*)\//", $body, $matches)) {
265
+	    $body_parse = substr($body_parse, strlen($matches[1]) - 1);
267 266
 	    $find = true;
268 267
 	    //echo $body_parse."\n";
269 268
 	}
270
-	if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([zh\\/])/',$body_parse,$matches)) {
269
+	if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([zh\\/])/', $body_parse, $matches)) {
271 270
 	    $find = true;
272 271
 	    //print_r($matches);
273 272
 	    $timestamp = $matches[0];
@@ -282,19 +281,19 @@  discard block
 block discarded – undo
282 281
 		// This work or not ?
283 282
 		$timestamp = strtotime(date('Ym').$matches[1].' '.$matches[2].':'.$matches[3]);
284 283
 	    }
285
-	    $body_parse = substr($body_parse,7);
284
+	    $body_parse = substr($body_parse, 7);
286 285
 	    $result['timestamp'] = $timestamp;
287 286
 	    //echo date('Ymd H:i:s',$timestamp);
288 287
 	}
289
-	if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})/',$body_parse,$matches)) {
288
+	if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})/', $body_parse, $matches)) {
290 289
 	    $find = true;
291 290
 	    $timestamp = strtotime(date('Y').$matches[1].$matches[2].' '.$matches[3].':'.$matches[4]);
292
-	    $body_parse = substr($body_parse,8);
291
+	    $body_parse = substr($body_parse, 8);
293 292
 	    $result['timestamp'] = $timestamp;
294 293
 	    //echo date('Ymd H:i:s',$timestamp);
295 294
 	}
296 295
 	//if (strlen($body_parse) > 19) {
297
-	    if (preg_match('/^([0-9]{2})([0-7 ][0-9 ]\\.[0-9 ]{2})([NnSs])(.)([0-9]{3})([0-7 ][0-9 ]\\.[0-9 ]{2})([EeWw])(.)/',$body_parse,$matches)) {
296
+	    if (preg_match('/^([0-9]{2})([0-7 ][0-9 ]\\.[0-9 ]{2})([NnSs])(.)([0-9]{3})([0-7 ][0-9 ]\\.[0-9 ]{2})([EeWw])(.)/', $body_parse, $matches)) {
298 297
 		$find = true;
299 298
 		// 4658.70N/00707.78Ez
300 299
 		//print_r(str_split($body_parse));
@@ -321,11 +320,11 @@  discard block
 block discarded – undo
321 320
 	    */
322 321
 		$latitude = $lat + floatval($lat_min)/60;
323 322
 		$longitude = $lon + floatval($lon_min)/60;
324
-		if ($sind == 'S') $latitude = 0-$latitude;
325
-		if ($wind == 'W') $longitude = 0-$longitude;
323
+		if ($sind == 'S') $latitude = 0 - $latitude;
324
+		if ($wind == 'W') $longitude = 0 - $longitude;
326 325
 		$result['latitude'] = $latitude;
327 326
 		$result['longitude'] = $longitude;
328
-		$body_parse = substr($body_parse,18);
327
+		$body_parse = substr($body_parse, 18);
329 328
 		$body_parse_len = strlen($body_parse);
330 329
 	    }
331 330
 	    $body_parse_len = strlen($body_parse);
@@ -357,7 +356,7 @@  discard block
 block discarded – undo
357 356
 		//echo $body_parse;
358 357
 			//if ($type != ';' && $type != '>') {
359 358
 			if ($type != '') {
360
-			$body_parse = substr($body_parse,1);
359
+			$body_parse = substr($body_parse, 1);
361 360
 			$body_parse_len = strlen($body_parse);
362 361
 			$result['symbol_code'] = $symbol_code;
363 362
 			if (isset($this->symbols[$symbol_code])) $result['symbol'] = $this->symbols[$symbol_code];
@@ -368,16 +367,16 @@  discard block
 block discarded – undo
368 367
 		    //$body_parse_len = strlen($body_parse);
369 368
 		    if ($body_parse_len >= 7) {
370 369
 			
371
-		        if (preg_match('/^([0-9\\. ]{3})\\/([0-9\\. ]{3})/',$body_parse)) {
372
-		    	    $course = substr($body_parse,0,3);
370
+		        if (preg_match('/^([0-9\\. ]{3})\\/([0-9\\. ]{3})/', $body_parse)) {
371
+		    	    $course = substr($body_parse, 0, 3);
373 372
 		    	    $tmp_s = intval($course);
374 373
 		    	    if ($tmp_s >= 1 && $tmp_s <= 360) $result['heading'] = intval($course);
375
-		    	    $speed = substr($body_parse,4,3);
374
+		    	    $speed = substr($body_parse, 4, 3);
376 375
 		    	    if ($speed != '...') {
377 376
 		    		//$result['speed'] = round($speed*1.852);
378 377
 		    		$result['speed'] = intval($speed);
379 378
 		    	    }
380
-		    	    $body_parse = substr($body_parse,7);
379
+		    	    $body_parse = substr($body_parse, 7);
381 380
 		        }
382 381
 		        // Check PHGR, PHG, RNG
383 382
 		    } 
@@ -387,12 +386,12 @@  discard block
 block discarded – undo
387 386
 		    }
388 387
 		    */
389 388
 		    if (strlen($body_parse) > 0) {
390
-		        if (preg_match('/\\/A=(-[0-9]{5}|[0-9]{6})/',$body_parse,$matches)) {
389
+		        if (preg_match('/\\/A=(-[0-9]{5}|[0-9]{6})/', $body_parse, $matches)) {
391 390
 		            $altitude = intval($matches[1]);
392 391
 		            //$result['altitude'] = round($altitude*0.3048);
393 392
 		            $result['altitude'] = $altitude;
394 393
 		            //$body_parse = trim(substr($body_parse,strlen($matches[0])));
395
-		            $body_parse = trim(preg_replace('/\\/A=(-[0-9]{5}|[0-9]{6})/','',$body_parse));
394
+		            $body_parse = trim(preg_replace('/\\/A=(-[0-9]{5}|[0-9]{6})/', '', $body_parse));
396 395
 		        }
397 396
 		    }
398 397
 		    
@@ -404,13 +403,13 @@  discard block
 block discarded – undo
404 403
 		    */
405 404
 		    // DAO
406 405
 		    
407
-		    if (preg_match('/^!([0-9A-Z]{3})/',$body_parse,$matches)) {
406
+		    if (preg_match('/^!([0-9A-Z]{3})/', $body_parse, $matches)) {
408 407
 			    
409 408
 			    $dao = $matches[1];
410
-			    if (preg_match('/^([A-Z])([0-9]{2})/',$dao)) {
409
+			    if (preg_match('/^([A-Z])([0-9]{2})/', $dao)) {
411 410
 				$dao_split = str_split($dao);
412
-			        $lat_off = (($dao_split[1])-48.0)*0.001/60.0;
413
-			        $lon_off = (($dao_split[2])-48.0)*0.001/60.0;
411
+			        $lat_off = (($dao_split[1]) - 48.0)*0.001/60.0;
412
+			        $lon_off = (($dao_split[2]) - 48.0)*0.001/60.0;
414 413
 			    
415 414
 				if ($result['latitude'] < 0) $result['latitude'] -= $lat_off;
416 415
 				else $result['latitude'] += $lat_off;
@@ -418,50 +417,50 @@  discard block
 block discarded – undo
418 417
 				else $result['longitude'] += $lon_off;
419 418
 			    }
420 419
 			    
421
-		            $body_parse = substr($body_parse,6);
420
+		            $body_parse = substr($body_parse, 6);
422 421
 		    }
423 422
 		    
424
-		    if (preg_match('/CS=([0-9A-Z_]*)/',$body_parse,$matches)) {
425
-			$result['ident'] = str_replace('_',' ',$matches[1]);
423
+		    if (preg_match('/CS=([0-9A-Z_]*)/', $body_parse, $matches)) {
424
+			$result['ident'] = str_replace('_', ' ', $matches[1]);
426 425
 		    }
427
-		    if (preg_match('/SQ=([0-9]{4})/',$body_parse,$matches)) {
426
+		    if (preg_match('/SQ=([0-9]{4})/', $body_parse, $matches)) {
428 427
 			$result['squawk'] = $matches[1];
429 428
 		    }
430
-		    if (preg_match('/AI=([0-9A-Z]{4})/',$body_parse,$matches)) {
429
+		    if (preg_match('/AI=([0-9A-Z]{4})/', $body_parse, $matches)) {
431 430
 			$result['aircraft_icao'] = $matches[1];
432 431
 		    }
433
-		    if (preg_match('/VR=([0-9]*)/',$body_parse,$matches)) {
432
+		    if (preg_match('/VR=([0-9]*)/', $body_parse, $matches)) {
434 433
 			$result['verticalrate'] = $matches[1];
435 434
 		    }
436
-		    if (preg_match('/TI=([0-9]*)/',$body_parse,$matches)) {
435
+		    if (preg_match('/TI=([0-9]*)/', $body_parse, $matches)) {
437 436
 			$result['typeid'] = $matches[1];
438 437
 		    }
439
-		    if (preg_match('/SI=([0-9]*)/',$body_parse,$matches)) {
438
+		    if (preg_match('/SI=([0-9]*)/', $body_parse, $matches)) {
440 439
 			$result['statusid'] = $matches[1];
441 440
 		    }
442
-		    if (preg_match('/IMO=([0-9]{7})/',$body_parse,$matches)) {
441
+		    if (preg_match('/IMO=([0-9]{7})/', $body_parse, $matches)) {
443 442
 			$result['imo'] = $matches[1];
444 443
 		    }
445
-		    if (preg_match('/AD=([0-9]*)/',$body_parse,$matches)) {
444
+		    if (preg_match('/AD=([0-9]*)/', $body_parse, $matches)) {
446 445
 			$result['arrival_date'] = $matches[1];
447 446
 		    }
448
-		    if (preg_match('/AC=([0-9A-Z_]*)/',$body_parse,$matches)) {
449
-			$result['arrival_code'] = str_replace('_',' ',$matches[1]);
447
+		    if (preg_match('/AC=([0-9A-Z_]*)/', $body_parse, $matches)) {
448
+			$result['arrival_code'] = str_replace('_', ' ', $matches[1]);
450 449
 		    }
451 450
 		    // OGN comment
452 451
 		   // echo "Before OGN : ".$body_parse."\n";
453 452
 		    //if (preg_match('/^id([0-9A-F]{8}) ([+-])([0-9]{3,4})fpm ([+-])([0-9.]{3,4})rot (.*)$/',$body_parse,$matches)) {
454
-		    if (preg_match('/^id([0-9A-F]{8})/',$body_parse,$matches)) {
453
+		    if (preg_match('/^id([0-9A-F]{8})/', $body_parse, $matches)) {
455 454
 			$id = $matches[1];
456 455
 			//$mode = substr($id,0,2);
457
-			$address = substr($id,2);
456
+			$address = substr($id, 2);
458 457
 			//print_r($matches);
459
-			$addressType = (intval(substr($id,0,2),16))&3;
458
+			$addressType = (intval(substr($id, 0, 2), 16))&3;
460 459
 			if ($addressType == 0) $result['addresstype'] = "RANDOM";
461 460
 			elseif ($addressType == 1) $result['addresstype'] = "ICAO";
462 461
 			elseif ($addressType == 2) $result['addresstype'] = "FLARM";
463 462
 			elseif ($addressType == 3) $result['addresstype'] = "OGN";
464
-			$aircraftType = $this->urshift(((intval(substr($id,0,2),16)) & 0b1111100),2);
463
+			$aircraftType = $this->urshift(((intval(substr($id, 0, 2), 16))&0b1111100), 2);
465 464
 			$result['aircrafttype_code'] = $aircraftType;
466 465
 			if ($aircraftType == 0) $result['aircrafttype'] = "UNKNOWN";
467 466
 			elseif ($aircraftType == 1) $result['aircrafttype'] = "GLIDER";
@@ -478,7 +477,7 @@  discard block
 block discarded – undo
478 477
 			elseif ($aircraftType == 12) $result['aircrafttype'] = "AIRSHIP";
479 478
 			elseif ($aircraftType == 13) $result['aircrafttype'] = "UAV";
480 479
 			elseif ($aircraftType == 15) $result['aircrafttype'] = "STATIC_OBJECT";
481
-			$stealth = (intval(substr($id,0,2), 16) & 0b10000000) != 0;
480
+			$stealth = (intval(substr($id, 0, 2), 16)&0b10000000) != 0;
482 481
 			$result['stealth'] = $stealth;
483 482
 			$result['address'] = $address;
484 483
 		    }
@@ -490,96 +489,96 @@  discard block
 block discarded – undo
490 489
 		    //$body_parse = substr($body_parse,1);
491 490
 		    //$body_parse_len = strlen($body_parse);
492 491
 		    //echo 'weather'."\n";
493
-		    if (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
492
+		    if (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/', $body_parse, $matches)) {
494 493
 			    $result['wind_dir'] = intval($matches[1]);
495
-			    $result['wind_speed'] = round(intval($matches[2])*1.60934,1);
496
-			    $result['wind_gust'] = round(intval($matches[3])*1.60934,1);
497
-			    $result['temp'] = round(5/9*((intval($matches[4]))-32),1);
498
-		    	    $body_parse = substr($body_parse,strlen($matches[0])+1);
499
-		    } elseif (preg_match('/^_{0,1}c([0-9 \\.\\-]{3})s([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
494
+			    $result['wind_speed'] = round(intval($matches[2])*1.60934, 1);
495
+			    $result['wind_gust'] = round(intval($matches[3])*1.60934, 1);
496
+			    $result['temp'] = round(5/9*((intval($matches[4])) - 32), 1);
497
+		    	    $body_parse = substr($body_parse, strlen($matches[0]) + 1);
498
+		    } elseif (preg_match('/^_{0,1}c([0-9 \\.\\-]{3})s([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/', $body_parse, $matches)) {
500 499
 			$result['wind_dir'] = intval($matches[1]);
501
-			$result['wind_speed'] = round($matches[2]*1.60934,1);
502
-			$result['wind_gust'] = round($matches[3]*1.60934,1);
503
-			$result['temp'] = round(5/9*(($matches[4])-32),1);
504
-		        $body_parse = substr($body_parse,strlen($matches[0])+1);
505
-		    } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
500
+			$result['wind_speed'] = round($matches[2]*1.60934, 1);
501
+			$result['wind_gust'] = round($matches[3]*1.60934, 1);
502
+			$result['temp'] = round(5/9*(($matches[4]) - 32), 1);
503
+		        $body_parse = substr($body_parse, strlen($matches[0]) + 1);
504
+		    } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})t(-{0,1}[0-9 \\.]+)/', $body_parse, $matches)) {
506 505
 			$result['wind_dir'] = intval($matches[1]);
507
-			$result['wind_speed'] = round($matches[2]*1.60934,1);
508
-			$result['wind_gust'] = round($matches[3]*1.60934,1);
509
-		        $body_parse = substr($body_parse,strlen($matches[0])+1);
510
-		    } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)/',$body_parse,$matches)) {
506
+			$result['wind_speed'] = round($matches[2]*1.60934, 1);
507
+			$result['wind_gust'] = round($matches[3]*1.60934, 1);
508
+		        $body_parse = substr($body_parse, strlen($matches[0]) + 1);
509
+		    } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)/', $body_parse, $matches)) {
511 510
 			$result['wind_dir'] = intval($matches[1]);
512
-			$result['wind_speed'] = round($matches[2]*1.60934,1);
513
-			$result['wind_gust'] = round($matches[3]*1.60934,1);
514
-		        $body_parse = substr($body_parse,strlen($matches[0])+1);
511
+			$result['wind_speed'] = round($matches[2]*1.60934, 1);
512
+			$result['wind_gust'] = round($matches[3]*1.60934, 1);
513
+		        $body_parse = substr($body_parse, strlen($matches[0]) + 1);
515 514
 		    }
516 515
 		    //if (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9]+)t(-?[0-9 \\.]{1,3})/',$body_parse,$matches)) {
517 516
 		    //g012t088r000p000P000h38b10110
518 517
 		    //g011t086r000p000P000h29b10198
519
-		    if (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3,4})r([0-9 \\.]{3})p([0-9 \\.]{3})P([0-9 \\.]{3})h([0-9 \\.]{2,3})b([0-9 \\.]{5})/',$body_parse,$matches)) {
520
-			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
521
-			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
522
-			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
523
-			if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1);
524
-			if ($matches[5] != '...') $result['precipitation24h'] = round((intval($matches[5])/100)*25.1,1);
518
+		    if (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3,4})r([0-9 \\.]{3})p([0-9 \\.]{3})P([0-9 \\.]{3})h([0-9 \\.]{2,3})b([0-9 \\.]{5})/', $body_parse, $matches)) {
519
+			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1);
520
+			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1);
521
+			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1, 1);
522
+			if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1, 1);
523
+			if ($matches[5] != '...') $result['precipitation24h'] = round((intval($matches[5])/100)*25.1, 1);
525 524
 			if ($matches[6] != '...') $result['humidity'] = intval($matches[6]);
526
-			if ($matches[7] != '...') $result['pressure'] = round((intval($matches[7])/10),1);
527
-		        $body_parse = substr($body_parse,strlen($matches[0]));
528
-		    } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3,4})r([0-9 \\.]{3})P([0-9 \\.]{3})p([0-9 \\.]{3})h([0-9 \\.]{2,3})b([0-9 \\.]{5})/',$body_parse,$matches)) {
529
-			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
530
-			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
531
-			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
532
-			if ($matches[5] != '...') $result['precipitation'] = round((intval($matches[5])/100)*25.1,1);
533
-			if ($matches[4] != '...') $result['precipitation24h'] = round((intval($matches[4])/100)*25.1,1);
525
+			if ($matches[7] != '...') $result['pressure'] = round((intval($matches[7])/10), 1);
526
+		        $body_parse = substr($body_parse, strlen($matches[0]));
527
+		    } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3,4})r([0-9 \\.]{3})P([0-9 \\.]{3})p([0-9 \\.]{3})h([0-9 \\.]{2,3})b([0-9 \\.]{5})/', $body_parse, $matches)) {
528
+			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1);
529
+			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1);
530
+			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1, 1);
531
+			if ($matches[5] != '...') $result['precipitation'] = round((intval($matches[5])/100)*25.1, 1);
532
+			if ($matches[4] != '...') $result['precipitation24h'] = round((intval($matches[4])/100)*25.1, 1);
534 533
 			if ($matches[6] != '...') $result['humidity'] = intval($matches[6]);
535
-			if ($matches[7] != '...') $result['pressure'] = round((intval($matches[7])/10),1);
536
-		        $body_parse = substr($body_parse,strlen($matches[0]));
537
-		    } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})P([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) {
538
-			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
539
-			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
540
-			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
541
-			if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1);
542
-			if ($matches[5] != '...') $result['precipitation24h'] = round((intval($matches[5])/100)*25.1,1);
534
+			if ($matches[7] != '...') $result['pressure'] = round((intval($matches[7])/10), 1);
535
+		        $body_parse = substr($body_parse, strlen($matches[0]));
536
+		    } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})P([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/', $body_parse, $matches)) {
537
+			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1);
538
+			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1);
539
+			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1, 1);
540
+			if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1, 1);
541
+			if ($matches[5] != '...') $result['precipitation24h'] = round((intval($matches[5])/100)*25.1, 1);
543 542
 			if ($matches[7] != '...') $result['humidity'] = intval($matches[7]);
544
-			if ($matches[6] != '...') $result['pressure'] = round((intval($matches[6])/10),1);
545
-		        $body_parse = substr($body_parse,strlen($matches[0]));
546
-		    } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})P([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) {
547
-			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
548
-			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
549
-			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
550
-			if ($matches[4] != '...') $result['precipitation24h'] = round((intval($matches[4])/100)*25.1,1);
543
+			if ($matches[6] != '...') $result['pressure'] = round((intval($matches[6])/10), 1);
544
+		        $body_parse = substr($body_parse, strlen($matches[0]));
545
+		    } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})P([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/', $body_parse, $matches)) {
546
+			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1);
547
+			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1);
548
+			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1, 1);
549
+			if ($matches[4] != '...') $result['precipitation24h'] = round((intval($matches[4])/100)*25.1, 1);
551 550
 			if ($matches[6] != '...') $result['humidity'] = intval($matches[6]);
552
-			if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1);
553
-		        $body_parse = substr($body_parse,strlen($matches[0]));
554
-		    } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) {
555
-			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
556
-			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
557
-			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
558
-			if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1);
551
+			if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10), 1);
552
+		        $body_parse = substr($body_parse, strlen($matches[0]));
553
+		    } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/', $body_parse, $matches)) {
554
+			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1);
555
+			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1);
556
+			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1, 1);
557
+			if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1, 1);
559 558
 			if ($matches[6] != '...') $result['humidity'] = intval($matches[6]);
560
-			if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1);
561
-		        $body_parse = substr($body_parse,strlen($matches[0]));
562
-		    } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) {
563
-			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
564
-			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
565
-			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
566
-			if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1);
559
+			if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10), 1);
560
+		        $body_parse = substr($body_parse, strlen($matches[0]));
561
+		    } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})h([0-9 \\.]{2})b([0-9 \\.]{5})/', $body_parse, $matches)) {
562
+			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1);
563
+			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1);
564
+			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1, 1);
565
+			if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1, 1);
567 566
 			if ($matches[5] != '...') $result['humidity'] = intval($matches[5]);
568
-			if ($matches[6] != '...') $result['pressure'] = round((intval($matches[6])/10),1);
569
-		        $body_parse = substr($body_parse,strlen($matches[0]));
570
-		    } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) {
571
-			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
572
-			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
567
+			if ($matches[6] != '...') $result['pressure'] = round((intval($matches[6])/10), 1);
568
+		        $body_parse = substr($body_parse, strlen($matches[0]));
569
+		    } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})h([0-9 \\.]{2})b([0-9 \\.]{5})/', $body_parse, $matches)) {
570
+			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1);
571
+			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1);
573 572
 			if ($matches[2] != '...') $result['humidity'] = intval($matches[3]);
574
-			if ($matches[4] != '...') $result['pressure'] = round((intval($matches[4])/10),1);
575
-		        $body_parse = substr($body_parse,strlen($matches[0]));
576
-		    } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{2,3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) {
577
-			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
578
-			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
579
-			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
573
+			if ($matches[4] != '...') $result['pressure'] = round((intval($matches[4])/10), 1);
574
+		        $body_parse = substr($body_parse, strlen($matches[0]));
575
+		    } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{2,3})h([0-9 \\.]{2})b([0-9 \\.]{5})/', $body_parse, $matches)) {
576
+			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1);
577
+			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1);
578
+			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1, 1);
580 579
 			if ($matches[4] != '...') $result['humidity'] = intval($matches[4]);
581
-			if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1);
582
-		        $body_parse = substr($body_parse,strlen($matches[0]));
580
+			if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10), 1);
581
+		        $body_parse = substr($body_parse, strlen($matches[0]));
583 582
 		    }
584 583
 		    $result['comment'] = trim($body_parse);
585 584
 		}
@@ -587,42 +586,42 @@  discard block
 block discarded – undo
587 586
 
588 587
 	    }
589 588
 	//}
590
-	if (isset($result['latitude'])) $result['latitude'] = round($result['latitude'],4);
591
-	if (isset($result['longitude'])) $result['longitude'] = round($result['longitude'],4);
589
+	if (isset($result['latitude'])) $result['latitude'] = round($result['latitude'], 4);
590
+	if (isset($result['longitude'])) $result['longitude'] = round($result['longitude'], 4);
592 591
 	if ($debug) print_r($result);
593 592
 	return $result;
594 593
     }
595 594
     
596 595
     public function connect() {
597
-	global $globalAPRSversion, $globalServerAPRSssid, $globalServerAPRSpass,$globalName, $globalServerAPRShost, $globalServerAPRSport;
596
+	global $globalAPRSversion, $globalServerAPRSssid, $globalServerAPRSpass, $globalName, $globalServerAPRShost, $globalServerAPRSport;
598 597
 	$aprs_connect = 0;
599 598
 	$aprs_keep = 120;
600 599
 	$aprs_last_tx = time();
601 600
 	if (isset($globalAPRSversion)) $aprs_version = $globalAPRSversion;
602
-	else $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName);
601
+	else $aprs_version = 'FlightAirMap '.str_replace(' ', '_', $globalName);
603 602
 	if (isset($globalServerAPRSssid)) $aprs_ssid = $globalServerAPRSssid;
604
-	else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8);
603
+	else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ', '_', $globalName)), 0, 8);
605 604
 	if (isset($globalServerAPRSpass)) $aprs_pass = $globalServerAPRSpass;
606 605
 	else $aprs_pass = '-1';
607 606
 	
608
-	$aprs_filter  = '';
607
+	$aprs_filter = '';
609 608
 	$aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version}\n";
610 609
 	$Common = new Common();
611
-	$s = $Common->create_socket($globalServerAPRShost,$globalServerAPRSport,$errno,$errstr);
610
+	$s = $Common->create_socket($globalServerAPRShost, $globalServerAPRSport, $errno, $errstr);
612 611
 	if ($s !== false) {
613 612
 		echo 'Connected to APRS server! '."\n";
614 613
 		$authstart = time();
615 614
 		$this->socket = $s;
616
-		$send = socket_send( $this->socket  , $aprs_login , strlen($aprs_login) , 0 );
617
-		socket_set_option($this->socket,SOL_SOCKET,SO_KEEPALIVE,1);
618
-		while ($msgin = socket_read($this->socket, 1000,PHP_NORMAL_READ)) {
615
+		$send = socket_send($this->socket, $aprs_login, strlen($aprs_login), 0);
616
+		socket_set_option($this->socket, SOL_SOCKET, SO_KEEPALIVE, 1);
617
+		while ($msgin = socket_read($this->socket, 1000, PHP_NORMAL_READ)) {
619 618
 			if (strpos($msgin, "$aprs_ssid verified") !== FALSE) {
620 619
 			    echo 'APRS user verified !'."\n";
621 620
 			    $this->connected = true;
622 621
 			    return true;
623 622
 			    break;
624 623
 			}
625
-			if (time()-$authstart > 5) {
624
+			if (time() - $authstart > 5) {
626 625
 			    echo 'APRS timeout'."\n";
627 626
 			    break;
628 627
 			}
@@ -637,7 +636,7 @@  discard block
 block discarded – undo
637 636
     public function send($data) {
638 637
 	global $globalDebug;
639 638
 	if ($this->connected === false) $this->connect();
640
-	$send = socket_send( $this->socket  , $data , strlen($data),0);
639
+	$send = socket_send($this->socket, $data, strlen($data), 0);
641 640
 	if ($send === FALSE) {
642 641
 		if ($globalDebug) echo 'Reconnect...';
643 642
 		socket_close($this->socket);
@@ -647,16 +646,16 @@  discard block
 block discarded – undo
647 646
 }
648 647
 
649 648
 class APRSSpotter extends APRS {
650
-	public function addLiveSpotterData($id,$ident,$aircraft_icao,$departure_airport,$arrival_airport,$latitude,$longitude,$waypoints,$altitude,$altitude_real,$heading,$speed,$datetime,$departure_airport_time,$arrival_airport_time,$squawk,$route_stop,$hex,$putinarchive,$registration,$pilot_id,$pilot_name, $verticalrate, $noarchive, $ground,$format_source,$source_name,$over_country) {
649
+	public function addLiveSpotterData($id, $ident, $aircraft_icao, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $altitude_real, $heading, $speed, $datetime, $departure_airport_time, $arrival_airport_time, $squawk, $route_stop, $hex, $putinarchive, $registration, $pilot_id, $pilot_name, $verticalrate, $noarchive, $ground, $format_source, $source_name, $over_country) {
651 650
 		$Common = new Common();
652 651
 		if ($latitude != '' && $longitude != '') {
653 652
 			$lat = $latitude;
654 653
 			$long = $longitude;
655
-			$latitude = $Common->convertDM($latitude,'latitude');
656
-			$longitude = $Common->convertDM($longitude,'longitude');
657
-			$coordinate = sprintf("%02d",$latitude['deg']).str_pad(number_format($latitude['min'],2,'.',''),5,'0',STR_PAD_LEFT).$latitude['NSEW'].'/'.sprintf("%03d",$longitude['deg']).str_pad(number_format($longitude['min'],2,'.',''),5,'0',STR_PAD_LEFT).$longitude['NSEW'];
658
-			$w1 = abs(ceil(($latitude['min'] - number_format($latitude['min'],2,'.',''))*1000));
659
-			$w2 = abs(ceil(($longitude['min'] - number_format($longitude['min'],2,'.',''))*1000));
654
+			$latitude = $Common->convertDM($latitude, 'latitude');
655
+			$longitude = $Common->convertDM($longitude, 'longitude');
656
+			$coordinate = sprintf("%02d", $latitude['deg']).str_pad(number_format($latitude['min'], 2, '.', ''), 5, '0', STR_PAD_LEFT).$latitude['NSEW'].'/'.sprintf("%03d", $longitude['deg']).str_pad(number_format($longitude['min'], 2, '.', ''), 5, '0', STR_PAD_LEFT).$longitude['NSEW'];
657
+			$w1 = abs(ceil(($latitude['min'] - number_format($latitude['min'], 2, '.', ''))*1000));
658
+			$w2 = abs(ceil(($longitude['min'] - number_format($longitude['min'], 2, '.', ''))*1000));
660 659
 			$w = $w1.$w2;
661 660
 			//$w = '00';
662 661
 			$custom = '';
@@ -683,25 +682,25 @@  discard block
 block discarded – undo
683 682
 			$geoid= round($GeoidClass->get($lat,$long)*3.28084,2);
684 683
 			$altitude_real = round($altitude_real + $geoid);
685 684
 			*/
686
-			$this->send('AIRCRAFT>APRS,TCPIP*:;'.$hex.'   *'.date('His',strtotime($datetime)).'h'.$coordinate.'^'.str_pad($heading,3,'0',STR_PAD_LEFT).'/'.str_pad($speed,3,'0',STR_PAD_LEFT).'/A='.str_pad($altitude_real,6,'0',STR_PAD_LEFT).' !W'.$w.'!'.$custom."\n");
685
+			$this->send('AIRCRAFT>APRS,TCPIP*:;'.$hex.'   *'.date('His', strtotime($datetime)).'h'.$coordinate.'^'.str_pad($heading, 3, '0', STR_PAD_LEFT).'/'.str_pad($speed, 3, '0', STR_PAD_LEFT).'/A='.str_pad($altitude_real, 6, '0', STR_PAD_LEFT).' !W'.$w.'!'.$custom."\n");
687 686
 		}
688 687
 	}
689 688
 }
690 689
 class APRSMarine extends APRS {
691
-	public function addLiveMarineData($id, $ident, $latitude, $longitude, $heading, $speed,$datetime, $putinarchive,$mmsi,$type,$typeid,$imo,$callsign,$arrival_code,$arrival_date,$status,$statusid,$noarchive,$format_source,$source_name,$over_country) {
690
+	public function addLiveMarineData($id, $ident, $latitude, $longitude, $heading, $speed, $datetime, $putinarchive, $mmsi, $type, $typeid, $imo, $callsign, $arrival_code, $arrival_date, $status, $statusid, $noarchive, $format_source, $source_name, $over_country) {
692 691
 		$Common = new Common();
693 692
 		if ($latitude != '' && $longitude != '') {
694
-			$latitude = $Common->convertDM($latitude,'latitude');
695
-			$longitude = $Common->convertDM($longitude,'longitude');
696
-			$coordinate = sprintf("%02d",$latitude['deg']).str_pad(number_format($latitude['min'],2,'.',''),5,'0',STR_PAD_LEFT).$latitude['NSEW'].'/'.sprintf("%03d",$longitude['deg']).str_pad(number_format($longitude['min'],2,'.',''),5,'0',STR_PAD_LEFT).$longitude['NSEW'];
697
-			$w1 = abs(ceil(($latitude['min'] - number_format($latitude['min'],2,'.',''))*1000));
698
-			$w2 = abs(ceil(($longitude['min'] - number_format($longitude['min'],2,'.',''))*1000));
693
+			$latitude = $Common->convertDM($latitude, 'latitude');
694
+			$longitude = $Common->convertDM($longitude, 'longitude');
695
+			$coordinate = sprintf("%02d", $latitude['deg']).str_pad(number_format($latitude['min'], 2, '.', ''), 5, '0', STR_PAD_LEFT).$latitude['NSEW'].'/'.sprintf("%03d", $longitude['deg']).str_pad(number_format($longitude['min'], 2, '.', ''), 5, '0', STR_PAD_LEFT).$longitude['NSEW'];
696
+			$w1 = abs(ceil(($latitude['min'] - number_format($latitude['min'], 2, '.', ''))*1000));
697
+			$w2 = abs(ceil(($longitude['min'] - number_format($longitude['min'], 2, '.', ''))*1000));
699 698
 			$w = $w1.$w2;
700 699
 			//$w = '00';
701 700
 			$custom = '';
702 701
 			if ($ident != '') {
703 702
 				if ($custom != '') $custom .= '/';
704
-				$custom .= 'CS='.str_replace(' ','_',$ident);
703
+				$custom .= 'CS='.str_replace(' ', '_', $ident);
705 704
 			}
706 705
 			if ($typeid != '') {
707 706
 				if ($custom != '') $custom .= '/';
@@ -721,11 +720,11 @@  discard block
 block discarded – undo
721 720
 			}
722 721
 			if ($arrival_code != '') {
723 722
 				if ($custom != '') $custom .= '/';
724
-				$custom .= 'AC='.str_replace(' ','_',$arrival_code);
723
+				$custom .= 'AC='.str_replace(' ', '_', $arrival_code);
725 724
 			}
726 725
 			if ($custom != '') $custom = ' '.$custom;
727 726
 			$altitude = 0;
728
-			$this->send('MARINE>APRS,TCPIP*:;'.$mmsi.'*'.date('His',strtotime($datetime)).'h'.$coordinate.'s'.str_pad($heading,3,'0',STR_PAD_LEFT).'/'.str_pad($speed,3,'0',STR_PAD_LEFT).'/A='.str_pad($altitude,6,'0',STR_PAD_LEFT).' !W'.$w.'!'.$custom."\n");
727
+			$this->send('MARINE>APRS,TCPIP*:;'.$mmsi.'*'.date('His', strtotime($datetime)).'h'.$coordinate.'s'.str_pad($heading, 3, '0', STR_PAD_LEFT).'/'.str_pad($speed, 3, '0', STR_PAD_LEFT).'/A='.str_pad($altitude, 6, '0', STR_PAD_LEFT).' !W'.$w.'!'.$custom."\n");
729 728
 		}
730 729
 	}
731 730
 }
Please login to merge, or discard this patch.
Braces   +307 added lines, -110 removed lines patch added patch discarded remove patch
@@ -184,17 +184,23 @@  discard block
 block discarded – undo
184 184
 	
185 185
 	/* Check that end was found and body has at least one byte. */
186 186
 	if ($splitpos == 0 || $splitpos + 1 == $input_len || $splitpos === FALSE) {
187
-	    if ($globalDebug) echo '!!! APRS invalid : '.$input."\n";
187
+	    if ($globalDebug) {
188
+	    	echo '!!! APRS invalid : '.$input."\n";
189
+	    }
188 190
 	    return false;
189 191
 	}
190 192
 	
191
-	if ($debug) echo 'input : '.$input."\n";
193
+	if ($debug) {
194
+		echo 'input : '.$input."\n";
195
+	}
192 196
 	/* Save header and body. */
193 197
 	$body = substr($input,$splitpos+1,$input_len);
194 198
 	$body_len = strlen($body);
195 199
 	$header = substr($input,0,$splitpos);
196 200
 	//$header_len = strlen($header);
197
-	if ($debug) echo 'header : '.$header."\n";
201
+	if ($debug) {
202
+		echo 'header : '.$header."\n";
203
+	}
198 204
 	
199 205
 	/* Parse source, target and path. */
200 206
 	//FLRDF0A52>APRS,qAS,LSTB
@@ -208,11 +214,15 @@  discard block
 block discarded – undo
208 214
 		$result['format_source'] = 'famaprs';
209 215
 		$result['source_type'] = 'ais';
210 216
 	    } else {
211
-		if ($debug) echo 'ident : '.$ident."\n";
217
+		if ($debug) {
218
+			echo 'ident : '.$ident."\n";
219
+		}
212 220
 		$result['ident'] = $ident;
213 221
 	    }
214 222
 	} else {
215
-	    if ($debug) 'No ident'."\n";
223
+	    if ($debug) {
224
+	    	'No ident'."\n";
225
+	    }
216 226
 	    return false;
217 227
 	}
218 228
 	$elements = explode(',',$all_elements);
@@ -223,7 +233,9 @@  discard block
 block discarded – undo
223 233
 	        //echo "ok";
224 234
 	        //if ($element == 'TCPIP*') return false;
225 235
 	    } elseif (!preg_match('/^([0-9A-F]{32})$/',$element)) {
226
-		if ($debug) echo 'element : '.$element."\n";
236
+		if ($debug) {
237
+			echo 'element : '.$element."\n";
238
+		}
227 239
 		return false;
228 240
 	    }
229 241
 	    /*
@@ -236,13 +248,17 @@  discard block
 block discarded – undo
236 248
 	}
237 249
 	
238 250
 	$type = substr($body,0,1);
239
-	if ($debug) echo 'type : '.$type."\n";
251
+	if ($debug) {
252
+		echo 'type : '.$type."\n";
253
+	}
240 254
 	if ($type == ';') {
241 255
 		if (isset($result['source_type']) && $result['source_type'] == 'modes') {
242 256
 			$result['address'] = trim(substr($body,1,9));
243 257
 		} elseif (isset($result['source_type']) && $result['source_type'] == 'ais') {
244 258
 			$result['mmsi'] = trim(substr($body,1,9));
245
-		} else $result['ident'] = trim(substr($body,1,9));
259
+		} else {
260
+			$result['ident'] = trim(substr($body,1,9));
261
+		}
246 262
 	} elseif ($type == ',') {
247 263
 		// Invalid data or test data
248 264
 		return false;
@@ -311,7 +327,9 @@  discard block
 block discarded – undo
311 327
 		//$symbol_table = $matches[4];
312 328
 		$lat = intval($lat_deg);
313 329
 		$lon = intval($lon_deg);
314
-		if ($lat > 89 || $lon > 179) return false;
330
+		if ($lat > 89 || $lon > 179) {
331
+			return false;
332
+		}
315 333
 	    
316 334
 	    /*
317 335
 	    $tmp_5b = str_replace('.','',$lat_min);
@@ -321,8 +339,12 @@  discard block
 block discarded – undo
321 339
 	    */
322 340
 		$latitude = $lat + floatval($lat_min)/60;
323 341
 		$longitude = $lon + floatval($lon_min)/60;
324
-		if ($sind == 'S') $latitude = 0-$latitude;
325
-		if ($wind == 'W') $longitude = 0-$longitude;
342
+		if ($sind == 'S') {
343
+			$latitude = 0-$latitude;
344
+		}
345
+		if ($wind == 'W') {
346
+			$longitude = 0-$longitude;
347
+		}
326 348
 		$result['latitude'] = $latitude;
327 349
 		$result['longitude'] = $longitude;
328 350
 		$body_parse = substr($body_parse,18);
@@ -350,8 +372,11 @@  discard block
 block discarded – undo
350 372
 			//echo 'find'."\n";
351 373
 			$body_split = str_split($body_parse);
352 374
 			$symbol_code = $body_split[0];
353
-			if (!isset($symbolll) || $symbolll == '/') $symbol_code = '/'.$symbol_code;
354
-			else $symbol_code = '\\'.$symbol_code;
375
+			if (!isset($symbolll) || $symbolll == '/') {
376
+				$symbol_code = '/'.$symbol_code;
377
+			} else {
378
+				$symbol_code = '\\'.$symbol_code;
379
+			}
355 380
 		//'
356 381
 		//}
357 382
 		//echo $body_parse;
@@ -360,7 +385,9 @@  discard block
 block discarded – undo
360 385
 			$body_parse = substr($body_parse,1);
361 386
 			$body_parse_len = strlen($body_parse);
362 387
 			$result['symbol_code'] = $symbol_code;
363
-			if (isset($this->symbols[$symbol_code])) $result['symbol'] = $this->symbols[$symbol_code];
388
+			if (isset($this->symbols[$symbol_code])) {
389
+				$result['symbol'] = $this->symbols[$symbol_code];
390
+			}
364 391
 			if ($symbol_code != '_') {
365 392
 			}
366 393
 		    //$body_parse = substr($body_parse,1);
@@ -371,7 +398,9 @@  discard block
 block discarded – undo
371 398
 		        if (preg_match('/^([0-9\\. ]{3})\\/([0-9\\. ]{3})/',$body_parse)) {
372 399
 		    	    $course = substr($body_parse,0,3);
373 400
 		    	    $tmp_s = intval($course);
374
-		    	    if ($tmp_s >= 1 && $tmp_s <= 360) $result['heading'] = intval($course);
401
+		    	    if ($tmp_s >= 1 && $tmp_s <= 360) {
402
+		    	    	$result['heading'] = intval($course);
403
+		    	    }
375 404
 		    	    $speed = substr($body_parse,4,3);
376 405
 		    	    if ($speed != '...') {
377 406
 		    		//$result['speed'] = round($speed*1.852);
@@ -412,10 +441,16 @@  discard block
 block discarded – undo
412 441
 			        $lat_off = (($dao_split[1])-48.0)*0.001/60.0;
413 442
 			        $lon_off = (($dao_split[2])-48.0)*0.001/60.0;
414 443
 			    
415
-				if ($result['latitude'] < 0) $result['latitude'] -= $lat_off;
416
-				else $result['latitude'] += $lat_off;
417
-				if ($result['longitude'] < 0) $result['longitude'] -= $lon_off;
418
-				else $result['longitude'] += $lon_off;
444
+				if ($result['latitude'] < 0) {
445
+					$result['latitude'] -= $lat_off;
446
+				} else {
447
+					$result['latitude'] += $lat_off;
448
+				}
449
+				if ($result['longitude'] < 0) {
450
+					$result['longitude'] -= $lon_off;
451
+				} else {
452
+					$result['longitude'] += $lon_off;
453
+				}
419 454
 			    }
420 455
 			    
421 456
 		            $body_parse = substr($body_parse,6);
@@ -457,27 +492,48 @@  discard block
 block discarded – undo
457 492
 			$address = substr($id,2);
458 493
 			//print_r($matches);
459 494
 			$addressType = (intval(substr($id,0,2),16))&3;
460
-			if ($addressType == 0) $result['addresstype'] = "RANDOM";
461
-			elseif ($addressType == 1) $result['addresstype'] = "ICAO";
462
-			elseif ($addressType == 2) $result['addresstype'] = "FLARM";
463
-			elseif ($addressType == 3) $result['addresstype'] = "OGN";
495
+			if ($addressType == 0) {
496
+				$result['addresstype'] = "RANDOM";
497
+			} elseif ($addressType == 1) {
498
+				$result['addresstype'] = "ICAO";
499
+			} elseif ($addressType == 2) {
500
+				$result['addresstype'] = "FLARM";
501
+			} elseif ($addressType == 3) {
502
+				$result['addresstype'] = "OGN";
503
+			}
464 504
 			$aircraftType = $this->urshift(((intval(substr($id,0,2),16)) & 0b1111100),2);
465 505
 			$result['aircrafttype_code'] = $aircraftType;
466
-			if ($aircraftType == 0) $result['aircrafttype'] = "UNKNOWN";
467
-			elseif ($aircraftType == 1) $result['aircrafttype'] = "GLIDER";
468
-			elseif ($aircraftType == 2) $result['aircrafttype'] = "TOW_PLANE";
469
-			elseif ($aircraftType == 3) $result['aircrafttype'] = "HELICOPTER_ROTORCRAFT";
470
-			elseif ($aircraftType == 4) $result['aircrafttype'] = "PARACHUTE";
471
-			elseif ($aircraftType == 5) $result['aircrafttype'] = "DROP_PLANE";
472
-			elseif ($aircraftType == 6) $result['aircrafttype'] = "HANG_GLIDER";
473
-			elseif ($aircraftType == 7) $result['aircrafttype'] = "PARA_GLIDER";
474
-			elseif ($aircraftType == 8) $result['aircrafttype'] = "POWERED_AIRCRAFT";
475
-			elseif ($aircraftType == 9) $result['aircrafttype'] = "JET_AIRCRAFT";
476
-			elseif ($aircraftType == 10) $result['aircrafttype'] = "UFO";
477
-			elseif ($aircraftType == 11) $result['aircrafttype'] = "BALLOON";
478
-			elseif ($aircraftType == 12) $result['aircrafttype'] = "AIRSHIP";
479
-			elseif ($aircraftType == 13) $result['aircrafttype'] = "UAV";
480
-			elseif ($aircraftType == 15) $result['aircrafttype'] = "STATIC_OBJECT";
506
+			if ($aircraftType == 0) {
507
+				$result['aircrafttype'] = "UNKNOWN";
508
+			} elseif ($aircraftType == 1) {
509
+				$result['aircrafttype'] = "GLIDER";
510
+			} elseif ($aircraftType == 2) {
511
+				$result['aircrafttype'] = "TOW_PLANE";
512
+			} elseif ($aircraftType == 3) {
513
+				$result['aircrafttype'] = "HELICOPTER_ROTORCRAFT";
514
+			} elseif ($aircraftType == 4) {
515
+				$result['aircrafttype'] = "PARACHUTE";
516
+			} elseif ($aircraftType == 5) {
517
+				$result['aircrafttype'] = "DROP_PLANE";
518
+			} elseif ($aircraftType == 6) {
519
+				$result['aircrafttype'] = "HANG_GLIDER";
520
+			} elseif ($aircraftType == 7) {
521
+				$result['aircrafttype'] = "PARA_GLIDER";
522
+			} elseif ($aircraftType == 8) {
523
+				$result['aircrafttype'] = "POWERED_AIRCRAFT";
524
+			} elseif ($aircraftType == 9) {
525
+				$result['aircrafttype'] = "JET_AIRCRAFT";
526
+			} elseif ($aircraftType == 10) {
527
+				$result['aircrafttype'] = "UFO";
528
+			} elseif ($aircraftType == 11) {
529
+				$result['aircrafttype'] = "BALLOON";
530
+			} elseif ($aircraftType == 12) {
531
+				$result['aircrafttype'] = "AIRSHIP";
532
+			} elseif ($aircraftType == 13) {
533
+				$result['aircrafttype'] = "UAV";
534
+			} elseif ($aircraftType == 15) {
535
+				$result['aircrafttype'] = "STATIC_OBJECT";
536
+			}
481 537
 			$stealth = (intval(substr($id,0,2), 16) & 0b10000000) != 0;
482 538
 			$result['stealth'] = $stealth;
483 539
 			$result['address'] = $address;
@@ -517,79 +573,183 @@  discard block
 block discarded – undo
517 573
 		    //g012t088r000p000P000h38b10110
518 574
 		    //g011t086r000p000P000h29b10198
519 575
 		    if (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3,4})r([0-9 \\.]{3})p([0-9 \\.]{3})P([0-9 \\.]{3})h([0-9 \\.]{2,3})b([0-9 \\.]{5})/',$body_parse,$matches)) {
520
-			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
521
-			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
522
-			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
523
-			if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1);
524
-			if ($matches[5] != '...') $result['precipitation24h'] = round((intval($matches[5])/100)*25.1,1);
525
-			if ($matches[6] != '...') $result['humidity'] = intval($matches[6]);
526
-			if ($matches[7] != '...') $result['pressure'] = round((intval($matches[7])/10),1);
576
+			if ($matches[1] != '...') {
577
+				$result['wind_gust'] = round($matches[1]*1.60934,1);
578
+			}
579
+			if ($matches[2] != '...') {
580
+				$result['temp'] = round(5/9*((intval($matches[2]))-32),1);
581
+			}
582
+			if ($matches[3] != '...') {
583
+				$result['rain'] = round((intval($matches[3])/100)*25.1,1);
584
+			}
585
+			if ($matches[4] != '...') {
586
+				$result['precipitation'] = round((intval($matches[4])/100)*25.1,1);
587
+			}
588
+			if ($matches[5] != '...') {
589
+				$result['precipitation24h'] = round((intval($matches[5])/100)*25.1,1);
590
+			}
591
+			if ($matches[6] != '...') {
592
+				$result['humidity'] = intval($matches[6]);
593
+			}
594
+			if ($matches[7] != '...') {
595
+				$result['pressure'] = round((intval($matches[7])/10),1);
596
+			}
527 597
 		        $body_parse = substr($body_parse,strlen($matches[0]));
528 598
 		    } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3,4})r([0-9 \\.]{3})P([0-9 \\.]{3})p([0-9 \\.]{3})h([0-9 \\.]{2,3})b([0-9 \\.]{5})/',$body_parse,$matches)) {
529
-			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
530
-			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
531
-			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
532
-			if ($matches[5] != '...') $result['precipitation'] = round((intval($matches[5])/100)*25.1,1);
533
-			if ($matches[4] != '...') $result['precipitation24h'] = round((intval($matches[4])/100)*25.1,1);
534
-			if ($matches[6] != '...') $result['humidity'] = intval($matches[6]);
535
-			if ($matches[7] != '...') $result['pressure'] = round((intval($matches[7])/10),1);
599
+			if ($matches[1] != '...') {
600
+				$result['wind_gust'] = round($matches[1]*1.60934,1);
601
+			}
602
+			if ($matches[2] != '...') {
603
+				$result['temp'] = round(5/9*((intval($matches[2]))-32),1);
604
+			}
605
+			if ($matches[3] != '...') {
606
+				$result['rain'] = round((intval($matches[3])/100)*25.1,1);
607
+			}
608
+			if ($matches[5] != '...') {
609
+				$result['precipitation'] = round((intval($matches[5])/100)*25.1,1);
610
+			}
611
+			if ($matches[4] != '...') {
612
+				$result['precipitation24h'] = round((intval($matches[4])/100)*25.1,1);
613
+			}
614
+			if ($matches[6] != '...') {
615
+				$result['humidity'] = intval($matches[6]);
616
+			}
617
+			if ($matches[7] != '...') {
618
+				$result['pressure'] = round((intval($matches[7])/10),1);
619
+			}
536 620
 		        $body_parse = substr($body_parse,strlen($matches[0]));
537 621
 		    } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})P([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) {
538
-			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
539
-			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
540
-			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
541
-			if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1);
542
-			if ($matches[5] != '...') $result['precipitation24h'] = round((intval($matches[5])/100)*25.1,1);
543
-			if ($matches[7] != '...') $result['humidity'] = intval($matches[7]);
544
-			if ($matches[6] != '...') $result['pressure'] = round((intval($matches[6])/10),1);
622
+			if ($matches[1] != '...') {
623
+				$result['wind_gust'] = round($matches[1]*1.60934,1);
624
+			}
625
+			if ($matches[2] != '...') {
626
+				$result['temp'] = round(5/9*((intval($matches[2]))-32),1);
627
+			}
628
+			if ($matches[3] != '...') {
629
+				$result['rain'] = round((intval($matches[3])/100)*25.1,1);
630
+			}
631
+			if ($matches[4] != '...') {
632
+				$result['precipitation'] = round((intval($matches[4])/100)*25.1,1);
633
+			}
634
+			if ($matches[5] != '...') {
635
+				$result['precipitation24h'] = round((intval($matches[5])/100)*25.1,1);
636
+			}
637
+			if ($matches[7] != '...') {
638
+				$result['humidity'] = intval($matches[7]);
639
+			}
640
+			if ($matches[6] != '...') {
641
+				$result['pressure'] = round((intval($matches[6])/10),1);
642
+			}
545 643
 		        $body_parse = substr($body_parse,strlen($matches[0]));
546 644
 		    } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})P([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) {
547
-			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
548
-			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
549
-			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
550
-			if ($matches[4] != '...') $result['precipitation24h'] = round((intval($matches[4])/100)*25.1,1);
551
-			if ($matches[6] != '...') $result['humidity'] = intval($matches[6]);
552
-			if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1);
645
+			if ($matches[1] != '...') {
646
+				$result['wind_gust'] = round($matches[1]*1.60934,1);
647
+			}
648
+			if ($matches[2] != '...') {
649
+				$result['temp'] = round(5/9*((intval($matches[2]))-32),1);
650
+			}
651
+			if ($matches[3] != '...') {
652
+				$result['rain'] = round((intval($matches[3])/100)*25.1,1);
653
+			}
654
+			if ($matches[4] != '...') {
655
+				$result['precipitation24h'] = round((intval($matches[4])/100)*25.1,1);
656
+			}
657
+			if ($matches[6] != '...') {
658
+				$result['humidity'] = intval($matches[6]);
659
+			}
660
+			if ($matches[5] != '...') {
661
+				$result['pressure'] = round((intval($matches[5])/10),1);
662
+			}
553 663
 		        $body_parse = substr($body_parse,strlen($matches[0]));
554 664
 		    } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) {
555
-			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
556
-			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
557
-			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
558
-			if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1);
559
-			if ($matches[6] != '...') $result['humidity'] = intval($matches[6]);
560
-			if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1);
665
+			if ($matches[1] != '...') {
666
+				$result['wind_gust'] = round($matches[1]*1.60934,1);
667
+			}
668
+			if ($matches[2] != '...') {
669
+				$result['temp'] = round(5/9*((intval($matches[2]))-32),1);
670
+			}
671
+			if ($matches[3] != '...') {
672
+				$result['rain'] = round((intval($matches[3])/100)*25.1,1);
673
+			}
674
+			if ($matches[4] != '...') {
675
+				$result['precipitation'] = round((intval($matches[4])/100)*25.1,1);
676
+			}
677
+			if ($matches[6] != '...') {
678
+				$result['humidity'] = intval($matches[6]);
679
+			}
680
+			if ($matches[5] != '...') {
681
+				$result['pressure'] = round((intval($matches[5])/10),1);
682
+			}
561 683
 		        $body_parse = substr($body_parse,strlen($matches[0]));
562 684
 		    } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) {
563
-			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
564
-			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
565
-			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
566
-			if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1);
567
-			if ($matches[5] != '...') $result['humidity'] = intval($matches[5]);
568
-			if ($matches[6] != '...') $result['pressure'] = round((intval($matches[6])/10),1);
685
+			if ($matches[1] != '...') {
686
+				$result['wind_gust'] = round($matches[1]*1.60934,1);
687
+			}
688
+			if ($matches[2] != '...') {
689
+				$result['temp'] = round(5/9*((intval($matches[2]))-32),1);
690
+			}
691
+			if ($matches[3] != '...') {
692
+				$result['rain'] = round((intval($matches[3])/100)*25.1,1);
693
+			}
694
+			if ($matches[4] != '...') {
695
+				$result['precipitation'] = round((intval($matches[4])/100)*25.1,1);
696
+			}
697
+			if ($matches[5] != '...') {
698
+				$result['humidity'] = intval($matches[5]);
699
+			}
700
+			if ($matches[6] != '...') {
701
+				$result['pressure'] = round((intval($matches[6])/10),1);
702
+			}
569 703
 		        $body_parse = substr($body_parse,strlen($matches[0]));
570 704
 		    } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) {
571
-			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
572
-			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
573
-			if ($matches[2] != '...') $result['humidity'] = intval($matches[3]);
574
-			if ($matches[4] != '...') $result['pressure'] = round((intval($matches[4])/10),1);
705
+			if ($matches[1] != '...') {
706
+				$result['wind_gust'] = round($matches[1]*1.60934,1);
707
+			}
708
+			if ($matches[2] != '...') {
709
+				$result['temp'] = round(5/9*((intval($matches[2]))-32),1);
710
+			}
711
+			if ($matches[2] != '...') {
712
+				$result['humidity'] = intval($matches[3]);
713
+			}
714
+			if ($matches[4] != '...') {
715
+				$result['pressure'] = round((intval($matches[4])/10),1);
716
+			}
575 717
 		        $body_parse = substr($body_parse,strlen($matches[0]));
576 718
 		    } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{2,3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) {
577
-			if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1);
578
-			if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1);
579
-			if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1);
580
-			if ($matches[4] != '...') $result['humidity'] = intval($matches[4]);
581
-			if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1);
719
+			if ($matches[1] != '...') {
720
+				$result['wind_gust'] = round($matches[1]*1.60934,1);
721
+			}
722
+			if ($matches[2] != '...') {
723
+				$result['temp'] = round(5/9*((intval($matches[2]))-32),1);
724
+			}
725
+			if ($matches[3] != '...') {
726
+				$result['rain'] = round((intval($matches[3])/100)*25.1,1);
727
+			}
728
+			if ($matches[4] != '...') {
729
+				$result['humidity'] = intval($matches[4]);
730
+			}
731
+			if ($matches[5] != '...') {
732
+				$result['pressure'] = round((intval($matches[5])/10),1);
733
+			}
582 734
 		        $body_parse = substr($body_parse,strlen($matches[0]));
583 735
 		    }
584 736
 		    $result['comment'] = trim($body_parse);
585 737
 		}
586
-		} else $result['comment'] = trim($body_parse);
738
+		} else {
739
+			$result['comment'] = trim($body_parse);
740
+		}
587 741
 
588 742
 	    }
589 743
 	//}
590
-	if (isset($result['latitude'])) $result['latitude'] = round($result['latitude'],4);
591
-	if (isset($result['longitude'])) $result['longitude'] = round($result['longitude'],4);
592
-	if ($debug) print_r($result);
744
+	if (isset($result['latitude'])) {
745
+		$result['latitude'] = round($result['latitude'],4);
746
+	}
747
+	if (isset($result['longitude'])) {
748
+		$result['longitude'] = round($result['longitude'],4);
749
+	}
750
+	if ($debug) {
751
+		print_r($result);
752
+	}
593 753
 	return $result;
594 754
     }
595 755
     
@@ -598,12 +758,21 @@  discard block
 block discarded – undo
598 758
 	$aprs_connect = 0;
599 759
 	$aprs_keep = 120;
600 760
 	$aprs_last_tx = time();
601
-	if (isset($globalAPRSversion)) $aprs_version = $globalAPRSversion;
602
-	else $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName);
603
-	if (isset($globalServerAPRSssid)) $aprs_ssid = $globalServerAPRSssid;
604
-	else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8);
605
-	if (isset($globalServerAPRSpass)) $aprs_pass = $globalServerAPRSpass;
606
-	else $aprs_pass = '-1';
761
+	if (isset($globalAPRSversion)) {
762
+		$aprs_version = $globalAPRSversion;
763
+	} else {
764
+		$aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName);
765
+	}
766
+	if (isset($globalServerAPRSssid)) {
767
+		$aprs_ssid = $globalServerAPRSssid;
768
+	} else {
769
+		$aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8);
770
+	}
771
+	if (isset($globalServerAPRSpass)) {
772
+		$aprs_pass = $globalServerAPRSpass;
773
+	} else {
774
+		$aprs_pass = '-1';
775
+	}
607 776
 	
608 777
 	$aprs_filter  = '';
609 778
 	$aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version}\n";
@@ -636,10 +805,14 @@  discard block
 block discarded – undo
636 805
     
637 806
     public function send($data) {
638 807
 	global $globalDebug;
639
-	if ($this->connected === false) $this->connect();
808
+	if ($this->connected === false) {
809
+		$this->connect();
810
+	}
640 811
 	$send = socket_send( $this->socket  , $data , strlen($data),0);
641 812
 	if ($send === FALSE) {
642
-		if ($globalDebug) echo 'Reconnect...';
813
+		if ($globalDebug) {
814
+			echo 'Reconnect...';
815
+		}
643 816
 		socket_close($this->socket);
644 817
 		$this->connect();
645 818
 	}
@@ -661,22 +834,32 @@  discard block
 block discarded – undo
661 834
 			//$w = '00';
662 835
 			$custom = '';
663 836
 			if ($ident != '') {
664
-				if ($custom != '') $custom .= '/';
837
+				if ($custom != '') {
838
+					$custom .= '/';
839
+				}
665 840
 				$custom .= 'CS='.$ident;
666 841
 			}
667 842
 			if ($squawk != '') {
668
-				if ($custom != '') $custom .= '/';
843
+				if ($custom != '') {
844
+					$custom .= '/';
845
+				}
669 846
 				$custom .= 'SQ='.$squawk;
670 847
 			}
671 848
 			if ($verticalrate != '') {
672
-				if ($custom != '') $custom .= '/';
849
+				if ($custom != '') {
850
+					$custom .= '/';
851
+				}
673 852
 				$custom .= 'VR='.$verticalrate;
674 853
 			}
675 854
 			if ($aircraft_icao != '' && $aircraft_icao != 'NA') {
676
-				if ($custom != '') $custom .= '/';
855
+				if ($custom != '') {
856
+					$custom .= '/';
857
+				}
677 858
 				$custom .= 'AI='.$aircraft_icao;
678 859
 			}
679
-			if ($custom != '') $custom = ' '.$custom;
860
+			if ($custom != '') {
861
+				$custom = ' '.$custom;
862
+			}
680 863
 			/*
681 864
 			// Use AMSL altitude
682 865
 			$GeoidClass = new GeoidHeight();
@@ -700,30 +883,44 @@  discard block
 block discarded – undo
700 883
 			//$w = '00';
701 884
 			$custom = '';
702 885
 			if ($ident != '') {
703
-				if ($custom != '') $custom .= '/';
886
+				if ($custom != '') {
887
+					$custom .= '/';
888
+				}
704 889
 				$custom .= 'CS='.str_replace(' ','_',$ident);
705 890
 			}
706 891
 			if ($typeid != '') {
707
-				if ($custom != '') $custom .= '/';
892
+				if ($custom != '') {
893
+					$custom .= '/';
894
+				}
708 895
 				$custom .= 'TI='.$typeid;
709 896
 			}
710 897
 			if ($statusid != '') {
711
-				if ($custom != '') $custom .= '/';
898
+				if ($custom != '') {
899
+					$custom .= '/';
900
+				}
712 901
 				$custom .= 'SI='.$statusid;
713 902
 			}
714 903
 			if ($imo != '') {
715
-				if ($custom != '') $custom .= '/';
904
+				if ($custom != '') {
905
+					$custom .= '/';
906
+				}
716 907
 				$custom .= 'IMO='.$imo;
717 908
 			}
718 909
 			if ($arrival_date != '') {
719
-				if ($custom != '') $custom .= '/';
910
+				if ($custom != '') {
911
+					$custom .= '/';
912
+				}
720 913
 				$custom .= 'AD='.strtotime($arrival_date);
721 914
 			}
722 915
 			if ($arrival_code != '') {
723
-				if ($custom != '') $custom .= '/';
916
+				if ($custom != '') {
917
+					$custom .= '/';
918
+				}
724 919
 				$custom .= 'AC='.str_replace(' ','_',$arrival_code);
725 920
 			}
726
-			if ($custom != '') $custom = ' '.$custom;
921
+			if ($custom != '') {
922
+				$custom = ' '.$custom;
923
+			}
727 924
 			$altitude = 0;
728 925
 			$this->send('MARINE>APRS,TCPIP*:;'.$mmsi.'*'.date('His',strtotime($datetime)).'h'.$coordinate.'s'.str_pad($heading,3,'0',STR_PAD_LEFT).'/'.str_pad($speed,3,'0',STR_PAD_LEFT).'/A='.str_pad($altitude,6,'0',STR_PAD_LEFT).' !W'.$w.'!'.$custom."\n");
729 926
 		}
Please login to merge, or discard this patch.
require/class.ATC.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 	/**
15 15
 	* Get SQL query part for filter used
16 16
 	* @param Array $filter the filter
17
-	* @return Array the SQL part
17
+	* @return string the SQL part
18 18
 	*/
19 19
 	public function getFilter($filter = array(),$where = false,$and = false) {
20 20
 		global $globalFilter, $globalStatsFilters, $globalFilterName;
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -10,10 +10,10 @@
 block discarded – undo
10 10
 	}
11 11
 
12 12
 	/**
13
-	* Get SQL query part for filter used
14
-	* @param Array $filter the filter
15
-	* @return Array the SQL part
16
-	*/
13
+	 * Get SQL query part for filter used
14
+	 * @param Array $filter the filter
15
+	 * @return Array the SQL part
16
+	 */
17 17
 	public function getFilter($filter = array(),$where = false,$and = false) {
18 18
 		global $globalFilter, $globalStatsFilters, $globalFilterName;
19 19
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -14,22 +14,22 @@  discard block
 block discarded – undo
14 14
 	* @param Array $filter the filter
15 15
 	* @return Array the SQL part
16 16
 	*/
17
-	public function getFilter($filter = array(),$where = false,$and = false) {
17
+	public function getFilter($filter = array(), $where = false, $and = false) {
18 18
 		global $globalFilter, $globalStatsFilters, $globalFilterName;
19 19
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
20 20
 			if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
21
-				foreach($globalStatsFilters[$globalFilterName] as $source) {
21
+				foreach ($globalStatsFilters[$globalFilterName] as $source) {
22 22
 					if (isset($source['source'])) $filter['source'][] = $source['source'];
23 23
 				}
24 24
 			} else {
25 25
 				$filter = $globalStatsFilters[$globalFilterName];
26 26
 			}
27 27
 		}
28
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
28
+		if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
29 29
 		$filter_query_join = '';
30 30
 		$filter_query_where = '';
31 31
 		if (isset($filter['source']) && !empty($filter['source'])) {
32
-			$filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')";
32
+			$filter_query_where = " WHERE format_source IN ('".implode("','", $filter['source'])."')";
33 33
 		}
34 34
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
35 35
 		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 		try {
45 45
 			$sth = $this->db->prepare($query);
46 46
 			$sth->execute($query_values);
47
-		} catch(PDOException $e) {
47
+		} catch (PDOException $e) {
48 48
 			return "error : ".$e->getMessage();
49 49
 		}
50 50
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -52,66 +52,66 @@  discard block
 block discarded – undo
52 52
 	}
53 53
 
54 54
 	public function getById($id) {
55
-		$filter_query = $this->getFilter(array(),true);
55
+		$filter_query = $this->getFilter(array(), true);
56 56
 		$query = "SELECT * FROM atc".$filter_query." atc_id = :id";
57 57
 		$query_values = array(':id' => $id);
58 58
 		try {
59 59
 			$sth = $this->db->prepare($query);
60 60
 			$sth->execute($query_values);
61
-		} catch(PDOException $e) {
61
+		} catch (PDOException $e) {
62 62
 			return "error : ".$e->getMessage();
63 63
 		}
64 64
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
65 65
 		return $all;
66 66
 	}
67 67
 
68
-	public function getByIdent($ident,$format_source = '') {
69
-		$filter_query = $this->getFilter(array(),true);
68
+	public function getByIdent($ident, $format_source = '') {
69
+		$filter_query = $this->getFilter(array(), true);
70 70
 		if ($format_source == '') {
71 71
 			$query = "SELECT * FROM atc".$filter_query." ident = :ident";
72 72
 			$query_values = array(':ident' => $ident);
73 73
 		} else {
74 74
 			$query = "SELECT * FROM atc".$filter_query." ident = :ident AND format_source = :format_source";
75
-			$query_values = array(':ident' => $ident,':format_source' => $format_source);
75
+			$query_values = array(':ident' => $ident, ':format_source' => $format_source);
76 76
 		}
77 77
 		try {
78 78
 			$sth = $this->db->prepare($query);
79 79
 			$sth->execute($query_values);
80
-		} catch(PDOException $e) {
80
+		} catch (PDOException $e) {
81 81
 			return "error : ".$e->getMessage();
82 82
 		}
83 83
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
84 84
 		return $all;
85 85
 	}
86 86
 
87
-	public function add($ident,$frequency,$latitude,$longitude,$range,$info,$date,$type = '',$ivao_id = '',$ivao_name = '',$format_source = '',$source_name = '') {
88
-		$info = preg_replace('/[^(\x20-\x7F)]*/','',$info);
89
-		$info = str_replace('^','<br />',$info);
90
-		$info = str_replace('&amp;sect;','',$info);
91
-		$info = str_replace('"','',$info);
87
+	public function add($ident, $frequency, $latitude, $longitude, $range, $info, $date, $type = '', $ivao_id = '', $ivao_name = '', $format_source = '', $source_name = '') {
88
+		$info = preg_replace('/[^(\x20-\x7F)]*/', '', $info);
89
+		$info = str_replace('^', '<br />', $info);
90
+		$info = str_replace('&amp;sect;', '', $info);
91
+		$info = str_replace('"', '', $info);
92 92
 		if ($type == '') $type = NULL;
93 93
 		$query = "INSERT INTO atc (ident,frequency,latitude,longitude,atc_range,info,atc_lastseen,type,ivao_id,ivao_name,format_source,source_name) VALUES (:ident,:frequency,:latitude,:longitude,:range,:info,:date,:type,:ivao_id,:ivao_name,:format_source,:source_name)";
94
-		$query_values = array(':ident' => $ident,':frequency' => $frequency,':latitude' => $latitude,':longitude' => $longitude,':range' => $range,':info' => $info,':date' => $date,':ivao_id' => $ivao_id,':ivao_name' => $ivao_name, ':type' => $type,':format_source' => $format_source,':source_name' => $source_name);
94
+		$query_values = array(':ident' => $ident, ':frequency' => $frequency, ':latitude' => $latitude, ':longitude' => $longitude, ':range' => $range, ':info' => $info, ':date' => $date, ':ivao_id' => $ivao_id, ':ivao_name' => $ivao_name, ':type' => $type, ':format_source' => $format_source, ':source_name' => $source_name);
95 95
 		try {
96 96
 			$sth = $this->db->prepare($query);
97 97
 			$sth->execute($query_values);
98
-		} catch(PDOException $e) {
98
+		} catch (PDOException $e) {
99 99
 			return "error : ".$e->getMessage();
100 100
 		}
101 101
 	}
102 102
 
103
-	public function update($ident,$frequency,$latitude,$longitude,$range,$info,$date,$type = '',$ivao_id = '',$ivao_name = '',$format_source = '',$source_name = '') {
104
-		$info = preg_replace('/[^(\x20-\x7F)]*/','',$info);
105
-		$info = str_replace('^','<br />',$info);
106
-		$info = str_replace('&amp;sect;','',$info);
107
-		$info = str_replace('"','',$info);
103
+	public function update($ident, $frequency, $latitude, $longitude, $range, $info, $date, $type = '', $ivao_id = '', $ivao_name = '', $format_source = '', $source_name = '') {
104
+		$info = preg_replace('/[^(\x20-\x7F)]*/', '', $info);
105
+		$info = str_replace('^', '<br />', $info);
106
+		$info = str_replace('&amp;sect;', '', $info);
107
+		$info = str_replace('"', '', $info);
108 108
 		if ($type == '') $type = NULL;
109 109
 		$query = "UPDATE atc SET frequency = :frequency,latitude = :latitude,longitude = :longitude,atc_range = :range,info = :info,atc_lastseen = :date,type = :type,ivao_id = :ivao_id,ivao_name = :ivao_name WHERE ident = :ident AND format_source = :format_source AND source_name = :source_name";
110
-		$query_values = array(':ident' => $ident,':frequency' => $frequency,':latitude' => $latitude,':longitude' => $longitude,':range' => $range,':info' => $info,':date' => $date,':ivao_id' => $ivao_id,':ivao_name' => $ivao_name, ':type' => $type,':format_source' => $format_source,':source_name' => $source_name);
110
+		$query_values = array(':ident' => $ident, ':frequency' => $frequency, ':latitude' => $latitude, ':longitude' => $longitude, ':range' => $range, ':info' => $info, ':date' => $date, ':ivao_id' => $ivao_id, ':ivao_name' => $ivao_name, ':type' => $type, ':format_source' => $format_source, ':source_name' => $source_name);
111 111
 		try {
112 112
 			$sth = $this->db->prepare($query);
113 113
 			$sth->execute($query_values);
114
-		} catch(PDOException $e) {
114
+		} catch (PDOException $e) {
115 115
 			return "error : ".$e->getMessage();
116 116
 		}
117 117
 	}
@@ -122,18 +122,18 @@  discard block
 block discarded – undo
122 122
 		try {
123 123
 			$sth = $this->db->prepare($query);
124 124
 			$sth->execute($query_values);
125
-		} catch(PDOException $e) {
125
+		} catch (PDOException $e) {
126 126
 			return "error : ".$e->getMessage();
127 127
 		}
128 128
 	}
129 129
 
130
-	public function deleteByIdent($ident,$format_source) {
130
+	public function deleteByIdent($ident, $format_source) {
131 131
 		$query = "DELETE FROM atc WHERE ident = :ident AND format_source = :format_source";
132
-		$query_values = array(':ident' => $ident,':format_source' => $format_source);
132
+		$query_values = array(':ident' => $ident, ':format_source' => $format_source);
133 133
 		try {
134 134
 			$sth = $this->db->prepare($query);
135 135
 			$sth->execute($query_values);
136
-		} catch(PDOException $e) {
136
+		} catch (PDOException $e) {
137 137
 			return "error : ".$e->getMessage();
138 138
 		}
139 139
 	}
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 		try {
145 145
 			$sth = $this->db->prepare($query);
146 146
 			$sth->execute($query_values);
147
-		} catch(PDOException $e) {
147
+		} catch (PDOException $e) {
148 148
 			return "error : ".$e->getMessage();
149 149
 		}
150 150
 	}
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 		try {
160 160
 			$sth = $this->db->prepare($query);
161 161
 			$sth->execute();
162
-		} catch(PDOException $e) {
162
+		} catch (PDOException $e) {
163 163
 			return "error";
164 164
 		}
165 165
 		return "success";
Please login to merge, or discard this patch.
Braces   +17 added lines, -6 removed lines patch added patch discarded remove patch
@@ -19,20 +19,27 @@  discard block
 block discarded – undo
19 19
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
20 20
 			if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
21 21
 				foreach($globalStatsFilters[$globalFilterName] as $source) {
22
-					if (isset($source['source'])) $filter['source'][] = $source['source'];
22
+					if (isset($source['source'])) {
23
+						$filter['source'][] = $source['source'];
24
+					}
23 25
 				}
24 26
 			} else {
25 27
 				$filter = $globalStatsFilters[$globalFilterName];
26 28
 			}
27 29
 		}
28
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
30
+		if (is_array($globalFilter)) {
31
+			$filter = array_merge($filter,$globalFilter);
32
+		}
29 33
 		$filter_query_join = '';
30 34
 		$filter_query_where = '';
31 35
 		if (isset($filter['source']) && !empty($filter['source'])) {
32 36
 			$filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')";
33 37
 		}
34
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
35
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
38
+		if ($filter_query_where == '' && $where) {
39
+			$filter_query_where = ' WHERE';
40
+		} elseif ($filter_query_where != '' && $and) {
41
+			$filter_query_where .= ' AND';
42
+		}
36 43
 		$filter_query = $filter_query_join.$filter_query_where;
37 44
 		return $filter_query;
38 45
 	}
@@ -89,7 +96,9 @@  discard block
 block discarded – undo
89 96
 		$info = str_replace('^','<br />',$info);
90 97
 		$info = str_replace('&amp;sect;','',$info);
91 98
 		$info = str_replace('"','',$info);
92
-		if ($type == '') $type = NULL;
99
+		if ($type == '') {
100
+			$type = NULL;
101
+		}
93 102
 		$query = "INSERT INTO atc (ident,frequency,latitude,longitude,atc_range,info,atc_lastseen,type,ivao_id,ivao_name,format_source,source_name) VALUES (:ident,:frequency,:latitude,:longitude,:range,:info,:date,:type,:ivao_id,:ivao_name,:format_source,:source_name)";
94 103
 		$query_values = array(':ident' => $ident,':frequency' => $frequency,':latitude' => $latitude,':longitude' => $longitude,':range' => $range,':info' => $info,':date' => $date,':ivao_id' => $ivao_id,':ivao_name' => $ivao_name, ':type' => $type,':format_source' => $format_source,':source_name' => $source_name);
95 104
 		try {
@@ -105,7 +114,9 @@  discard block
 block discarded – undo
105 114
 		$info = str_replace('^','<br />',$info);
106 115
 		$info = str_replace('&amp;sect;','',$info);
107 116
 		$info = str_replace('"','',$info);
108
-		if ($type == '') $type = NULL;
117
+		if ($type == '') {
118
+			$type = NULL;
119
+		}
109 120
 		$query = "UPDATE atc SET frequency = :frequency,latitude = :latitude,longitude = :longitude,atc_range = :range,info = :info,atc_lastseen = :date,type = :type,ivao_id = :ivao_id,ivao_name = :ivao_name WHERE ident = :ident AND format_source = :format_source AND source_name = :source_name";
110 121
 		$query_values = array(':ident' => $ident,':frequency' => $frequency,':latitude' => $latitude,':longitude' => $longitude,':range' => $range,':info' => $info,':date' => $date,':ivao_id' => $ivao_id,':ivao_name' => $ivao_name, ':type' => $type,':format_source' => $format_source,':source_name' => $source_name);
111 122
 		try {
Please login to merge, or discard this patch.
tools-geoid.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
5 5
 try {
6 6
 $GeoidHeight = new GeoidHeight();
7 7
 } catch (Exception $e) {
8
-    echo $e;
8
+	echo $e;
9 9
 }
10 10
 $title = _("Geoid Height Calculator");
11 11
 require_once('header.php');
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -12,9 +12,9 @@  discard block
 block discarded – undo
12 12
 
13 13
 $page_url = $globalURL.'/tools-geoid';
14 14
 
15
-$latitude = filter_input(INPUT_POST,'latitude',FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
16
-$longitude = filter_input(INPUT_POST,'longitude',FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
17
-$altitude = filter_input(INPUT_POST,'altitude',FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
15
+$latitude = filter_input(INPUT_POST, 'latitude', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
16
+$longitude = filter_input(INPUT_POST, 'longitude', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
17
+$altitude = filter_input(INPUT_POST, 'altitude', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
18 18
 
19 19
 print '<div class="info column">';
20 20
 print '<h1>'._("Geoid Height Calculator").'</h1>';
@@ -51,14 +51,14 @@  discard block
 block discarded – undo
51 51
 
52 52
 if ($latitude != '' && $longitude != '') {
53 53
 	$globalDebug = FALSE;
54
-	$geoid = $GeoidHeight->get($latitude,$longitude);
54
+	$geoid = $GeoidHeight->get($latitude, $longitude);
55 55
 	print '<div class="row">';
56 56
 	print '<div class="col-md-3 col-md-offset-5">';
57 57
 	print '<div class="col-sm-6"><b>Geoid</b></div>';
58 58
 	print '<div class="col-sm-6">'.$geoid.'</div>';
59 59
 	if ($altitude != '') {
60 60
 		print '<div class="col-sm-6"><b>AMSL Elevation</b></div>';
61
-		print '<div class="col-sm-6">'.round($altitude-$geoid,3).'</div>';
61
+		print '<div class="col-sm-6">'.round($altitude - $geoid, 3).'</div>';
62 62
 	}
63 63
 	print '<div class="col-sm-6"><b>Earth Gravity Model</b></div>';
64 64
 	if (isset($globalGeoidSource) && $globalGeoidSource != '') $geoidsource = $globalGeoidSource;
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -61,8 +61,11 @@
 block discarded – undo
61 61
 		print '<div class="col-sm-6">'.round($altitude-$geoid,3).'</div>';
62 62
 	}
63 63
 	print '<div class="col-sm-6"><b>Earth Gravity Model</b></div>';
64
-	if (isset($globalGeoidSource) && $globalGeoidSource != '') $geoidsource = $globalGeoidSource;
65
-	else $geoidsource = 'EGM96-15';
64
+	if (isset($globalGeoidSource) && $globalGeoidSource != '') {
65
+		$geoidsource = $globalGeoidSource;
66
+	} else {
67
+		$geoidsource = 'EGM96-15';
68
+	}
66 69
 	print '<div class="col-sm-6">'.$geoidsource.'</div>';
67 70
 	print '</div>';
68 71
 }
Please login to merge, or discard this patch.