Completed
Push — master ( 52a4df...30fb54 )
by Yannick
12:47 queued 06:49
created
date.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@
 block discarded – undo
1 1
 <?php
2 2
 $date = filter_input(INPUT_POST,'date',FILTER_SANITIZE_STRING);
3
-if ($date == '') $date = date('Y-m-d');
3
+if ($date == '') {
4
+	$date = date('Y-m-d');
5
+}
4 6
 header('Location: '.$globalURL.'/date/'.$date);
5 7
 ?>
6 8
\ No newline at end of file
Please login to merge, or discard this patch.
incident.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@
 block discarded – undo
1 1
 <?php
2 2
 $date = filter_input(INPUT_POST,'date',FILTER_SANITIZE_STRING);
3
-if ($date == '') $date = date('Y-m-d');
3
+if ($date == '') {
4
+	$date = date('Y-m-d');
5
+}
4 6
 header('Location: '.$globalURL.'/incident/'.$date);
5 7
 ?>
6 8
\ No newline at end of file
Please login to merge, or discard this patch.
require/class.Image.php 1 patch
Braces   +123 added lines, -45 removed lines patch added patch discarded remove patch
@@ -22,7 +22,9 @@  discard block
 block discarded – undo
22 22
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
23 23
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
24 24
 		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
25
-		if ($registration == '' && $aircraft_icao != '') $registration = $aircraft_icao.$airline_icao;
25
+		if ($registration == '' && $aircraft_icao != '') {
26
+			$registration = $aircraft_icao.$airline_icao;
27
+		}
26 28
 		$registration = trim($registration);
27 29
 		$query  = "SELECT spotter_image.image, spotter_image.image_thumbnail, spotter_image.image_source, spotter_image.image_source_website,spotter_image.image_copyright, spotter_image.registration 
28 30
 			FROM spotter_image 
@@ -60,8 +62,11 @@  discard block
 block discarded – undo
60 62
 	public function getExifCopyright($url) {
61 63
 		$exif = exif_read_data($url);
62 64
 		$copyright = '';
63
-		if (isset($exif['COMPUTED']['copyright'])) $copyright = $exif['COMPUTED']['copyright'];
64
-		elseif (isset($exif['copyright'])) $copyright = $exif['copyright'];
65
+		if (isset($exif['COMPUTED']['copyright'])) {
66
+			$copyright = $exif['COMPUTED']['copyright'];
67
+		} elseif (isset($exif['copyright'])) {
68
+			$copyright = $exif['copyright'];
69
+		}
65 70
 		if ($copyright != '') {
66 71
 			$copyright = str_replace('Copyright ','',$copyright);
67 72
 			$copyright = str_replace('© ','',$copyright);
@@ -79,18 +84,29 @@  discard block
 block discarded – undo
79 84
 	public function addSpotterImage($registration,$aircraft_icao = '', $airline_icao = '')
80 85
 	{
81 86
 		global $globalDebug,$globalAircraftImageFetch;
82
-		if (isset($globalAircraftImageFetch) && !$globalAircraftImageFetch) return '';
87
+		if (isset($globalAircraftImageFetch) && !$globalAircraftImageFetch) {
88
+			return '';
89
+		}
83 90
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
84 91
 		$registration = trim($registration);
85 92
 		//getting the aircraft image
86
-		if ($globalDebug && $registration != '') echo 'Try to find an aircraft image for '.$registration.'...';
87
-		elseif ($globalDebug && $aircraft_icao != '') echo 'Try to find an aircraft image for '.$aircraft_icao.'...';
88
-		elseif ($globalDebug && $airline_icao != '') echo 'Try to find an aircraft image for '.$airline_icao.'...';
89
-		else return "success";
93
+		if ($globalDebug && $registration != '') {
94
+			echo 'Try to find an aircraft image for '.$registration.'...';
95
+		} elseif ($globalDebug && $aircraft_icao != '') {
96
+			echo 'Try to find an aircraft image for '.$aircraft_icao.'...';
97
+		} elseif ($globalDebug && $airline_icao != '') {
98
+			echo 'Try to find an aircraft image for '.$airline_icao.'...';
99
+		} else {
100
+			return "success";
101
+		}
90 102
 		$image_url = $this->findAircraftImage($registration,$aircraft_icao,$airline_icao);
91
-		if ($registration == '' && $aircraft_icao != '') $registration = $aircraft_icao.$airline_icao;
103
+		if ($registration == '' && $aircraft_icao != '') {
104
+			$registration = $aircraft_icao.$airline_icao;
105
+		}
92 106
 		if ($image_url['original'] != '') {
93
-			if ($globalDebug) echo 'Found !'."\n";
107
+			if ($globalDebug) {
108
+				echo 'Found !'."\n";
109
+			}
94 110
 			$query  = "INSERT INTO spotter_image (registration, image, image_thumbnail, image_copyright, image_source,image_source_website) VALUES (:registration,:image,:image_thumbnail,:copyright,:source,:source_website)";
95 111
 			try {
96 112
 				$sth = $this->db->prepare($query);
@@ -99,7 +115,9 @@  discard block
 block discarded – undo
99 115
 				echo $e->getMessage()."\n";
100 116
 				return "error";
101 117
 			}
102
-		} elseif ($globalDebug) echo "Not found :'(\n";
118
+		} elseif ($globalDebug) {
119
+			echo "Not found :'(\n";
120
+		}
103 121
 		return "success";
104 122
 	}
105 123
 
@@ -114,36 +132,75 @@  discard block
 block discarded – undo
114 132
 	{
115 133
 		global $globalAircraftImageSources, $globalIVAO;
116 134
 		$Spotter = new Spotter($this->db);
117
-		if (!isset($globalIVAO)) $globalIVAO = FALSE;
135
+		if (!isset($globalIVAO)) {
136
+			$globalIVAO = FALSE;
137
+		}
118 138
 		$aircraft_registration = filter_var($aircraft_registration,FILTER_SANITIZE_STRING);
119 139
 		if ($aircraft_registration != '') {
120
-			if (strpos($aircraft_registration,'/') !== false) return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => '');
140
+			if (strpos($aircraft_registration,'/') !== false) {
141
+				return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => '');
142
+			}
121 143
 			$aircraft_registration = urlencode(trim($aircraft_registration));
122 144
 			$aircraft_info = $Spotter->getAircraftInfoByRegistration($aircraft_registration);
123
-			if (isset($aircraft_info[0]['aircraft_name'])) $aircraft_name = $aircraft_info[0]['aircraft_name'];
124
-			else $aircraft_name = '';
125
-			if (isset($aircraft_info[0]['aircraft_icao'])) $aircraft_name = $aircraft_info[0]['aircraft_icao'];
126
-			else $aircraft_icao = '';
127
-			if (isset($aircraft_info[0]['airline_icao'])) $airline_icao = $aircraft_info[0]['airline_icao'];
128
-			else $airline_icao = '';
145
+			if (isset($aircraft_info[0]['aircraft_name'])) {
146
+				$aircraft_name = $aircraft_info[0]['aircraft_name'];
147
+			} else {
148
+				$aircraft_name = '';
149
+			}
150
+			if (isset($aircraft_info[0]['aircraft_icao'])) {
151
+				$aircraft_name = $aircraft_info[0]['aircraft_icao'];
152
+			} else {
153
+				$aircraft_icao = '';
154
+			}
155
+			if (isset($aircraft_info[0]['airline_icao'])) {
156
+				$airline_icao = $aircraft_info[0]['airline_icao'];
157
+			} else {
158
+				$airline_icao = '';
159
+			}
129 160
 		} elseif ($aircraft_icao != '') {
130 161
 			$aircraft_registration = $aircraft_icao;
131 162
 			$aircraft_name = '';
132
-		} else return array('thumbnail' => '','original' => '', 'copyright' => '', 'source' => '','source_website' => '');
133
-		if (!isset($globalAircraftImageSources)) $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters');
163
+		} else {
164
+			return array('thumbnail' => '','original' => '', 'copyright' => '', 'source' => '','source_website' => '');
165
+		}
166
+		if (!isset($globalAircraftImageSources)) {
167
+			$globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters');
168
+		}
134 169
 		foreach ($globalAircraftImageSources as $source) {
135 170
 			$source = strtolower($source);
136
-			if ($source == 'ivaomtl' && $globalIVAO && $aircraft_icao != '' && $airline_icao != '') $images_array = $this->fromIvaoMtl($aircraft_icao,$airline_icao);
137
-			if ($source == 'planespotters' && !$globalIVAO) $images_array = $this->fromPlanespotters($aircraft_registration,$aircraft_name);
138
-			if ($source == 'flickr') $images_array = $this->fromFlickr($aircraft_registration,$aircraft_name);
139
-			if ($source == 'bing') $images_array = $this->fromBing($aircraft_registration,$aircraft_name);
140
-			if ($source == 'deviantart') $images_array = $this->fromDeviantart($aircraft_registration,$aircraft_name);
141
-			if ($source == 'wikimedia') $images_array = $this->fromWikimedia($aircraft_registration,$aircraft_name);
142
-			if ($source == 'jetphotos' && !$globalIVAO) $images_array = $this->fromJetPhotos($aircraft_registration,$aircraft_name);
143
-			if ($source == 'planepictures' && !$globalIVAO) $images_array = $this->fromPlanePictures($aircraft_registration,$aircraft_name);
144
-			if ($source == 'airportdata' && !$globalIVAO) $images_array = $this->fromAirportData($aircraft_registration,$aircraft_name);
145
-			if ($source == 'customsources') $images_array = $this->fromCustomSource($aircraft_registration,$aircraft_name);
146
-			if (isset($images_array) && $images_array['original'] != '') return $images_array;
171
+			if ($source == 'ivaomtl' && $globalIVAO && $aircraft_icao != '' && $airline_icao != '') {
172
+				$images_array = $this->fromIvaoMtl($aircraft_icao,$airline_icao);
173
+			}
174
+			if ($source == 'planespotters' && !$globalIVAO) {
175
+				$images_array = $this->fromPlanespotters($aircraft_registration,$aircraft_name);
176
+			}
177
+			if ($source == 'flickr') {
178
+				$images_array = $this->fromFlickr($aircraft_registration,$aircraft_name);
179
+			}
180
+			if ($source == 'bing') {
181
+				$images_array = $this->fromBing($aircraft_registration,$aircraft_name);
182
+			}
183
+			if ($source == 'deviantart') {
184
+				$images_array = $this->fromDeviantart($aircraft_registration,$aircraft_name);
185
+			}
186
+			if ($source == 'wikimedia') {
187
+				$images_array = $this->fromWikimedia($aircraft_registration,$aircraft_name);
188
+			}
189
+			if ($source == 'jetphotos' && !$globalIVAO) {
190
+				$images_array = $this->fromJetPhotos($aircraft_registration,$aircraft_name);
191
+			}
192
+			if ($source == 'planepictures' && !$globalIVAO) {
193
+				$images_array = $this->fromPlanePictures($aircraft_registration,$aircraft_name);
194
+			}
195
+			if ($source == 'airportdata' && !$globalIVAO) {
196
+				$images_array = $this->fromAirportData($aircraft_registration,$aircraft_name);
197
+			}
198
+			if ($source == 'customsources') {
199
+				$images_array = $this->fromCustomSource($aircraft_registration,$aircraft_name);
200
+			}
201
+			if (isset($images_array) && $images_array['original'] != '') {
202
+				return $images_array;
203
+			}
147 204
 		}
148 205
 		return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => '');
149 206
 	}
@@ -301,8 +358,11 @@  discard block
 block discarded – undo
301 358
 	*/
302 359
 	public function fromFlickr($aircraft_registration,$aircraft_name='') {
303 360
 		$Common = new Common();
304
-		if ($aircraft_name != '') $url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.$aircraft_registration.','.urlencode($aircraft_name);
305
-		else $url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.$aircraft_registration.',aircraft';
361
+		if ($aircraft_name != '') {
362
+			$url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.$aircraft_registration.','.urlencode($aircraft_name);
363
+		} else {
364
+			$url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.$aircraft_registration.',aircraft';
365
+		}
306 366
 		$data = $Common->getData($url);
307 367
 		if ($xml = simplexml_load_string($data)) {
308 368
 			if (isset($xml->channel->item)) {
@@ -346,9 +406,14 @@  discard block
 block discarded – undo
346 406
 	public function fromBing($aircraft_registration,$aircraft_name='') {
347 407
 		global $globalImageBingKey;
348 408
 		$Common = new Common();
349
-		if (!isset($globalImageBingKey) || $globalImageBingKey == '') return false;
350
-		if ($aircraft_name != '') $url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27'.$aircraft_registration.'%20'.urlencode($aircraft_name).'%20-site:planespotters.com%20-site:flickr.com%27';
351
-		else $url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27%2B'.$aircraft_registration.'%20%2Baircraft%20-site:planespotters.com%20-site:flickr.com%27';
409
+		if (!isset($globalImageBingKey) || $globalImageBingKey == '') {
410
+			return false;
411
+		}
412
+		if ($aircraft_name != '') {
413
+			$url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27'.$aircraft_registration.'%20'.urlencode($aircraft_name).'%20-site:planespotters.com%20-site:flickr.com%27';
414
+		} else {
415
+			$url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27%2B'.$aircraft_registration.'%20%2Baircraft%20-site:planespotters.com%20-site:flickr.com%27';
416
+		}
352 417
 		$headers = array("Authorization: Basic " . base64_encode("ignored:".$globalImageBingKey));
353 418
 		$data = $Common->getData($url,'get','',$headers);
354 419
 		$result = json_decode($data);
@@ -402,13 +467,18 @@  discard block
 block discarded – undo
402 467
 	*/
403 468
 	public function fromWikimedia($aircraft_registration,$aircraft_name='') {
404 469
 		$Common = new Common();
405
-		if ($aircraft_name != '') $url = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srlimit=1&srnamespace=6&continue&srsearch="'.$aircraft_registration.'"%20'.urlencode($aircraft_name);
406
-		else $url = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srlimit=1&srnamespace=6&continue&srsearch="'.$aircraft_registration.'"%20aircraft';
470
+		if ($aircraft_name != '') {
471
+			$url = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srlimit=1&srnamespace=6&continue&srsearch="'.$aircraft_registration.'"%20'.urlencode($aircraft_name);
472
+		} else {
473
+			$url = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srlimit=1&srnamespace=6&continue&srsearch="'.$aircraft_registration.'"%20aircraft';
474
+		}
407 475
 		$data = $Common->getData($url);
408 476
 		$result = json_decode($data);
409 477
 		if (isset($result->query->search[0]->title)) {
410 478
 			$fileo = $result->query->search[0]->title;
411
-			if (substr($fileo,-3) == 'pdf') return false;
479
+			if (substr($fileo,-3) == 'pdf') {
480
+				return false;
481
+			}
412 482
 			$file = urlencode($fileo);
413 483
 			$url2 = 'https://commons.wikimedia.org/w/api.php?action=query&format=json&continue&iilimit=500&prop=imageinfo&iiprop=user|url|size|mime|sha1|timestamp&iiurlwidth=200%27&titles='.$file;
414 484
 			$data2 = $Common->getData($url2);
@@ -478,17 +548,25 @@  discard block
 block discarded – undo
478 548
 					$image_url = array();
479 549
 					$image_url['thumbnail'] = $url_thumbnail;
480 550
 					$image_url['original'] = $url;
481
-					if ($source['exif'] && exif_imagetype($url) == IMAGETYPE_JPEG) $exifCopyright = $this->getExifCopyright($url);
482
-					else $exifCopyright = '';
483
-					if ($exifCopyright  != '') $image_url['copyright'] = $exifCopyright;
484
-					else $image_url['copyright'] = $source['copyright'];
551
+					if ($source['exif'] && exif_imagetype($url) == IMAGETYPE_JPEG) {
552
+						$exifCopyright = $this->getExifCopyright($url);
553
+					} else {
554
+						$exifCopyright = '';
555
+					}
556
+					if ($exifCopyright  != '') {
557
+						$image_url['copyright'] = $exifCopyright;
558
+					} else {
559
+						$image_url['copyright'] = $source['copyright'];
560
+					}
485 561
 					$image_url['source_website'] = $source['source_website'];
486 562
 					$image_url['source'] = $source['source'];
487 563
 					return $image_url;
488 564
 				}
489 565
 			}
490 566
 			return false;
491
-		} else return false;
567
+		} else {
568
+			return false;
569
+		}
492 570
 	}
493 571
 }
494 572
 
Please login to merge, or discard this patch.
require/class.Common.php 1 patch
Braces   +57 added lines, -24 removed lines patch added patch discarded remove patch
@@ -27,8 +27,11 @@  discard block
 block discarded – undo
27 27
 		} else {
28 28
 			curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
29 29
 		}
30
-		if ($timeout == '') curl_setopt($ch, CURLOPT_TIMEOUT, 10); 
31
-		else curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); 
30
+		if ($timeout == '') {
31
+			curl_setopt($ch, CURLOPT_TIMEOUT, 10);
32
+		} else {
33
+			curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
34
+		}
32 35
 		curl_setopt($ch, CURLOPT_HEADERFUNCTION, array('Common',"curlResponseHeaderCallback"));
33 36
 		if ($type == 'post') {
34 37
 			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
@@ -74,8 +77,9 @@  discard block
 block discarded – undo
74 77
 	private function curlResponseHeaderCallback($ch, $headerLine) {
75 78
 		//global $cookies;
76 79
 		$cookies = array();
77
-		if (preg_match('/^Set-Cookie:\s*([^;]*)/mi', $headerLine, $cookie) == 1)
78
-			$cookies[] = $cookie;
80
+		if (preg_match('/^Set-Cookie:\s*([^;]*)/mi', $headerLine, $cookie) == 1) {
81
+					$cookies[] = $cookie;
82
+		}
79 83
 		return strlen($headerLine); // Needed by curl
80 84
 	}
81 85
 
@@ -86,11 +90,15 @@  discard block
 block discarded – undo
86 90
 		curl_setopt($ch, CURLOPT_URL, $url);
87 91
 		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
88 92
 		curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
89
-		if ($referer != '') curl_setopt($ch, CURLOPT_REFERER, $referer);
93
+		if ($referer != '') {
94
+			curl_setopt($ch, CURLOPT_REFERER, $referer);
95
+		}
90 96
 		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');
91 97
 		curl_setopt($ch, CURLOPT_FILE, $fp);
92 98
 		curl_exec($ch);
93
-		if (curl_errno($ch) && $globalDebug) echo 'Download error: '.curl_error($ch);
99
+		if (curl_errno($ch) && $globalDebug) {
100
+			echo 'Download error: '.curl_error($ch);
101
+		}
94 102
 		curl_close($ch);
95 103
 		fclose($fp);
96 104
 	}
@@ -101,10 +109,16 @@  discard block
 block discarded – undo
101 109
 	* @return Array array of the tables in HTML page
102 110
 	*/
103 111
 	public function table2array($data) {
104
-		if (!is_string($data)) return array();
105
-		if ($data == '') return array();
112
+		if (!is_string($data)) {
113
+			return array();
114
+		}
115
+		if ($data == '') {
116
+			return array();
117
+		}
106 118
 		$html = str_get_html($data);
107
-		if ($html === false) return array();
119
+		if ($html === false) {
120
+			return array();
121
+		}
108 122
 		$tabledata=array();
109 123
 		foreach($html->find('tr') as $element)
110 124
 		{
@@ -139,7 +153,9 @@  discard block
 block discarded – undo
139 153
 	*/
140 154
 	public function text2array($data) {
141 155
 		$html = str_get_html($data);
142
-		if ($html === false) return array();
156
+		if ($html === false) {
157
+			return array();
158
+		}
143 159
 		$tabledata=array();
144 160
 		foreach($html->find('p') as $element)
145 161
 		{
@@ -160,7 +176,9 @@  discard block
 block discarded – undo
160 176
 	* @return Float Distance in $unit
161 177
 	*/
162 178
 	public function distance($lat, $lon, $latc, $lonc, $unit = 'km') {
163
-		if ($lat == $latc && $lon == $lonc) return 0;
179
+		if ($lat == $latc && $lon == $lonc) {
180
+			return 0;
181
+		}
164 182
 		$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;
165 183
 		if ($unit == "km") {
166 184
 			return round($dist * 1.609344);
@@ -184,10 +202,16 @@  discard block
 block discarded – undo
184 202
 	public function withinThreshold ($timeDifference, $distance) {
185 203
 		$x = abs($timeDifference);
186 204
 		$d = abs($distance);
187
-		if ($x == 0 || $d == 0) return true;
205
+		if ($x == 0 || $d == 0) {
206
+			return true;
207
+		}
188 208
 		// may be due to Internet jitter; distance is realistic
189
-		if ($x < 0.7 && $d < 2000) return true;
190
-		else return $d/$x < 1500*0.27778; // 1500 km/h max
209
+		if ($x < 0.7 && $d < 2000) {
210
+			return true;
211
+		} else {
212
+			return $d/$x < 1500*0.27778;
213
+		}
214
+		// 1500 km/h max
191 215
 	}
192 216
 
193 217
 
@@ -247,7 +271,9 @@  discard block
 block discarded – undo
247 271
 	public function hex2str($hex) {
248 272
 		$str = '';
249 273
 		$hexln = strlen($hex);
250
-		for($i=0;$i<$hexln;$i+=2) $str .= chr(hexdec(substr($hex,$i,2)));
274
+		for($i=0;$i<$hexln;$i+=2) {
275
+			$str .= chr(hexdec(substr($hex,$i,2)));
276
+		}
251 277
 		return $str;
252 278
 	}
253 279
 	
@@ -275,8 +301,11 @@  discard block
 block discarded – undo
275 301
 		$b = $lat2 - $lat1;
276 302
 		$c = -($a*$lat1+$b*$lon1);
277 303
 		$d = $a*$lat3+$b*$lon3+$c;
278
-		if ($d > -$approx && $d < $approx) return true;
279
-		else return false;
304
+		if ($d > -$approx && $d < $approx) {
305
+			return true;
306
+		} else {
307
+			return false;
308
+		}
280 309
 	}
281 310
 	
282 311
 	public function array_merge_noappend() {
@@ -312,7 +341,9 @@  discard block
 block discarded – undo
312 341
 			return $result;
313 342
 		}
314 343
 		$handle = @opendir('./locale');
315
-		if ($handle === false) return $result;
344
+		if ($handle === false) {
345
+			return $result;
346
+		}
316 347
 		while (false !== ($file = readdir($handle))) {
317 348
 			$path = './locale'.'/'.$file.'/LC_MESSAGES/fam.mo';
318 349
 			if ($file != "." && $file != ".." && @file_exists($path)) {
@@ -379,8 +410,9 @@  discard block
 block discarded – undo
379 410
 		$error = false; 
380 411
 		if ($fp_out = gzopen($dest, $mode)) { 
381 412
 			if ($fp_in = fopen($source,'rb')) { 
382
-				while (!feof($fp_in)) 
383
-					gzwrite($fp_out, fread($fp_in, 1024 * 512)); 
413
+				while (!feof($fp_in)) {
414
+									gzwrite($fp_out, fread($fp_in, 1024 * 512));
415
+				}
384 416
 				fclose($fp_in); 
385 417
 			} else {
386 418
 				$error = true; 
@@ -389,10 +421,11 @@  discard block
 block discarded – undo
389 421
 		} else {
390 422
 			$error = true; 
391 423
 		}
392
-		if ($error)
393
-			return false; 
394
-		else
395
-			return $dest; 
424
+		if ($error) {
425
+					return false;
426
+		} else {
427
+					return $dest;
428
+		}
396 429
 	} 
397 430
 }
398 431
 ?>
399 432
\ No newline at end of file
Please login to merge, or discard this patch.
live-geojson.php 1 patch
Braces   +142 added lines, -55 removed lines patch added patch discarded remove patch
@@ -18,27 +18,52 @@  discard block
 block discarded – undo
18 18
 }
19 19
 header('Content-Type: text/javascript');
20 20
 
21
-if (!isset($globalJsonCompress)) $compress = true;
22
-else $compress = $globalJsonCompress;
21
+if (!isset($globalJsonCompress)) {
22
+	$compress = true;
23
+} else {
24
+	$compress = $globalJsonCompress;
25
+}
23 26
 
24 27
 $from_archive = false;
25 28
 $min = true;
26 29
 $allhistory = false;
27 30
 $filter['source'] = array();
28
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
29
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
30
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
31
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs'));
32
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
33
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
34
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
35
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
36
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
37
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
31
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') {
32
+	$filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
33
+}
34
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') {
35
+	$filter['source'] = array_merge($filter['source'],array('whazzup'));
36
+}
37
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') {
38
+	$filter['source'] = array_merge($filter['source'],array('phpvmacars'));
39
+}
40
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') {
41
+	$filter['source'] = array_merge($filter['source'],array('sbs'));
42
+}
43
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') {
44
+	$filter['source'] = array_merge($filter['source'],array('aprs'));
45
+}
46
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') {
47
+	$filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
48
+}
49
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') {
50
+	$filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
51
+}
52
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') {
53
+	$filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
54
+}
55
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') {
56
+	$filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
57
+}
58
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') {
59
+	$filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
60
+}
38 61
 
39 62
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
40 63
 	$min = true;
41
-} else $min = false;
64
+} else {
65
+	$min = false;
66
+}
42 67
 
43 68
 if (isset($_GET['ident'])) {
44 69
 	$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
@@ -88,20 +113,30 @@  discard block
 block discarded – undo
88 113
 	}
89 114
 */
90 115
 	$flightcnt = count($spotter_array);
91
-	if ($flightcnt == '') $flightcnt = 0;
92
-} else $flightcnt = 0;
116
+	if ($flightcnt == '') {
117
+		$flightcnt = 0;
118
+	}
119
+	} else {
120
+	$flightcnt = 0;
121
+}
93 122
 
94 123
 $sqltime = round(microtime(true)-$begintime,2);
95 124
 
96
-if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false;
97
-else $usenextlatlon = true;
125
+if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) {
126
+	$usenextlatlon = false;
127
+} else {
128
+	$usenextlatlon = true;
129
+}
98 130
 $j = 0;
99 131
 $prev_flightaware_id = '';
100 132
 $aircrafts_shadow = array();
101 133
 $output = '{';
102 134
 	$output .= '"type": "FeatureCollection",';
103
-		if ($min) $output .= '"minimal": "true",';
104
-		else $output .= '"minimal": "false",';
135
+		if ($min) {
136
+			$output .= '"minimal": "true",';
137
+		} else {
138
+			$output .= '"minimal": "false",';
139
+		}
105 140
 		$output .= '"fc": "'.$flightcnt.'",';
106 141
 		$output .= '"sqt": "'.$sqltime.'",';
107 142
 
@@ -138,11 +173,16 @@  discard block
 block discarded – undo
138 173
 						//$output .= '"sqt": "'.$sqltime.'",';
139 174
 						$output .= '"id": "'.$spotter_item['flightaware_id'].'",';
140 175
 						$output .= '"properties": {';
141
-							if ($compress) $output .= '"fi": "'.$spotter_item['flightaware_id'].'",';
142
-							else $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",';
176
+							if ($compress) {
177
+								$output .= '"fi": "'.$spotter_item['flightaware_id'].'",';
178
+							} else {
179
+								$output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",';
180
+							}
143 181
 							$output .= '"fc": "'.$flightcnt.'",';
144 182
 							$output .= '"sqt": "'.$sqltime.'",';
145
-							if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
183
+							if (isset($begindate)) {
184
+								$output .= '"archive_date": "'.$begindate.'",';
185
+							}
146 186
 
147 187
 /*
148 188
 							if ($min) $output .= '"minimal": "true",';
@@ -150,13 +190,21 @@  discard block
 block discarded – undo
150 190
 */
151 191
 							//$output .= '"fc": "'.$spotter_item['nb'].'",';
152 192
 						if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') {
153
-							if ($compress) $output .= '"c": "'.$spotter_item['ident'].'",';
154
-							else $output .= '"callsign": "'.$spotter_item['ident'].'",';
193
+							if ($compress) {
194
+								$output .= '"c": "'.$spotter_item['ident'].'",';
195
+							} else {
196
+								$output .= '"callsign": "'.$spotter_item['ident'].'",';
197
+							}
155 198
 						} else {
156
-							if ($compress) $output .= '"c": "NA",';
157
-							else $output .= '"callsign": "NA",';
199
+							if ($compress) {
200
+								$output .= '"c": "NA",';
201
+							} else {
202
+								$output .= '"callsign": "NA",';
203
+							}
204
+						}
205
+						if (isset($spotter_item['registration'])) {
206
+							$output .= '"registration": "'.$spotter_item['registration'].'",';
158 207
 						}
159
-						if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",';
160 208
 						if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) {
161 209
 							$output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",';
162 210
 							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",';
@@ -169,25 +217,37 @@  discard block
 block discarded – undo
169 217
 							$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
170 218
 						}
171 219
 						if (!isset($spotter_item['aircraft_shadow'])) {
172
-							if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = '';
173
-							else {
220
+							if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') {
221
+								$spotter_item['aircraft_shadow'] = '';
222
+							} else {
174 223
 								$aircraft_icao = $spotter_item['aircraft_icao'];
175
-								if (isset($aircrafts_shadow[$aircraft_icao])) $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao];
176
-								else {
224
+								if (isset($aircrafts_shadow[$aircraft_icao])) {
225
+									$spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao];
226
+								} else {
177 227
 									$aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']);
178
-									if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
179
-									elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png';
180
-									else $spotter_item['aircraft_shadow'] = '';
228
+									if (count($aircraft_info) > 0) {
229
+										$spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
230
+									} elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') {
231
+										$spotter_item['aircraft_shadow'] = 'PA18.png';
232
+									} else {
233
+										$spotter_item['aircraft_shadow'] = '';
234
+									}
181 235
 									$aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow'];
182 236
 								}
183 237
 							}
184 238
 						}
185 239
 						if ($spotter_item['aircraft_shadow'] == '') {
186
-							if ($compress) $output .= '"as": "default.png",';
187
-							else $output .= '"aircraft_shadow": "default.png",';
240
+							if ($compress) {
241
+								$output .= '"as": "default.png",';
242
+							} else {
243
+								$output .= '"aircraft_shadow": "default.png",';
244
+							}
188 245
 						} else {
189
-							if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
190
-							else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
246
+							if ($compress) {
247
+								$output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
248
+							} else {
249
+								$output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
250
+							}
191 251
 						}
192 252
 						if (isset($spotter_item['airline_name'])) {
193 253
 							$output .= '"airline_name": "'.$spotter_item['airline_name'].'",';
@@ -195,8 +255,11 @@  discard block
 block discarded – undo
195 255
 							$output .= '"airline_name": "NA",';
196 256
 						}
197 257
 						if (isset($spotter_item['departure_airport'])) {
198
-							if ($compress) $output .= '"dac": "'.$spotter_item['departure_airport'].'",';
199
-							else $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",';
258
+							if ($compress) {
259
+								$output .= '"dac": "'.$spotter_item['departure_airport'].'",';
260
+							} else {
261
+								$output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",';
262
+							}
200 263
 						}
201 264
 						if (isset($spotter_item['departure_airport_city'])) {
202 265
 							$output .= '"departure_airport": "'.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_country'].'",';
@@ -208,8 +271,11 @@  discard block
 block discarded – undo
208 271
 							$output .= '"arrival_airport_time": "'.$spotter_item['arrival_airport_time'].'",';
209 272
 						}
210 273
 						if (isset($spotter_item['arrival_airport'])) {
211
-							if ($compress) $output .= '"aac": "'.$spotter_item['arrival_airport'].'",';
212
-							else $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",';
274
+							if ($compress) {
275
+								$output .= '"aac": "'.$spotter_item['arrival_airport'].'",';
276
+							} else {
277
+								$output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",';
278
+							}
213 279
 						}
214 280
 						if (isset($spotter_item['arrival_airport_city'])) {
215 281
 							$output .= '"arrival_airport": "'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].'",';
@@ -227,10 +293,16 @@  discard block
 block discarded – undo
227 293
 							$output .= '"ground_speed": "'.$spotter_item['ground_speed'].'",';
228 294
 						}
229 295
 						
230
-						if ($compress) $output .= '"a": "'.$spotter_item['altitude'].'",';
231
-						else $output .= '"altitude": "'.$spotter_item['altitude'].'",';
232
-						if ($compress)$output .= '"h": "'.$spotter_item['heading'].'",';
233
-						else $output .= '"heading": "'.$spotter_item['heading'].'",';
296
+						if ($compress) {
297
+							$output .= '"a": "'.$spotter_item['altitude'].'",';
298
+						} else {
299
+							$output .= '"altitude": "'.$spotter_item['altitude'].'",';
300
+						}
301
+						if ($compress) {
302
+							$output .= '"h": "'.$spotter_item['heading'].'",';
303
+						} else {
304
+							$output .= '"heading": "'.$spotter_item['heading'].'",';
305
+						}
234 306
 						
235 307
 						if (isset($archivespeed)) {
236 308
 							$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed);
@@ -240,7 +312,9 @@  discard block
 block discarded – undo
240 312
 							$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
241 313
 						}
242 314
 
243
-						if (!$min) $output .= '"image": "'.$image.'",';
315
+						if (!$min) {
316
+							$output .= '"image": "'.$image.'",';
317
+						}
244 318
 						if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') {
245 319
 							$output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",';
246 320
 						}
@@ -248,8 +322,11 @@  discard block
 block discarded – undo
248 322
 							$output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",';
249 323
 						}
250 324
 						if (isset($spotter_item['squawk'])) {
251
-							if ($compress) $output .= '"sq": "'.$spotter_item['squawk'].'",';
252
-							else $output .= '"squawk": "'.$spotter_item['squawk'].'",';
325
+							if ($compress) {
326
+								$output .= '"sq": "'.$spotter_item['squawk'].'",';
327
+							} else {
328
+								$output .= '"squawk": "'.$spotter_item['squawk'].'",';
329
+							}
253 330
 						}
254 331
 						if (isset($spotter_item['squawk_usage'])) {
255 332
 							$output .= '"squawk_usage": "'.$spotter_item['squawk_usage'].'",';
@@ -267,8 +344,11 @@  discard block
 block discarded – undo
267 344
 							$output .= '"acars": "'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"), '<br />',$spotter_item['acars']['message'])).'",';
268 345
 						}
269 346
 						// type when not aircraft ?
270
-						if ($compress) $output .= '"t": "aircraft"';
271
-						else $output .= '"type": "aircraft"';
347
+						if ($compress) {
348
+							$output .= '"t": "aircraft"';
349
+						} else {
350
+							$output .= '"type": "aircraft"';
351
+						}
272 352
 						$output .= '},';
273 353
 						$output .= '"geometry": {';
274 354
 							$output .= '"type": "Point",';
@@ -335,7 +415,9 @@  discard block
 block discarded – undo
335 415
 			}
336 416
 */
337 417
 				$history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING);
338
-				if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history'];
418
+				if ($history == '' && isset($_COOKIE['history'])) {
419
+					$history = $_COOKIE['history'];
420
+				}
339 421
 				
340 422
 				if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') 
341 423
 				|| (!isset($_COOKIE['flightpath']) 
@@ -357,8 +439,11 @@  discard block
 block discarded – undo
357 439
 						$output_history .= ']}},';
358 440
 						$output .= $output_history;
359 441
 					    }
360
-					    if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
361
-					    else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
442
+					    if ($compress) {
443
+					    	$output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
444
+					    } else {
445
+					    	$output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
446
+					    }
362 447
 					}
363 448
 					$output_history .= '[';
364 449
 					$output_history .=  $spotter_history['longitude'].', ';
@@ -404,7 +489,9 @@  discard block
 block discarded – undo
404 489
 			$output .= ']';
405 490
 			$output .= ',"initial_sqltime": "'.$sqltime.'",';
406 491
 			$output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",';
407
-			if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
492
+			if (isset($begindate)) {
493
+				$output .= '"archive_date": "'.$begindate.'",';
494
+			}
408 495
 			$output .= '"fc": "'.$j.'"';
409 496
 		} else {
410 497
 			$output .= '"features": ';
Please login to merge, or discard this patch.
js/map.js.php 1 patch
Braces   +128 added lines, -33 removed lines patch added patch discarded remove patch
@@ -5,8 +5,11 @@  discard block
 block discarded – undo
5 5
 setcookie("MapFormat",'2d');
6 6
 
7 7
 // Compressed GeoJson is used if true
8
-if (!isset($globalJsonCompress)) $compress = true;
9
-else $compress = $globalJsonCompress;
8
+if (!isset($globalJsonCompress)) {
9
+	$compress = true;
10
+} else {
11
+	$compress = $globalJsonCompress;
12
+}
10 13
 if (isset($_GET['archive'])) {
11 14
 	//$archiveupdatetime = 50;
12 15
 	$archiveupdatetime = $globalMapRefresh;
@@ -16,8 +19,11 @@  discard block
 block discarded – undo
16 19
 	//$lastupd = round(($_GET['enddate']-$_GET['begindate'])/(($_GET['during']*60)/10));
17 20
 	//$lastupd = 20;
18 21
 	$lastupd = $_GET['archivespeed']*$archiveupdatetime;
19
-	if (isset($_GET['enddate']) && $_GET['enddate'] != '') $enddate = $_GET['enddate'];
20
-	else $enddate = time();
22
+	if (isset($_GET['enddate']) && $_GET['enddate'] != '') {
23
+		$enddate = $_GET['enddate'];
24
+	} else {
25
+		$enddate = time();
26
+	}
21 27
 	setcookie("archive_begin",$begindate);
22 28
 	setcookie("archive_end",$enddate);
23 29
 	setcookie("archive_update",$lastupd);
@@ -123,7 +129,17 @@  discard block
 block discarded – undo
123 129
 	}
124 130
 
125 131
 	//create the map
126
-	map = L.map('archive-map', { zoomControl:false }).setView([<?php if (isset($latitude)) print $latitude; else print $globalCenterLatitude; ?>,<?php if (isset($longitude)) print $longitude; else print $globalCenterLongitude; ?>], zoom);
132
+	map = L.map('archive-map', { zoomControl:false }).setView([<?php if (isset($latitude)) {
133
+	print $latitude;
134
+} else {
135
+	print $globalCenterLatitude;
136
+}
137
+?>,<?php if (isset($longitude)) {
138
+	print $longitude;
139
+} else {
140
+	print $globalCenterLongitude;
141
+}
142
+?>], zoom);
127 143
 <?php
128 144
 	} else {
129 145
 ?>
@@ -136,9 +152,19 @@  discard block
 block discarded – undo
136 152
 	     || navigator.userAgent.match(/BlackBerry/i)
137 153
 	     || navigator.userAgent.match(/Windows Phone/i))
138 154
 	{
139
-		var zoom = <?php if (isset($globalLiveZoom)) print $globalLiveZoom-1; else print '8'; ?>;
155
+		var zoom = <?php if (isset($globalLiveZoom)) {
156
+	print $globalLiveZoom-1;
157
+} else {
158
+	print '8';
159
+}
160
+?>;
140 161
 	} else {
141
-		var zoom = <?php if (isset($globalLiveZoom)) print $globalLiveZoom; else print '9'; ?>;
162
+		var zoom = <?php if (isset($globalLiveZoom)) {
163
+	print $globalLiveZoom;
164
+} else {
165
+	print '9';
166
+}
167
+?>;
142 168
 	}
143 169
 
144 170
 	//create the map
@@ -163,16 +189,27 @@  discard block
 block discarded – undo
163 189
 	bounds = L.latLngBounds(southWest,northEast);
164 190
 	//a few title layers
165 191
 <?php
166
-	if (isset($_COOKIE['MapType'])) $MapType = $_COOKIE['MapType'];
167
-	else $MapType = $globalMapProvider;
192
+	if (isset($_COOKIE['MapType'])) {
193
+		$MapType = $_COOKIE['MapType'];
194
+	} else {
195
+		$MapType = $globalMapProvider;
196
+	}
168 197
 
169 198
 	if ($MapType == 'Mapbox') {
170
-		if ($_COOKIE['MapTypeId'] == 'default') $MapBoxId = $globalMapboxId;
171
-		else $MapBoxId = $_COOKIE['MapTypeId'];
172
-?>
199
+		if ($_COOKIE['MapTypeId'] == 'default') {
200
+			$MapBoxId = $globalMapboxId;
201
+		} else {
202
+			$MapBoxId = $_COOKIE['MapTypeId'];
203
+		}
204
+		?>
173 205
 	L.tileLayer('https://{s}.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={token}', {
174 206
 	    maxZoom: 18,
175
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
207
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
208
+	print 'false';
209
+} else {
210
+	print 'true';
211
+}
212
+?>,
176 213
 	    attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' +
177 214
 	      '<a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
178 215
 	      'Imagery © <a href="http://mapbox.com">Mapbox</a>',
@@ -184,7 +221,12 @@  discard block
 block discarded – undo
184 221
 ?>
185 222
 	L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
186 223
 	    maxZoom: 18,
187
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
224
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
225
+	print 'false';
226
+} else {
227
+	print 'true';
228
+}
229
+?>,
188 230
 	    attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' +
189 231
 	      '<a href="www.openstreetmap.org/copyright">Open Database Licence</a>'
190 232
 	}).addTo(map);
@@ -230,20 +272,26 @@  discard block
 block discarded – undo
230 272
 	map.addLayer(yandexLayer);
231 273
 <?php
232 274
 	} elseif ($MapType == 'Bing-Aerial') {
233
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
234
-?>
275
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') {
276
+			setcookie('MapType','OpenStreetMap');
277
+		}
278
+		?>
235 279
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Aerial'});
236 280
 	map.addLayer(bingLayer);
237 281
 <?php
238 282
 	} elseif ($MapType == 'Bing-Hybrid') {
239
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
240
-?>
283
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') {
284
+			setcookie('MapType','OpenStreetMap');
285
+		}
286
+		?>
241 287
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'AerialWithLabels'});
242 288
 	map.addLayer(bingLayer);
243 289
 <?php
244 290
 	} elseif ($MapType == 'Bing-Road') {
245
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
246
-?>
291
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') {
292
+			setcookie('MapType','OpenStreetMap');
293
+		}
294
+		?>
247 295
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Road'});
248 296
 	map.addLayer(bingLayer);
249 297
 <?php
@@ -291,7 +339,12 @@  discard block
 block discarded – undo
291 339
 		}
292 340
 	} elseif ($globalBounding == 'circle') {
293 341
 ?>
294
-	var circle = L.circle([<?php print $globalCenterLatitude; ?>, <?php print $globalCenterLongitude; ?>],<?php if (isset($globalBoundingCircleSize)) print $globalBoundingCircleSize; else print '70000'; ?>,{
342
+	var circle = L.circle([<?php print $globalCenterLatitude; ?>, <?php print $globalCenterLongitude; ?>],<?php if (isset($globalBoundingCircleSize)) {
343
+	print $globalBoundingCircleSize;
344
+} else {
345
+	print '70000';
346
+}
347
+?>,{
295 348
 	    color: '#92C7D1',
296 349
 	    fillColor: '#92C7D1',
297 350
 	    fillOpacity: 0.3,
@@ -350,8 +403,11 @@  discard block
 block discarded – undo
350 403
 
351 404
 	function update_airportsLayer() {
352 405
 	    <?php
353
-		if (isset($_COOKIE['AirportZoom'])) $getZoom = $_COOKIE['AirportZoom'];
354
-		else $getZoom = '7';
406
+		if (isset($_COOKIE['AirportZoom'])) {
407
+			$getZoom = $_COOKIE['AirportZoom'];
408
+		} else {
409
+			$getZoom = '7';
410
+		}
355 411
 	    ?>
356 412
 	    //if (map.getZoom() <= <?php print $getZoom; ?>) {
357 413
 		if (typeof airportsLayer != 'undefined') {
@@ -687,9 +743,13 @@  discard block
 block discarded – undo
687 743
 		    if (callsign != ""){ markerLabel += callsign; }
688 744
 		    if (departure_airport_code != "" && arrival_airport_code != "" && departure_airport_code != "NA" && arrival_airport_code != "NA"){ markerLabel += ' ( '+departure_airport_code+' - '+arrival_airport_code+' )'; }
689 745
 <?php
690
-	if (isset($_COOKIE['IconColor'])) $IconColor = $_COOKIE['IconColor'];
691
-	elseif (isset($globalAircraftIconColor)) $IconColor = $globalAircraftIconColor;
692
-	else $IconColor = '1a3151';
746
+	if (isset($_COOKIE['IconColor'])) {
747
+		$IconColor = $_COOKIE['IconColor'];
748
+	} elseif (isset($globalAircraftIconColor)) {
749
+		$IconColor = $globalAircraftIconColor;
750
+	} else {
751
+		$IconColor = '1a3151';
752
+	}
693 753
 	if (!isset($ident) && !isset($flightaware_id)) {
694 754
 ?>
695 755
 		    info_update(feature.properties.fc);
@@ -737,7 +797,12 @@  discard block
 block discarded – undo
737 797
 <?php
738 798
 		} else {
739 799
 ?>
740
-		    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
800
+		    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
801
+	print $archiveupdatetime*1000;
802
+} else {
803
+	print $globalMapRefresh*1000+20000;
804
+}
805
+?>+feature.properties.sqt*1000);
741 806
 		    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
742 807
 <?php
743 808
 		}
@@ -786,7 +851,12 @@  discard block
 block discarded – undo
786 851
 <?php
787 852
 		} else {
788 853
 ?>
789
-			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
854
+			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
855
+	print $archiveupdatetime*1000;
856
+} else {
857
+	print $globalMapRefresh*1000+20000;
858
+}
859
+?>+feature.properties.sqt*1000);
790 860
 			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
791 861
 <?php
792 862
 		}
@@ -834,7 +904,12 @@  discard block
 block discarded – undo
834 904
 <?php
835 905
 		} else {
836 906
 ?>
837
-			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
907
+			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
908
+	print $archiveupdatetime*1000;
909
+} else {
910
+	print $globalMapRefresh*1000+20000;
911
+}
912
+?>+feature.properties.sqt*1000);
838 913
 			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
839 914
 <?php
840 915
 		}
@@ -1177,14 +1252,24 @@  discard block
 block discarded – undo
1177 1252
 	if (isset($_GET['archive'])) {
1178 1253
 ?>
1179 1254
 //then load it again every 30 seconds
1180
-//  var reload = setInterval(function(){if (noTimeout) getLiveData(0)},<?php if (isset($globalMapRefresh)) print ($globalMapRefresh*1000)/2; else print '15000'; ?>);
1255
+//  var reload = setInterval(function(){if (noTimeout) getLiveData(0)},<?php if (isset($globalMapRefresh)) {
1256
+	print ($globalMapRefresh*1000)/2;
1257
+} else {
1258
+	print '15000';
1259
+}
1260
+?>);
1181 1261
 reloadPage = setInterval(function(){if (noTimeout) getLiveData(0)},<?php print $archiveupdatetime*1000; ?>);
1182 1262
 <?php
1183 1263
 	} else {
1184 1264
 ?>
1185 1265
 //then load it again every 30 seconds
1186 1266
 reloadPage = setInterval(
1187
-    function(){if (noTimeout) getLiveData(0)},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>);
1267
+    function(){if (noTimeout) getLiveData(0)},<?php if (isset($globalMapRefresh)) {
1268
+	print $globalMapRefresh*1000;
1269
+} else {
1270
+	print '30000';
1271
+}
1272
+?>);
1188 1273
 var currentdate = new Date();
1189 1274
 var currentyear = new Date().getFullYear();
1190 1275
 var begindate = new Date(Date.UTC(currentyear,11,24,2,0,0,0));
@@ -1196,7 +1281,12 @@  discard block
 block discarded – undo
1196 1281
 		if (!((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) && (isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
1197 1282
 ?>
1198 1283
 update_polarLayer();
1199
-setInterval(function(){map.removeLayer(polarLayer);update_polarLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
1284
+setInterval(function(){map.removeLayer(polarLayer);update_polarLayer()},<?php if (isset($globalMapRefresh)) {
1285
+	print $globalMapRefresh*1000*2;
1286
+} else {
1287
+	print '60000';
1288
+}
1289
+?>);
1200 1290
 <?php
1201 1291
 		}
1202 1292
 ?>
@@ -1212,7 +1302,12 @@  discard block
 block discarded – undo
1212 1302
 	if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) {
1213 1303
 ?>
1214 1304
 update_atcLayer();
1215
-setInterval(function(){map.removeLayer(atcLayer);update_atcLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
1305
+setInterval(function(){map.removeLayer(atcLayer);update_atcLayer()},<?php if (isset($globalMapRefresh)) {
1306
+	print $globalMapRefresh*1000*2;
1307
+} else {
1308
+	print '60000';
1309
+}
1310
+?>);
1216 1311
 <?php
1217 1312
 	}
1218 1313
 ?>
Please login to merge, or discard this patch.
live-czml.php 1 patch
Braces   +65 added lines, -22 removed lines patch added patch discarded remove patch
@@ -40,23 +40,46 @@  discard block
 block discarded – undo
40 40
 }
41 41
 header('Content-Type: text/javascript');
42 42
 
43
-if (!isset($globalJsonCompress)) $compress = true;
44
-else $compress = $globalJsonCompress;
43
+if (!isset($globalJsonCompress)) {
44
+	$compress = true;
45
+} else {
46
+	$compress = $globalJsonCompress;
47
+}
45 48
 
46 49
 $from_archive = false;
47 50
 $min = false;
48 51
 $allhistory = false;
49 52
 $filter['source'] = array();
50
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
51
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
52
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
53
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs'));
54
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
55
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
56
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
57
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
58
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
59
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
53
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') {
54
+	$filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
55
+}
56
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') {
57
+	$filter['source'] = array_merge($filter['source'],array('whazzup'));
58
+}
59
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') {
60
+	$filter['source'] = array_merge($filter['source'],array('phpvmacars'));
61
+}
62
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') {
63
+	$filter['source'] = array_merge($filter['source'],array('sbs'));
64
+}
65
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') {
66
+	$filter['source'] = array_merge($filter['source'],array('aprs'));
67
+}
68
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') {
69
+	$filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
70
+}
71
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') {
72
+	$filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
73
+}
74
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') {
75
+	$filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
76
+}
77
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') {
78
+	$filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
79
+}
80
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') {
81
+	$filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
82
+}
60 83
 /*
61 84
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
62 85
 	$min = true;
@@ -133,8 +156,12 @@  discard block
 block discarded – undo
133 156
 	} else {
134 157
 		$flightcnt = $SpotterLive->getLiveSpotterCount($filter);
135 158
 	}
136
-	if ($flightcnt == '') $flightcnt = 0;
137
-} else $flightcnt = 0;
159
+	if ($flightcnt == '') {
160
+		$flightcnt = 0;
161
+	}
162
+	} else {
163
+	$flightcnt = 0;
164
+}
138 165
 
139 166
 $sqltime = round(microtime(true)-$begintime,2);
140 167
 $minitime = time();
@@ -157,7 +184,9 @@  discard block
 block discarded – undo
157 184
 $j = 0;
158 185
 $prev_flightaware_id = '';
159 186
 $speed = 1;
160
-if (isset($archivespeed)) $speed = $archivespeed;
187
+if (isset($archivespeed)) {
188
+	$speed = $archivespeed;
189
+}
161 190
 $output = '[';
162 191
 $output .= '{"id" : "document", "name" : "fam","version" : "1.0"';
163 192
 //	$output .= ',"clock": {"interval" : "'.date("c",time()-$globalLiveInterval).'/'.date("c").'","currentTime" : "'.date("c",time() - $globalLiveInterval).'","multiplier" : 1,"range" : "LOOP_STOP","step": "SYSTEM_CLOCK_MULTIPLIER"}';
@@ -227,7 +256,9 @@  discard block
 block discarded – undo
227 256
 					$spotter_item['engine_type'] = $aircraft_info[0]['engine_type'];
228 257
 					$spotter_item['wake_category'] = $aircraft_info[0]['wake_category'];
229 258
 					$spotter_item['engine_count'] = $aircraft_info[0]['engine_count'];
230
-				} else $aircraft_shadow = '';
259
+				} else {
260
+					$aircraft_shadow = '';
261
+				}
231 262
 				if ($aircraft_shadow != '') {
232 263
 					if (isset($modelsdb[$aircraft_shadow])) {
233 264
 						$output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$modelsdb[$aircraft_shadow].'","scale" : 1.0,"minimumPixelSize": 20 ,';
@@ -324,7 +355,9 @@  discard block
 block discarded – undo
324 355
 						$output .= '"model": {"gltf" : "'.$globalURL.'/models/Cesium_Air.glb","scale" : 1.0,"minimumPixelSize": 20,';
325 356
 						$output .= '"heightReference": "'.$heightrelative.'"},';
326 357
 							//if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
327
-						if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
358
+						if ($spotter_item['aircraft_icao'] != '') {
359
+							$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
360
+						}
328 361
 						$modelsdb[$aircraft_icao] = 'Cesium_Air.glb';
329 362
 					}
330 363
 				} elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') {
@@ -336,7 +369,9 @@  discard block
 block discarded – undo
336 369
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/Cesium_Air.glb","scale" : 1.0,"minimumPixelSize": 20,';
337 370
 					$output .= '"heightReference": "'.$heightrelative.'"},';
338 371
 					//if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
339
-					if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
372
+					if ($spotter_item['aircraft_icao'] != '') {
373
+						$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
374
+					}
340 375
 					$modelsdb[$aircraft_icao] = 'Cesium_Air.glb';
341 376
 				}
342 377
 
@@ -344,7 +379,9 @@  discard block
 block discarded – undo
344 379
 				$output .= '"model": {"gltf" : "'.$globalURL.'/models/Cesium_Air.glb","scale" : 1.0,"minimumPixelSize": 20,';
345 380
 				$output .= '"heightReference": "'.$heightrelative.'"},';
346 381
 				//if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
347
-				if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
382
+				if ($spotter_item['aircraft_icao'] != '') {
383
+					$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
384
+				}
348 385
 				$modelsdb[$aircraft_icao] = 'Cesium_Air.glb';
349 386
 			}
350 387
 	//		$output .= '"heightReference": "CLAMP_TO_GROUND",';
@@ -357,8 +394,12 @@  discard block
 block discarded – undo
357 394
 	//		$output .= '"interpolationDegree" : 5,';
358 395
 	//		$output .= '"epoch" : "'.date("c",strtotime($spotter_item['date'])).'", ';
359 396
 			$output .= '"cartographicDegrees": [';
360
-			if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']);
361
-			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
397
+			if ($minitime > strtotime($spotter_item['date'])) {
398
+				$minitime = strtotime($spotter_item['date']);
399
+			}
400
+			if ($maxitime < strtotime($spotter_item['date'])) {
401
+				$maxitime = strtotime($spotter_item['date']);
402
+			}
362 403
 			$output .= '"'.date("c",strtotime($spotter_item['date'])).'", ';
363 404
 			$output .= $spotter_item['longitude'].', ';
364 405
 			$output .= $spotter_item['latitude'].', ';
@@ -372,7 +413,9 @@  discard block
 block discarded – undo
372 413
 			//$orientation .= '"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w'];
373 414
 		} else {
374 415
 			$output .= ',"'.date("c",strtotime($spotter_item['date'])).'", ';
375
-			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
416
+			if ($maxitime < strtotime($spotter_item['date'])) {
417
+				$maxitime = strtotime($spotter_item['date']);
418
+			}
376 419
 			if ($spotter_item['ground_speed'] == 0) {
377 420
 				$output .= $prevlong.', ';
378 421
 				$output .= $prevlat.', ';
Please login to merge, or discard this patch.
index.php 1 patch
Braces   +361 added lines, -96 removed lines patch added patch discarded remove patch
@@ -135,11 +135,26 @@  discard block
 block discarded – undo
135 135
 				<li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam();" /><?php echo _("Display NOTAM"); ?></label></div></li>
136 136
 				<li><?php echo _("NOTAM scope:"); ?>
137 137
 					<select class="selectpicker" onchange="notamscope(this);">
138
-						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') print ' selected'; ?>>All</option>
139
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') print ' selected'; ?>>Airport/Enroute warning</option>
140
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') print ' selected'; ?>>Airport warning</option>
141
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') print ' selected'; ?>>Navigation warning</option>
142
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') print ' selected'; ?>>Enroute warning</option>
138
+						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') {
139
+	print ' selected';
140
+}
141
+?>>All</option>
142
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') {
143
+	print ' selected';
144
+}
145
+?>>Airport/Enroute warning</option>
146
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') {
147
+	print ' selected';
148
+}
149
+?>>Airport warning</option>
150
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') {
151
+	print ' selected';
152
+}
153
+?>>Navigation warning</option>
154
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') {
155
+	print ' selected';
156
+}
157
+?>>Enroute warning</option>
143 158
 					</select
144 159
 				</li>
145 160
 			</ul>
@@ -167,7 +182,12 @@  discard block
 block discarded – undo
167 182
 		        <div class="form-group">
168 183
 			    <label>From (UTC):</label>
169 184
 		            <div class='input-group date' id='datetimepicker1'>
170
-            			<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 />
185
+            			<input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) {
186
+	print $_POST['start_date'];
187
+} elseif (isset($_COOKIE['archive_begin'])) {
188
+	print date("m/d/Y h:i a",$_COOKIE['archive_begin']);
189
+}
190
+?>" required />
171 191
 		                <span class="input-group-addon">
172 192
             			    <span class="glyphicon glyphicon-calendar"></span>
173 193
 		                </span>
@@ -176,7 +196,12 @@  discard block
 block discarded – undo
176 196
 		        <div class="form-group">
177 197
 			    <label>To (UTC):</label>
178 198
 		            <div class='input-group date' id='datetimepicker2'>
179
-		                <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']); ?>" />
199
+		                <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) {
200
+	print $_POST['end_date'];
201
+} elseif (isset($_COOKIE['archive_end'])) {
202
+	print date("m/d/Y h:i a",$_COOKIE['archive_end']);
203
+}
204
+?>" />
180 205
             			<span class="input-group-addon">
181 206
 		                    <span class="glyphicon glyphicon-calendar"></span>
182 207
             			</span>
@@ -202,8 +227,20 @@  discard block
 block discarded – undo
202 227
 
203 228
 		    <li><?php echo _("Playback speed:"); ?>
204 229
 			<div class="range">
205
-			    <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'; ?>">
206
-			    <output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?></output>
230
+			    <input type="range" min="0" max="50" step="1" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php  if (isset($_POST['archivespeed'])) {
231
+	print $_POST['archivespeed'];
232
+} elseif (isset($_COOKIE['archive_speed'])) {
233
+	print $_COOKIE['archive_speed'];
234
+} else {
235
+	print '1';
236
+}
237
+?>">
238
+			    <output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) {
239
+	print $_COOKIE['archive_speed'];
240
+} else {
241
+	print '1';
242
+}
243
+?></output>
207 244
 			</div>
208 245
 		    </li>
209 246
 		    <li><input type="submit" name="archive" value="Show archive" class="btn btn-primary" /></li>
@@ -225,15 +262,27 @@  discard block
 block discarded – undo
225 262
 		    <li><?php echo _("Type of Map:"); ?>
226 263
 			<select  class="selectpicker" onchange="mapType(this);">
227 264
 			    <?php
228
-				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider;
229
-				else $MapType = $_COOKIE['MapType'];
265
+				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') {
266
+					$MapType = $globalMapProvider;
267
+				} else {
268
+					$MapType = $_COOKIE['MapType'];
269
+				}
230 270
 			    ?>
231 271
 			    <?php
232 272
 				if (isset($globalBingMapKey) && $globalBingMapKey != '') {
233 273
 			    ?>
234
-			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option>
235
-			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option>
236
-			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option>
274
+			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') {
275
+	print ' selected';
276
+}
277
+?>>Bing-Aerial</option>
278
+			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') {
279
+	print ' selected';
280
+}
281
+?>>Bing-Hybrid</option>
282
+			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') {
283
+	print ' selected';
284
+}
285
+?>>Bing-Road</option>
237 286
 			    <?php
238 287
 				}
239 288
 			    ?>
@@ -243,56 +292,131 @@  discard block
 block discarded – undo
243 292
 			    <?php
244 293
 				    if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
245 294
 			    ?>
246
-			    <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option>
247
-			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option>
248
-			    <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option>
295
+			    <option value="Here-Aerial"<?php if ($MapType == 'Here') {
296
+	print ' selected';
297
+}
298
+?>>Here-Aerial</option>
299
+			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') {
300
+	print ' selected';
301
+}
302
+?>>Here-Hybrid</option>
303
+			    <option value="Here-Road"<?php if ($MapType == 'Here') {
304
+	print ' selected';
305
+}
306
+?>>Here-Road</option>
249 307
 			    <?php
250 308
 				    }
251 309
 			    ?>
252 310
 			    <?php
253 311
 				    if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
254 312
 			    ?>
255
-			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option>
256
-			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option>
257
-			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option>
258
-			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option>
313
+			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') {
314
+	print ' selected';
315
+}
316
+?>>Google Roadmap</option>
317
+			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') {
318
+	print ' selected';
319
+}
320
+?>>Google Satellite</option>
321
+			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') {
322
+	print ' selected';
323
+}
324
+?>>Google Hybrid</option>
325
+			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') {
326
+	print ' selected';
327
+}
328
+?>>Google Terrain</option>
259 329
 			    <?php
260 330
 				    }
261 331
 			    ?>
262 332
 			    <?php
263 333
 				    if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
264 334
 			    ?>
265
-			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option>
266
-			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option>
267
-			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option>
335
+			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') {
336
+	print ' selected';
337
+}
338
+?>>MapQuest-OSM</option>
339
+			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') {
340
+	print ' selected';
341
+}
342
+?>>MapQuest-Aerial</option>
343
+			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') {
344
+	print ' selected';
345
+}
346
+?>>MapQuest-Hybrid</option>
268 347
 			    <?php
269 348
 				    }
270 349
 			    ?>
271
-			    <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option>
350
+			    <option value="Yandex"<?php if ($MapType == 'Yandex') {
351
+	print ' selected';
352
+}
353
+?>>Yandex</option>
272 354
 			    <?php
273 355
 				}
274 356
 			    ?>
275 357
 			    <?php
276 358
 				    if (isset($globalMapboxToken) && $globalMapboxToken != '') {
277
-					if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default';
278
-					else $MapBoxId = $_COOKIE['MapTypeId'];
359
+					if (!isset($_COOKIE['MapTypeId'])) {
360
+						$MapBoxId = 'default';
361
+					} else {
362
+						$MapBoxId = $_COOKIE['MapTypeId'];
363
+					}
279 364
 			    ?>
280
-			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option>
281
-			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option>
282
-			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option>
283
-			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') print ' selected'; ?>>Mapbox dark</option>
284
-			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') print ' selected'; ?>>Mapbox satellite</option>
285
-			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') print ' selected'; ?>>Mapbox streets-satellite</option>
286
-			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') print ' selected'; ?>>Mapbox streets-basic</option>
287
-			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') print ' selected'; ?>>Mapbox comic</option>
288
-			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') print ' selected'; ?>>Mapbox outdoors</option>
289
-			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') print ' selected'; ?>>Mapbox pencil</option>
290
-			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option>
291
-			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option>
365
+			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') {
366
+	print ' selected';
367
+}
368
+?>>Mapbox default</option>
369
+			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') {
370
+	print ' selected';
371
+}
372
+?>>Mapbox streets</option>
373
+			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') {
374
+	print ' selected';
375
+}
376
+?>>Mapbox light</option>
377
+			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') {
378
+	print ' selected';
379
+}
380
+?>>Mapbox dark</option>
381
+			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') {
382
+	print ' selected';
383
+}
384
+?>>Mapbox satellite</option>
385
+			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') {
386
+	print ' selected';
387
+}
388
+?>>Mapbox streets-satellite</option>
389
+			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') {
390
+	print ' selected';
391
+}
392
+?>>Mapbox streets-basic</option>
393
+			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') {
394
+	print ' selected';
395
+}
396
+?>>Mapbox comic</option>
397
+			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') {
398
+	print ' selected';
399
+}
400
+?>>Mapbox outdoors</option>
401
+			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') {
402
+	print ' selected';
403
+}
404
+?>>Mapbox pencil</option>
405
+			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') {
406
+	print ' selected';
407
+}
408
+?>>Mapbox pirates</option>
409
+			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') {
410
+	print ' selected';
411
+}
412
+?>>Mapbox emerald</option>
292 413
 			    <?php
293 414
 				    }
294 415
 			    ?>
295
-			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option>
416
+			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') {
417
+	print ' selected';
418
+}
419
+?>>OpenStreetMap</option>
296 420
 			</select>
297 421
 		    </li>
298 422
 <?php
@@ -300,9 +424,18 @@  discard block
 block discarded – undo
300 424
 ?>
301 425
 		    <li><?php echo _("Type of Terrain:"); ?>
302 426
 			<select  class="selectpicker" onchange="terrainType(this);">
303
-			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option>
304
-			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option>
305
-			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option>
427
+			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') {
428
+	print ' selected';
429
+}
430
+?>>stk terrain</option>
431
+			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') {
432
+	print ' selected';
433
+}
434
+?>>ellipsoid</option>
435
+			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') {
436
+	print ' selected';
437
+}
438
+?>>vr terrain</option>
306 439
 			</select>
307 440
 		    </li>
308 441
 <?php
@@ -312,18 +445,36 @@  discard block
 block discarded – undo
312 445
     if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
313 446
 ?>
314 447
 		    
315
-		    <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>
316
-		    <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>
317
-		    <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>
318
-		    <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>
448
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') {
449
+	print 'checked';
450
+}
451
+?> ><?php echo _("Display flight info as popup"); ?></label></div></li>
452
+		    <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'])) {
453
+	print 'checked';
454
+}
455
+?> ><?php echo _("Display flight path"); ?></label></div></li>
456
+		    <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'])) {
457
+	print 'checked';
458
+}
459
+?> ><?php echo _("Display flight route on click"); ?></label></div></li>
460
+		    <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)) {
461
+	print 'checked';
462
+}
463
+?> ><?php echo _("Planes animate between updates"); ?></label></div></li>
319 464
 <?php
320 465
     }
321 466
 ?>
322
-		    <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>
467
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true') {
468
+	print 'checked';
469
+}
470
+?> ><?php echo _("Display airports on map"); ?></label></div></li>
323 471
 <?php
324 472
     if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
325 473
 ?>
326
-		    <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>
474
+		    <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')) {
475
+	print 'checked';
476
+}
477
+?> ><?php echo _("Show mini-map"); ?></label></div></li>
327 478
 <?php
328 479
     }
329 480
     if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
@@ -337,17 +488,25 @@  discard block
 block discarded – undo
337 488
 			if (function_exists('array_column')) {
338 489
 			    if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
339 490
 		    ?>
340
-		    <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>
491
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
492
+	print 'checked';
493
+}
494
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
341 495
 		    <?php
342 496
 			    }
343 497
 			} elseif (isset($globalSources)) {
344 498
 			    $dispolar = false;
345 499
 			    foreach ($globalSources as $testsource) {
346
-			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
500
+			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) {
501
+			        	$dispolar = true;
502
+			        }
347 503
 			    }
348 504
 			    if ($dispolar) {
349 505
 		    ?>
350
-		    <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>
351 510
 		    <?php
352 511
 			    }
353 512
 		        }
@@ -359,12 +518,22 @@  discard block
 block discarded – undo
359 518
 		    <?php
360 519
 		        if (extension_loaded('gd') && function_exists('gd_info')) {
361 520
 		    ?>
362
-		    <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>
521
+		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') {
522
+	print 'checked';
523
+}
524
+?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
363 525
 		    <?php 
364 526
 			if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') {
365 527
 		    ?>
366 528
 		    <li><?php echo _("Aircraft icon color:"); ?>
367
-			<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'; ?>">
529
+			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) {
530
+	print $_COOKIE['IconColor'];
531
+} elseif (isset($globalAircraftIconColor)) {
532
+	print $globalAircraftIconColor;
533
+} else {
534
+	print '1a3151';
535
+}
536
+?>">
368 537
 		    </li>
369 538
 		    <?php
370 539
 			    }
@@ -372,8 +541,22 @@  discard block
 block discarded – undo
372 541
 		    ?>
373 542
 		    <li><?php echo _("Show airport icon at zoom level:"); ?>
374 543
 			<div class="range">
375
-			    <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'; ?>">
376
-			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?></output>
544
+			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) {
545
+	print $_COOKIE['AirportZoom'];
546
+} elseif (isset($globalAirportZoom)) {
547
+	print $globalAirportZoom;
548
+} else {
549
+	print '7';
550
+}
551
+?>">
552
+			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) {
553
+	print $_COOKIE['AirportZoom'];
554
+} elseif (isset($globalAirportZoom)) {
555
+	print $globalAirportZoom;
556
+} else {
557
+	print '7';
558
+}
559
+?></output>
377 560
 			</div>
378 561
 		    </li>
379 562
 <?php
@@ -381,22 +564,46 @@  discard block
 block discarded – undo
381 564
 ?>
382 565
 		    <li><?php echo _("Distance unit:"); ?>
383 566
 			<select class="selectpicker" onchange="unitdistance(this);">
384
-			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) echo ' selected'; ?>>km</option>
385
-			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) echo ' selected'; ?>>nm</option>
386
-			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) echo ' selected'; ?>>mi</option>
567
+			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) {
568
+	echo ' selected';
569
+}
570
+?>>km</option>
571
+			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
572
+	echo ' selected';
573
+}
574
+?>>nm</option>
575
+			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
576
+	echo ' selected';
577
+}
578
+?>>mi</option>
387 579
 		        </select>
388 580
 		    </li>
389 581
 		    <li><?php echo _("Altitude unit:"); ?>
390 582
 			<select class="selectpicker" onchange="unitaltitude(this);">
391
-			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) echo ' selected'; ?>>m</option>
392
-			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) echo ' selected'; ?>>feet</option>
583
+			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) {
584
+	echo ' selected';
585
+}
586
+?>>m</option>
587
+			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) {
588
+	echo ' selected';
589
+}
590
+?>>feet</option>
393 591
 		        </select>
394 592
 		    </li>
395 593
 		    <li><?php echo _("Speed unit:"); ?>
396 594
 			<select class="selectpicker" onchange="unitspeed(this);">
397
-			    <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>
398
-			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) echo ' selected'; ?>>mph</option>
399
-			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) echo ' selected'; ?>>knots</option>
595
+			    <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) {
596
+	echo ' selected';
597
+}
598
+?>>km/h</option>
599
+			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) {
600
+	echo ' selected';
601
+}
602
+?>>mph</option>
603
+			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) {
604
+	echo ' selected';
605
+}
606
+?>>knots</option>
400 607
 		        </select>
401 608
 		    </li>
402 609
 
@@ -411,9 +618,18 @@  discard block
 block discarded – undo
411 618
 		    <?php
412 619
 			if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) {
413 620
 		    ?>
414
-			<?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 } ?>
415
-			<?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 } ?>
416
-			<?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 } ?>
621
+			<?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'])) {
622
+	print 'checked';
623
+}
624
+?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
625
+			<?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'])) {
626
+	print 'checked';
627
+}
628
+?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
629
+			<?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'])) {
630
+	print 'checked';
631
+}
632
+?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
417 633
 		    <?php
418 634
 			}
419 635
 		    ?>
@@ -421,10 +637,16 @@  discard block
 block discarded – undo
421 637
 			if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) {
422 638
 		    ?>
423 639
 			<?php if (isset($globalSBS1) && $globalSBS1) { ?>
424
-			    <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>
640
+			    <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'])) {
641
+	print 'checked';
642
+}
643
+?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
425 644
 			<?php } ?>
426 645
 			<?php if (isset($globalAPRS) && $globalAPRS) { ?>
427
-			    <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>
646
+			    <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'])) {
647
+	print 'checked';
648
+}
649
+?> ><?php echo _("Display APRS data"); ?></label></div></li>
428 650
 			<?php } ?>
429 651
 		    <?php
430 652
 			}
@@ -441,7 +663,9 @@  discard block
 block discarded – undo
441 663
 				}
442 664
 				foreach($allairlinenames as $airline) {
443 665
 					$airline_name = $airline['airline_name'];
444
-					if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...';
666
+					if (strlen($airline_name) > 30) {
667
+						$airline_name = substr($airline_name,0,30).'...';
668
+					}
445 669
 					if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['filter_Airlines']))) {
446 670
 						echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>';
447 671
 					} else {
@@ -459,7 +683,10 @@  discard block
 block discarded – undo
459 683
 		    <li><?php echo _("Display alliance:"); ?>
460 684
 		    <br/>
461 685
 			<select class="selectpicker" onchange="alliance(this);" id="display_alliance">
462
-			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
686
+			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') {
687
+	echo ' selected';
688
+}
689
+?>><?php echo _("All"); ?></option>
463 690
 			    <?php
464 691
 				foreach($allalliancenames as $alliance) {
465 692
 					$alliance_name = $alliance['alliance'];
@@ -500,10 +727,22 @@  discard block
 block discarded – undo
500 727
 		    ?>
501 728
 		    <li><?php echo _("Display airlines of type:"); ?><br/>
502 729
 			<select class="selectpicker" onchange="airlinestype(this);">
503
-			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
504
-			    <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') echo ' selected'; ?>><?php echo _("Passenger"); ?></option>
505
-			    <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') echo ' selected'; ?>><?php echo _("Cargo"); ?></option>
506
-			    <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') echo ' selected'; ?>><?php echo _("Military"); ?></option>
730
+			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') {
731
+	echo ' selected';
732
+}
733
+?>><?php echo _("All"); ?></option>
734
+			    <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') {
735
+	echo ' selected';
736
+}
737
+?>><?php echo _("Passenger"); ?></option>
738
+			    <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') {
739
+	echo ' selected';
740
+}
741
+?>><?php echo _("Cargo"); ?></option>
742
+			    <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') {
743
+	echo ' selected';
744
+}
745
+?>><?php echo _("Military"); ?></option>
507 746
 			</select>
508 747
 		    </li>
509 748
 		    <?php
@@ -511,7 +750,10 @@  discard block
 block discarded – undo
511 750
 		    ?>
512 751
 		    <li>
513 752
 			<?php echo _("Display flight with ident:"); ?>
514
-			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" />
753
+			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) {
754
+	print $_COOKIE['filter_ident'];
755
+}
756
+?>" />
515 757
 		    </li>
516 758
 		</ul>
517 759
 	    </form>
@@ -527,7 +769,10 @@  discard block
 block discarded – undo
527 769
 	    <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
528 770
 	    <form>
529 771
 		<ul>
530
-		    <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>
772
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if (isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') {
773
+	print 'checked';
774
+}
775
+?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li>
531 776
 		    <li><?php echo _("Type:"); ?>
532 777
 			<select class="selectpicker" multiple onchange="sattypes(this);">
533 778
 			    <?php
@@ -535,25 +780,45 @@  discard block
 block discarded – undo
535 780
 				$types = $Satellite->get_tle_types();
536 781
 				foreach ($types as $type) {
537 782
 					$type_name = $type['tle_type'];
538
-					if ($type_name == 'musson') $type_name = 'Russian LEO Navigation';
539
-					else if ($type_name == 'nnss') $type_name = 'Navi Navigation Satellite System';
540
-					else if ($type_name == 'sbas') $type_name = 'Satellite-Based Augmentation System';
541
-					else if ($type_name == 'glo-ops') $type_name = 'Glonass Operational';
542
-					else if ($type_name == 'gps-ops') $type_name = 'GPS Operational';
543
-					else if ($type_name == 'argos') $type_name = 'ARGOS Data Collection System';
544
-					else if ($type_name == 'tdrss') $type_name = 'Tracking and Data Relay Satellite System';
545
-					else if ($type_name == 'sarsat') $type_name = 'Search & Rescue';
546
-					else if ($type_name == 'dmc') $type_name = 'Disaster Monitoring';
547
-					else if ($type_name == 'resource') $type_name = 'Earth Resources';
548
-					else if ($type_name == 'stations') $type_name = 'Space Stations';
549
-					else if ($type_name == 'geo') $type_name = 'Geostationary';
550
-					else if ($type_name == 'amateur') $type_name = 'Amateur Radio';
551
-					else if ($type_name == 'x-comm') $type_name = 'Experimental';
552
-					else if ($type_name == 'other-comm') $type_name = 'Other Comm';
553
-					else if ($type_name == 'science') $type_name = 'Space & Earth Science';
554
-					else if ($type_name == 'military') $type_name = 'Miscellaneous Military';
555
-					else if ($type_name == 'radar') $type_name = 'Radar Calibration';
556
-					else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches';
783
+					if ($type_name == 'musson') {
784
+						$type_name = 'Russian LEO Navigation';
785
+					} else if ($type_name == 'nnss') {
786
+						$type_name = 'Navi Navigation Satellite System';
787
+					} else if ($type_name == 'sbas') {
788
+						$type_name = 'Satellite-Based Augmentation System';
789
+					} else if ($type_name == 'glo-ops') {
790
+						$type_name = 'Glonass Operational';
791
+					} else if ($type_name == 'gps-ops') {
792
+						$type_name = 'GPS Operational';
793
+					} else if ($type_name == 'argos') {
794
+						$type_name = 'ARGOS Data Collection System';
795
+					} else if ($type_name == 'tdrss') {
796
+						$type_name = 'Tracking and Data Relay Satellite System';
797
+					} else if ($type_name == 'sarsat') {
798
+						$type_name = 'Search & Rescue';
799
+					} else if ($type_name == 'dmc') {
800
+						$type_name = 'Disaster Monitoring';
801
+					} else if ($type_name == 'resource') {
802
+						$type_name = 'Earth Resources';
803
+					} else if ($type_name == 'stations') {
804
+						$type_name = 'Space Stations';
805
+					} else if ($type_name == 'geo') {
806
+						$type_name = 'Geostationary';
807
+					} else if ($type_name == 'amateur') {
808
+						$type_name = 'Amateur Radio';
809
+					} else if ($type_name == 'x-comm') {
810
+						$type_name = 'Experimental';
811
+					} else if ($type_name == 'other-comm') {
812
+						$type_name = 'Other Comm';
813
+					} else if ($type_name == 'science') {
814
+						$type_name = 'Space & Earth Science';
815
+					} else if ($type_name == 'military') {
816
+						$type_name = 'Miscellaneous Military';
817
+					} else if ($type_name == 'radar') {
818
+						$type_name = 'Radar Calibration';
819
+					} else if ($type_name == 'tle-new') {
820
+						$type_name = 'Last 30 days launches';
821
+					}
557 822
 					
558 823
 					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) {
559 824
 						print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>';
Please login to merge, or discard this patch.
airline.php 1 patch
Braces   +24 added lines, -8 removed lines patch added patch discarded remove patch
@@ -24,13 +24,21 @@  discard block
 block discarded – undo
24 24
 
25 25
 	print '<div class="select-item"><form action="'.$globalURL.'/airline" method="post"><select name="airline_type" class="selectpicker" data-live-search="true">';
26 26
 	print '<option value="all"';
27
-	if ($airline_type == 'all') print 'selected="selected" ';
27
+	if ($airline_type == 'all') {
28
+		print 'selected="selected" ';
29
+	}
28 30
 	print '>'._("All").'</option><option value="passenger"';
29
-	if ($airline_type == 'passenger') print 'selected="selected" ';
31
+	if ($airline_type == 'passenger') {
32
+		print 'selected="selected" ';
33
+	}
30 34
 	print '>'._("Passenger").'</option><option value="cargo"';
31
-	if ($airline_type == 'cargo') print 'selected="selected" ';
35
+	if ($airline_type == 'cargo') {
36
+		print 'selected="selected" ';
37
+	}
32 38
 	print '>'._("Cargo").'</option><option value="military"';
33
-	if ($airline_type == 'military') print 'selected="selected" ';
39
+	if ($airline_type == 'military') {
40
+		print 'selected="selected" ';
41
+	}
34 42
 	print '>'._("Military").'</option></select>';
35 43
 	print '<button type="submit"><i class="fa fa-angle-double-right"></i></button></form></div>';
36 44
 
@@ -57,7 +65,9 @@  discard block
 block discarded – undo
57 65
 		$firstLetter = mb_strtoupper(mb_substr($value['airline_name'], 0, 1),'UTF-8');
58 66
 		if($previous !== $firstLetter)
59 67
 		{
60
-			if ($previous !== null) print ' | ';
68
+			if ($previous !== null) {
69
+				print ' | ';
70
+			}
61 71
 			print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>';
62 72
 		}
63 73
 		$previous = $firstLetter;
@@ -70,7 +80,9 @@  discard block
 block discarded – undo
70 80
 		{
71 81
 			if($previous !== $firstLetter)
72 82
 			{
73
-				if ($previous !== null) print '</div>';
83
+				if ($previous !== null) {
84
+					print '</div>';
85
+				}
74 86
 				print '<a name="'.$firstLetter.'"></a><h4 class="alphabet-header">'.$firstLetter.'</h4><div class="alphabet">';
75 87
 			}
76 88
 			$previous = $firstLetter;
@@ -82,10 +94,14 @@  discard block
 block discarded – undo
82 94
 			} elseif (@getimagesize('images/airlines/'.$value['airline_icao'].'.png') || @getimagesize($globalURL.'/images/airlines/'.$value['airline_icao'].'.png'))
83 95
 			{
84 96
 				print '<img src="'.$globalURL.'/images/airlines/'.$value['airline_icao'].'.png" alt="'._("Click to see airline activity").'" title="'._("Click to see airline activity").'" /> ';
85
-				if (isset($value['ban_eu']) && $value['ban_eu'] == 1) print '<img src="'.$globalURL.'/images/baneu.png" alt="'._("Banned in Europe").'" title="'._("Banned in Europe").'" /> ';
97
+				if (isset($value['ban_eu']) && $value['ban_eu'] == 1) {
98
+					print '<img src="'.$globalURL.'/images/baneu.png" alt="'._("Banned in Europe").'" title="'._("Banned in Europe").'" /> ';
99
+				}
86 100
 			} else {
87 101
 				print $value['airline_name'];
88
-				if (isset($value['ban_eu']) && $value['ban_eu'] == 1) print '<img src="'.$globalURL.'/images/baneu.png" alt="'._("Banned in Europe").'" title="'._("Banned in Europe").'" /> ';
102
+				if (isset($value['ban_eu']) && $value['ban_eu'] == 1) {
103
+					print '<img src="'.$globalURL.'/images/baneu.png" alt="'._("Banned in Europe").'" title="'._("Banned in Europe").'" /> ';
104
+				}
89 105
 			}
90 106
 			print '</a>';
91 107
 			print '</div>';
Please login to merge, or discard this patch.