Completed
Push — master ( 6ab92f...6e8bf5 )
by Yannick
36:39
created
require/class.Common.php 1 patch
Braces   +101 added lines, -45 removed lines patch added patch discarded remove patch
@@ -37,8 +37,11 @@  discard block
 block discarded – undo
37 37
 		} else {
38 38
 			curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
39 39
 		}
40
-		if ($timeout == '') curl_setopt($ch, CURLOPT_TIMEOUT, 10); 
41
-		else curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); 
40
+		if ($timeout == '') {
41
+			curl_setopt($ch, CURLOPT_TIMEOUT, 10);
42
+		} else {
43
+			curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
44
+		}
42 45
 		curl_setopt($ch, CURLOPT_HEADERFUNCTION, array('Common',"curlResponseHeaderCallback"));
43 46
 		if ($type == 'post') {
44 47
 			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
@@ -95,8 +98,9 @@  discard block
 block discarded – undo
95 98
 	private function curlResponseHeaderCallback($ch, $headerLine) {
96 99
 		//global $cookies;
97 100
 		$cookies = array();
98
-		if (preg_match('/^Set-Cookie:\s*([^;]*)/mi', $headerLine, $cookie) == 1)
99
-			$cookies[] = $cookie;
101
+		if (preg_match('/^Set-Cookie:\s*([^;]*)/mi', $headerLine, $cookie) == 1) {
102
+					$cookies[] = $cookie;
103
+		}
100 104
 		return strlen($headerLine); // Needed by curl
101 105
 	}
102 106
 
@@ -107,7 +111,9 @@  discard block
 block discarded – undo
107 111
 		curl_setopt($ch, CURLOPT_URL, $url);
108 112
 		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
109 113
 		curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
110
-		if ($referer != '') curl_setopt($ch, CURLOPT_REFERER, $referer);
114
+		if ($referer != '') {
115
+			curl_setopt($ch, CURLOPT_REFERER, $referer);
116
+		}
111 117
 		if (isset($globalForceIPv4) && $globalForceIPv4) {
112 118
 			if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')){
113 119
 				curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
@@ -119,7 +125,9 @@  discard block
 block discarded – undo
119 125
 		curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5');
120 126
 		curl_setopt($ch, CURLOPT_FILE, $fp);
121 127
 		curl_exec($ch);
122
-		if (curl_errno($ch) && $globalDebug) echo 'Download error: '.curl_error($ch);
128
+		if (curl_errno($ch) && $globalDebug) {
129
+			echo 'Download error: '.curl_error($ch);
130
+		}
123 131
 		curl_close($ch);
124 132
 		fclose($fp);
125 133
 	}
@@ -127,12 +135,16 @@  discard block
 block discarded – undo
127 135
 	public static function gunzip($in_file,$out_file_name = '') {
128 136
 		//echo $in_file.' -> '.$out_file_name."\n";
129 137
 		$buffer_size = 4096; // read 4kb at a time
130
-		if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); 
138
+		if ($out_file_name == '') {
139
+			$out_file_name = str_replace('.gz', '', $in_file);
140
+		}
131 141
 		if ($in_file != '' && file_exists($in_file)) {
132 142
 			// PHP version of Ubuntu use gzopen64 instead of gzopen
133
-			if (function_exists('gzopen')) $file = gzopen($in_file,'rb');
134
-			elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb');
135
-			else {
143
+			if (function_exists('gzopen')) {
144
+				$file = gzopen($in_file,'rb');
145
+			} elseif (function_exists('gzopen64')) {
146
+				$file = gzopen64($in_file,'rb');
147
+			} else {
136 148
 				echo 'gzopen not available';
137 149
 				die;
138 150
 			}
@@ -148,11 +160,14 @@  discard block
 block discarded – undo
148 160
 	public static function bunzip2($in_file,$out_file_name = '') {
149 161
 		//echo $in_file.' -> '.$out_file_name."\n";
150 162
 		$buffer_size = 4096; // read 4kb at a time
151
-		if ($out_file_name == '') $out_file_name = str_replace('.bz2', '', $in_file); 
163
+		if ($out_file_name == '') {
164
+			$out_file_name = str_replace('.bz2', '', $in_file);
165
+		}
152 166
 		if ($in_file != '' && file_exists($in_file)) {
153 167
 			// PHP version of Ubuntu use gzopen64 instead of gzopen
154
-			if (function_exists('bzopen')) $file = bzopen($in_file,'rb');
155
-			else {
168
+			if (function_exists('bzopen')) {
169
+				$file = bzopen($in_file,'rb');
170
+			} else {
156 171
 				echo 'bzopen not available';
157 172
 				die;
158 173
 			}
@@ -171,10 +186,16 @@  discard block
 block discarded – undo
171 186
 	* @return Array array of the tables in HTML page
172 187
 	*/
173 188
 	public function table2array($data) {
174
-		if (!is_string($data)) return array();
175
-		if ($data == '') return array();
189
+		if (!is_string($data)) {
190
+			return array();
191
+		}
192
+		if ($data == '') {
193
+			return array();
194
+		}
176 195
 		$html = str_get_html($data);
177
-		if ($html === false) return array();
196
+		if ($html === false) {
197
+			return array();
198
+		}
178 199
 		$tabledata=array();
179 200
 		foreach($html->find('tr') as $element)
180 201
 		{
@@ -209,7 +230,9 @@  discard block
 block discarded – undo
209 230
 	*/
210 231
 	public function text2array($data) {
211 232
 		$html = str_get_html($data);
212
-		if ($html === false) return array();
233
+		if ($html === false) {
234
+			return array();
235
+		}
213 236
 		$tabledata=array();
214 237
 		foreach($html->find('p') as $element)
215 238
 		{
@@ -230,7 +253,9 @@  discard block
 block discarded – undo
230 253
 	* @return Float Distance in $unit
231 254
 	*/
232 255
 	public function distance($lat, $lon, $latc, $lonc, $unit = 'km') {
233
-		if ($lat == $latc && $lon == $lonc) return 0;
256
+		if ($lat == $latc && $lon == $lonc) {
257
+			return 0;
258
+		}
234 259
 		$dist = rad2deg(acos(sin(deg2rad(floatval($lat)))*sin(deg2rad(floatval($latc)))+ cos(deg2rad(floatval($lat)))*cos(deg2rad(floatval($latc)))*cos(deg2rad(floatval($lon)-floatval($lonc)))))*60*1.1515;
235 260
 		if ($unit == "km") {
236 261
 			return round($dist * 1.609344);
@@ -269,7 +294,9 @@  discard block
 block discarded – undo
269 294
 		$dX = $latc - $lat;
270 295
 		$dY = $lonc - $lon;
271 296
 		$azimuth = rad2deg(atan2($dY,$dX));
272
-		if ($azimuth < 0) return $azimuth+360;
297
+		if ($azimuth < 0) {
298
+			return $azimuth+360;
299
+		}
273 300
 		return $azimuth;
274 301
 	}
275 302
 	
@@ -283,10 +310,16 @@  discard block
 block discarded – undo
283 310
 	public function withinThreshold ($timeDifference, $distance) {
284 311
 		$x = abs($timeDifference);
285 312
 		$d = abs($distance);
286
-		if ($x == 0 || $d == 0) return true;
313
+		if ($x == 0 || $d == 0) {
314
+			return true;
315
+		}
287 316
 		// may be due to Internet jitter; distance is realistic
288
-		if ($x < 0.7 && $d < 2000) return true;
289
-		else return $d/$x < 1500*0.27778; // 1500 km/h max
317
+		if ($x < 0.7 && $d < 2000) {
318
+			return true;
319
+		} else {
320
+			return $d/$x < 1500*0.27778;
321
+		}
322
+		// 1500 km/h max
290 323
 	}
291 324
 
292 325
 
@@ -314,11 +347,17 @@  discard block
 block discarded – undo
314 347
 	
315 348
 	public function convertDM($coord,$latlong) {
316 349
 		if ($latlong == 'latitude') {
317
-			if ($coord < 0) $NSEW = 'S';
318
-			else $NSEW = 'N';
350
+			if ($coord < 0) {
351
+				$NSEW = 'S';
352
+			} else {
353
+				$NSEW = 'N';
354
+			}
319 355
 		} else {
320
-			if ($coord < 0) $NSEW = 'W';
321
-			else $NSEW = 'E';
356
+			if ($coord < 0) {
357
+				$NSEW = 'W';
358
+			} else {
359
+				$NSEW = 'E';
360
+			}
322 361
 		}
323 362
 		$coord = abs($coord);
324 363
 		$deg = floor($coord);
@@ -361,7 +400,9 @@  discard block
 block discarded – undo
361 400
 	public function hex2str($hex) {
362 401
 		$str = '';
363 402
 		$hexln = strlen($hex);
364
-		for($i=0;$i<$hexln;$i+=2) $str .= chr(hexdec(substr($hex,$i,2)));
403
+		for($i=0;$i<$hexln;$i+=2) {
404
+			$str .= chr(hexdec(substr($hex,$i,2)));
405
+		}
365 406
 		return $str;
366 407
 	}
367 408
 	
@@ -398,8 +439,11 @@  discard block
 block discarded – undo
398 439
 		$b = $lat2 - $lat1;
399 440
 		$c = -($a*$lat1+$b*$lon1);
400 441
 		$d = $a*$lat3+$b*$lon3+$c;
401
-		if ($d > -$approx && $d < $approx) return true;
402
-		else return false;
442
+		if ($d > -$approx && $d < $approx) {
443
+			return true;
444
+		} else {
445
+			return false;
446
+		}
403 447
 	}
404 448
 	
405 449
 	public function array_merge_noappend() {
@@ -458,7 +502,9 @@  discard block
 block discarded – undo
458 502
 			return $result;
459 503
 		}
460 504
 		$handle = @opendir('./locale');
461
-		if ($handle === false) return $result;
505
+		if ($handle === false) {
506
+			return $result;
507
+		}
462 508
 		while (false !== ($file = readdir($handle))) {
463 509
 			$path = './locale'.'/'.$file.'/LC_MESSAGES/fam.mo';
464 510
 			if ($file != "." && $file != ".." && @file_exists($path)) {
@@ -529,8 +575,9 @@  discard block
 block discarded – undo
529 575
 		$error = false; 
530 576
 		if ($fp_out = gzopen($dest, $mode)) { 
531 577
 			if ($fp_in = fopen($source,'rb')) { 
532
-				while (!feof($fp_in)) 
533
-					gzwrite($fp_out, fread($fp_in, 1024 * 512)); 
578
+				while (!feof($fp_in)) {
579
+									gzwrite($fp_out, fread($fp_in, 1024 * 512));
580
+				}
534 581
 				fclose($fp_in); 
535 582
 			} else {
536 583
 				$error = true; 
@@ -539,14 +586,17 @@  discard block
 block discarded – undo
539 586
 		} else {
540 587
 			$error = true; 
541 588
 		}
542
-		if ($error)
543
-			return false; 
544
-		else
545
-			return $dest; 
589
+		if ($error) {
590
+					return false;
591
+		} else {
592
+					return $dest;
593
+		}
546 594
 	} 
547 595
 	
548 596
 	public function remove_accents($string) {
549
-		if ( !preg_match('/[\x80-\xff]/', $string) ) return $string;
597
+		if ( !preg_match('/[\x80-\xff]/', $string) ) {
598
+			return $string;
599
+		}
550 600
 		$chars = array(
551 601
 		    // Decompositions for Latin-1 Supplement
552 602
 		    chr(195).chr(128) => 'A', chr(195).chr(129) => 'A',
@@ -670,7 +720,9 @@  discard block
 block discarded – undo
670 720
 		$ip = gethostbyname($host);
671 721
 		$s = socket_create(AF_INET, SOCK_STREAM, 0);
672 722
 		$r = @socket_connect($s, $ip, $port);
673
-		if (!socket_set_nonblock($s)) echo "Unable to set nonblock on socket\n";
723
+		if (!socket_set_nonblock($s)) {
724
+			echo "Unable to set nonblock on socket\n";
725
+		}
674 726
 		if ($r || socket_last_error() == 114 || socket_last_error() == 115) {
675 727
 			return $s;
676 728
 		}
@@ -715,18 +767,22 @@  discard block
 block discarded – undo
715 767
 		//NOTE: use a trailing slash for folders!!!
716 768
 		//see http://bugs.php.net/bug.php?id=27609
717 769
 		//see http://bugs.php.net/bug.php?id=30931
718
-		if ($path{strlen($path)-1}=='/') // recursively return a temporary file path
770
+		if ($path{strlen($path)-1}=='/') {
771
+			// recursively return a temporary file path
719 772
 			return $this->is__writable($path.uniqid(mt_rand()).'.tmp');
720
-		else if (is_dir($path))
721
-			return $this->is__writable($path.'/'.uniqid(mt_rand()).'.tmp');
773
+		} else if (is_dir($path)) {
774
+					return $this->is__writable($path.'/'.uniqid(mt_rand()).'.tmp');
775
+		}
722 776
 		// check tmp file for read/write capabilities
723 777
 		$rm = file_exists($path);
724 778
 		$f = @fopen($path, 'a');
725
-		if ($f===false)
726
-			return false;
779
+		if ($f===false) {
780
+					return false;
781
+		}
727 782
 		fclose($f);
728
-		if (!$rm)
729
-			unlink($path);
783
+		if (!$rm) {
784
+					unlink($path);
785
+		}
730 786
 		return true;
731 787
 	}
732 788
 }
Please login to merge, or discard this patch.
index.php 1 patch
Braces   +461 added lines, -116 removed lines patch added patch discarded remove patch
@@ -49,7 +49,10 @@  discard block
 block discarded – undo
49 49
 <?php
50 50
     if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
51 51
 ?>
52
-<script src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) print '?tsk='.$tsk; ?>"></script>
52
+<script src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) {
53
+	print '?tsk='.$tsk;
54
+}
55
+?>"></script>
53 56
 <?php
54 57
 	if (!isset($globalAircraft) || $globalAircraft) {
55 58
 ?>
@@ -163,11 +166,26 @@  discard block
 block discarded – undo
163 166
 				<li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam();" /><?php echo _("Display NOTAM"); ?></label></div></li>
164 167
 				<li><?php echo _("NOTAM scope:"); ?>
165 168
 					<select class="selectpicker" onchange="notamscope(this);">
166
-						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') print ' selected'; ?>>All</option>
167
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') print ' selected'; ?>>Airport/Enroute warning</option>
168
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') print ' selected'; ?>>Airport warning</option>
169
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') print ' selected'; ?>>Navigation warning</option>
170
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') print ' selected'; ?>>Enroute warning</option>
169
+						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') {
170
+	print ' selected';
171
+}
172
+?>>All</option>
173
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') {
174
+	print ' selected';
175
+}
176
+?>>Airport/Enroute warning</option>
177
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') {
178
+	print ' selected';
179
+}
180
+?>>Airport warning</option>
181
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') {
182
+	print ' selected';
183
+}
184
+?>>Navigation warning</option>
185
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') {
186
+	print ' selected';
187
+}
188
+?>>Enroute warning</option>
171 189
 					</select
172 190
 				</li>
173 191
 			</ul>
@@ -195,7 +213,12 @@  discard block
 block discarded – undo
195 213
 		        <div class="form-group">
196 214
 			    <label>From (UTC):</label>
197 215
 		            <div class='input-group date' id='datetimepicker1'>
198
-            			<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 />
216
+            			<input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) {
217
+	print $_POST['start_date'];
218
+} elseif (isset($_COOKIE['archive_begin'])) {
219
+	print date("m/d/Y h:i a",$_COOKIE['archive_begin']);
220
+}
221
+?>" required />
199 222
 		                <span class="input-group-addon">
200 223
             			    <span class="glyphicon glyphicon-calendar"></span>
201 224
 		                </span>
@@ -204,7 +227,12 @@  discard block
 block discarded – undo
204 227
 		        <div class="form-group">
205 228
 			    <label>To (UTC):</label>
206 229
 		            <div class='input-group date' id='datetimepicker2'>
207
-		                <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']); ?>" />
230
+		                <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) {
231
+	print $_POST['end_date'];
232
+} elseif (isset($_COOKIE['archive_end'])) {
233
+	print date("m/d/Y h:i a",$_COOKIE['archive_end']);
234
+}
235
+?>" />
208 236
             			<span class="input-group-addon">
209 237
 		                    <span class="glyphicon glyphicon-calendar"></span>
210 238
             			</span>
@@ -229,8 +257,20 @@  discard block
 block discarded – undo
229 257
 			</script>
230 258
 		    <li><?php echo _("Playback speed:"); ?>
231 259
 			<div class="range">
232
-			    <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'; ?>">
233
-			    <output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?></output>
260
+			    <input type="range" min="0" max="50" step="1" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php  if (isset($_POST['archivespeed'])) {
261
+	print $_POST['archivespeed'];
262
+} elseif (isset($_COOKIE['archive_speed'])) {
263
+	print $_COOKIE['archive_speed'];
264
+} else {
265
+	print '1';
266
+}
267
+?>">
268
+			    <output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) {
269
+	print $_COOKIE['archive_speed'];
270
+} else {
271
+	print '1';
272
+}
273
+?></output>
234 274
 			</div>
235 275
 		    </li>
236 276
 		    <li><input type="submit" name="archive" value="Show archive" class="btn btn-primary" /></li>
@@ -252,15 +292,27 @@  discard block
 block discarded – undo
252 292
 		    <li><?php echo _("Type of Map:"); ?>
253 293
 			<select  class="selectpicker" onchange="mapType(this);">
254 294
 			    <?php
255
-				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider;
256
-				else $MapType = $_COOKIE['MapType'];
295
+				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') {
296
+					$MapType = $globalMapProvider;
297
+				} else {
298
+					$MapType = $_COOKIE['MapType'];
299
+				}
257 300
 			    ?>
258 301
 			    <?php
259 302
 				if (isset($globalBingMapKey) && $globalBingMapKey != '') {
260 303
 			    ?>
261
-			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option>
262
-			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option>
263
-			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option>
304
+			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') {
305
+	print ' selected';
306
+}
307
+?>>Bing-Aerial</option>
308
+			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') {
309
+	print ' selected';
310
+}
311
+?>>Bing-Hybrid</option>
312
+			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') {
313
+	print ' selected';
314
+}
315
+?>>Bing-Road</option>
264 316
 			    <?php
265 317
 				}
266 318
 			    ?>
@@ -270,57 +322,135 @@  discard block
 block discarded – undo
270 322
 			    <?php
271 323
 				    if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
272 324
 			    ?>
273
-			    <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option>
274
-			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option>
275
-			    <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option>
325
+			    <option value="Here-Aerial"<?php if ($MapType == 'Here') {
326
+	print ' selected';
327
+}
328
+?>>Here-Aerial</option>
329
+			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') {
330
+	print ' selected';
331
+}
332
+?>>Here-Hybrid</option>
333
+			    <option value="Here-Road"<?php if ($MapType == 'Here') {
334
+	print ' selected';
335
+}
336
+?>>Here-Road</option>
276 337
 			    <?php
277 338
 				    }
278 339
 			    ?>
279 340
 			    <?php
280 341
 				    if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
281 342
 			    ?>
282
-			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option>
283
-			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option>
284
-			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option>
285
-			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option>
343
+			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') {
344
+	print ' selected';
345
+}
346
+?>>Google Roadmap</option>
347
+			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') {
348
+	print ' selected';
349
+}
350
+?>>Google Satellite</option>
351
+			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') {
352
+	print ' selected';
353
+}
354
+?>>Google Hybrid</option>
355
+			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') {
356
+	print ' selected';
357
+}
358
+?>>Google Terrain</option>
286 359
 			    <?php
287 360
 				    }
288 361
 			    ?>
289 362
 			    <?php
290 363
 				    if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
291 364
 			    ?>
292
-			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option>
293
-			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option>
294
-			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option>
365
+			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') {
366
+	print ' selected';
367
+}
368
+?>>MapQuest-OSM</option>
369
+			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') {
370
+	print ' selected';
371
+}
372
+?>>MapQuest-Aerial</option>
373
+			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') {
374
+	print ' selected';
375
+}
376
+?>>MapQuest-Hybrid</option>
295 377
 			    <?php
296 378
 				    }
297 379
 			    ?>
298
-			    <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option>
380
+			    <option value="Yandex"<?php if ($MapType == 'Yandex') {
381
+	print ' selected';
382
+}
383
+?>>Yandex</option>
299 384
 			    <?php
300 385
 				}
301 386
 			    ?>
302 387
 			    <?php
303 388
 				    if (isset($globalMapboxToken) && $globalMapboxToken != '') {
304
-					if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default';
305
-					else $MapBoxId = $_COOKIE['MapTypeId'];
389
+					if (!isset($_COOKIE['MapTypeId'])) {
390
+						$MapBoxId = 'default';
391
+					} else {
392
+						$MapBoxId = $_COOKIE['MapTypeId'];
393
+					}
306 394
 			    ?>
307
-			<!--    <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') print ' selected'; ?>>Mapbox GL</option> -->
308
-			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option>
309
-			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option>
310
-			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option>
311
-			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') print ' selected'; ?>>Mapbox dark</option>
312
-			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') print ' selected'; ?>>Mapbox satellite</option>
313
-			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') print ' selected'; ?>>Mapbox streets-satellite</option>
314
-			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') print ' selected'; ?>>Mapbox streets-basic</option>
315
-			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') print ' selected'; ?>>Mapbox comic</option>
316
-			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') print ' selected'; ?>>Mapbox outdoors</option>
317
-			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') print ' selected'; ?>>Mapbox pencil</option>
318
-			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option>
319
-			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option>
395
+			<!--    <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') {
396
+	print ' selected';
397
+}
398
+?>>Mapbox GL</option> -->
399
+			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') {
400
+	print ' selected';
401
+}
402
+?>>Mapbox default</option>
403
+			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') {
404
+	print ' selected';
405
+}
406
+?>>Mapbox streets</option>
407
+			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') {
408
+	print ' selected';
409
+}
410
+?>>Mapbox light</option>
411
+			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') {
412
+	print ' selected';
413
+}
414
+?>>Mapbox dark</option>
415
+			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') {
416
+	print ' selected';
417
+}
418
+?>>Mapbox satellite</option>
419
+			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') {
420
+	print ' selected';
421
+}
422
+?>>Mapbox streets-satellite</option>
423
+			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') {
424
+	print ' selected';
425
+}
426
+?>>Mapbox streets-basic</option>
427
+			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') {
428
+	print ' selected';
429
+}
430
+?>>Mapbox comic</option>
431
+			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') {
432
+	print ' selected';
433
+}
434
+?>>Mapbox outdoors</option>
435
+			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') {
436
+	print ' selected';
437
+}
438
+?>>Mapbox pencil</option>
439
+			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') {
440
+	print ' selected';
441
+}
442
+?>>Mapbox pirates</option>
443
+			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') {
444
+	print ' selected';
445
+}
446
+?>>Mapbox emerald</option>
320 447
 			    <?php
321 448
 				    }
322 449
 			    ?>
323
-			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option>
450
+			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') {
451
+	print ' selected';
452
+}
453
+?>>OpenStreetMap</option>
324 454
 			</select>
325 455
 		    </li>
326 456
 <?php
@@ -328,10 +458,22 @@  discard block
 block discarded – undo
328 458
 ?>
329 459
 		    <li><?php echo _("Type of Terrain:"); ?>
330 460
 			<select  class="selectpicker" onchange="terrainType(this);">
331
-			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option>
332
-			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option>
333
-			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option>
334
-			    <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected';?>>ArticDEM</option>
461
+			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') {
462
+	print ' selected';
463
+}
464
+?>>stk terrain</option>
465
+			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') {
466
+	print ' selected';
467
+}
468
+?>>ellipsoid</option>
469
+			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') {
470
+	print ' selected';
471
+}
472
+?>>vr terrain</option>
473
+			    <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') {
474
+	print ' selected';
475
+}
476
+?>>ArticDEM</option>
335 477
 			</select>
336 478
 		    </li>
337 479
 <?php
@@ -340,38 +482,77 @@  discard block
 block discarded – undo
340 482
 <?php
341 483
     if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
342 484
 ?>
343
-		    <li><div class="checkbox"><label><input type="checkbox" name="display2dbuildings" value="1" onclick="clickDisplay2DBuildings(this)" <?php if ((isset($_COOKIE['Map2DBuildings']) && $_COOKIE['Map2DBuildings'] == 'true') || (!isset($_COOKIE['Map2DBuildings']))) print 'checked'; ?> ><?php echo _("Display 2.5D buidings on map"); ?></label></div></li>
485
+		    <li><div class="checkbox"><label><input type="checkbox" name="display2dbuildings" value="1" onclick="clickDisplay2DBuildings(this)" <?php if ((isset($_COOKIE['Map2DBuildings']) && $_COOKIE['Map2DBuildings'] == 'true') || (!isset($_COOKIE['Map2DBuildings']))) {
486
+	print 'checked';
487
+}
488
+?> ><?php echo _("Display 2.5D buidings on map"); ?></label></div></li>
344 489
 
345 490
 <?php
346 491
 	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
347 492
 ?>
348
-		    <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>
349
-		    <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>
350
-		    <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>
351
-		    <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>
352
-		    <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>
493
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') {
494
+	print 'checked';
495
+}
496
+?> ><?php echo _("Display flight info as popup"); ?></label></div></li>
497
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true')) {
498
+	print 'checked';
499
+}
500
+?> ><?php echo _("Display flight path"); ?></label></div></li>
501
+		    <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)) {
502
+	print 'checked';
503
+}
504
+?> ><?php echo _("Display flight route on click"); ?></label></div></li>
505
+		    <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)) {
506
+	print 'checked';
507
+}
508
+?> ><?php echo _("Display flight remaining route on click"); ?></label></div></li>
509
+		    <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)) {
510
+	print 'checked';
511
+}
512
+?> ><?php echo _("Planes animate between updates"); ?></label></div></li>
353 513
 <?php
354 514
 	}
355 515
 	if (isset($globalSatellite) && $globalSatellite === TRUE) {
356 516
 ?>
357
-		    <li><div class="checkbox"><label><input type="checkbox" name="satelliteestimation" value="1" onclick="clickSatelliteEstimation(this)" <?php if ((isset($_COOKIE['satelliteestimation']) && $_COOKIE['satelliteestimation'] == 'true') || (!isset($_COOKIE['satelliteestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['satelliteestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Satellites animate between updates"); ?></label></div></li>
517
+		    <li><div class="checkbox"><label><input type="checkbox" name="satelliteestimation" value="1" onclick="clickSatelliteEstimation(this)" <?php if ((isset($_COOKIE['satelliteestimation']) && $_COOKIE['satelliteestimation'] == 'true') || (!isset($_COOKIE['satelliteestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['satelliteestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) {
518
+	print 'checked';
519
+}
520
+?> ><?php echo _("Satellites animate between updates"); ?></label></div></li>
358 521
 <?php
359 522
 	}
360 523
     }
361 524
 ?>
362
-		    <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>
363
-		    <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>
364
-		    <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>
365
-		    <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>
525
+		    <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'])) {
526
+	print 'checked';
527
+}
528
+?> ><?php echo _("Display airports on map"); ?></label></div></li>
529
+		    <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))) {
530
+	print 'checked';
531
+}
532
+?> ><?php echo _("Display ground station on map"); ?></label></div></li>
533
+		    <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))) {
534
+	print 'checked';
535
+}
536
+?> ><?php echo _("Display weather station on map"); ?></label></div></li>
537
+		    <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))) {
538
+	print 'checked';
539
+}
540
+?> ><?php echo _("Display lightning on map"); ?></label></div></li>
366 541
 <?php
367 542
 	if (isset($globalFires)) {
368 543
 ?>
369
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayfires" value="1" onclick="clickDisplayFires(this)" <?php if ((isset($_COOKIE['show_Fires']) && $_COOKIE['show_Fires'] == 'true') || (!isset($_COOKIE['show_Fires']) && (isset($globalMapFires) && $globalMapFires === TRUE))) print 'checked'; ?> ><?php echo _("Display fires on map"); ?></label></div></li>
544
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayfires" value="1" onclick="clickDisplayFires(this)" <?php if ((isset($_COOKIE['show_Fires']) && $_COOKIE['show_Fires'] == 'true') || (!isset($_COOKIE['show_Fires']) && (isset($globalMapFires) && $globalMapFires === TRUE))) {
545
+	print 'checked';
546
+}
547
+?> ><?php echo _("Display fires on map"); ?></label></div></li>
370 548
 <?php
371 549
 	}
372 550
     if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
373 551
 ?>
374
-		    <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>
552
+		    <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')) {
553
+	print 'checked';
554
+}
555
+?> ><?php echo _("Show mini-map"); ?></label></div></li>
375 556
 <?php
376 557
     }
377 558
     if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
@@ -384,17 +565,25 @@  discard block
 block discarded – undo
384 565
 			if (function_exists('array_column')) {
385 566
 			    if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
386 567
 		    ?>
387
-		    <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>
568
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
569
+	print 'checked';
570
+}
571
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
388 572
 		    <?php
389 573
 			    }
390 574
 			} elseif (isset($globalSources)) {
391 575
 			    $dispolar = false;
392 576
 			    foreach ($globalSources as $testsource) {
393
-			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
577
+			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) {
578
+			        	$dispolar = true;
579
+			        }
394 580
 			    }
395 581
 			    if ($dispolar) {
396 582
 		    ?>
397
-		    <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>
583
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
584
+	print 'checked';
585
+}
586
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
398 587
 		    <?php
399 588
 			    }
400 589
 		        }
@@ -407,12 +596,22 @@  discard block
 block discarded – undo
407 596
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
408 597
 		    	    if (extension_loaded('gd') && function_exists('gd_info')) {
409 598
 		    ?>
410
-		    <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>
599
+		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') {
600
+	print 'checked';
601
+}
602
+?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
411 603
 		    <?php 
412 604
 				if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') {
413 605
 		    ?>
414 606
 		    <li><?php echo _("Aircraft icon color:"); ?>
415
-			<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'; ?>">
607
+			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) {
608
+	print $_COOKIE['IconColor'];
609
+} elseif (isset($globalAircraftIconColor)) {
610
+	print $globalAircraftIconColor;
611
+} else {
612
+	print '1a3151';
613
+}
614
+?>">
416 615
 		    </li>
417 616
 		    <?php
418 617
 				}
@@ -424,7 +623,14 @@  discard block
 block discarded – undo
424 623
 			    if (extension_loaded('gd') && function_exists('gd_info')) {
425 624
 		    ?>
426 625
 		    <li><?php echo _("Marine icon color:"); ?>
427
-			<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'; ?>">
626
+			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) {
627
+	print $_COOKIE['MarineIconColor'];
628
+} elseif (isset($globalMarineIconColor)) {
629
+	print $globalMarineIconColor;
630
+} else {
631
+	print '1a3151';
632
+}
633
+?>">
428 634
 		    </li>
429 635
 		    <?php
430 636
 			    }
@@ -435,7 +641,14 @@  discard block
 block discarded – undo
435 641
 			    if (extension_loaded('gd') && function_exists('gd_info')) {
436 642
 		    ?>
437 643
 		    <li><?php echo _("Tracker icon color:"); ?>
438
-			<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'; ?>">
644
+			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) {
645
+	print $_COOKIE['TrackerIconColor'];
646
+} elseif (isset($globalTrackerIconColor)) {
647
+	print $globalTrackerIconColor;
648
+} else {
649
+	print '1a3151';
650
+}
651
+?>">
439 652
 		    </li>
440 653
 		    <?php
441 654
 			    }
@@ -446,8 +659,22 @@  discard block
 block discarded – undo
446 659
 		    ?>
447 660
 		    <li><?php echo _("Show airport icon at zoom level:"); ?>
448 661
 			<div class="range">
449
-			    <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'; ?>">
450
-			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?></output>
662
+			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) {
663
+	print $_COOKIE['AirportZoom'];
664
+} elseif (isset($globalAirportZoom)) {
665
+	print $globalAirportZoom;
666
+} else {
667
+	print '7';
668
+}
669
+?>">
670
+			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) {
671
+	print $_COOKIE['AirportZoom'];
672
+} elseif (isset($globalAirportZoom)) {
673
+	print $globalAirportZoom;
674
+} else {
675
+	print '7';
676
+}
677
+?></output>
451 678
 			</div>
452 679
 		    </li>
453 680
 		    <?php
@@ -459,10 +686,23 @@  discard block
 block discarded – undo
459 686
 <?php
460 687
 	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
461 688
 ?>
462
-		    <li><input type="checkbox" name="useliveries" value="1" onclick="useLiveries(this)" <?php if (isset($_COOKIE['UseLiveries']) && $_COOKIE['UseLiveries'] == 'true') print 'checked'; ?> ><?php echo _("Use airlines liveries"); ?></li>
463
-		    <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>
689
+		    <li><input type="checkbox" name="useliveries" value="1" onclick="useLiveries(this)" <?php if (isset($_COOKIE['UseLiveries']) && $_COOKIE['UseLiveries'] == 'true') {
690
+	print 'checked';
691
+}
692
+?> ><?php echo _("Use airlines liveries"); ?></li>
693
+		    <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') {
694
+	print 'checked';
695
+}
696
+?> ><?php echo _("Force Aircraft color"); ?></li>
464 697
 		    <li><?php echo _("Aircraft icon color:"); ?>
465
-			<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'; ?>">
698
+			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) {
699
+	print $_COOKIE['IconColor'];
700
+} elseif (isset($globalAircraftIconColor)) {
701
+	print $globalAircraftIconColor;
702
+} else {
703
+	print 'ff0000';
704
+}
705
+?>">
466 706
 		    </li>
467 707
 <?php
468 708
 	}
@@ -470,9 +710,19 @@  discard block
 block discarded – undo
470 710
 <?php
471 711
 	if (isset($globalMarine) && $globalMarine === TRUE) {
472 712
 ?>
473
-		    <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>
713
+		    <li><input type="checkbox" name="marinecolorforce" value="1" onclick="MarineiconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') {
714
+	print 'checked';
715
+}
716
+?> ><?php echo _("Force Marine color"); ?></li>
474 717
 		    <li><?php echo _("Marine icon color:"); ?>
475
-			<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'; ?>">
718
+			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) {
719
+	print $_COOKIE['MarineIconColor'];
720
+} elseif (isset($globalMarineIconColor)) {
721
+	print $globalMarineIconColor;
722
+} else {
723
+	print 'ff0000';
724
+}
725
+?>">
476 726
 		    </li>
477 727
 <?php
478 728
 	}
@@ -480,9 +730,19 @@  discard block
 block discarded – undo
480 730
 <?php
481 731
 	if (isset($globalTracker) && $globalTracker === TRUE) {
482 732
 ?>
483
-		    <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>
733
+		    <li><input type="checkbox" name="trackercolorforce" value="1" onclick="TrackericonColorForce(this)" <?php if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true') {
734
+	print 'checked';
735
+}
736
+?> ><?php echo _("Force Tracker color"); ?></li>
484 737
 		    <li><?php echo _("Tracker icon color:"); ?>
485
-			<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'; ?>">
738
+			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) {
739
+	print $_COOKIE['TrackerIconColor'];
740
+} elseif (isset($globalTrackerIconColor)) {
741
+	print $globalTrackerIconColor;
742
+} else {
743
+	print 'ff0000';
744
+}
745
+?>">
486 746
 		    </li>
487 747
 <?php
488 748
 	}
@@ -490,22 +750,46 @@  discard block
 block discarded – undo
490 750
 ?>
491 751
 		    <li><?php echo _("Distance unit:"); ?>
492 752
 			<select class="selectpicker" onchange="unitdistance(this);">
493
-			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) echo ' selected'; ?>>km</option>
494
-			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) echo ' selected'; ?>>nm</option>
495
-			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) echo ' selected'; ?>>mi</option>
753
+			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) {
754
+	echo ' selected';
755
+}
756
+?>>km</option>
757
+			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
758
+	echo ' selected';
759
+}
760
+?>>nm</option>
761
+			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
762
+	echo ' selected';
763
+}
764
+?>>mi</option>
496 765
 		        </select>
497 766
 		    </li>
498 767
 		    <li><?php echo _("Altitude unit:"); ?>
499 768
 			<select class="selectpicker" onchange="unitaltitude(this);">
500
-			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) echo ' selected'; ?>>m</option>
501
-			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) echo ' selected'; ?>>feet</option>
769
+			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) {
770
+	echo ' selected';
771
+}
772
+?>>m</option>
773
+			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) {
774
+	echo ' selected';
775
+}
776
+?>>feet</option>
502 777
 		        </select>
503 778
 		    </li>
504 779
 		    <li><?php echo _("Speed unit:"); ?>
505 780
 			<select class="selectpicker" onchange="unitspeed(this);">
506
-			    <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>
507
-			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) echo ' selected'; ?>>mph</option>
508
-			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) echo ' selected'; ?>>knots</option>
781
+			    <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) {
782
+	echo ' selected';
783
+}
784
+?>>km/h</option>
785
+			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) {
786
+	echo ' selected';
787
+}
788
+?>>mph</option>
789
+			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) {
790
+	echo ' selected';
791
+}
792
+?>>knots</option>
509 793
 		        </select>
510 794
 		    </li>
511 795
 
@@ -523,9 +807,18 @@  discard block
 block discarded – undo
523 807
 		    <?php
524 808
 			if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) {
525 809
 		    ?>
526
-			<?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 } ?>
527
-			<?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 } ?>
528
-			<?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 } ?>
810
+			<?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'])) {
811
+	print 'checked';
812
+}
813
+?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
814
+			<?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'])) {
815
+	print 'checked';
816
+}
817
+?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
818
+			<?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'])) {
819
+	print 'checked';
820
+}
821
+?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
529 822
 		    <?php
530 823
 			}
531 824
 		    ?>
@@ -533,10 +826,16 @@  discard block
 block discarded – undo
533 826
 			if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) {
534 827
 		    ?>
535 828
 			<?php if (isset($globalSBS1) && $globalSBS1) { ?>
536
-			    <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>
829
+			    <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'])) {
830
+	print 'checked';
831
+}
832
+?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
537 833
 			<?php } ?>
538 834
 			<?php if (isset($globalAPRS) && $globalAPRS) { ?>
539
-			    <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>
835
+			    <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'])) {
836
+	print 'checked';
837
+}
838
+?> ><?php echo _("Display APRS data"); ?></label></div></li>
540 839
 			<?php } ?>
541 840
 		    <?php
542 841
 			}
@@ -553,7 +852,9 @@  discard block
 block discarded – undo
553 852
 				}
554 853
 				foreach($allairlinenames as $airline) {
555 854
 					$airline_name = $airline['airline_name'];
556
-					if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...';
855
+					if (strlen($airline_name) > 30) {
856
+						$airline_name = substr($airline_name,0,30).'...';
857
+					}
557 858
 					if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['filter_Airlines']))) {
558 859
 						echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>';
559 860
 					} else {
@@ -571,7 +872,10 @@  discard block
 block discarded – undo
571 872
 		    <li><?php echo _("Display alliance:"); ?>
572 873
 		    <br/>
573 874
 			<select class="selectpicker" onchange="alliance(this);" id="display_alliance">
574
-			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
875
+			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') {
876
+	echo ' selected';
877
+}
878
+?>><?php echo _("All"); ?></option>
575 879
 			    <?php
576 880
 				foreach($allalliancenames as $alliance) {
577 881
 					$alliance_name = $alliance['alliance'];
@@ -630,10 +934,22 @@  discard block
 block discarded – undo
630 934
 		    ?>
631 935
 		    <li><?php echo _("Display airlines of type:"); ?><br/>
632 936
 			<select class="selectpicker" onchange="airlinestype(this);">
633
-			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
634
-			    <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') echo ' selected'; ?>><?php echo _("Passenger"); ?></option>
635
-			    <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') echo ' selected'; ?>><?php echo _("Cargo"); ?></option>
636
-			    <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') echo ' selected'; ?>><?php echo _("Military"); ?></option>
937
+			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') {
938
+	echo ' selected';
939
+}
940
+?>><?php echo _("All"); ?></option>
941
+			    <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') {
942
+	echo ' selected';
943
+}
944
+?>><?php echo _("Passenger"); ?></option>
945
+			    <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') {
946
+	echo ' selected';
947
+}
948
+?>><?php echo _("Cargo"); ?></option>
949
+			    <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') {
950
+	echo ' selected';
951
+}
952
+?>><?php echo _("Military"); ?></option>
637 953
 			</select>
638 954
 		    </li>
639 955
 		    <?php
@@ -647,14 +963,20 @@  discard block
 block discarded – undo
647 963
 		    ?>
648 964
 		    <li>
649 965
 			<?php echo _("Display vessels with MMSI:"); ?>
650
-			<input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) print $_COOKIE['filter_mmsi']; ?>" />
966
+			<input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) {
967
+	print $_COOKIE['filter_mmsi'];
968
+}
969
+?>" />
651 970
 		    </li>
652 971
 		    <?php
653 972
 			}
654 973
 		    ?>
655 974
 		    <li>
656 975
 			<?php echo _("Display with ident:"); ?>
657
-			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" />
976
+			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) {
977
+	print $_COOKIE['filter_ident'];
978
+}
979
+?>" />
658 980
 		    </li>
659 981
 		</ul>
660 982
 	    </form>
@@ -670,7 +992,10 @@  discard block
 block discarded – undo
670 992
 	    <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
671 993
 	    <form>
672 994
 		<ul>
673
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if ((isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') || !isset($_COOKIE['displayiss'])) print 'checked'; ?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li>
995
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if ((isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') || !isset($_COOKIE['displayiss'])) {
996
+	print 'checked';
997
+}
998
+?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li>
674 999
 		    <li><?php echo _("Type:"); ?>
675 1000
 			<select class="selectpicker" multiple onchange="sattypes(this);">
676 1001
 			    <?php
@@ -678,25 +1003,45 @@  discard block
 block discarded – undo
678 1003
 				$types = $Satellite->get_tle_types();
679 1004
 				foreach ($types as $type) {
680 1005
 					$type_name = $type['tle_type'];
681
-					if ($type_name == 'musson') $type_name = 'Russian LEO Navigation';
682
-					else if ($type_name == 'nnss') $type_name = 'Navi Navigation Satellite System';
683
-					else if ($type_name == 'sbas') $type_name = 'Satellite-Based Augmentation System';
684
-					else if ($type_name == 'glo-ops') $type_name = 'Glonass Operational';
685
-					else if ($type_name == 'gps-ops') $type_name = 'GPS Operational';
686
-					else if ($type_name == 'argos') $type_name = 'ARGOS Data Collection System';
687
-					else if ($type_name == 'tdrss') $type_name = 'Tracking and Data Relay Satellite System';
688
-					else if ($type_name == 'sarsat') $type_name = 'Search & Rescue';
689
-					else if ($type_name == 'dmc') $type_name = 'Disaster Monitoring';
690
-					else if ($type_name == 'resource') $type_name = 'Earth Resources';
691
-					else if ($type_name == 'stations') $type_name = 'Space Stations';
692
-					else if ($type_name == 'geo') $type_name = 'Geostationary';
693
-					else if ($type_name == 'amateur') $type_name = 'Amateur Radio';
694
-					else if ($type_name == 'x-comm') $type_name = 'Experimental';
695
-					else if ($type_name == 'other-comm') $type_name = 'Other Comm';
696
-					else if ($type_name == 'science') $type_name = 'Space & Earth Science';
697
-					else if ($type_name == 'military') $type_name = 'Miscellaneous Military';
698
-					else if ($type_name == 'radar') $type_name = 'Radar Calibration';
699
-					else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches';
1006
+					if ($type_name == 'musson') {
1007
+						$type_name = 'Russian LEO Navigation';
1008
+					} else if ($type_name == 'nnss') {
1009
+						$type_name = 'Navi Navigation Satellite System';
1010
+					} else if ($type_name == 'sbas') {
1011
+						$type_name = 'Satellite-Based Augmentation System';
1012
+					} else if ($type_name == 'glo-ops') {
1013
+						$type_name = 'Glonass Operational';
1014
+					} else if ($type_name == 'gps-ops') {
1015
+						$type_name = 'GPS Operational';
1016
+					} else if ($type_name == 'argos') {
1017
+						$type_name = 'ARGOS Data Collection System';
1018
+					} else if ($type_name == 'tdrss') {
1019
+						$type_name = 'Tracking and Data Relay Satellite System';
1020
+					} else if ($type_name == 'sarsat') {
1021
+						$type_name = 'Search & Rescue';
1022
+					} else if ($type_name == 'dmc') {
1023
+						$type_name = 'Disaster Monitoring';
1024
+					} else if ($type_name == 'resource') {
1025
+						$type_name = 'Earth Resources';
1026
+					} else if ($type_name == 'stations') {
1027
+						$type_name = 'Space Stations';
1028
+					} else if ($type_name == 'geo') {
1029
+						$type_name = 'Geostationary';
1030
+					} else if ($type_name == 'amateur') {
1031
+						$type_name = 'Amateur Radio';
1032
+					} else if ($type_name == 'x-comm') {
1033
+						$type_name = 'Experimental';
1034
+					} else if ($type_name == 'other-comm') {
1035
+						$type_name = 'Other Comm';
1036
+					} else if ($type_name == 'science') {
1037
+						$type_name = 'Space & Earth Science';
1038
+					} else if ($type_name == 'military') {
1039
+						$type_name = 'Miscellaneous Military';
1040
+					} else if ($type_name == 'radar') {
1041
+						$type_name = 'Radar Calibration';
1042
+					} else if ($type_name == 'tle-new') {
1043
+						$type_name = 'Last 30 days launches';
1044
+					}
700 1045
 					
701 1046
 					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) {
702 1047
 						print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>';
Please login to merge, or discard this patch.