Completed
Push — master ( 523b76...c0c7e7 )
by Yannick
11:24
created
live-czml.php 1 patch
Braces   +89 added lines, -31 removed lines patch added patch discarded remove patch
@@ -3,8 +3,12 @@  discard block
 block discarded – undo
3 3
 require_once('require/class.Common.php');
4 4
 $tracker = false;
5 5
 $marine = false;
6
-if (isset($_GET['tracker'])) $tracker = true;
7
-if (isset($_GET['marine'])) $marine = true;
6
+if (isset($_GET['tracker'])) {
7
+	$tracker = true;
8
+}
9
+if (isset($_GET['marine'])) {
10
+	$marine = true;
11
+}
8 12
 if ($tracker) {
9 13
 	require_once('require/class.Tracker.php');
10 14
 	require_once('require/class.TrackerLive.php');
@@ -61,23 +65,46 @@  discard block
 block discarded – undo
61 65
 }
62 66
 header('Content-Type: text/javascript');
63 67
 
64
-if (!isset($globalJsonCompress)) $compress = true;
65
-else $compress = $globalJsonCompress;
68
+if (!isset($globalJsonCompress)) {
69
+	$compress = true;
70
+} else {
71
+	$compress = $globalJsonCompress;
72
+}
66 73
 
67 74
 $from_archive = false;
68 75
 $min = false;
69 76
 $allhistory = false;
70 77
 $filter['source'] = array();
71
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
72
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
73
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
74
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs'));
75
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
76
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
77
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
78
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
79
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
80
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
78
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') {
79
+	$filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
80
+}
81
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') {
82
+	$filter['source'] = array_merge($filter['source'],array('whazzup'));
83
+}
84
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') {
85
+	$filter['source'] = array_merge($filter['source'],array('phpvmacars'));
86
+}
87
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') {
88
+	$filter['source'] = array_merge($filter['source'],array('sbs'));
89
+}
90
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') {
91
+	$filter['source'] = array_merge($filter['source'],array('aprs'));
92
+}
93
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') {
94
+	$filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
95
+}
96
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') {
97
+	$filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
98
+}
99
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') {
100
+	$filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
101
+}
102
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') {
103
+	$filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
104
+}
105
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') {
106
+	$filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
107
+}
81 108
 /*
82 109
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
83 110
 	$min = true;
@@ -162,8 +189,12 @@  discard block
 block discarded – undo
162 189
 	} else {
163 190
 		$flightcnt = $SpotterLive->getLiveSpotterCount($filter);
164 191
 	}
165
-	if ($flightcnt == '') $flightcnt = 0;
166
-} else $flightcnt = 0;
192
+	if ($flightcnt == '') {
193
+		$flightcnt = 0;
194
+	}
195
+	} else {
196
+	$flightcnt = 0;
197
+}
167 198
 
168 199
 $sqltime = round(microtime(true)-$begintime,2);
169 200
 $minitime = time();
@@ -186,7 +217,9 @@  discard block
 block discarded – undo
186 217
 $j = 0;
187 218
 $prev_flightaware_id = '';
188 219
 $speed = 1;
189
-if (isset($archivespeed)) $speed = $archivespeed;
220
+if (isset($archivespeed)) {
221
+	$speed = $archivespeed;
222
+}
190 223
 $output = '[';
191 224
 if ($tracker) {
192 225
 	$output .= '{"id" : "document", "name" : "tracker","version" : "1.0"';
@@ -220,9 +253,13 @@  discard block
 block discarded – undo
220 253
 			$image = "images/placeholder_thumb.png";
221 254
 		}
222 255
 
223
-                if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id'];
224
-                elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid'];
225
-                elseif (isset($spotter_item['fammarine_id'])) $id = $spotter_item['fammarine_id'];
256
+                if (isset($spotter_item['flightaware_id'])) {
257
+                	$id = $spotter_item['flightaware_id'];
258
+                } elseif (isset($spotter_item['famtrackid'])) {
259
+                	$id = $spotter_item['famtrackid'];
260
+                } elseif (isset($spotter_item['fammarine_id'])) {
261
+                	$id = $spotter_item['fammarine_id'];
262
+                }
226 263
                 if ($prev_flightaware_id != $id) {
227 264
 			if ($prev_flightaware_id != '') {
228 265
 				$output .= ']';
@@ -268,7 +305,9 @@  discard block
 block discarded – undo
268 305
 						$spotter_item['engine_type'] = $aircraft_info[0]['engine_type'];
269 306
 						$spotter_item['wake_category'] = $aircraft_info[0]['wake_category'];
270 307
 						$spotter_item['engine_count'] = $aircraft_info[0]['engine_count'];
271
-					} else $aircraft_shadow = '';
308
+					} else {
309
+						$aircraft_shadow = '';
310
+					}
272 311
 					if ($aircraft_shadow != '') {
273 312
 						if (isset($modelsdb[$aircraft_shadow])) {
274 313
 							$output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$modelsdb[$aircraft_shadow].'","scale" : 1.0,"minimumPixelSize": 20';
@@ -405,7 +444,9 @@  discard block
 block discarded – undo
405 444
 							}
406 445
 							$output .= '},';
407 446
 								//if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
408
-							if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
447
+							if ($spotter_item['aircraft_icao'] != '') {
448
+								$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
449
+							}
409 450
 							$modelsdb[$aircraft_icao] = 'Cesium_Air.glb';
410 451
 						}
411 452
 					} elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') {
@@ -427,7 +468,9 @@  discard block
 block discarded – undo
427 468
 						}
428 469
 						$output .= '},';
429 470
 						//if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
430
-						if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
471
+						if ($spotter_item['aircraft_icao'] != '') {
472
+							$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
473
+						}
431 474
 						$modelsdb[$aircraft_icao] = 'Cesium_Air.glb';
432 475
 					}
433 476
 				} else {
@@ -440,7 +483,9 @@  discard block
 block discarded – undo
440 483
 					}
441 484
 					$output .= '},';
442 485
 					//if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
443
-					if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
486
+					if ($spotter_item['aircraft_icao'] != '') {
487
+						$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
488
+					}
444 489
 					$modelsdb[$aircraft_icao] = 'Cesium_Air.glb';
445 490
 				}
446 491
 			} elseif ($tracker && isset($spotter_item['type'])) {
@@ -495,8 +540,12 @@  discard block
 block discarded – undo
495 540
 	//		$output .= '"interpolationDegree" : 5,';
496 541
 	//		$output .= '"epoch" : "'.date("c",strtotime($spotter_item['date'])).'", ';
497 542
 			$output .= '"cartographicDegrees": [';
498
-			if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']);
499
-			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
543
+			if ($minitime > strtotime($spotter_item['date'])) {
544
+				$minitime = strtotime($spotter_item['date']);
545
+			}
546
+			if ($maxitime < strtotime($spotter_item['date'])) {
547
+				$maxitime = strtotime($spotter_item['date']);
548
+			}
500 549
 			$output .= '"'.date("c",strtotime($spotter_item['date'])).'", ';
501 550
 			$output .= $spotter_item['longitude'].', ';
502 551
 			$output .= $spotter_item['latitude'];
@@ -505,19 +554,26 @@  discard block
 block discarded – undo
505 554
 			if (!$tracker && !$marine) {
506 555
 				$output .= ', '.round($spotter_item['altitude']*30.48);
507 556
 				$prevalt = round($spotter_item['altitude']*30.48);
508
-			} else $output .= ', 0';
557
+			} else {
558
+				$output .= ', 0';
559
+			}
509 560
 			//$orientation = '"orientation" : { ';
510 561
 			//$orientation .= '"unitQuaternion": [';
511 562
 			//$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0));
512 563
 			//$orientation .= '"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w'];
513 564
 		} else {
514 565
 			$output .= ',"'.date("c",strtotime($spotter_item['date'])).'", ';
515
-			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
566
+			if ($maxitime < strtotime($spotter_item['date'])) {
567
+				$maxitime = strtotime($spotter_item['date']);
568
+			}
516 569
 			if ($spotter_item['ground_speed'] == 0) {
517 570
 				$output .= $prevlong.', ';
518 571
 				$output .= $prevlat;
519
-				if (!$tracker && !$marine) $output .= ', '.$prevalt;
520
-				else $output .= ', 0';
572
+				if (!$tracker && !$marine) {
573
+					$output .= ', '.$prevalt;
574
+				} else {
575
+					$output .= ', 0';
576
+				}
521 577
 			} else {
522 578
 				$output .= $spotter_item['longitude'].', ';
523 579
 				$output .= $spotter_item['latitude'];
@@ -531,7 +587,9 @@  discard block
 block discarded – undo
531 587
 					} else {
532 588
 						$output .= ', '.round($spotter_item['altitude']*30.48);
533 589
 					}
534
-				} else $output .= ', 0';
590
+				} else {
591
+					$output .= ', 0';
592
+				}
535 593
 			}
536 594
 			//$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0));
537 595
 			//$orientation .= ',"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w'];
Please login to merge, or discard this patch.
require/class.Common.php 2 patches
Indentation   +143 added lines, -143 removed lines patch added patch discarded remove patch
@@ -7,13 +7,13 @@  discard block
 block discarded – undo
7 7
 	//protected $cookies = array();
8 8
 	
9 9
 	/**
10
-	* Get data from form result
11
-	* @param String $url form URL
12
-	* @param String $type type of submit form method (get or post)
13
-	* @param String|Array $data values form post method
14
-	* @param Array $headers header to submit with the form
15
-	* @return String the result
16
-	*/
10
+	 * Get data from form result
11
+	 * @param String $url form URL
12
+	 * @param String $type type of submit form method (get or post)
13
+	 * @param String|Array $data values form post method
14
+	 * @param Array $headers header to submit with the form
15
+	 * @return String the result
16
+	 */
17 17
 	public function getData($url, $type = 'get', $data = '', $headers = '',$cookie = '',$referer = '',$timeout = '',$useragent = '') {
18 18
 		global $globalProxy, $globalForceIPv4;
19 19
 		$ch = curl_init();
@@ -107,10 +107,10 @@  discard block
 block discarded – undo
107 107
 	}
108 108
 	
109 109
 	/**
110
-	* Convert a HTML table to an array
111
-	* @param String $data HTML page
112
-	* @return Array array of the tables in HTML page
113
-	*/
110
+	 * Convert a HTML table to an array
111
+	 * @param String $data HTML page
112
+	 * @return Array array of the tables in HTML page
113
+	 */
114 114
 	public function table2array($data) {
115 115
 		if (!is_string($data)) return array();
116 116
 		if ($data == '') return array();
@@ -144,10 +144,10 @@  discard block
 block discarded – undo
144 144
 	}
145 145
 	
146 146
 	/**
147
-	* Convert <p> part of a HTML page to an array
148
-	* @param String $data HTML page
149
-	* @return Array array of the <p> in HTML page
150
-	*/
147
+	 * Convert <p> part of a HTML page to an array
148
+	 * @param String $data HTML page
149
+	 * @return Array array of the <p> in HTML page
150
+	 */
151 151
 	public function text2array($data) {
152 152
 		$html = str_get_html($data);
153 153
 		if ($html === false) return array();
@@ -162,14 +162,14 @@  discard block
 block discarded – undo
162 162
 	}
163 163
 
164 164
 	/**
165
-	* Give distance between 2 coordonnates
166
-	* @param Float $lat latitude of first point
167
-	* @param Float $lon longitude of first point
168
-	* @param Float $latc latitude of second point
169
-	* @param Float $lonc longitude of second point
170
-	* @param String $unit km else no unit used
171
-	* @return Float Distance in $unit
172
-	*/
165
+	 * Give distance between 2 coordonnates
166
+	 * @param Float $lat latitude of first point
167
+	 * @param Float $lon longitude of first point
168
+	 * @param Float $latc latitude of second point
169
+	 * @param Float $lonc longitude of second point
170
+	 * @param String $unit km else no unit used
171
+	 * @return Float Distance in $unit
172
+	 */
173 173
 	public function distance($lat, $lon, $latc, $lonc, $unit = 'km') {
174 174
 		if ($lat == $latc && $lon == $lonc) return 0;
175 175
 		$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;
@@ -187,11 +187,11 @@  discard block
 block discarded – undo
187 187
 	}
188 188
 
189 189
 	/**
190
-	* Check is distance realistic
191
-	* @param int $timeDifference the time between the reception of both messages
192
-	* @param float $distance distance covered
193
-	* @return whether distance is realistic
194
-	*/
190
+	 * Check is distance realistic
191
+	 * @param int $timeDifference the time between the reception of both messages
192
+	 * @param float $distance distance covered
193
+	 * @return whether distance is realistic
194
+	 */
195 195
 	public function withinThreshold ($timeDifference, $distance) {
196 196
 		$x = abs($timeDifference);
197 197
 		$d = abs($distance);
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 	}
210 210
 
211 211
 	public function isInteger($input){
212
-	    return(ctype_digit(strval($input)));
212
+		return(ctype_digit(strval($input)));
213 213
 	}
214 214
 
215 215
 
@@ -240,11 +240,11 @@  discard block
 block discarded – undo
240 240
 	}
241 241
 	
242 242
 	/**
243
-	* Copy folder contents
244
-	* @param       string   $source    Source path
245
-	* @param       string   $dest      Destination path
246
-	* @return      bool     Returns true on success, false on failure
247
-	*/
243
+	 * Copy folder contents
244
+	 * @param       string   $source    Source path
245
+	 * @param       string   $dest      Destination path
246
+	 * @return      bool     Returns true on success, false on failure
247
+	 */
248 248
 	public function xcopy($source, $dest)
249 249
 	{
250 250
 		$files = glob($source.'*.*');
@@ -256,20 +256,20 @@  discard block
 block discarded – undo
256 256
 	}
257 257
 	
258 258
 	/**
259
-	* Check if an url exist
260
-	* @param	String $url url to check
261
-	* @return	bool Return true on succes false on failure
262
-	*/
259
+	 * Check if an url exist
260
+	 * @param	String $url url to check
261
+	 * @return	bool Return true on succes false on failure
262
+	 */
263 263
 	public function urlexist($url){
264 264
 		$headers=get_headers($url);
265 265
 		return stripos($headers[0],"200 OK")?true:false;
266 266
 	}
267 267
 	
268 268
 	/**
269
-	* Convert hexa to string
270
-	* @param	String $hex data in hexa
271
-	* @return	String Return result
272
-	*/
269
+	 * Convert hexa to string
270
+	 * @param	String $hex data in hexa
271
+	 * @return	String Return result
272
+	 */
273 273
 	public function hex2str($hex) {
274 274
 		$str = '';
275 275
 		$hexln = strlen($hex);
@@ -278,10 +278,10 @@  discard block
 block discarded – undo
278 278
 	}
279 279
 	
280 280
 	/**
281
-	* Convert hexa color to rgb
282
-	* @param	String $hex data in hexa
283
-	* @return	String Return result
284
-	*/
281
+	 * Convert hexa color to rgb
282
+	 * @param	String $hex data in hexa
283
+	 * @return	String Return result
284
+	 */
285 285
 	public function hex2rgb($hex) {
286 286
 		$hex = str_replace('#','',$hex);
287 287
 		return sscanf($hex, "%02x%02x%02x"); 
@@ -359,9 +359,9 @@  discard block
 block discarded – undo
359 359
 	}
360 360
 	
361 361
 	/**
362
-	* Returns list of available locales
363
-	*
364
-	* @return array
362
+	 * Returns list of available locales
363
+	 *
364
+	 * @return array
365 365
 	 */
366 366
 	public function listLocaleDir()
367 367
 	{
@@ -456,100 +456,100 @@  discard block
 block discarded – undo
456 456
 	public function remove_accents($string) {
457 457
 		if ( !preg_match('/[\x80-\xff]/', $string) ) return $string;
458 458
 		$chars = array(
459
-		    // Decompositions for Latin-1 Supplement
460
-		    chr(195).chr(128) => 'A', chr(195).chr(129) => 'A',
461
-		    chr(195).chr(130) => 'A', chr(195).chr(131) => 'A',
462
-		    chr(195).chr(132) => 'A', chr(195).chr(133) => 'A',
463
-		    chr(195).chr(135) => 'C', chr(195).chr(136) => 'E',
464
-		    chr(195).chr(137) => 'E', chr(195).chr(138) => 'E',
465
-		    chr(195).chr(139) => 'E', chr(195).chr(140) => 'I',
466
-		    chr(195).chr(141) => 'I', chr(195).chr(142) => 'I',
467
-		    chr(195).chr(143) => 'I', chr(195).chr(145) => 'N',
468
-		    chr(195).chr(146) => 'O', chr(195).chr(147) => 'O',
469
-		    chr(195).chr(148) => 'O', chr(195).chr(149) => 'O',
470
-		    chr(195).chr(150) => 'O', chr(195).chr(153) => 'U',
471
-		    chr(195).chr(154) => 'U', chr(195).chr(155) => 'U',
472
-		    chr(195).chr(156) => 'U', chr(195).chr(157) => 'Y',
473
-		    chr(195).chr(159) => 's', chr(195).chr(160) => 'a',
474
-		    chr(195).chr(161) => 'a', chr(195).chr(162) => 'a',
475
-		    chr(195).chr(163) => 'a', chr(195).chr(164) => 'a',
476
-		    chr(195).chr(165) => 'a', chr(195).chr(167) => 'c',
477
-		    chr(195).chr(168) => 'e', chr(195).chr(169) => 'e',
478
-		    chr(195).chr(170) => 'e', chr(195).chr(171) => 'e',
479
-		    chr(195).chr(172) => 'i', chr(195).chr(173) => 'i',
480
-		    chr(195).chr(174) => 'i', chr(195).chr(175) => 'i',
481
-		    chr(195).chr(177) => 'n', chr(195).chr(178) => 'o',
482
-		    chr(195).chr(179) => 'o', chr(195).chr(180) => 'o',
483
-		    chr(195).chr(181) => 'o', chr(195).chr(182) => 'o',
484
-		    chr(195).chr(182) => 'o', chr(195).chr(185) => 'u',
485
-		    chr(195).chr(186) => 'u', chr(195).chr(187) => 'u',
486
-		    chr(195).chr(188) => 'u', chr(195).chr(189) => 'y',
487
-		    chr(195).chr(191) => 'y',
488
-		    // Decompositions for Latin Extended-A
489
-		    chr(196).chr(128) => 'A', chr(196).chr(129) => 'a',
490
-		    chr(196).chr(130) => 'A', chr(196).chr(131) => 'a',
491
-		    chr(196).chr(132) => 'A', chr(196).chr(133) => 'a',
492
-		    chr(196).chr(134) => 'C', chr(196).chr(135) => 'c',
493
-		    chr(196).chr(136) => 'C', chr(196).chr(137) => 'c',
494
-		    chr(196).chr(138) => 'C', chr(196).chr(139) => 'c',
495
-		    chr(196).chr(140) => 'C', chr(196).chr(141) => 'c',
496
-		    chr(196).chr(142) => 'D', chr(196).chr(143) => 'd',
497
-		    chr(196).chr(144) => 'D', chr(196).chr(145) => 'd',
498
-		    chr(196).chr(146) => 'E', chr(196).chr(147) => 'e',
499
-		    chr(196).chr(148) => 'E', chr(196).chr(149) => 'e',
500
-		    chr(196).chr(150) => 'E', chr(196).chr(151) => 'e',
501
-		    chr(196).chr(152) => 'E', chr(196).chr(153) => 'e',
502
-		    chr(196).chr(154) => 'E', chr(196).chr(155) => 'e',
503
-		    chr(196).chr(156) => 'G', chr(196).chr(157) => 'g',
504
-		    chr(196).chr(158) => 'G', chr(196).chr(159) => 'g',
505
-		    chr(196).chr(160) => 'G', chr(196).chr(161) => 'g',
506
-		    chr(196).chr(162) => 'G', chr(196).chr(163) => 'g',
507
-		    chr(196).chr(164) => 'H', chr(196).chr(165) => 'h',
508
-		    chr(196).chr(166) => 'H', chr(196).chr(167) => 'h',
509
-		    chr(196).chr(168) => 'I', chr(196).chr(169) => 'i',
510
-		    chr(196).chr(170) => 'I', chr(196).chr(171) => 'i',
511
-		    chr(196).chr(172) => 'I', chr(196).chr(173) => 'i',
512
-		    chr(196).chr(174) => 'I', chr(196).chr(175) => 'i',
513
-		    chr(196).chr(176) => 'I', chr(196).chr(177) => 'i',
514
-		    chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij',
515
-		    chr(196).chr(180) => 'J', chr(196).chr(181) => 'j',
516
-		    chr(196).chr(182) => 'K', chr(196).chr(183) => 'k',
517
-		    chr(196).chr(184) => 'k', chr(196).chr(185) => 'L',
518
-		    chr(196).chr(186) => 'l', chr(196).chr(187) => 'L',
519
-		    chr(196).chr(188) => 'l', chr(196).chr(189) => 'L',
520
-		    chr(196).chr(190) => 'l', chr(196).chr(191) => 'L',
521
-		    chr(197).chr(128) => 'l', chr(197).chr(129) => 'L',
522
-		    chr(197).chr(130) => 'l', chr(197).chr(131) => 'N',
523
-		    chr(197).chr(132) => 'n', chr(197).chr(133) => 'N',
524
-		    chr(197).chr(134) => 'n', chr(197).chr(135) => 'N',
525
-		    chr(197).chr(136) => 'n', chr(197).chr(137) => 'N',
526
-		    chr(197).chr(138) => 'n', chr(197).chr(139) => 'N',
527
-		    chr(197).chr(140) => 'O', chr(197).chr(141) => 'o',
528
-		    chr(197).chr(142) => 'O', chr(197).chr(143) => 'o',
529
-		    chr(197).chr(144) => 'O', chr(197).chr(145) => 'o',
530
-		    chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe',
531
-		    chr(197).chr(148) => 'R',chr(197).chr(149) => 'r',
532
-		    chr(197).chr(150) => 'R',chr(197).chr(151) => 'r',
533
-		    chr(197).chr(152) => 'R',chr(197).chr(153) => 'r',
534
-		    chr(197).chr(154) => 'S',chr(197).chr(155) => 's',
535
-		    chr(197).chr(156) => 'S',chr(197).chr(157) => 's',
536
-		    chr(197).chr(158) => 'S',chr(197).chr(159) => 's',
537
-		    chr(197).chr(160) => 'S', chr(197).chr(161) => 's',
538
-		    chr(197).chr(162) => 'T', chr(197).chr(163) => 't',
539
-		    chr(197).chr(164) => 'T', chr(197).chr(165) => 't',
540
-		    chr(197).chr(166) => 'T', chr(197).chr(167) => 't',
541
-		    chr(197).chr(168) => 'U', chr(197).chr(169) => 'u',
542
-		    chr(197).chr(170) => 'U', chr(197).chr(171) => 'u',
543
-		    chr(197).chr(172) => 'U', chr(197).chr(173) => 'u',
544
-		    chr(197).chr(174) => 'U', chr(197).chr(175) => 'u',
545
-		    chr(197).chr(176) => 'U', chr(197).chr(177) => 'u',
546
-		    chr(197).chr(178) => 'U', chr(197).chr(179) => 'u',
547
-		    chr(197).chr(180) => 'W', chr(197).chr(181) => 'w',
548
-		    chr(197).chr(182) => 'Y', chr(197).chr(183) => 'y',
549
-		    chr(197).chr(184) => 'Y', chr(197).chr(185) => 'Z',
550
-		    chr(197).chr(186) => 'z', chr(197).chr(187) => 'Z',
551
-		    chr(197).chr(188) => 'z', chr(197).chr(189) => 'Z',
552
-		    chr(197).chr(190) => 'z', chr(197).chr(191) => 's'
459
+			// Decompositions for Latin-1 Supplement
460
+			chr(195).chr(128) => 'A', chr(195).chr(129) => 'A',
461
+			chr(195).chr(130) => 'A', chr(195).chr(131) => 'A',
462
+			chr(195).chr(132) => 'A', chr(195).chr(133) => 'A',
463
+			chr(195).chr(135) => 'C', chr(195).chr(136) => 'E',
464
+			chr(195).chr(137) => 'E', chr(195).chr(138) => 'E',
465
+			chr(195).chr(139) => 'E', chr(195).chr(140) => 'I',
466
+			chr(195).chr(141) => 'I', chr(195).chr(142) => 'I',
467
+			chr(195).chr(143) => 'I', chr(195).chr(145) => 'N',
468
+			chr(195).chr(146) => 'O', chr(195).chr(147) => 'O',
469
+			chr(195).chr(148) => 'O', chr(195).chr(149) => 'O',
470
+			chr(195).chr(150) => 'O', chr(195).chr(153) => 'U',
471
+			chr(195).chr(154) => 'U', chr(195).chr(155) => 'U',
472
+			chr(195).chr(156) => 'U', chr(195).chr(157) => 'Y',
473
+			chr(195).chr(159) => 's', chr(195).chr(160) => 'a',
474
+			chr(195).chr(161) => 'a', chr(195).chr(162) => 'a',
475
+			chr(195).chr(163) => 'a', chr(195).chr(164) => 'a',
476
+			chr(195).chr(165) => 'a', chr(195).chr(167) => 'c',
477
+			chr(195).chr(168) => 'e', chr(195).chr(169) => 'e',
478
+			chr(195).chr(170) => 'e', chr(195).chr(171) => 'e',
479
+			chr(195).chr(172) => 'i', chr(195).chr(173) => 'i',
480
+			chr(195).chr(174) => 'i', chr(195).chr(175) => 'i',
481
+			chr(195).chr(177) => 'n', chr(195).chr(178) => 'o',
482
+			chr(195).chr(179) => 'o', chr(195).chr(180) => 'o',
483
+			chr(195).chr(181) => 'o', chr(195).chr(182) => 'o',
484
+			chr(195).chr(182) => 'o', chr(195).chr(185) => 'u',
485
+			chr(195).chr(186) => 'u', chr(195).chr(187) => 'u',
486
+			chr(195).chr(188) => 'u', chr(195).chr(189) => 'y',
487
+			chr(195).chr(191) => 'y',
488
+			// Decompositions for Latin Extended-A
489
+			chr(196).chr(128) => 'A', chr(196).chr(129) => 'a',
490
+			chr(196).chr(130) => 'A', chr(196).chr(131) => 'a',
491
+			chr(196).chr(132) => 'A', chr(196).chr(133) => 'a',
492
+			chr(196).chr(134) => 'C', chr(196).chr(135) => 'c',
493
+			chr(196).chr(136) => 'C', chr(196).chr(137) => 'c',
494
+			chr(196).chr(138) => 'C', chr(196).chr(139) => 'c',
495
+			chr(196).chr(140) => 'C', chr(196).chr(141) => 'c',
496
+			chr(196).chr(142) => 'D', chr(196).chr(143) => 'd',
497
+			chr(196).chr(144) => 'D', chr(196).chr(145) => 'd',
498
+			chr(196).chr(146) => 'E', chr(196).chr(147) => 'e',
499
+			chr(196).chr(148) => 'E', chr(196).chr(149) => 'e',
500
+			chr(196).chr(150) => 'E', chr(196).chr(151) => 'e',
501
+			chr(196).chr(152) => 'E', chr(196).chr(153) => 'e',
502
+			chr(196).chr(154) => 'E', chr(196).chr(155) => 'e',
503
+			chr(196).chr(156) => 'G', chr(196).chr(157) => 'g',
504
+			chr(196).chr(158) => 'G', chr(196).chr(159) => 'g',
505
+			chr(196).chr(160) => 'G', chr(196).chr(161) => 'g',
506
+			chr(196).chr(162) => 'G', chr(196).chr(163) => 'g',
507
+			chr(196).chr(164) => 'H', chr(196).chr(165) => 'h',
508
+			chr(196).chr(166) => 'H', chr(196).chr(167) => 'h',
509
+			chr(196).chr(168) => 'I', chr(196).chr(169) => 'i',
510
+			chr(196).chr(170) => 'I', chr(196).chr(171) => 'i',
511
+			chr(196).chr(172) => 'I', chr(196).chr(173) => 'i',
512
+			chr(196).chr(174) => 'I', chr(196).chr(175) => 'i',
513
+			chr(196).chr(176) => 'I', chr(196).chr(177) => 'i',
514
+			chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij',
515
+			chr(196).chr(180) => 'J', chr(196).chr(181) => 'j',
516
+			chr(196).chr(182) => 'K', chr(196).chr(183) => 'k',
517
+			chr(196).chr(184) => 'k', chr(196).chr(185) => 'L',
518
+			chr(196).chr(186) => 'l', chr(196).chr(187) => 'L',
519
+			chr(196).chr(188) => 'l', chr(196).chr(189) => 'L',
520
+			chr(196).chr(190) => 'l', chr(196).chr(191) => 'L',
521
+			chr(197).chr(128) => 'l', chr(197).chr(129) => 'L',
522
+			chr(197).chr(130) => 'l', chr(197).chr(131) => 'N',
523
+			chr(197).chr(132) => 'n', chr(197).chr(133) => 'N',
524
+			chr(197).chr(134) => 'n', chr(197).chr(135) => 'N',
525
+			chr(197).chr(136) => 'n', chr(197).chr(137) => 'N',
526
+			chr(197).chr(138) => 'n', chr(197).chr(139) => 'N',
527
+			chr(197).chr(140) => 'O', chr(197).chr(141) => 'o',
528
+			chr(197).chr(142) => 'O', chr(197).chr(143) => 'o',
529
+			chr(197).chr(144) => 'O', chr(197).chr(145) => 'o',
530
+			chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe',
531
+			chr(197).chr(148) => 'R',chr(197).chr(149) => 'r',
532
+			chr(197).chr(150) => 'R',chr(197).chr(151) => 'r',
533
+			chr(197).chr(152) => 'R',chr(197).chr(153) => 'r',
534
+			chr(197).chr(154) => 'S',chr(197).chr(155) => 's',
535
+			chr(197).chr(156) => 'S',chr(197).chr(157) => 's',
536
+			chr(197).chr(158) => 'S',chr(197).chr(159) => 's',
537
+			chr(197).chr(160) => 'S', chr(197).chr(161) => 's',
538
+			chr(197).chr(162) => 'T', chr(197).chr(163) => 't',
539
+			chr(197).chr(164) => 'T', chr(197).chr(165) => 't',
540
+			chr(197).chr(166) => 'T', chr(197).chr(167) => 't',
541
+			chr(197).chr(168) => 'U', chr(197).chr(169) => 'u',
542
+			chr(197).chr(170) => 'U', chr(197).chr(171) => 'u',
543
+			chr(197).chr(172) => 'U', chr(197).chr(173) => 'u',
544
+			chr(197).chr(174) => 'U', chr(197).chr(175) => 'u',
545
+			chr(197).chr(176) => 'U', chr(197).chr(177) => 'u',
546
+			chr(197).chr(178) => 'U', chr(197).chr(179) => 'u',
547
+			chr(197).chr(180) => 'W', chr(197).chr(181) => 'w',
548
+			chr(197).chr(182) => 'Y', chr(197).chr(183) => 'y',
549
+			chr(197).chr(184) => 'Y', chr(197).chr(185) => 'Z',
550
+			chr(197).chr(186) => 'z', chr(197).chr(187) => 'Z',
551
+			chr(197).chr(188) => 'z', chr(197).chr(189) => 'Z',
552
+			chr(197).chr(190) => 'z', chr(197).chr(191) => 's'
553 553
 		);
554 554
 		$string = strtr($string, $chars);
555 555
 		return $string;
Please login to merge, or discard this patch.
Spacing   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -14,12 +14,12 @@  discard block
 block discarded – undo
14 14
 	* @param Array $headers header to submit with the form
15 15
 	* @return String the result
16 16
 	*/
17
-	public function getData($url, $type = 'get', $data = '', $headers = '',$cookie = '',$referer = '',$timeout = '',$useragent = '') {
17
+	public function getData($url, $type = 'get', $data = '', $headers = '', $cookie = '', $referer = '', $timeout = '', $useragent = '') {
18 18
 		global $globalProxy, $globalForceIPv4;
19 19
 		$ch = curl_init();
20 20
 		curl_setopt($ch, CURLOPT_URL, $url);
21 21
 		if (isset($globalForceIPv4) && $globalForceIPv4) {
22
-			if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')){
22
+			if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')) {
23 23
 				curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
24 24
 			}
25 25
 		}
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
30 30
 		curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
31 31
 		curl_setopt($ch, CURLINFO_HEADER_OUT, true); 
32
-		curl_setopt($ch,CURLOPT_ENCODING , "gzip");
32
+		curl_setopt($ch, CURLOPT_ENCODING, "gzip");
33 33
 		//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');
34 34
 //		curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0');
35 35
 		if ($useragent == '') {
@@ -39,13 +39,13 @@  discard block
 block discarded – undo
39 39
 		}
40 40
 		if ($timeout == '') curl_setopt($ch, CURLOPT_TIMEOUT, 10); 
41 41
 		else curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); 
42
-		curl_setopt($ch, CURLOPT_HEADERFUNCTION, array('Common',"curlResponseHeaderCallback"));
42
+		curl_setopt($ch, CURLOPT_HEADERFUNCTION, array('Common', "curlResponseHeaderCallback"));
43 43
 		if ($type == 'post') {
44 44
 			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
45 45
 			if (is_array($data)) {
46 46
 				curl_setopt($ch, CURLOPT_POST, count($data));
47 47
 				$data_string = '';
48
-				foreach($data as $key=>$value) { $data_string .= $key.'='.$value.'&'; }
48
+				foreach ($data as $key=>$value) { $data_string .= $key.'='.$value.'&'; }
49 49
 				rtrim($data_string, '&');
50 50
 				curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
51 51
 			} else {
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 		}
58 58
 		if ($cookie != '') {
59 59
 			if (is_array($cookie)) {
60
-				curl_setopt($ch, CURLOPT_COOKIE, implode($cookie,';'));
60
+				curl_setopt($ch, CURLOPT_COOKIE, implode($cookie, ';'));
61 61
 			} else {
62 62
 				curl_setopt($ch, CURLOPT_COOKIE, $cookie);
63 63
 			}
@@ -69,13 +69,13 @@  discard block
 block discarded – undo
69 69
 		$info = curl_getinfo($ch);
70 70
 		//var_dump($info);
71 71
 		curl_close($ch);
72
-		if ($info['http_code'] == '503' && strstr($result,'DDoS protection by CloudFlare')) {
72
+		if ($info['http_code'] == '503' && strstr($result, 'DDoS protection by CloudFlare')) {
73 73
 			echo "Cloudflare Detected\n";
74 74
 			require_once(dirname(__FILE__).'/libs/cloudflare-bypass/libraries/cloudflareClass.php');
75 75
 			$useragent = UAgent::random();
76 76
 			cloudflare::useUserAgent($useragent);
77 77
 			if ($clearanceCookie = cloudflare::bypass($url)) {
78
-				return $this->getData($url,'get',$data,$headers,$clearanceCookie,$referer,$timeout,$useragent);
78
+				return $this->getData($url, 'get', $data, $headers, $clearanceCookie, $referer, $timeout, $useragent);
79 79
 			}
80 80
 		} else {
81 81
 			return $result;
@@ -116,27 +116,27 @@  discard block
 block discarded – undo
116 116
 		if ($data == '') return array();
117 117
 		$html = str_get_html($data);
118 118
 		if ($html === false) return array();
119
-		$tabledata=array();
120
-		foreach($html->find('tr') as $element)
119
+		$tabledata = array();
120
+		foreach ($html->find('tr') as $element)
121 121
 		{
122 122
 			$td = array();
123
-			foreach( $element->find('th') as $row)
123
+			foreach ($element->find('th') as $row)
124 124
 			{
125 125
 				$td [] = trim($row->plaintext);
126 126
 			}
127
-			$td=array_filter($td);
127
+			$td = array_filter($td);
128 128
 			$tabledata[] = $td;
129 129
 
130 130
 			$td = array();
131 131
 			$tdi = array();
132
-			foreach( $element->find('td') as $row)
132
+			foreach ($element->find('td') as $row)
133 133
 			{
134 134
 				$td [] = trim($row->plaintext);
135 135
 				$tdi [] = trim($row->innertext);
136 136
 			}
137
-			$td=array_filter($td);
138
-			$tdi=array_filter($tdi);
139
-			$tabledata[]=array_merge($td,$tdi);
137
+			$td = array_filter($td);
138
+			$tdi = array_filter($tdi);
139
+			$tabledata[] = array_merge($td, $tdi);
140 140
 		}
141 141
 		$html->clear();
142 142
 		unset($html);
@@ -151,8 +151,8 @@  discard block
 block discarded – undo
151 151
 	public function text2array($data) {
152 152
 		$html = str_get_html($data);
153 153
 		if ($html === false) return array();
154
-		$tabledata=array();
155
-		foreach($html->find('p') as $element)
154
+		$tabledata = array();
155
+		foreach ($html->find('p') as $element)
156 156
 		{
157 157
 			$tabledata [] = trim($element->plaintext);
158 158
 		}
@@ -172,11 +172,11 @@  discard block
 block discarded – undo
172 172
 	*/
173 173
 	public function distance($lat, $lon, $latc, $lonc, $unit = 'km') {
174 174
 		if ($lat == $latc && $lon == $lonc) return 0;
175
-		$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;
175
+		$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;
176 176
 		if ($unit == "km") {
177
-			return round($dist * 1.609344);
177
+			return round($dist*1.609344);
178 178
 		} elseif ($unit == "m") {
179
-			return round($dist * 1.609344 * 1000);
179
+			return round($dist*1.609344*1000);
180 180
 		} elseif ($unit == "mile" || $unit == "mi") {
181 181
 			return round($dist);
182 182
 		} elseif ($unit == "nm") {
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 	* @param float $distance distance covered
193 193
 	* @return whether distance is realistic
194 194
 	*/
195
-	public function withinThreshold ($timeDifference, $distance) {
195
+	public function withinThreshold($timeDifference, $distance) {
196 196
 		$x = abs($timeDifference);
197 197
 		$d = abs($distance);
198 198
 		if ($x == 0 || $d == 0) return true;
@@ -208,12 +208,12 @@  discard block
 block discarded – undo
208 208
 		return ($array !== array_values($array));
209 209
 	}
210 210
 
211
-	public function isInteger($input){
211
+	public function isInteger($input) {
212 212
 	    return(ctype_digit(strval($input)));
213 213
 	}
214 214
 
215 215
 
216
-	public function convertDec($dms,$latlong) {
216
+	public function convertDec($dms, $latlong) {
217 217
 		if ($latlong == 'latitude') {
218 218
 			$deg = substr($dms, 0, 2);
219 219
 			$min = substr($dms, 2, 4);
@@ -221,10 +221,10 @@  discard block
 block discarded – undo
221 221
 			$deg = substr($dms, 0, 3);
222 222
 			$min = substr($dms, 3, 5);
223 223
 		}
224
-		return $deg+(($min*60)/3600);
224
+		return $deg + (($min*60)/3600);
225 225
 	}
226 226
 	
227
-	public function convertDM($coord,$latlong) {
227
+	public function convertDM($coord, $latlong) {
228 228
 		if ($latlong == 'latitude') {
229 229
 			if ($coord < 0) $NSEW = 'S';
230 230
 			else $NSEW = 'N';
@@ -234,9 +234,9 @@  discard block
 block discarded – undo
234 234
 		}
235 235
 		$coord = abs($coord);
236 236
 		$deg = floor($coord);
237
-		$coord = ($coord-$deg)*60;
237
+		$coord = ($coord - $deg)*60;
238 238
 		$min = $coord;
239
-		return array('deg' => $deg,'min' => $min,'NSEW' => $NSEW);
239
+		return array('deg' => $deg, 'min' => $min, 'NSEW' => $NSEW);
240 240
 	}
241 241
 	
242 242
 	/**
@@ -248,8 +248,8 @@  discard block
 block discarded – undo
248 248
 	public function xcopy($source, $dest)
249 249
 	{
250 250
 		$files = glob($source.'*.*');
251
-		foreach($files as $file){
252
-			$file_to_go = str_replace($source,$dest,$file);
251
+		foreach ($files as $file) {
252
+			$file_to_go = str_replace($source, $dest, $file);
253 253
 			copy($file, $file_to_go);
254 254
 		}
255 255
 		return true;
@@ -260,9 +260,9 @@  discard block
 block discarded – undo
260 260
 	* @param	String $url url to check
261 261
 	* @return	bool Return true on succes false on failure
262 262
 	*/
263
-	public function urlexist($url){
264
-		$headers=get_headers($url);
265
-		return stripos($headers[0],"200 OK")?true:false;
263
+	public function urlexist($url) {
264
+		$headers = get_headers($url);
265
+		return stripos($headers[0], "200 OK") ? true : false;
266 266
 	}
267 267
 	
268 268
 	/**
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 	public function hex2str($hex) {
274 274
 		$str = '';
275 275
 		$hexln = strlen($hex);
276
-		for($i=0;$i<$hexln;$i+=2) $str .= chr(hexdec(substr($hex,$i,2)));
276
+		for ($i = 0; $i < $hexln; $i += 2) $str .= chr(hexdec(substr($hex, $i, 2)));
277 277
 		return $str;
278 278
 	}
279 279
 	
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 	* @return	String Return result
284 284
 	*/
285 285
 	public function hex2rgb($hex) {
286
-		$hex = str_replace('#','',$hex);
286
+		$hex = str_replace('#', '', $hex);
287 287
 		return sscanf($hex, "%02x%02x%02x"); 
288 288
 	}
289 289
 	
@@ -291,33 +291,33 @@  discard block
 block discarded – undo
291 291
 		//difference in longitudinal coordinates
292 292
 		$dLon = deg2rad($lon2) - deg2rad($lon1);
293 293
 		//difference in the phi of latitudinal coordinates
294
-		$dPhi = log(tan(deg2rad($lat2) / 2 + pi() / 4) / tan(deg2rad($lat1) / 2 + pi() / 4));
294
+		$dPhi = log(tan(deg2rad($lat2)/2 + pi()/4)/tan(deg2rad($lat1)/2 + pi()/4));
295 295
 		//we need to recalculate $dLon if it is greater than pi
296
-		if(abs($dLon) > pi()) {
297
-			if($dLon > 0) {
298
-				$dLon = (2 * pi() - $dLon) * -1;
296
+		if (abs($dLon) > pi()) {
297
+			if ($dLon > 0) {
298
+				$dLon = (2*pi() - $dLon)*-1;
299 299
 			} else {
300
-				$dLon = 2 * pi() + $dLon;
300
+				$dLon = 2*pi() + $dLon;
301 301
 			}
302 302
 		}
303 303
 		//return the angle, normalized
304
-		return (rad2deg(atan2($dLon, $dPhi)) + 360) % 360;
304
+		return (rad2deg(atan2($dLon, $dPhi)) + 360)%360;
305 305
 	}
306 306
 	
307
-	public function checkLine($lat1,$lon1,$lat2,$lon2,$lat3,$lon3,$approx = 0.2) {
307
+	public function checkLine($lat1, $lon1, $lat2, $lon2, $lat3, $lon3, $approx = 0.2) {
308 308
 		//$a = ($lon2-$lon1)*$lat3+($lat2-$lat1)*$lon3+($lat1*$lon2+$lat2*$lon1);
309
-		$a = -($lon2-$lon1);
309
+		$a = -($lon2 - $lon1);
310 310
 		$b = $lat2 - $lat1;
311
-		$c = -($a*$lat1+$b*$lon1);
312
-		$d = $a*$lat3+$b*$lon3+$c;
311
+		$c = -($a*$lat1 + $b*$lon1);
312
+		$d = $a*$lat3 + $b*$lon3 + $c;
313 313
 		if ($d > -$approx && $d < $approx) return true;
314 314
 		else return false;
315 315
 	}
316 316
 	
317 317
 	public function array_merge_noappend() {
318 318
 		$output = array();
319
-		foreach(func_get_args() as $array) {
320
-			foreach($array as $key => $value) {
319
+		foreach (func_get_args() as $array) {
320
+			foreach ($array as $key => $value) {
321 321
 				$output[$key] = isset($output[$key]) ?
322 322
 				array_merge($output[$key], $value) : $value;
323 323
 			}
@@ -381,34 +381,34 @@  discard block
 block discarded – undo
381 381
 		return $result;
382 382
 	}
383 383
 
384
-	public function nextcoord($latitude, $longitude, $speed, $heading, $archivespeed = 1){
384
+	public function nextcoord($latitude, $longitude, $speed, $heading, $archivespeed = 1) {
385 385
 		global $globalMapRefresh;
386 386
 		$distance = ($speed*0.514444*$globalMapRefresh*$archivespeed)/1000;
387 387
 		$r = 6378;
388 388
 		$latitude = deg2rad($latitude);
389 389
 		$longitude = deg2rad($longitude);
390 390
 		$bearing = deg2rad($heading); 
391
-		$latitude2 =  asin( (sin($latitude) * cos($distance/$r)) + (cos($latitude) * sin($distance/$r) * cos($bearing)) );
392
-		$longitude2 = $longitude + atan2( sin($bearing)*sin($distance/$r)*cos($latitude), cos($distance/$r)-(sin($latitude)*sin($latitude2)) );
393
-		return array('latitude' => number_format(rad2deg($latitude2),5,'.',''),'longitude' => number_format(rad2deg($longitude2),5,'.',''));
391
+		$latitude2 = asin((sin($latitude)*cos($distance/$r)) + (cos($latitude)*sin($distance/$r)*cos($bearing)));
392
+		$longitude2 = $longitude + atan2(sin($bearing)*sin($distance/$r)*cos($latitude), cos($distance/$r) - (sin($latitude)*sin($latitude2)));
393
+		return array('latitude' => number_format(rad2deg($latitude2), 5, '.', ''), 'longitude' => number_format(rad2deg($longitude2), 5, '.', ''));
394 394
 	}
395 395
 	
396
-	public function getCoordfromDistanceBearing($latitude,$longitude,$bearing,$distance) {
396
+	public function getCoordfromDistanceBearing($latitude, $longitude, $bearing, $distance) {
397 397
 		// distance in meter
398 398
 		$R = 6378.14;
399
-		$latitude1 = $latitude * (M_PI/180);
400
-		$longitude1 = $longitude * (M_PI/180);
401
-		$brng = $bearing * (M_PI/180);
399
+		$latitude1 = $latitude*(M_PI/180);
400
+		$longitude1 = $longitude*(M_PI/180);
401
+		$brng = $bearing*(M_PI/180);
402 402
 		$d = $distance;
403 403
 
404 404
 		$latitude2 = asin(sin($latitude1)*cos($d/$R) + cos($latitude1)*sin($d/$R)*cos($brng));
405
-		$longitude2 = $longitude1 + atan2(sin($brng)*sin($d/$R)*cos($latitude1),cos($d/$R)-sin($latitude1)*sin($latitude2));
405
+		$longitude2 = $longitude1 + atan2(sin($brng)*sin($d/$R)*cos($latitude1), cos($d/$R) - sin($latitude1)*sin($latitude2));
406 406
 
407
-		$latitude2 = $latitude2 * (180/M_PI);
408
-		$longitude2 = $longitude2 * (180/M_PI);
407
+		$latitude2 = $latitude2*(180/M_PI);
408
+		$longitude2 = $longitude2*(180/M_PI);
409 409
 
410
-		$flat = round ($latitude2,6);
411
-		$flong = round ($longitude2,6);
410
+		$flat = round($latitude2, 6);
411
+		$flong = round($longitude2, 6);
412 412
 /*
413 413
 		$dx = $distance*cos($bearing);
414 414
 		$dy = $distance*sin($bearing);
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
 		$flong = $longitude + $dlong;
418 418
 		$flat = $latitude + $dlat;
419 419
 */
420
-		return array('latitude' => $flat,'longitude' => $flong);
420
+		return array('latitude' => $flat, 'longitude' => $flong);
421 421
 	}
422 422
 
423 423
 	/**
@@ -431,14 +431,14 @@  discard block
 block discarded – undo
431 431
 	 * @param integer $level GZIP compression level (default: 9)
432 432
 	 * @return string New filename (with .gz appended) if success, or false if operation fails
433 433
 	 */
434
-	public function gzCompressFile($source, $level = 9){ 
435
-		$dest = $source . '.gz'; 
436
-		$mode = 'wb' . $level; 
434
+	public function gzCompressFile($source, $level = 9) { 
435
+		$dest = $source.'.gz'; 
436
+		$mode = 'wb'.$level; 
437 437
 		$error = false; 
438 438
 		if ($fp_out = gzopen($dest, $mode)) { 
439
-			if ($fp_in = fopen($source,'rb')) { 
439
+			if ($fp_in = fopen($source, 'rb')) { 
440 440
 				while (!feof($fp_in)) 
441
-					gzwrite($fp_out, fread($fp_in, 1024 * 512)); 
441
+					gzwrite($fp_out, fread($fp_in, 1024*512)); 
442 442
 				fclose($fp_in); 
443 443
 			} else {
444 444
 				$error = true; 
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
 	} 
455 455
 	
456 456
 	public function remove_accents($string) {
457
-		if ( !preg_match('/[\x80-\xff]/', $string) ) return $string;
457
+		if (!preg_match('/[\x80-\xff]/', $string)) return $string;
458 458
 		$chars = array(
459 459
 		    // Decompositions for Latin-1 Supplement
460 460
 		    chr(195).chr(128) => 'A', chr(195).chr(129) => 'A',
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
 		    chr(196).chr(172) => 'I', chr(196).chr(173) => 'i',
512 512
 		    chr(196).chr(174) => 'I', chr(196).chr(175) => 'i',
513 513
 		    chr(196).chr(176) => 'I', chr(196).chr(177) => 'i',
514
-		    chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij',
514
+		    chr(196).chr(178) => 'IJ', chr(196).chr(179) => 'ij',
515 515
 		    chr(196).chr(180) => 'J', chr(196).chr(181) => 'j',
516 516
 		    chr(196).chr(182) => 'K', chr(196).chr(183) => 'k',
517 517
 		    chr(196).chr(184) => 'k', chr(196).chr(185) => 'L',
@@ -527,13 +527,13 @@  discard block
 block discarded – undo
527 527
 		    chr(197).chr(140) => 'O', chr(197).chr(141) => 'o',
528 528
 		    chr(197).chr(142) => 'O', chr(197).chr(143) => 'o',
529 529
 		    chr(197).chr(144) => 'O', chr(197).chr(145) => 'o',
530
-		    chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe',
531
-		    chr(197).chr(148) => 'R',chr(197).chr(149) => 'r',
532
-		    chr(197).chr(150) => 'R',chr(197).chr(151) => 'r',
533
-		    chr(197).chr(152) => 'R',chr(197).chr(153) => 'r',
534
-		    chr(197).chr(154) => 'S',chr(197).chr(155) => 's',
535
-		    chr(197).chr(156) => 'S',chr(197).chr(157) => 's',
536
-		    chr(197).chr(158) => 'S',chr(197).chr(159) => 's',
530
+		    chr(197).chr(146) => 'OE', chr(197).chr(147) => 'oe',
531
+		    chr(197).chr(148) => 'R', chr(197).chr(149) => 'r',
532
+		    chr(197).chr(150) => 'R', chr(197).chr(151) => 'r',
533
+		    chr(197).chr(152) => 'R', chr(197).chr(153) => 'r',
534
+		    chr(197).chr(154) => 'S', chr(197).chr(155) => 's',
535
+		    chr(197).chr(156) => 'S', chr(197).chr(157) => 's',
536
+		    chr(197).chr(158) => 'S', chr(197).chr(159) => 's',
537 537
 		    chr(197).chr(160) => 'S', chr(197).chr(161) => 's',
538 538
 		    chr(197).chr(162) => 'T', chr(197).chr(163) => 't',
539 539
 		    chr(197).chr(164) => 'T', chr(197).chr(165) => 't',
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
 		for ($i = 0, $int = '', $concat_flag = true; $i < $length; $i++) {
568 568
 			if (is_numeric($string[$i]) && $concat_flag) {
569 569
 				$int .= $string[$i];
570
-			} elseif(!$concat && $concat_flag && strlen($int) > 0) {
570
+			} elseif (!$concat && $concat_flag && strlen($int) > 0) {
571 571
 				$concat_flag = false;
572 572
 			}
573 573
 		}
Please login to merge, or discard this patch.
index.php 2 patches
Indentation   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 <div id="showdetails" class="showdetails"></div>
37 37
 <div id="infobox" class="infobox"><h4><?php echo _("Aircrafts detected"); ?></h4><br /><i class="fa fa-spinner fa-pulse fa-fw"></i></div>
38 38
 <?php
39
-    if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
39
+	if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
40 40
 
41 41
 ?>
42 42
 <script src="<?php echo $globalURL; ?>/js/map.3d.js.php"></script>
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 <script src="<?php echo $globalURL; ?>/js/map-marine.3d.js.php"></script>
57 57
 <?php
58 58
 	}
59
-    }
59
+	}
60 60
 ?>
61 61
 <div id="dialog" title="<?php echo _("Session has timed-out"); ?>">
62 62
   <p><?php echo _("In order to save data consumption web page times out after 30 minutes. Close this dialog to continue."); ?></p>
@@ -70,34 +70,34 @@  discard block
 block discarded – undo
70 70
 	<li><a href="#" onclick="getUserLocation(); return false;" title="<?php echo _("Plot your Location"); ?>"><i class="fa fa-map-marker"></i></a></li>
71 71
 	<li><a href="#" onclick="getCompassDirection(); return false;" title="<?php echo _("Compass Mode"); ?>"><i class="fa fa-compass"></i></a></li>
72 72
 <?php
73
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
73
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
74 74
 	if (isset($globalArchive) && $globalArchive == TRUE) {
75 75
 ?>
76 76
 	<li><a href="#archive" role="tab" title="<?php echo _("Archive"); ?>"><i class="fa fa-archive"></i></a></li>
77 77
 <?php
78 78
 	}
79
-    }
79
+	}
80 80
 ?>
81 81
 	<li><a href="#home" role="tab" title="<?php echo _("Layers"); ?>"><i class="fa fa-map"></i></a></li>
82 82
 	<li><a href="#filters" role="tab" title="<?php echo _("Filters"); ?>"><i class="fa fa-filter"></i></a></li>
83 83
 	<li><a href="#settings" role="tab" title="<?php echo _("Settings"); ?>"><i class="fa fa-gears"></i></a></li>
84 84
 <?php
85
-    if (isset($globalMap3D) && $globalMap3D) {
85
+	if (isset($globalMap3D) && $globalMap3D) {
86 86
 	if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
87 87
 ?>
88 88
 	<li><a href="#" onclick="show3D(); return false;" role="tab" title="3D"><b>3D</b></a></li>
89 89
 <?php
90
-        } else {
91
-    	    if (isset($globalMapSatellites) && $globalMapSatellites) {
90
+		} else {
91
+			if (isset($globalMapSatellites) && $globalMapSatellites) {
92 92
 ?>
93 93
 	<li><a href="#satellites" role="tab" title="<?php echo _("Satellites"); ?>"><i class="satellite"></i></a></li>
94 94
 <?php
95
-	    }
95
+		}
96 96
 ?>
97 97
 	<li><a href="#" onclick="show2D(); return false;" role="tab" title="2D"><b>2D</b></a></li>
98 98
 <?php
99 99
 	}
100
-    }
100
+	}
101 101
 ?>
102 102
     </ul>
103 103
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 ?>
172 172
         </div>
173 173
 <?php
174
-    if (isset($globalArchive) && $globalArchive == TRUE) {
174
+	if (isset($globalArchive) && $globalArchive == TRUE) {
175 175
 ?>
176 176
         <div class="sidebar-pane" id="archive">
177 177
 	    <h1 class="sidebar-header"><?php echo _("Playback"); ?> <i>Bêta</i><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 	    </form>
232 232
 	</div>
233 233
 <?php
234
-    }
234
+	}
235 235
 ?>
236 236
         <div class="sidebar-pane" id="settings">
237 237
 	    <h1 class="sidebar-header"><?php echo _("Settings"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
@@ -242,56 +242,56 @@  discard block
 block discarded – undo
242 242
 			    <?php
243 243
 				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider;
244 244
 				else $MapType = $_COOKIE['MapType'];
245
-			    ?>
245
+				?>
246 246
 			    <?php
247 247
 				if (isset($globalBingMapKey) && $globalBingMapKey != '') {
248
-			    ?>
248
+				?>
249 249
 			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option>
250 250
 			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option>
251 251
 			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option>
252 252
 			    <?php
253 253
 				}
254
-			    ?>
254
+				?>
255 255
 			    <?php
256
-			        if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
257
-			    ?>
256
+					if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
257
+				?>
258 258
 			    <?php
259
-				    if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
260
-			    ?>
259
+					if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
260
+				?>
261 261
 			    <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option>
262 262
 			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option>
263 263
 			    <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option>
264 264
 			    <?php
265
-				    }
266
-			    ?>
265
+					}
266
+				?>
267 267
 			    <?php
268
-				    if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
269
-			    ?>
268
+					if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
269
+				?>
270 270
 			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option>
271 271
 			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option>
272 272
 			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option>
273 273
 			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option>
274 274
 			    <?php
275
-				    }
276
-			    ?>
275
+					}
276
+				?>
277 277
 			    <?php
278
-				    if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
279
-			    ?>
278
+					if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
279
+				?>
280 280
 			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option>
281 281
 			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option>
282 282
 			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option>
283 283
 			    <?php
284
-				    }
285
-			    ?>
284
+					}
285
+				?>
286 286
 			    <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option>
287 287
 			    <?php
288 288
 				}
289
-			    ?>
289
+				?>
290 290
 			    <?php
291
-				    if (isset($globalMapboxToken) && $globalMapboxToken != '') {
291
+					if (isset($globalMapboxToken) && $globalMapboxToken != '') {
292 292
 					if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default';
293 293
 					else $MapBoxId = $_COOKIE['MapTypeId'];
294
-			    ?>
294
+				?>
295 295
 			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option>
296 296
 			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option>
297 297
 			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option>
@@ -305,13 +305,13 @@  discard block
 block discarded – undo
305 305
 			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option>
306 306
 			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option>
307 307
 			    <?php
308
-				    }
309
-			    ?>
308
+					}
309
+				?>
310 310
 			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option>
311 311
 			</select>
312 312
 		    </li>
313 313
 <?php
314
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
314
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
315 315
 ?>
316 316
 		    <li><?php echo _("Type of Terrain:"); ?>
317 317
 			<select  class="selectpicker" onchange="terrainType(this);">
@@ -321,10 +321,10 @@  discard block
 block discarded – undo
321 321
 			</select>
322 322
 		    </li>
323 323
 <?php
324
-    }
324
+	}
325 325
 ?>
326 326
 <?php
327
-    if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
327
+	if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
328 328
 ?>
329 329
 		    
330 330
 		    <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>
@@ -332,59 +332,59 @@  discard block
 block discarded – undo
332 332
 		    <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || !isset($_COOKIE['MapRoute'])) print 'checked'; ?> ><?php echo _("Display flight route on click"); ?></label></div></li>
333 333
 		    <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>
334 334
 <?php
335
-    }
335
+	}
336 336
 ?>
337 337
 		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true') print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li>
338 338
 <?php
339
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
339
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
340 340
 ?>
341 341
 		    <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>
342 342
 <?php
343
-    }
344
-    if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
343
+	}
344
+	if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
345 345
 ?>
346 346
 		    <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>
347 347
 <?php
348
-    }
348
+	}
349 349
 ?>
350 350
 
351 351
 		    <?php
352 352
 			if (function_exists('array_column')) {
353
-			    if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
354
-		    ?>
353
+				if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
354
+			?>
355 355
 		    <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>
356 356
 		    <?php
357
-			    }
357
+				}
358 358
 			} elseif (isset($globalSources)) {
359
-			    $dispolar = false;
360
-			    foreach ($globalSources as $testsource) {
361
-			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
362
-			    }
363
-			    if ($dispolar) {
364
-		    ?>
359
+				$dispolar = false;
360
+				foreach ($globalSources as $testsource) {
361
+					if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
362
+				}
363
+				if ($dispolar) {
364
+			?>
365 365
 		    <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>
366 366
 		    <?php
367
-			    }
368
-		        }
369
-		    ?>
367
+				}
368
+				}
369
+			?>
370 370
 <?php
371
-    if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
371
+	if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
372 372
 ?>
373 373
 
374 374
 		    <?php
375
-		        if (extension_loaded('gd') && function_exists('gd_info')) {
376
-		    ?>
375
+				if (extension_loaded('gd') && function_exists('gd_info')) {
376
+			?>
377 377
 		    <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>
378 378
 		    <?php 
379 379
 			if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') {
380
-		    ?>
380
+			?>
381 381
 		    <li><?php echo _("Aircraft icon color:"); ?>
382 382
 			<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'; ?>">
383 383
 		    </li>
384 384
 		    <?php
385
-			    }
386
-		        }
387
-		    ?>
385
+				}
386
+				}
387
+			?>
388 388
 		    <li><?php echo _("Show airport icon at zoom level:"); ?>
389 389
 			<div class="range">
390 390
 			    <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'; ?>">
@@ -392,14 +392,14 @@  discard block
 block discarded – undo
392 392
 			</div>
393 393
 		    </li>
394 394
 <?php
395
-    } elseif (isset($_COOKIE['MapFormat']) || $_COOKIE['MapFOrmat'] == '3d') {
395
+	} elseif (isset($_COOKIE['MapFormat']) || $_COOKIE['MapFOrmat'] == '3d') {
396 396
 ?>
397 397
 		    <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>
398 398
 		    <li><?php echo _("Aircraft icon color:"); ?>
399 399
 			<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'; ?>">
400 400
 		    </li>
401 401
 <?php
402
-    }
402
+	}
403 403
 ?>
404 404
 		    <li><?php echo _("Distance unit:"); ?>
405 405
 			<select class="selectpicker" onchange="unitdistance(this);">
@@ -432,16 +432,16 @@  discard block
 block discarded – undo
432 432
 		    <ul>
433 433
 		    <?php
434 434
 			if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) {
435
-		    ?>
435
+			?>
436 436
 			<?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 } ?>
437 437
 			<?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 } ?>
438 438
 			<?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 } ?>
439 439
 		    <?php
440 440
 			}
441
-		    ?>
441
+			?>
442 442
 		    <?php
443 443
 			if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) {
444
-		    ?>
444
+			?>
445 445
 			<?php if (isset($globalSBS1) && $globalSBS1) { ?>
446 446
 			    <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>
447 447
 			<?php } ?>
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
 			<?php } ?>
451 451
 		    <?php
452 452
 			}
453
-		    ?>
453
+			?>
454 454
 		    <li><?php echo _("Display airlines:"); ?>
455 455
 		    <br/>
456 456
 			<select class="selectpicker" multiple onchange="airlines(this);" id="display_airlines">
@@ -470,14 +470,14 @@  discard block
 block discarded – undo
470 470
 						echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>';
471 471
 					}
472 472
 				}
473
-			    ?>
473
+				?>
474 474
 			</select>
475 475
 		    </li>
476 476
 		    <?php
477 477
 			$Spotter = new Spotter();
478 478
 			$allalliancenames = $Spotter->getAllAllianceNames();
479 479
 			if (!empty($allalliancenames)) {
480
-		    ?>
480
+			?>
481 481
 		    <li><?php echo _("Display alliance:"); ?>
482 482
 		    <br/>
483 483
 			<select class="selectpicker" onchange="alliance(this);" id="display_alliance">
@@ -491,15 +491,15 @@  discard block
 block discarded – undo
491 491
 						echo '<option value="'.$alliance_name.'">'.$alliance_name.'</option>';
492 492
 					}
493 493
 				}
494
-			    ?>
494
+				?>
495 495
 			</select>
496 496
 		    </li>
497 497
 		    <?php
498 498
 			}
499
-		    ?>
499
+			?>
500 500
 		    <?php
501 501
 			if (isset($globalAPRS) && $globalAPRS) {
502
-		    ?>
502
+			?>
503 503
 		    <li><?php echo _("Display APRS sources name:"); ?>
504 504
 			<select class="selectpicker" multiple onchange="sources(this);">
505 505
 			    <?php
@@ -511,15 +511,15 @@  discard block
 block discarded – undo
511 511
 						echo '<option value="'.$source['source_name'].'">'.$source['source_name'].'</option>';
512 512
 					}
513 513
 				}
514
-			    ?>
514
+				?>
515 515
 			</select>
516 516
 		    </li>
517 517
 		    <?php
518 518
 			}
519
-		    ?>
519
+			?>
520 520
 		    <?php
521 521
 			if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS)) {
522
-		    ?>
522
+			?>
523 523
 		    <li><?php echo _("Display airlines of type:"); ?><br/>
524 524
 			<select class="selectpicker" onchange="airlinestype(this);">
525 525
 			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
 		    </li>
531 531
 		    <?php
532 532
 			}
533
-		    ?>
533
+			?>
534 534
 		    <li>
535 535
 			<?php echo _("Display flight with ident:"); ?>
536 536
 			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" />
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
 	    </form>
544 544
     	</div>
545 545
 <?php
546
-    if (isset($globalMapSatellites) && $globalMapSatellites && isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
546
+	if (isset($globalMapSatellites) && $globalMapSatellites && isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
547 547
 ?>
548 548
         <div class="sidebar-pane" id="satellites">
549 549
 	    <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
@@ -583,14 +583,14 @@  discard block
 block discarded – undo
583 583
 						print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>';
584 584
 					}
585 585
 				}
586
-			    ?>
586
+				?>
587 587
 			</select>
588 588
 		    </li>
589 589
 		</ul>
590 590
 	    </form>
591 591
 	</div>
592 592
 <?php
593
-    }
593
+	}
594 594
 ?>
595 595
     </div>
596 596
 </div>
Please login to merge, or discard this patch.
Braces   +373 added lines, -98 removed lines patch added patch discarded remove patch
@@ -150,11 +150,26 @@  discard block
 block discarded – undo
150 150
 				<li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam();" /><?php echo _("Display NOTAM"); ?></label></div></li>
151 151
 				<li><?php echo _("NOTAM scope:"); ?>
152 152
 					<select class="selectpicker" onchange="notamscope(this);">
153
-						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') print ' selected'; ?>>All</option>
154
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') print ' selected'; ?>>Airport/Enroute warning</option>
155
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') print ' selected'; ?>>Airport warning</option>
156
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') print ' selected'; ?>>Navigation warning</option>
157
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') print ' selected'; ?>>Enroute warning</option>
153
+						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') {
154
+	print ' selected';
155
+}
156
+?>>All</option>
157
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') {
158
+	print ' selected';
159
+}
160
+?>>Airport/Enroute warning</option>
161
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') {
162
+	print ' selected';
163
+}
164
+?>>Airport warning</option>
165
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') {
166
+	print ' selected';
167
+}
168
+?>>Navigation warning</option>
169
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') {
170
+	print ' selected';
171
+}
172
+?>>Enroute warning</option>
158 173
 					</select
159 174
 				</li>
160 175
 			</ul>
@@ -182,7 +197,12 @@  discard block
 block discarded – undo
182 197
 		        <div class="form-group">
183 198
 			    <label>From (UTC):</label>
184 199
 		            <div class='input-group date' id='datetimepicker1'>
185
-            			<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 />
200
+            			<input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) {
201
+	print $_POST['start_date'];
202
+} elseif (isset($_COOKIE['archive_begin'])) {
203
+	print date("m/d/Y h:i a",$_COOKIE['archive_begin']);
204
+}
205
+?>" required />
186 206
 		                <span class="input-group-addon">
187 207
             			    <span class="glyphicon glyphicon-calendar"></span>
188 208
 		                </span>
@@ -191,7 +211,12 @@  discard block
 block discarded – undo
191 211
 		        <div class="form-group">
192 212
 			    <label>To (UTC):</label>
193 213
 		            <div class='input-group date' id='datetimepicker2'>
194
-		                <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']); ?>" />
214
+		                <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) {
215
+	print $_POST['end_date'];
216
+} elseif (isset($_COOKIE['archive_end'])) {
217
+	print date("m/d/Y h:i a",$_COOKIE['archive_end']);
218
+}
219
+?>" />
195 220
             			<span class="input-group-addon">
196 221
 		                    <span class="glyphicon glyphicon-calendar"></span>
197 222
             			</span>
@@ -217,8 +242,20 @@  discard block
 block discarded – undo
217 242
 
218 243
 		    <li><?php echo _("Playback speed:"); ?>
219 244
 			<div class="range">
220
-			    <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'; ?>">
221
-			    <output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?></output>
245
+			    <input type="range" min="0" max="50" step="1" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php  if (isset($_POST['archivespeed'])) {
246
+	print $_POST['archivespeed'];
247
+} elseif (isset($_COOKIE['archive_speed'])) {
248
+	print $_COOKIE['archive_speed'];
249
+} else {
250
+	print '1';
251
+}
252
+?>">
253
+			    <output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) {
254
+	print $_COOKIE['archive_speed'];
255
+} else {
256
+	print '1';
257
+}
258
+?></output>
222 259
 			</div>
223 260
 		    </li>
224 261
 		    <li><input type="submit" name="archive" value="Show archive" class="btn btn-primary" /></li>
@@ -240,15 +277,27 @@  discard block
 block discarded – undo
240 277
 		    <li><?php echo _("Type of Map:"); ?>
241 278
 			<select  class="selectpicker" onchange="mapType(this);">
242 279
 			    <?php
243
-				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider;
244
-				else $MapType = $_COOKIE['MapType'];
280
+				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') {
281
+					$MapType = $globalMapProvider;
282
+				} else {
283
+					$MapType = $_COOKIE['MapType'];
284
+				}
245 285
 			    ?>
246 286
 			    <?php
247 287
 				if (isset($globalBingMapKey) && $globalBingMapKey != '') {
248 288
 			    ?>
249
-			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option>
250
-			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option>
251
-			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option>
289
+			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') {
290
+	print ' selected';
291
+}
292
+?>>Bing-Aerial</option>
293
+			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') {
294
+	print ' selected';
295
+}
296
+?>>Bing-Hybrid</option>
297
+			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') {
298
+	print ' selected';
299
+}
300
+?>>Bing-Road</option>
252 301
 			    <?php
253 302
 				}
254 303
 			    ?>
@@ -258,56 +307,131 @@  discard block
 block discarded – undo
258 307
 			    <?php
259 308
 				    if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
260 309
 			    ?>
261
-			    <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option>
262
-			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option>
263
-			    <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option>
310
+			    <option value="Here-Aerial"<?php if ($MapType == 'Here') {
311
+	print ' selected';
312
+}
313
+?>>Here-Aerial</option>
314
+			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') {
315
+	print ' selected';
316
+}
317
+?>>Here-Hybrid</option>
318
+			    <option value="Here-Road"<?php if ($MapType == 'Here') {
319
+	print ' selected';
320
+}
321
+?>>Here-Road</option>
264 322
 			    <?php
265 323
 				    }
266 324
 			    ?>
267 325
 			    <?php
268 326
 				    if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
269 327
 			    ?>
270
-			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option>
271
-			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option>
272
-			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option>
273
-			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option>
328
+			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') {
329
+	print ' selected';
330
+}
331
+?>>Google Roadmap</option>
332
+			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') {
333
+	print ' selected';
334
+}
335
+?>>Google Satellite</option>
336
+			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') {
337
+	print ' selected';
338
+}
339
+?>>Google Hybrid</option>
340
+			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') {
341
+	print ' selected';
342
+}
343
+?>>Google Terrain</option>
274 344
 			    <?php
275 345
 				    }
276 346
 			    ?>
277 347
 			    <?php
278 348
 				    if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
279 349
 			    ?>
280
-			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option>
281
-			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option>
282
-			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option>
350
+			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') {
351
+	print ' selected';
352
+}
353
+?>>MapQuest-OSM</option>
354
+			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') {
355
+	print ' selected';
356
+}
357
+?>>MapQuest-Aerial</option>
358
+			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') {
359
+	print ' selected';
360
+}
361
+?>>MapQuest-Hybrid</option>
283 362
 			    <?php
284 363
 				    }
285 364
 			    ?>
286
-			    <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option>
365
+			    <option value="Yandex"<?php if ($MapType == 'Yandex') {
366
+	print ' selected';
367
+}
368
+?>>Yandex</option>
287 369
 			    <?php
288 370
 				}
289 371
 			    ?>
290 372
 			    <?php
291 373
 				    if (isset($globalMapboxToken) && $globalMapboxToken != '') {
292
-					if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default';
293
-					else $MapBoxId = $_COOKIE['MapTypeId'];
374
+					if (!isset($_COOKIE['MapTypeId'])) {
375
+						$MapBoxId = 'default';
376
+					} else {
377
+						$MapBoxId = $_COOKIE['MapTypeId'];
378
+					}
294 379
 			    ?>
295
-			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option>
296
-			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option>
297
-			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option>
298
-			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') print ' selected'; ?>>Mapbox dark</option>
299
-			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') print ' selected'; ?>>Mapbox satellite</option>
300
-			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') print ' selected'; ?>>Mapbox streets-satellite</option>
301
-			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') print ' selected'; ?>>Mapbox streets-basic</option>
302
-			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') print ' selected'; ?>>Mapbox comic</option>
303
-			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') print ' selected'; ?>>Mapbox outdoors</option>
304
-			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') print ' selected'; ?>>Mapbox pencil</option>
305
-			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option>
306
-			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option>
380
+			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') {
381
+	print ' selected';
382
+}
383
+?>>Mapbox default</option>
384
+			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') {
385
+	print ' selected';
386
+}
387
+?>>Mapbox streets</option>
388
+			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') {
389
+	print ' selected';
390
+}
391
+?>>Mapbox light</option>
392
+			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') {
393
+	print ' selected';
394
+}
395
+?>>Mapbox dark</option>
396
+			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') {
397
+	print ' selected';
398
+}
399
+?>>Mapbox satellite</option>
400
+			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') {
401
+	print ' selected';
402
+}
403
+?>>Mapbox streets-satellite</option>
404
+			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') {
405
+	print ' selected';
406
+}
407
+?>>Mapbox streets-basic</option>
408
+			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') {
409
+	print ' selected';
410
+}
411
+?>>Mapbox comic</option>
412
+			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') {
413
+	print ' selected';
414
+}
415
+?>>Mapbox outdoors</option>
416
+			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') {
417
+	print ' selected';
418
+}
419
+?>>Mapbox pencil</option>
420
+			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') {
421
+	print ' selected';
422
+}
423
+?>>Mapbox pirates</option>
424
+			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') {
425
+	print ' selected';
426
+}
427
+?>>Mapbox emerald</option>
307 428
 			    <?php
308 429
 				    }
309 430
 			    ?>
310
-			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option>
431
+			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') {
432
+	print ' selected';
433
+}
434
+?>>OpenStreetMap</option>
311 435
 			</select>
312 436
 		    </li>
313 437
 <?php
@@ -315,9 +439,18 @@  discard block
 block discarded – undo
315 439
 ?>
316 440
 		    <li><?php echo _("Type of Terrain:"); ?>
317 441
 			<select  class="selectpicker" onchange="terrainType(this);">
318
-			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option>
319
-			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option>
320
-			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option>
442
+			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') {
443
+	print ' selected';
444
+}
445
+?>>stk terrain</option>
446
+			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') {
447
+	print ' selected';
448
+}
449
+?>>ellipsoid</option>
450
+			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') {
451
+	print ' selected';
452
+}
453
+?>>vr terrain</option>
321 454
 			</select>
322 455
 		    </li>
323 456
 <?php
@@ -327,18 +460,36 @@  discard block
 block discarded – undo
327 460
     if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
328 461
 ?>
329 462
 		    
330
-		    <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>
331
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') || !isset($_COOKIE['flightpath'])) print 'checked'; ?> ><?php echo _("Display flight path"); ?></label></div></li>
332
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || !isset($_COOKIE['MapRoute'])) print 'checked'; ?> ><?php echo _("Display flight route on click"); ?></label></div></li>
333
-		    <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>
463
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') {
464
+	print 'checked';
465
+}
466
+?> ><?php echo _("Display flight info as popup"); ?></label></div></li>
467
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') || !isset($_COOKIE['flightpath'])) {
468
+	print 'checked';
469
+}
470
+?> ><?php echo _("Display flight path"); ?></label></div></li>
471
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || !isset($_COOKIE['MapRoute'])) {
472
+	print 'checked';
473
+}
474
+?> ><?php echo _("Display flight route on click"); ?></label></div></li>
475
+		    <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)) {
476
+	print 'checked';
477
+}
478
+?> ><?php echo _("Planes animate between updates"); ?></label></div></li>
334 479
 <?php
335 480
     }
336 481
 ?>
337
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true') print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li>
482
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true') {
483
+	print 'checked';
484
+}
485
+?> ><?php echo _("Display airports on map"); ?></label></div></li>
338 486
 <?php
339 487
     if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
340 488
 ?>
341
-		    <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>
489
+		    <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')) {
490
+	print 'checked';
491
+}
492
+?> ><?php echo _("Show mini-map"); ?></label></div></li>
342 493
 <?php
343 494
     }
344 495
     if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
@@ -352,17 +503,25 @@  discard block
 block discarded – undo
352 503
 			if (function_exists('array_column')) {
353 504
 			    if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
354 505
 		    ?>
355
-		    <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>
506
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
507
+	print 'checked';
508
+}
509
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
356 510
 		    <?php
357 511
 			    }
358 512
 			} elseif (isset($globalSources)) {
359 513
 			    $dispolar = false;
360 514
 			    foreach ($globalSources as $testsource) {
361
-			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
515
+			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) {
516
+			        	$dispolar = true;
517
+			        }
362 518
 			    }
363 519
 			    if ($dispolar) {
364 520
 		    ?>
365
-		    <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>
521
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
522
+	print 'checked';
523
+}
524
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
366 525
 		    <?php
367 526
 			    }
368 527
 		        }
@@ -374,12 +533,22 @@  discard block
 block discarded – undo
374 533
 		    <?php
375 534
 		        if (extension_loaded('gd') && function_exists('gd_info')) {
376 535
 		    ?>
377
-		    <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>
536
+		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') {
537
+	print 'checked';
538
+}
539
+?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
378 540
 		    <?php 
379 541
 			if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') {
380 542
 		    ?>
381 543
 		    <li><?php echo _("Aircraft icon color:"); ?>
382
-			<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'; ?>">
544
+			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) {
545
+	print $_COOKIE['IconColor'];
546
+} elseif (isset($globalAircraftIconColor)) {
547
+	print $globalAircraftIconColor;
548
+} else {
549
+	print '1a3151';
550
+}
551
+?>">
383 552
 		    </li>
384 553
 		    <?php
385 554
 			    }
@@ -387,38 +556,86 @@  discard block
 block discarded – undo
387 556
 		    ?>
388 557
 		    <li><?php echo _("Show airport icon at zoom level:"); ?>
389 558
 			<div class="range">
390
-			    <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'; ?>">
391
-			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?></output>
559
+			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) {
560
+	print $_COOKIE['AirportZoom'];
561
+} elseif (isset($globalAirportZoom)) {
562
+	print $globalAirportZoom;
563
+} else {
564
+	print '7';
565
+}
566
+?>">
567
+			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) {
568
+	print $_COOKIE['AirportZoom'];
569
+} elseif (isset($globalAirportZoom)) {
570
+	print $globalAirportZoom;
571
+} else {
572
+	print '7';
573
+}
574
+?></output>
392 575
 			</div>
393 576
 		    </li>
394 577
 <?php
395 578
     } elseif (isset($_COOKIE['MapFormat']) || $_COOKIE['MapFOrmat'] == '3d') {
396 579
 ?>
397
-		    <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>
580
+		    <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') {
581
+	print 'checked';
582
+}
583
+?> ><?php echo _("Force Aircraft color"); ?></li>
398 584
 		    <li><?php echo _("Aircraft icon color:"); ?>
399
-			<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'; ?>">
585
+			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) {
586
+	print $_COOKIE['IconColor'];
587
+} elseif (isset($globalAircraftIconColor)) {
588
+	print $globalAircraftIconColor;
589
+} else {
590
+	print 'ff0000';
591
+}
592
+?>">
400 593
 		    </li>
401 594
 <?php
402 595
     }
403 596
 ?>
404 597
 		    <li><?php echo _("Distance unit:"); ?>
405 598
 			<select class="selectpicker" onchange="unitdistance(this);">
406
-			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) echo ' selected'; ?>>km</option>
407
-			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) echo ' selected'; ?>>nm</option>
408
-			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) echo ' selected'; ?>>mi</option>
599
+			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) {
600
+	echo ' selected';
601
+}
602
+?>>km</option>
603
+			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
604
+	echo ' selected';
605
+}
606
+?>>nm</option>
607
+			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
608
+	echo ' selected';
609
+}
610
+?>>mi</option>
409 611
 		        </select>
410 612
 		    </li>
411 613
 		    <li><?php echo _("Altitude unit:"); ?>
412 614
 			<select class="selectpicker" onchange="unitaltitude(this);">
413
-			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) echo ' selected'; ?>>m</option>
414
-			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) echo ' selected'; ?>>feet</option>
615
+			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) {
616
+	echo ' selected';
617
+}
618
+?>>m</option>
619
+			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) {
620
+	echo ' selected';
621
+}
622
+?>>feet</option>
415 623
 		        </select>
416 624
 		    </li>
417 625
 		    <li><?php echo _("Speed unit:"); ?>
418 626
 			<select class="selectpicker" onchange="unitspeed(this);">
419
-			    <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>
420
-			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) echo ' selected'; ?>>mph</option>
421
-			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) echo ' selected'; ?>>knots</option>
627
+			    <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) {
628
+	echo ' selected';
629
+}
630
+?>>km/h</option>
631
+			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) {
632
+	echo ' selected';
633
+}
634
+?>>mph</option>
635
+			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) {
636
+	echo ' selected';
637
+}
638
+?>>knots</option>
422 639
 		        </select>
423 640
 		    </li>
424 641
 
@@ -433,9 +650,18 @@  discard block
 block discarded – undo
433 650
 		    <?php
434 651
 			if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) {
435 652
 		    ?>
436
-			<?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 } ?>
437
-			<?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 } ?>
438
-			<?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 } ?>
653
+			<?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'])) {
654
+	print 'checked';
655
+}
656
+?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
657
+			<?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'])) {
658
+	print 'checked';
659
+}
660
+?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
661
+			<?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'])) {
662
+	print 'checked';
663
+}
664
+?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
439 665
 		    <?php
440 666
 			}
441 667
 		    ?>
@@ -443,10 +669,16 @@  discard block
 block discarded – undo
443 669
 			if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) {
444 670
 		    ?>
445 671
 			<?php if (isset($globalSBS1) && $globalSBS1) { ?>
446
-			    <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>
672
+			    <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'])) {
673
+	print 'checked';
674
+}
675
+?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
447 676
 			<?php } ?>
448 677
 			<?php if (isset($globalAPRS) && $globalAPRS) { ?>
449
-			    <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>
678
+			    <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'])) {
679
+	print 'checked';
680
+}
681
+?> ><?php echo _("Display APRS data"); ?></label></div></li>
450 682
 			<?php } ?>
451 683
 		    <?php
452 684
 			}
@@ -463,7 +695,9 @@  discard block
 block discarded – undo
463 695
 				}
464 696
 				foreach($allairlinenames as $airline) {
465 697
 					$airline_name = $airline['airline_name'];
466
-					if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...';
698
+					if (strlen($airline_name) > 30) {
699
+						$airline_name = substr($airline_name,0,30).'...';
700
+					}
467 701
 					if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['filter_Airlines']))) {
468 702
 						echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>';
469 703
 					} else {
@@ -481,7 +715,10 @@  discard block
 block discarded – undo
481 715
 		    <li><?php echo _("Display alliance:"); ?>
482 716
 		    <br/>
483 717
 			<select class="selectpicker" onchange="alliance(this);" id="display_alliance">
484
-			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
718
+			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') {
719
+	echo ' selected';
720
+}
721
+?>><?php echo _("All"); ?></option>
485 722
 			    <?php
486 723
 				foreach($allalliancenames as $alliance) {
487 724
 					$alliance_name = $alliance['alliance'];
@@ -522,10 +759,22 @@  discard block
 block discarded – undo
522 759
 		    ?>
523 760
 		    <li><?php echo _("Display airlines of type:"); ?><br/>
524 761
 			<select class="selectpicker" onchange="airlinestype(this);">
525
-			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
526
-			    <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') echo ' selected'; ?>><?php echo _("Passenger"); ?></option>
527
-			    <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') echo ' selected'; ?>><?php echo _("Cargo"); ?></option>
528
-			    <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') echo ' selected'; ?>><?php echo _("Military"); ?></option>
762
+			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') {
763
+	echo ' selected';
764
+}
765
+?>><?php echo _("All"); ?></option>
766
+			    <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') {
767
+	echo ' selected';
768
+}
769
+?>><?php echo _("Passenger"); ?></option>
770
+			    <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') {
771
+	echo ' selected';
772
+}
773
+?>><?php echo _("Cargo"); ?></option>
774
+			    <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') {
775
+	echo ' selected';
776
+}
777
+?>><?php echo _("Military"); ?></option>
529 778
 			</select>
530 779
 		    </li>
531 780
 		    <?php
@@ -533,7 +782,10 @@  discard block
 block discarded – undo
533 782
 		    ?>
534 783
 		    <li>
535 784
 			<?php echo _("Display flight with ident:"); ?>
536
-			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" />
785
+			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) {
786
+	print $_COOKIE['filter_ident'];
787
+}
788
+?>" />
537 789
 		    </li>
538 790
 		</ul>
539 791
 	    </form>
@@ -549,7 +801,10 @@  discard block
 block discarded – undo
549 801
 	    <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
550 802
 	    <form>
551 803
 		<ul>
552
-		    <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>
804
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if (isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') {
805
+	print 'checked';
806
+}
807
+?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li>
553 808
 		    <li><?php echo _("Type:"); ?>
554 809
 			<select class="selectpicker" multiple onchange="sattypes(this);">
555 810
 			    <?php
@@ -557,25 +812,45 @@  discard block
 block discarded – undo
557 812
 				$types = $Satellite->get_tle_types();
558 813
 				foreach ($types as $type) {
559 814
 					$type_name = $type['tle_type'];
560
-					if ($type_name == 'musson') $type_name = 'Russian LEO Navigation';
561
-					else if ($type_name == 'nnss') $type_name = 'Navi Navigation Satellite System';
562
-					else if ($type_name == 'sbas') $type_name = 'Satellite-Based Augmentation System';
563
-					else if ($type_name == 'glo-ops') $type_name = 'Glonass Operational';
564
-					else if ($type_name == 'gps-ops') $type_name = 'GPS Operational';
565
-					else if ($type_name == 'argos') $type_name = 'ARGOS Data Collection System';
566
-					else if ($type_name == 'tdrss') $type_name = 'Tracking and Data Relay Satellite System';
567
-					else if ($type_name == 'sarsat') $type_name = 'Search & Rescue';
568
-					else if ($type_name == 'dmc') $type_name = 'Disaster Monitoring';
569
-					else if ($type_name == 'resource') $type_name = 'Earth Resources';
570
-					else if ($type_name == 'stations') $type_name = 'Space Stations';
571
-					else if ($type_name == 'geo') $type_name = 'Geostationary';
572
-					else if ($type_name == 'amateur') $type_name = 'Amateur Radio';
573
-					else if ($type_name == 'x-comm') $type_name = 'Experimental';
574
-					else if ($type_name == 'other-comm') $type_name = 'Other Comm';
575
-					else if ($type_name == 'science') $type_name = 'Space & Earth Science';
576
-					else if ($type_name == 'military') $type_name = 'Miscellaneous Military';
577
-					else if ($type_name == 'radar') $type_name = 'Radar Calibration';
578
-					else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches';
815
+					if ($type_name == 'musson') {
816
+						$type_name = 'Russian LEO Navigation';
817
+					} else if ($type_name == 'nnss') {
818
+						$type_name = 'Navi Navigation Satellite System';
819
+					} else if ($type_name == 'sbas') {
820
+						$type_name = 'Satellite-Based Augmentation System';
821
+					} else if ($type_name == 'glo-ops') {
822
+						$type_name = 'Glonass Operational';
823
+					} else if ($type_name == 'gps-ops') {
824
+						$type_name = 'GPS Operational';
825
+					} else if ($type_name == 'argos') {
826
+						$type_name = 'ARGOS Data Collection System';
827
+					} else if ($type_name == 'tdrss') {
828
+						$type_name = 'Tracking and Data Relay Satellite System';
829
+					} else if ($type_name == 'sarsat') {
830
+						$type_name = 'Search & Rescue';
831
+					} else if ($type_name == 'dmc') {
832
+						$type_name = 'Disaster Monitoring';
833
+					} else if ($type_name == 'resource') {
834
+						$type_name = 'Earth Resources';
835
+					} else if ($type_name == 'stations') {
836
+						$type_name = 'Space Stations';
837
+					} else if ($type_name == 'geo') {
838
+						$type_name = 'Geostationary';
839
+					} else if ($type_name == 'amateur') {
840
+						$type_name = 'Amateur Radio';
841
+					} else if ($type_name == 'x-comm') {
842
+						$type_name = 'Experimental';
843
+					} else if ($type_name == 'other-comm') {
844
+						$type_name = 'Other Comm';
845
+					} else if ($type_name == 'science') {
846
+						$type_name = 'Space & Earth Science';
847
+					} else if ($type_name == 'military') {
848
+						$type_name = 'Miscellaneous Military';
849
+					} else if ($type_name == 'radar') {
850
+						$type_name = 'Radar Calibration';
851
+					} else if ($type_name == 'tle-new') {
852
+						$type_name = 'Last 30 days launches';
853
+					}
579 854
 					
580 855
 					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) {
581 856
 						print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>';
Please login to merge, or discard this patch.