Completed
Push — master ( df2e86...bc2613 )
by Yannick
32:43
created
require/class.MarineLive.php 2 patches
Spacing   +123 added lines, -123 removed lines patch added patch discarded remove patch
@@ -17,33 +17,33 @@  discard block
 block discarded – undo
17 17
 	* @param Array $filter the filter
18 18
 	* @return Array the SQL part
19 19
 	*/
20
-	public function getFilter($filter = array(),$where = false,$and = false) {
20
+	public function getFilter($filter = array(), $where = false, $and = false) {
21 21
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
22 22
 		$filters = array();
23 23
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
24 24
 			if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
25 25
 				$filters = $globalStatsFilters[$globalFilterName];
26 26
 			} else {
27
-				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
27
+				$filter = array_merge($filter, $globalStatsFilters[$globalFilterName]);
28 28
 			}
29 29
 		}
30 30
 		if (isset($filter[0]['source'])) {
31
-			$filters = array_merge($filters,$filter);
31
+			$filters = array_merge($filters, $filter);
32 32
 		}
33
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
33
+		if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
34 34
 		$filter_query_join = '';
35 35
 		$filter_query_where = '';
36
-		foreach($filters as $flt) {
36
+		foreach ($filters as $flt) {
37 37
 			if (isset($flt['idents']) && !empty($flt['idents'])) {
38 38
 				if (isset($flt['source'])) {
39
-					$filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','",$flt['idents'])."') AND marine_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id";
39
+					$filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','", $flt['idents'])."') AND marine_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id";
40 40
 				} else {
41
-					$filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id";
41
+					$filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id";
42 42
 				}
43 43
 			}
44 44
 		}
45 45
 		if (isset($filter['source']) && !empty($filter['source'])) {
46
-			$filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')";
46
+			$filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')";
47 47
 		}
48 48
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
49 49
 			$filter_query_where .= " AND ident = '".$filter['ident']."'";
@@ -81,15 +81,15 @@  discard block
 block discarded – undo
81 81
 					$filter_query_date .= " AND EXTRACT(DAY FROM marine_output.date) = '".$filter['day']."'";
82 82
 				}
83 83
 			}
84
-			$filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.fammarine_id = marine_live.fammarine_id";
84
+			$filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.fammarine_id = marine_live.fammarine_id";
85 85
 		}
86 86
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
87
-			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
87
+			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
88 88
 		}
89 89
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
90 90
 		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
91 91
 		if ($filter_query_where != '') {
92
-			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
92
+			$filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where);
93 93
 		}
94 94
 		$filter_query = $filter_query_join.$filter_query_where;
95 95
 		return $filter_query;
@@ -112,8 +112,8 @@  discard block
 block discarded – undo
112 112
 		if ($limit != '')
113 113
 		{
114 114
 			$limit_array = explode(',', $limit);
115
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
116
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
115
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
116
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
117 117
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
118 118
 			{
119 119
 				$limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0];
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 				$orderby_query = ' '.$search_orderby_array[$sort]['sql'];
129 129
 			}
130 130
 		}
131
-		if ($orderby_query == '') $orderby_query= ' ORDER BY date DESC';
131
+		if ($orderby_query == '') $orderby_query = ' ORDER BY date DESC';
132 132
 
133 133
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
134 134
 		if ($globalDBdriver == 'mysql') {
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 		} else {
138 138
 			$query  = "SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate".$filter_query.$orderby_query;
139 139
 		}
140
-		$spotter_array = $Marine->getDataFromDB($query.$limit_query,array(),'',true);
140
+		$spotter_array = $Marine->getDataFromDB($query.$limit_query, array(), '', true);
141 141
 
142 142
 		return $spotter_array;
143 143
 	}
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 		global $globalDBdriver, $globalLiveInterval;
154 154
 		date_default_timezone_set('UTC');
155 155
 
156
-		$filter_query = $this->getFilter($filter,true,true);
156
+		$filter_query = $this->getFilter($filter, true, true);
157 157
 
158 158
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
159 159
 		if ($globalDBdriver == 'mysql') {
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 		try {
168 168
 			$sth = $this->db->prepare($query);
169 169
 			$sth->execute();
170
-		} catch(PDOException $e) {
170
+		} catch (PDOException $e) {
171 171
 			echo $e->getMessage();
172 172
 			die;
173 173
 		}
@@ -182,26 +182,26 @@  discard block
 block discarded – undo
182 182
 	* @return Array the spotter information
183 183
 	*
184 184
 	*/
185
-	public function getMinLastLiveMarineData($coord = array(),$filter = array(), $limit = false, $id = '')
185
+	public function getMinLastLiveMarineData($coord = array(), $filter = array(), $limit = false, $id = '')
186 186
 	{
187 187
 		global $globalDBdriver, $globalLiveInterval, $globalMap3DMarinesLimit, $globalArchive;
188 188
 		date_default_timezone_set('UTC');
189 189
 		$usecoord = false;
190 190
 		if (is_array($coord) && !empty($coord)) {
191
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
192
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
193
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
194
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
191
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
192
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
193
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
194
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
195 195
 			$usecoord = true;
196 196
 		}
197
-		$id = filter_var($id,FILTER_SANITIZE_STRING);
198
-		$filter_query = $this->getFilter($filter,true,true);
197
+		$id = filter_var($id, FILTER_SANITIZE_STRING);
198
+		$filter_query = $this->getFilter($filter, true, true);
199 199
 
200 200
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
201 201
 		if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') $globalMap3DMarinesLimit = '300';
202 202
 		if ($globalDBdriver == 'mysql') {
203 203
 			if (isset($globalArchive) && $globalArchive === TRUE) {
204
-				$query  = 'SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id,marine_archive.type_id,marine_archive.type, marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source, marine_archive.captain_name 
204
+				$query = 'SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id,marine_archive.type_id,marine_archive.type, marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source, marine_archive.captain_name 
205 205
 				    FROM marine_archive INNER JOIN (SELECT fammarine_id FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date) l ON l.fammarine_id = marine_archive.fammarine_id ";
206 206
 				if ($usecoord) $query .= "AND marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
207 207
 				if ($id != '') $query .= "OR marine_archive.fammarine_id = :id ";
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 				    ORDER BY fammarine_id, date";
216 216
 				if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit;
217 217
 			} else {
218
-				$query  = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name 
218
+				$query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name 
219 219
 				    FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date ";
220 220
 				if ($usecoord) $query .= "AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
221 221
 				if ($id != '') $query .= "OR marine_live.fammarine_id = :id ";
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 			}
226 226
 		} else {
227 227
 			if (isset($globalArchive) && $globalArchive === TRUE) {
228
-				$query  = "SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id, marine_archive.type_id, marine_archive.type,marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source, marine_archive.captain_name 
228
+				$query = "SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id, marine_archive.type_id, marine_archive.type,marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source, marine_archive.captain_name 
229 229
 				    FROM marine_archive INNER JOIN (SELECT fammarine_id FROM marine_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date) l ON l.fammarine_id = marine_archive.fammarine_id ";
230 230
 				if ($usecoord) $query .= "AND (marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
231 231
 				if ($id != '') $query .= "OR marine_archive.fammarine_id = :id ";
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 		try {
253 253
 			$sth = $this->db->prepare($query);
254 254
 			$sth->execute($query_values);
255
-		} catch(PDOException $e) {
255
+		} catch (PDOException $e) {
256 256
 			echo $e->getMessage();
257 257
 			die;
258 258
 		}
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 	public function getLiveMarineCount($filter = array())
270 270
 	{
271 271
 		global $globalDBdriver, $globalLiveInterval;
272
-		$filter_query = $this->getFilter($filter,true,true);
272
+		$filter_query = $this->getFilter($filter, true, true);
273 273
 
274 274
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
275 275
 		if ($globalDBdriver == 'mysql') {
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 		try {
281 281
 			$sth = $this->db->prepare($query);
282 282
 			$sth->execute();
283
-		} catch(PDOException $e) {
283
+		} catch (PDOException $e) {
284 284
 			echo $e->getMessage();
285 285
 			die;
286 286
 		}
@@ -303,10 +303,10 @@  discard block
 block discarded – undo
303 303
 		$filter_query = $this->getFilter($filter);
304 304
 
305 305
 		if (is_array($coord)) {
306
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
307
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
308
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
309
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
306
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
307
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
308
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
309
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
310 310
 		} else return array();
311 311
 		if ($globalDBdriver == 'mysql') {
312 312
 			$query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate AND marine_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND marine_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY marine_live.fammarine_id ORDER BY date DESC'.$filter_query;
@@ -328,13 +328,13 @@  discard block
 block discarded – undo
328 328
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
329 329
 		$Marine = new Marine($this->db);
330 330
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
331
-		$filter_query = $this->getFilter($filter,true,true);
331
+		$filter_query = $this->getFilter($filter, true, true);
332 332
 
333 333
 		if (is_array($coord)) {
334
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
335
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
336
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
337
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
334
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
335
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
336
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
337
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
338 338
 		} else return array();
339 339
 		/*
340 340
 		if ($globalDBdriver == 'mysql') {
@@ -349,13 +349,13 @@  discard block
 block discarded – undo
349 349
 		*/
350 350
 		if ($globalDBdriver == 'mysql') {
351 351
 			if (isset($globalArchive) && $globalArchive === TRUE) {
352
-				$query  = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name 
352
+				$query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name 
353 353
 				    FROM marine_live 
354 354
 				    '.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= marine_live.date 
355 355
 				    AND marine_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND marine_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.'
356 356
 				    AND marine_live.latitude <> 0 AND marine_live.longitude <> 0 ORDER BY date DESC';
357 357
 			} else {
358
-				$query  = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name 
358
+				$query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name 
359 359
 				    FROM marine_live 
360 360
 				    INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate 
361 361
 				    FROM marine_live l 
@@ -367,14 +367,14 @@  discard block
 block discarded – undo
367 367
 			}
368 368
 		} else {
369 369
 			if (isset($globalArchive) && $globalArchive === TRUE) {
370
-				$query  = "SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name 
370
+				$query = "SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name 
371 371
 				    FROM marine_live 
372 372
 				    ".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date 
373 373
 				    AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." 
374 374
 				    AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." 
375 375
 				    AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' ORDER BY date DESC";
376 376
 			} else {
377
-				$query  = "SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name 
377
+				$query = "SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name 
378 378
 				    FROM marine_live 
379 379
 				    INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate 
380 380
 				    FROM marine_live l 
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
                 if ($interval == '1m')
432 432
                 {
433 433
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';
434
-                } else if ($interval == '15m'){
434
+                } else if ($interval == '15m') {
435 435
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= marine_live.date ';
436 436
                 } 
437 437
             }
@@ -439,14 +439,14 @@  discard block
 block discarded – undo
439 439
          $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';   
440 440
         }
441 441
 
442
-                $query  = "SELECT marine_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM marine_live 
442
+                $query = "SELECT marine_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM marine_live 
443 443
                    WHERE marine_live.latitude <> '' 
444 444
                                    AND marine_live.longitude <> '' 
445 445
                    ".$additional_query."
446 446
                    HAVING distance < :radius  
447 447
                                    ORDER BY distance";
448 448
 
449
-                $spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
449
+                $spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius));
450 450
 
451 451
                 return $spotter_array;
452 452
         }
@@ -464,9 +464,9 @@  discard block
 block discarded – undo
464 464
 		date_default_timezone_set('UTC');
465 465
 
466 466
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
467
-                $query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
467
+                $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
468 468
 
469
-		$spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident),'',true);
469
+		$spotter_array = $Marine->getDataFromDB($query, array(':ident' => $ident), '', true);
470 470
 
471 471
 		return $spotter_array;
472 472
 	}
@@ -477,14 +477,14 @@  discard block
 block discarded – undo
477 477
 	* @return Array the spotter information
478 478
 	*
479 479
 	*/
480
-	public function getDateLiveMarineDataByIdent($ident,$date)
480
+	public function getDateLiveMarineDataByIdent($ident, $date)
481 481
 	{
482 482
 		$Marine = new Marine($this->db);
483 483
 		date_default_timezone_set('UTC');
484 484
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
485 485
 		$query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
486
-		$date = date('c',$date);
487
-		$spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
486
+		$date = date('c', $date);
487
+		$spotter_array = $Marine->getDataFromDB($query, array(':ident' => $ident, ':date' => $date));
488 488
 		return $spotter_array;
489 489
 	}
490 490
 
@@ -494,14 +494,14 @@  discard block
 block discarded – undo
494 494
 	* @return Array the spotter information
495 495
 	*
496 496
 	*/
497
-	public function getDateLiveMarineDataByMMSI($mmsi,$date)
497
+	public function getDateLiveMarineDataByMMSI($mmsi, $date)
498 498
 	{
499 499
 		$Marine = new Marine($this->db);
500 500
 		date_default_timezone_set('UTC');
501 501
 		$mmsi = filter_var($mmsi, FILTER_SANITIZE_NUMBER_INT);
502 502
 		$query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.mmsi = :mmsi AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
503
-		$date = date('c',$date);
504
-		$spotter_array = $Marine->getDataFromDB($query,array(':mmsi' => $mmsi,':date' => $date));
503
+		$date = date('c', $date);
504
+		$spotter_array = $Marine->getDataFromDB($query, array(':mmsi' => $mmsi, ':date' => $date));
505 505
 		return $spotter_array;
506 506
 	}
507 507
 
@@ -517,9 +517,9 @@  discard block
 block discarded – undo
517 517
 		date_default_timezone_set('UTC');
518 518
 
519 519
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
520
-                $query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
520
+                $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
521 521
 
522
-		$spotter_array = $Marine->getDataFromDB($query,array(':id' => $id),'',true);
522
+		$spotter_array = $Marine->getDataFromDB($query, array(':id' => $id), '', true);
523 523
 
524 524
 		return $spotter_array;
525 525
 	}
@@ -530,15 +530,15 @@  discard block
 block discarded – undo
530 530
 	* @return Array the spotter information
531 531
 	*
532 532
 	*/
533
-	public function getDateLiveMarineDataById($id,$date)
533
+	public function getDateLiveMarineDataById($id, $date)
534 534
 	{
535 535
 		$Marine = new Marine($this->db);
536 536
 		date_default_timezone_set('UTC');
537 537
 
538 538
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
539
-                $query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
540
-                $date = date('c',$date);
541
-		$spotter_array = $Marine->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
539
+                $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
540
+                $date = date('c', $date);
541
+		$spotter_array = $Marine->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true);
542 542
 
543 543
 		return $spotter_array;
544 544
 	}
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
 	* @return Array the spotter information
551 551
 	*
552 552
 	*/
553
-	public function getAllLiveMarineDataById($id,$liveinterval = false)
553
+	public function getAllLiveMarineDataById($id, $liveinterval = false)
554 554
 	{
555 555
 		global $globalDBdriver, $globalLiveInterval;
556 556
 		date_default_timezone_set('UTC');
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
 		try {
570 570
 			$sth = $this->db->prepare($query);
571 571
 			$sth->execute(array(':id' => $id));
572
-		} catch(PDOException $e) {
572
+		} catch (PDOException $e) {
573 573
 			echo $e->getMessage();
574 574
 			die;
575 575
 		}
@@ -587,12 +587,12 @@  discard block
 block discarded – undo
587 587
 	{
588 588
 		date_default_timezone_set('UTC');
589 589
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
590
-		$query  = self::$global_query.' WHERE marine_live.ident = :ident';
590
+		$query = self::$global_query.' WHERE marine_live.ident = :ident';
591 591
     		try {
592 592
 			
593 593
 			$sth = $this->db->prepare($query);
594 594
 			$sth->execute(array(':ident' => $ident));
595
-		} catch(PDOException $e) {
595
+		} catch (PDOException $e) {
596 596
 			echo $e->getMessage();
597 597
 			die;
598 598
 		}
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
 			
623 623
 			$sth = $this->db->prepare($query);
624 624
 			$sth->execute();
625
-		} catch(PDOException $e) {
625
+		} catch (PDOException $e) {
626 626
 			return "error";
627 627
 		}
628 628
 
@@ -645,14 +645,14 @@  discard block
 block discarded – undo
645 645
 				
646 646
 				$sth = $this->db->prepare($query);
647 647
 				$sth->execute();
648
-			} catch(PDOException $e) {
648
+			} catch (PDOException $e) {
649 649
 				return "error";
650 650
 			}
651 651
 			$query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN (';
652 652
                         $i = 0;
653
-                        $j =0;
653
+                        $j = 0;
654 654
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
655
-			foreach($all as $row)
655
+			foreach ($all as $row)
656 656
 			{
657 657
 				$i++;
658 658
 				$j++;
@@ -660,9 +660,9 @@  discard block
 block discarded – undo
660 660
 					if ($globalDebug) echo ".";
661 661
 				    	try {
662 662
 						
663
-						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
663
+						$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
664 664
 						$sth->execute();
665
-					} catch(PDOException $e) {
665
+					} catch (PDOException $e) {
666 666
 						return "error";
667 667
 					}
668 668
                                 	$query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN (';
@@ -673,9 +673,9 @@  discard block
 block discarded – undo
673 673
 			if ($i > 0) {
674 674
     				try {
675 675
 					
676
-					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
676
+					$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
677 677
 					$sth->execute();
678
-				} catch(PDOException $e) {
678
+				} catch (PDOException $e) {
679 679
 					return "error";
680 680
 				}
681 681
 			}
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
 				
689 689
 				$sth = $this->db->prepare($query);
690 690
 				$sth->execute();
691
-			} catch(PDOException $e) {
691
+			} catch (PDOException $e) {
692 692
 				return "error";
693 693
 			}
694 694
 /*			$query_delete = "DELETE FROM marine_live WHERE fammarine_id IN (";
@@ -736,13 +736,13 @@  discard block
 block discarded – undo
736 736
 	public function deleteLiveMarineDataByIdent($ident)
737 737
 	{
738 738
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
739
-		$query  = 'DELETE FROM marine_live WHERE ident = :ident';
739
+		$query = 'DELETE FROM marine_live WHERE ident = :ident';
740 740
         
741 741
     		try {
742 742
 			
743 743
 			$sth = $this->db->prepare($query);
744 744
 			$sth->execute(array(':ident' => $ident));
745
-		} catch(PDOException $e) {
745
+		} catch (PDOException $e) {
746 746
 			return "error";
747 747
 		}
748 748
 
@@ -758,13 +758,13 @@  discard block
 block discarded – undo
758 758
 	public function deleteLiveMarineDataById($id)
759 759
 	{
760 760
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
761
-		$query  = 'DELETE FROM marine_live WHERE fammarine_id = :id';
761
+		$query = 'DELETE FROM marine_live WHERE fammarine_id = :id';
762 762
         
763 763
     		try {
764 764
 			
765 765
 			$sth = $this->db->prepare($query);
766 766
 			$sth->execute(array(':id' => $id));
767
-		} catch(PDOException $e) {
767
+		} catch (PDOException $e) {
768 768
 			return "error";
769 769
 		}
770 770
 
@@ -780,7 +780,7 @@  discard block
 block discarded – undo
780 780
 	*/
781 781
 	public function getAllRaces()
782 782
 	{
783
-		$query  = 'SELECT DISTINCT marine_live.race_id, marine_live.race_name FROM marine_live ORDER BY marine_live.race_name';
783
+		$query = 'SELECT DISTINCT marine_live.race_id, marine_live.race_name FROM marine_live ORDER BY marine_live.race_name';
784 784
 		$sth = $this->db->prepare($query);
785 785
 		$sth->execute();
786 786
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -796,13 +796,13 @@  discard block
 block discarded – undo
796 796
 	{
797 797
 		global $globalDBdriver, $globalTimezone;
798 798
 		if ($globalDBdriver == 'mysql') {
799
-			$query  = 'SELECT marine_live.ident FROM marine_live 
799
+			$query = 'SELECT marine_live.ident FROM marine_live 
800 800
 				WHERE marine_live.ident = :ident 
801 801
 				AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
802 802
 				AND marine_live.date < UTC_TIMESTAMP()';
803 803
 			$query_data = array(':ident' => $ident);
804 804
 		} else {
805
-			$query  = "SELECT marine_live.ident FROM marine_live 
805
+			$query = "SELECT marine_live.ident FROM marine_live 
806 806
 				WHERE marine_live.ident = :ident 
807 807
 				AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
808 808
 				AND marine_live.date < now() AT TIME ZONE 'UTC'";
@@ -811,8 +811,8 @@  discard block
 block discarded – undo
811 811
 		
812 812
 		$sth = $this->db->prepare($query);
813 813
 		$sth->execute($query_data);
814
-		$ident_result='';
815
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
814
+		$ident_result = '';
815
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
816 816
 		{
817 817
 			$ident_result = $row['ident'];
818 818
 		}
@@ -829,13 +829,13 @@  discard block
 block discarded – undo
829 829
 	{
830 830
 		global $globalDBdriver, $globalTimezone;
831 831
 		if ($globalDBdriver == 'mysql') {
832
-			$query  = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live 
832
+			$query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live 
833 833
 				WHERE marine_live.ident = :ident 
834 834
 				AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; 
835 835
 //				AND marine_live.date < UTC_TIMESTAMP()";
836 836
 			$query_data = array(':ident' => $ident);
837 837
 		} else {
838
-			$query  = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live 
838
+			$query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live 
839 839
 				WHERE marine_live.ident = :ident 
840 840
 				AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'";
841 841
 //				AND marine_live.date < now() AT TIME ZONE 'UTC'";
@@ -844,8 +844,8 @@  discard block
 block discarded – undo
844 844
 		
845 845
 		$sth = $this->db->prepare($query);
846 846
 		$sth->execute($query_data);
847
-		$ident_result='';
848
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
847
+		$ident_result = '';
848
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
849 849
 		{
850 850
 			$ident_result = $row['fammarine_id'];
851 851
 		}
@@ -862,13 +862,13 @@  discard block
 block discarded – undo
862 862
 	{
863 863
 		global $globalDBdriver, $globalTimezone;
864 864
 		if ($globalDBdriver == 'mysql') {
865
-			$query  = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live 
865
+			$query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live 
866 866
 				WHERE marine_live.fammarine_id = :id 
867 867
 				AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; 
868 868
 //				AND marine_live.date < UTC_TIMESTAMP()";
869 869
 			$query_data = array(':id' => $id);
870 870
 		} else {
871
-			$query  = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live 
871
+			$query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live 
872 872
 				WHERE marine_live.fammarine_id = :id 
873 873
 				AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'";
874 874
 //				AND marine_live.date < now() AT TIME ZONE 'UTC'";
@@ -877,8 +877,8 @@  discard block
 block discarded – undo
877 877
 		
878 878
 		$sth = $this->db->prepare($query);
879 879
 		$sth->execute($query_data);
880
-		$ident_result='';
881
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
880
+		$ident_result = '';
881
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
882 882
 		{
883 883
 			$ident_result = $row['fammarine_id'];
884 884
 		}
@@ -895,13 +895,13 @@  discard block
 block discarded – undo
895 895
 	{
896 896
 		global $globalDBdriver, $globalTimezone;
897 897
 		if ($globalDBdriver == 'mysql') {
898
-			$query  = 'SELECT marine_live.fammarine_id FROM marine_live 
898
+			$query = 'SELECT marine_live.fammarine_id FROM marine_live 
899 899
 				WHERE marine_live.mmsi = :mmsi 
900 900
 				AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; 
901 901
 //				AND marine_live.date < UTC_TIMESTAMP()";
902 902
 			$query_data = array(':mmsi' => $mmsi);
903 903
 		} else {
904
-			$query  = "SELECT marine_live.fammarine_id FROM marine_live 
904
+			$query = "SELECT marine_live.fammarine_id FROM marine_live 
905 905
 				WHERE marine_live.mmsi = :mmsi 
906 906
 				AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'";
907 907
 //				AND marine_live.date < now() AT TIME ZONE 'UTC'";
@@ -910,8 +910,8 @@  discard block
 block discarded – undo
910 910
 		
911 911
 		$sth = $this->db->prepare($query);
912 912
 		$sth->execute($query_data);
913
-		$ident_result='';
914
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
913
+		$ident_result = '';
914
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
915 915
 		{
916 916
 			$ident_result = $row['fammarine_id'];
917 917
 		}
@@ -929,7 +929,7 @@  discard block
 block discarded – undo
929 929
 	* @return String success or false
930 930
 	*
931 931
 	*/
932
-	public function addLiveMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $mmsi = '',$type = '',$typeid = '',$imo = '', $callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '',$captain_id = '',$captain_name = '',$race_id = '', $race_name = '')
932
+	public function addLiveMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $mmsi = '', $type = '', $typeid = '', $imo = '', $callsign = '', $arrival_code = '', $arrival_date = '', $status = '', $statusid = '', $noarchive = false, $format_source = '', $source_name = '', $over_country = '', $captain_id = '', $captain_name = '', $race_id = '', $race_name = '')
933 933
 	{
934 934
 		global $globalURL, $globalArchive, $globalDebug;
935 935
 		$Common = new Common();
@@ -981,33 +981,33 @@  discard block
 block discarded – undo
981 981
 		if ($date == '') $date = date("Y-m-d H:i:s", time());
982 982
 
983 983
         
984
-		$fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING);
985
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
986
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
987
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
988
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
989
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
990
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
991
-		$source_name = filter_var($source_name,FILTER_SANITIZE_STRING);
992
-		$over_country = filter_var($over_country,FILTER_SANITIZE_STRING);
993
-		$type = filter_var($type,FILTER_SANITIZE_STRING);
994
-		$typeid = filter_var($typeid,FILTER_SANITIZE_NUMBER_INT);
995
-		$mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT);
996
-		$status = filter_var($status,FILTER_SANITIZE_STRING);
997
-		$statusid = filter_var($statusid,FILTER_SANITIZE_NUMBER_INT);
998
-		$imo = filter_var($imo,FILTER_SANITIZE_STRING);
999
-		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
1000
-		$arrival_code = filter_var($arrival_code,FILTER_SANITIZE_STRING);
1001
-		$arrival_date = filter_var($arrival_date,FILTER_SANITIZE_STRING);
1002
-		$captain_id = filter_var($captain_id,FILTER_SANITIZE_STRING);
1003
-		$captain_name = filter_var($captain_name,FILTER_SANITIZE_STRING);
1004
-		$race_id = filter_var($race_id,FILTER_SANITIZE_STRING);
1005
-		$race_name = filter_var($race_name,FILTER_SANITIZE_STRING);
984
+		$fammarine_id = filter_var($fammarine_id, FILTER_SANITIZE_STRING);
985
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
986
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
987
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
988
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
989
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
990
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
991
+		$source_name = filter_var($source_name, FILTER_SANITIZE_STRING);
992
+		$over_country = filter_var($over_country, FILTER_SANITIZE_STRING);
993
+		$type = filter_var($type, FILTER_SANITIZE_STRING);
994
+		$typeid = filter_var($typeid, FILTER_SANITIZE_NUMBER_INT);
995
+		$mmsi = filter_var($mmsi, FILTER_SANITIZE_NUMBER_INT);
996
+		$status = filter_var($status, FILTER_SANITIZE_STRING);
997
+		$statusid = filter_var($statusid, FILTER_SANITIZE_NUMBER_INT);
998
+		$imo = filter_var($imo, FILTER_SANITIZE_STRING);
999
+		$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
1000
+		$arrival_code = filter_var($arrival_code, FILTER_SANITIZE_STRING);
1001
+		$arrival_date = filter_var($arrival_date, FILTER_SANITIZE_STRING);
1002
+		$captain_id = filter_var($captain_id, FILTER_SANITIZE_STRING);
1003
+		$captain_name = filter_var($captain_name, FILTER_SANITIZE_STRING);
1004
+		$race_id = filter_var($race_id, FILTER_SANITIZE_STRING);
1005
+		$race_name = filter_var($race_name, FILTER_SANITIZE_STRING);
1006 1006
 		if ($typeid == '') $typeid = NULL;
1007 1007
 		if ($statusid == '') $statusid = NULL;
1008 1008
 
1009
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
1010
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
1009
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
1010
+            	if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
1011 1011
             	if ($arrival_date == '') $arrival_date = NULL;
1012 1012
             	$query = '';
1013 1013
 		if ($globalArchive) {
@@ -1016,19 +1016,19 @@  discard block
 block discarded – undo
1016 1016
 		}
1017 1017
 		$query .= 'INSERT INTO marine_live (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, over_country, mmsi, type,type_id,status,status_id,imo,arrival_port_name,arrival_port_date,captain_id,captain_name,race_id,race_name) 
1018 1018
 		    VALUES (:fammarine_id,:ident,:latitude,:longitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:mmsi,:type,:typeid,:status,:statusid,:imo,:arrival_port_name,:arrival_port_date,:captain_id,:captain_name,:race_id,:race_name)';
1019
-		$query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country,':mmsi' => $mmsi,':type' => $type,':typeid' => $typeid,':status' => $status,':statusid' => $statusid,':imo' => $imo,':arrival_port_name' => $arrival_code,':arrival_port_date' => $arrival_date,':captain_id' => $captain_id,':captain_name' => $captain_name,':race_id' => $race_id,':race_name' => $race_name);
1019
+		$query_values = array(':fammarine_id' => $fammarine_id, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country, ':mmsi' => $mmsi, ':type' => $type, ':typeid' => $typeid, ':status' => $status, ':statusid' => $statusid, ':imo' => $imo, ':arrival_port_name' => $arrival_code, ':arrival_port_date' => $arrival_date, ':captain_id' => $captain_id, ':captain_name' => $captain_name, ':race_id' => $race_id, ':race_name' => $race_name);
1020 1020
 		try {
1021 1021
 			$sth = $this->db->prepare($query);
1022 1022
 			$sth->execute($query_values);
1023 1023
 			$sth->closeCursor();
1024
-		} catch(PDOException $e) {
1024
+		} catch (PDOException $e) {
1025 1025
 			return "error : ".$e->getMessage();
1026 1026
 		}
1027 1027
 		
1028 1028
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
1029 1029
 			if ($globalDebug) echo '(Add to Marine archive : ';
1030 1030
 			$MarineArchive = new MarineArchive($this->db);
1031
-			$result =  $MarineArchive->addMarineArchiveData($fammarine_id, $ident, $latitude, $longitude, $heading, $groundspeed, $date, $putinarchive, $mmsi,$type,$typeid,$imo, $callsign,$arrival_code,$arrival_date,$status,$statusid,$noarchive,$format_source, $source_name, $over_country,$captain_id,$captain_name,$race_id,$race_name);
1031
+			$result = $MarineArchive->addMarineArchiveData($fammarine_id, $ident, $latitude, $longitude, $heading, $groundspeed, $date, $putinarchive, $mmsi, $type, $typeid, $imo, $callsign, $arrival_code, $arrival_date, $status, $statusid, $noarchive, $format_source, $source_name, $over_country, $captain_id, $captain_name, $race_id, $race_name);
1032 1032
 			if ($globalDebug) echo $result.')';
1033 1033
 		}
1034 1034
 		return "success";
@@ -1036,7 +1036,7 @@  discard block
 block discarded – undo
1036 1036
 
1037 1037
 	public function getOrderBy()
1038 1038
 	{
1039
-		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY marine_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY marine_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY marine_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY marine_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY marine_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY marine_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY marine_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY marine_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY marine_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY marine_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY marine_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY marine_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY marine_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY marine_live.date DESC"));
1039
+		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY marine_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY marine_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY marine_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY marine_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY marine_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY marine_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY marine_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY marine_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY marine_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY marine_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY marine_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY marine_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY marine_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY marine_live.date DESC"));
1040 1040
 		return $orderby;
1041 1041
 	}
1042 1042
 
Please login to merge, or discard this patch.
Braces   +140 added lines, -47 removed lines patch added patch discarded remove patch
@@ -8,7 +8,9 @@  discard block
 block discarded – undo
8 8
 	public function __construct($dbc = null) {
9 9
 		$Connection = new Connection($dbc);
10 10
 		$this->db = $Connection->db();
11
-		if ($this->db === null) die('Error: No DB connection. (MarineLive)');
11
+		if ($this->db === null) {
12
+			die('Error: No DB connection. (MarineLive)');
13
+		}
12 14
 	}
13 15
 
14 16
 
@@ -30,7 +32,9 @@  discard block
 block discarded – undo
30 32
 		if (isset($filter[0]['source'])) {
31 33
 			$filters = array_merge($filters,$filter);
32 34
 		}
33
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
35
+		if (is_array($globalFilter)) {
36
+			$filter = array_merge($filter,$globalFilter);
37
+		}
34 38
 		$filter_query_join = '';
35 39
 		$filter_query_where = '';
36 40
 		foreach($filters as $flt) {
@@ -86,8 +90,11 @@  discard block
 block discarded – undo
86 90
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
87 91
 			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
88 92
 		}
89
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
90
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
93
+		if ($filter_query_where == '' && $where) {
94
+			$filter_query_where = ' WHERE';
95
+		} elseif ($filter_query_where != '' && $and) {
96
+			$filter_query_where .= ' AND';
97
+		}
91 98
 		if ($filter_query_where != '') {
92 99
 			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
93 100
 		}
@@ -128,9 +135,13 @@  discard block
 block discarded – undo
128 135
 				$orderby_query = ' '.$search_orderby_array[$sort]['sql'];
129 136
 			}
130 137
 		}
131
-		if ($orderby_query == '') $orderby_query= ' ORDER BY date DESC';
138
+		if ($orderby_query == '') {
139
+			$orderby_query= ' ORDER BY date DESC';
140
+		}
132 141
 
133
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
142
+		if (!isset($globalLiveInterval)) {
143
+			$globalLiveInterval = '200';
144
+		}
134 145
 		if ($globalDBdriver == 'mysql') {
135 146
 			//$query  = "SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate";
136 147
 			$query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate'.$filter_query.$orderby_query;
@@ -155,7 +166,9 @@  discard block
 block discarded – undo
155 166
 
156 167
 		$filter_query = $this->getFilter($filter,true,true);
157 168
 
158
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
169
+		if (!isset($globalLiveInterval)) {
170
+			$globalLiveInterval = '200';
171
+		}
159 172
 		if ($globalDBdriver == 'mysql') {
160 173
 			$query  = 'SELECT marine_live.mmsi, marine_live.ident, marine_live.type,marine_live.fammarine_id, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name 
161 174
 			FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate'.$filter_query." marine_live.latitude <> 0 AND marine_live.longitude <> 0";
@@ -197,58 +210,96 @@  discard block
 block discarded – undo
197 210
 		$id = filter_var($id,FILTER_SANITIZE_STRING);
198 211
 		$filter_query = $this->getFilter($filter,true,true);
199 212
 
200
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
201
-		if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') $globalMap3DMarinesLimit = '300';
213
+		if (!isset($globalLiveInterval)) {
214
+			$globalLiveInterval = '200';
215
+		}
216
+		if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') {
217
+			$globalMap3DMarinesLimit = '300';
218
+		}
202 219
 		if ($globalDBdriver == 'mysql') {
203 220
 			if (isset($globalArchive) && $globalArchive === TRUE) {
204 221
 				$query  = 'SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id,marine_archive.type_id,marine_archive.type, marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source, marine_archive.captain_name 
205 222
 				    FROM marine_archive INNER JOIN (SELECT fammarine_id FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date) l ON l.fammarine_id = marine_archive.fammarine_id ";
206
-				if ($usecoord) $query .= "AND marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
207
-				if ($id != '') $query .= "OR marine_archive.fammarine_id = :id ";
223
+				if ($usecoord) {
224
+					$query .= "AND marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
225
+				}
226
+				if ($id != '') {
227
+					$query .= "OR marine_archive.fammarine_id = :id ";
228
+				}
208 229
 				$query .= "UNION
209 230
 				    SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name 
210 231
 				    FROM marine_live".$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date";
211
-				if ($usecoord) $query .= " AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong;
212
-				if ($id != '') $query .= "OR marine_live.fammarine_id = :id ";
232
+				if ($usecoord) {
233
+					$query .= " AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong;
234
+				}
235
+				if ($id != '') {
236
+					$query .= "OR marine_live.fammarine_id = :id ";
237
+				}
213 238
 				$query .= ") AS marine 
214 239
 				    WHERE latitude <> '0' AND longitude <> '0' 
215 240
 				    ORDER BY fammarine_id, date";
216
-				if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit;
241
+				if ($limit) {
242
+					$query .= " LIMIT ".$globalMap3DMarinesLimit;
243
+				}
217 244
 			} else {
218 245
 				$query  = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name 
219 246
 				    FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date ";
220
-				if ($usecoord) $query .= "AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
221
-				if ($id != '') $query .= "OR marine_live.fammarine_id = :id ";
247
+				if ($usecoord) {
248
+					$query .= "AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
249
+				}
250
+				if ($id != '') {
251
+					$query .= "OR marine_live.fammarine_id = :id ";
252
+				}
222 253
 				$query .= "AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' 
223 254
 				ORDER BY marine_live.fammarine_id, marine_live.date";
224
-				if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit;
255
+				if ($limit) {
256
+					$query .= " LIMIT ".$globalMap3DMarinesLimit;
257
+				}
225 258
 			}
226 259
 		} else {
227 260
 			if (isset($globalArchive) && $globalArchive === TRUE) {
228 261
 				$query  = "SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id, marine_archive.type_id, marine_archive.type,marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source, marine_archive.captain_name 
229 262
 				    FROM marine_archive INNER JOIN (SELECT fammarine_id FROM marine_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date) l ON l.fammarine_id = marine_archive.fammarine_id ";
230
-				if ($usecoord) $query .= "AND (marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
231
-				if ($id != '') $query .= "OR marine_archive.fammarine_id = :id ";
263
+				if ($usecoord) {
264
+					$query .= "AND (marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
265
+				}
266
+				if ($id != '') {
267
+					$query .= "OR marine_archive.fammarine_id = :id ";
268
+				}
232 269
 				$query .= "UNION
233 270
 				    SELECT marine_live.ident, marine_live.fammarine_id, marine_live.type_id, marine_live.type,marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name 
234 271
 				    FROM marine_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date";
235
-				if ($usecoord) $query .= " AND (marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")";
236
-				if ($id != '') $query .= " OR marine_live.fammarine_id = :id";
272
+				if ($usecoord) {
273
+					$query .= " AND (marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")";
274
+				}
275
+				if ($id != '') {
276
+					$query .= " OR marine_live.fammarine_id = :id";
277
+				}
237 278
 				$query .= ") AS marine WHERE latitude <> '0' AND longitude <> '0' ";
238 279
 				$query .= "ORDER BY fammarine_id, date";
239
-				if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit;
280
+				if ($limit) {
281
+					$query .= " LIMIT ".$globalMap3DMarinesLimit;
282
+				}
240 283
 			} else {
241 284
 				$query  = "SELECT marine_live.ident, marine_live.fammarine_id, marine_live.type_id, marine_live.type,marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name 
242 285
 				    FROM marine_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date ";
243
-				if ($usecoord) $query .= "AND (marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
244
-				if ($id != '') $query .= "OR marine_live.fammarine_id = :id ";
286
+				if ($usecoord) {
287
+					$query .= "AND (marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
288
+				}
289
+				if ($id != '') {
290
+					$query .= "OR marine_live.fammarine_id = :id ";
291
+				}
245 292
 				$query .= "AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' 
246 293
 				ORDER BY marine_live.fammarine_id, marine_live.date";
247
-				if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit;
294
+				if ($limit) {
295
+					$query .= " LIMIT ".$globalMap3DMarinesLimit;
296
+				}
248 297
 			}
249 298
 		}
250 299
 		$query_values = array();
251
-		if ($id != '') $query_values = array(':id' => $id);
300
+		if ($id != '') {
301
+			$query_values = array(':id' => $id);
302
+		}
252 303
 		try {
253 304
 			$sth = $this->db->prepare($query);
254 305
 			$sth->execute($query_values);
@@ -271,7 +322,9 @@  discard block
 block discarded – undo
271 322
 		global $globalDBdriver, $globalLiveInterval;
272 323
 		$filter_query = $this->getFilter($filter,true,true);
273 324
 
274
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
325
+		if (!isset($globalLiveInterval)) {
326
+			$globalLiveInterval = '200';
327
+		}
275 328
 		if ($globalDBdriver == 'mysql') {
276 329
 			$query = 'SELECT COUNT(DISTINCT marine_live.fammarine_id) as nb FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
277 330
 		} else {
@@ -299,7 +352,9 @@  discard block
 block discarded – undo
299 352
 	{
300 353
 		global $globalDBdriver, $globalLiveInterval;
301 354
 		$Marine = new Marine($this->db);
302
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
355
+		if (!isset($globalLiveInterval)) {
356
+			$globalLiveInterval = '200';
357
+		}
303 358
 		$filter_query = $this->getFilter($filter);
304 359
 
305 360
 		if (is_array($coord)) {
@@ -307,7 +362,9 @@  discard block
 block discarded – undo
307 362
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
308 363
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
309 364
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
310
-		} else return array();
365
+		} else {
366
+			return array();
367
+		}
311 368
 		if ($globalDBdriver == 'mysql') {
312 369
 			$query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate AND marine_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND marine_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY marine_live.fammarine_id ORDER BY date DESC'.$filter_query;
313 370
 		} else {
@@ -327,7 +384,9 @@  discard block
 block discarded – undo
327 384
 	{
328 385
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
329 386
 		$Marine = new Marine($this->db);
330
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
387
+		if (!isset($globalLiveInterval)) {
388
+			$globalLiveInterval = '200';
389
+		}
331 390
 		$filter_query = $this->getFilter($filter,true,true);
332 391
 
333 392
 		if (is_array($coord)) {
@@ -335,7 +394,9 @@  discard block
 block discarded – undo
335 394
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
336 395
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
337 396
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
338
-		} else return array();
397
+		} else {
398
+			return array();
399
+		}
339 400
 		/*
340 401
 		if ($globalDBdriver == 'mysql') {
341 402
 			$query  = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source 
@@ -558,11 +619,15 @@  discard block
 block discarded – undo
558 619
 		//$query  = self::$global_query.' WHERE marine_live.fammarine_id = :id ORDER BY date';
559 620
 		if ($globalDBdriver == 'mysql') {
560 621
 			$query = 'SELECT marine_live.* FROM marine_live WHERE marine_live.fammarine_id = :id';
561
-			if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
622
+			if ($liveinterval) {
623
+				$query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
624
+			}
562 625
 			$query .= ' ORDER BY date';
563 626
 		} else {
564 627
 			$query = 'SELECT marine_live.* FROM marine_live WHERE marine_live.fammarine_id = :id';
565
-			if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
628
+			if ($liveinterval) {
629
+				$query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
630
+			}
566 631
 			$query .= ' ORDER BY date';
567 632
 		}
568 633
 
@@ -657,7 +722,9 @@  discard block
 block discarded – undo
657 722
 				$i++;
658 723
 				$j++;
659 724
 				if ($j == 30) {
660
-					if ($globalDebug) echo ".";
725
+					if ($globalDebug) {
726
+						echo ".";
727
+					}
661 728
 				    	try {
662 729
 						
663 730
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
@@ -951,7 +1018,9 @@  discard block
 block discarded – undo
951 1018
 			{
952 1019
 				return false;
953 1020
 			}
954
-		} else return '';
1021
+		} else {
1022
+			return '';
1023
+		}
955 1024
 
956 1025
 		if ($longitude != '')
957 1026
 		{
@@ -959,7 +1028,9 @@  discard block
 block discarded – undo
959 1028
 			{
960 1029
 				return false;
961 1030
 			}
962
-		} else return '';
1031
+		} else {
1032
+			return '';
1033
+		}
963 1034
 
964 1035
 
965 1036
 		if ($heading != '')
@@ -968,7 +1039,9 @@  discard block
 block discarded – undo
968 1039
 			{
969 1040
 				return false;
970 1041
 			}
971
-		} else $heading = 0;
1042
+		} else {
1043
+			$heading = 0;
1044
+		}
972 1045
 
973 1046
 		if ($groundspeed != '')
974 1047
 		{
@@ -976,9 +1049,13 @@  discard block
 block discarded – undo
976 1049
 			{
977 1050
 				return false;
978 1051
 			}
979
-		} else $groundspeed = 0;
1052
+		} else {
1053
+			$groundspeed = 0;
1054
+		}
980 1055
 		date_default_timezone_set('UTC');
981
-		if ($date == '') $date = date("Y-m-d H:i:s", time());
1056
+		if ($date == '') {
1057
+			$date = date("Y-m-d H:i:s", time());
1058
+		}
982 1059
 
983 1060
         
984 1061
 		$fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING);
@@ -1003,15 +1080,27 @@  discard block
 block discarded – undo
1003 1080
 		$captain_name = filter_var($captain_name,FILTER_SANITIZE_STRING);
1004 1081
 		$race_id = filter_var($race_id,FILTER_SANITIZE_STRING);
1005 1082
 		$race_name = filter_var($race_name,FILTER_SANITIZE_STRING);
1006
-		if ($typeid == '') $typeid = NULL;
1007
-		if ($statusid == '') $statusid = NULL;
1083
+		if ($typeid == '') {
1084
+			$typeid = NULL;
1085
+		}
1086
+		if ($statusid == '') {
1087
+			$statusid = NULL;
1088
+		}
1008 1089
 
1009
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
1010
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
1011
-            	if ($arrival_date == '') $arrival_date = NULL;
1090
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) {
1091
+            		$groundspeed = 0;
1092
+            	}
1093
+            	if ($heading == '' || $Common->isInteger($heading) === false ) {
1094
+            		$heading = 0;
1095
+            	}
1096
+            	if ($arrival_date == '') {
1097
+            		$arrival_date = NULL;
1098
+            	}
1012 1099
             	$query = '';
1013 1100
 		if ($globalArchive) {
1014
-			if ($globalDebug) echo '-- Delete previous data -- ';
1101
+			if ($globalDebug) {
1102
+				echo '-- Delete previous data -- ';
1103
+			}
1015 1104
 			$query .= 'DELETE FROM marine_live WHERE fammarine_id = :fammarine_id;';
1016 1105
 		}
1017 1106
 		$query .= 'INSERT INTO marine_live (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, over_country, mmsi, type,type_id,status,status_id,imo,arrival_port_name,arrival_port_date,captain_id,captain_name,race_id,race_name) 
@@ -1026,10 +1115,14 @@  discard block
 block discarded – undo
1026 1115
 		}
1027 1116
 		
1028 1117
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
1029
-			if ($globalDebug) echo '(Add to Marine archive : ';
1118
+			if ($globalDebug) {
1119
+				echo '(Add to Marine archive : ';
1120
+			}
1030 1121
 			$MarineArchive = new MarineArchive($this->db);
1031 1122
 			$result =  $MarineArchive->addMarineArchiveData($fammarine_id, $ident, $latitude, $longitude, $heading, $groundspeed, $date, $putinarchive, $mmsi,$type,$typeid,$imo, $callsign,$arrival_code,$arrival_date,$status,$statusid,$noarchive,$format_source, $source_name, $over_country,$captain_id,$captain_name,$race_id,$race_name);
1032
-			if ($globalDebug) echo $result.')';
1123
+			if ($globalDebug) {
1124
+				echo $result.')';
1125
+			}
1033 1126
 		}
1034 1127
 		return "success";
1035 1128
 	}
Please login to merge, or discard this patch.
marine-data.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -9,15 +9,15 @@  discard block
 block discarded – undo
9 9
 
10 10
 $from_archive = false;
11 11
 if (isset($_GET['ident'])) {
12
-	$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
12
+	$ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING);
13 13
 	if (isset($_GET['currenttime'])) {
14
-		$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
14
+		$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT);
15 15
 		$currenttime = round($currenttime/1000);
16
-		$spotter_array = $MarineLive->getDateLiveMarineDataByIdent($ident,$currenttime);
16
+		$spotter_array = $MarineLive->getDateLiveMarineDataByIdent($ident, $currenttime);
17 17
 		
18 18
 		if (empty($spotter_array)) {
19 19
 			$from_archive = true;
20
-			$spotter_array = $MarineArchive->getDateArchiveMarineDataByIdent($ident,$currenttime);
20
+			$spotter_array = $MarineArchive->getDateArchiveMarineDataByIdent($ident, $currenttime);
21 21
 		}
22 22
 		
23 23
 	} else {
@@ -31,16 +31,16 @@  discard block
 block discarded – undo
31 31
 	}
32 32
 }
33 33
 if (isset($_GET['fammarine_id'])) {
34
-	$fammarine_id = filter_input(INPUT_GET,'fammarine_id',FILTER_SANITIZE_STRING);
34
+	$fammarine_id = filter_input(INPUT_GET, 'fammarine_id', FILTER_SANITIZE_STRING);
35 35
 	if (isset($_GET['currenttime'])) {
36
-		$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
36
+		$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT);
37 37
 		$currenttime = round($currenttime/1000);
38
-		$spotter_array = $MarineLive->getDateLiveMarineDataById($fammarine_id,$currenttime);
38
+		$spotter_array = $MarineLive->getDateLiveMarineDataById($fammarine_id, $currenttime);
39 39
 		
40 40
 		if (empty($spotter_array)) {
41 41
 			$from_archive = true;
42 42
 //			$spotter_array = $SpotterArchive->getLastArchiveSpotterDataById($flightaware_id);
43
-			$spotter_array = $MarineArchive->getDateArchiveMarineDataById($fammarine_id,$currenttime);
43
+			$spotter_array = $MarineArchive->getDateArchiveMarineDataById($fammarine_id, $currenttime);
44 44
 		}
45 45
 		
46 46
 	} else {
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 if (isset($spotter_item['image_thumbnail']) && $spotter_item['image_thumbnail'] != "")
63 63
 {
64 64
 	if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') {
65
-		$image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
65
+		$image = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']);
66 66
 	} else $image = $spotter_item['image_thumbnail'];
67 67
 
68 68
 }
Please login to merge, or discard this patch.
index.php 2 patches
Indentation   +104 added lines, -104 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
     <?php }; if (isset($globalSatellite) && $globalSatellite) { ?><td><div id="ibxsatellite"><h4><?php echo _("Satellites Displayed"); ?></h4><br /><i class="fa fa-spinner fa-pulse fa-fw"></i></div></td><?php } ?>
51 51
 </tr></table></div>
52 52
 <?php
53
-    if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
53
+	if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
54 54
 ?>
55 55
 <script src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) print '?tsk='.$tsk; ?>"></script>
56 56
 <?php
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 <script src="<?php echo $globalURL; ?>/js/map-marine.3d.js.php"></script>
75 75
 <?php
76 76
 	}
77
-    }
77
+	}
78 78
 ?>
79 79
 
80 80
 <div id="sidebar" class="sidebar collapsed">
@@ -85,13 +85,13 @@  discard block
 block discarded – undo
85 85
 	<li><a href="" onclick="getUserLocation(); return false;" title="<?php echo _("Plot your Location"); ?>"><i class="fa fa-map-marker"></i></a></li>
86 86
 	<li><a href="" onclick="getCompassDirection(); return false;" title="<?php echo _("Compass Mode"); ?>"><i class="fa fa-compass"></i></a></li>
87 87
 <?php
88
-    //if ((isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') || (isset($globalBeta) && $globalBeta === TRUE)) {
88
+	//if ((isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') || (isset($globalBeta) && $globalBeta === TRUE)) {
89 89
 	if (isset($globalArchive) && $globalArchive == TRUE && (!isset($globalAircraft) || $globalAircraft === TRUE)) {
90 90
 ?>
91 91
 	<li><a href="#archive" role="tab" title="<?php echo _("Archive"); ?>"><i class="fa fa-archive"></i></a></li>
92 92
 <?php
93 93
 	}
94
-    //}
94
+	//}
95 95
 ?>
96 96
 	<li><a href="#home" role="tab" title="<?php echo _("Layers"); ?>"><i class="fa fa-map"></i></a></li>
97 97
 	<li><a href="#filters" role="tab" title="<?php echo _("Filters"); ?>"><i class="fa fa-filter"></i></a></li>
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 ?>
106 106
 
107 107
 <?php
108
-    if (isset($globalMap3D) && $globalMap3D) {
108
+	if (isset($globalMap3D) && $globalMap3D) {
109 109
 	if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
110 110
 ?>
111 111
 	<li><a href="" onclick="show3D(); return false;" role="tab" title="3D"><b>3D</b></a></li>
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 	<li><a href="" onclick="show2D(); return false;" role="tab" title="2D"><b>2D</b></a></li>
116 116
 <?php
117 117
 	}
118
-    }
118
+	}
119 119
 ?>
120 120
     </ul>
121 121
 
@@ -275,15 +275,15 @@  discard block
 block discarded – undo
275 275
 		    </div>
276 276
 		</li>
277 277
 		<?php
278
-		    if (isset($globalDemo) && $globalDemo) {
278
+			if (isset($globalDemo) && $globalDemo) {
279 279
 		?>
280 280
 		<li><button type="button" class="btn btn-primary disabled"><?php echo _("Show archive"); ?></button> Disabled in Demo mode</li>
281 281
 		<?php
282
-		    } else {
282
+			} else {
283 283
 		?>
284 284
 		<li><button type="button" onclick="addarchive(begindate,enddate);" class="btn btn-primary"><?php echo _("Show archive"); ?></button></li>
285 285
 		<?php
286
-		    }
286
+			}
287 287
 		?>
288 288
 	    </ul>
289 289
 	    <ul>
@@ -302,83 +302,83 @@  discard block
 block discarded – undo
302 302
 				if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
303 303
 					if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider;
304 304
 					else $MapType = $_COOKIE['MapType'];
305
-			    ?>
305
+				?>
306 306
 			<select  class="selectpicker" onchange="mapType(this);">
307 307
 			    <?php
308 308
 				} else {
309 309
 					if (!isset($_COOKIE['MapType3D']) || $_COOKIE['MapType3D'] == '') $MapType = $globalMapProvider;
310 310
 					else $MapType = $_COOKIE['MapType3D'];
311
-			    ?>
311
+				?>
312 312
 			<select  class="selectpicker" onchange="mapType3D(this);">
313 313
 			    <?php
314 314
 				}
315
-			    ?>
315
+				?>
316 316
 			    <?php
317 317
 				if (isset($globalMapOffline) && $globalMapOffline === TRUE) {
318
-			    ?>
318
+				?>
319 319
 			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option>
320 320
 			    <?php
321 321
 				} else {
322
-				    if (file_exists(dirname(__FILE__).'/js/Cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml')) {
323
-			    ?>
322
+					if (file_exists(dirname(__FILE__).'/js/Cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml')) {
323
+				?>
324 324
 			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option>
325 325
 			    <?php
326
-				    }
327
-			    ?>
326
+					}
327
+				?>
328 328
 			    <option value="ArcGIS-Streetmap"<?php if ($MapType == 'ArcGIS-Streetmap') print ' selected'; ?>>ArcGIS Streetmap</option>
329 329
 			    <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Satellite') print ' selected'; ?>>ArcGIS Satellite</option>
330 330
 			    <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Ocean') print ' selected'; ?>>ArcGIS Ocean</option>
331 331
 			    <?php
332
-				    if (isset($globalBingMapKey) && $globalBingMapKey != '') {
333
-			    ?>
332
+					if (isset($globalBingMapKey) && $globalBingMapKey != '') {
333
+				?>
334 334
 			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option>
335 335
 			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option>
336 336
 			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option>
337 337
 			    <?php
338
-				    }
339
-			    ?>
338
+					}
339
+				?>
340 340
 			    <?php
341
-				    if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
342
-			    ?>
341
+					if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
342
+				?>
343 343
 			    <?php
344 344
 					if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
345
-			    ?>
345
+				?>
346 346
 			    <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option>
347 347
 			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option>
348 348
 			    <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option>
349 349
 			    <?php
350 350
 					}
351
-			    ?>
351
+				?>
352 352
 			    <?php
353 353
 					if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
354
-			    ?>
354
+				?>
355 355
 			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option>
356 356
 			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option>
357 357
 			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option>
358 358
 			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option>
359 359
 			    <?php
360 360
 					}
361
-			    ?>
361
+				?>
362 362
 			    <?php
363 363
 					if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
364
-			    ?>
364
+				?>
365 365
 			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option>
366 366
 			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option>
367 367
 			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option>
368 368
 			    <?php
369 369
 					}
370
-			    ?>
370
+				?>
371 371
 			    <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option>
372 372
 			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth</option>
373 373
 			    <?php
374
-				    }
375
-			    ?>
374
+					}
375
+				?>
376 376
 			    <option value="NatGeo-Street"<?php if ($MapType == 'NatGeo-Street') print ' selected'; ?>>National Geographic Street</option>
377 377
 			    <?php
378
-				    if (isset($globalMapboxToken) && $globalMapboxToken != '') {
378
+					if (isset($globalMapboxToken) && $globalMapboxToken != '') {
379 379
 					if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default';
380 380
 					else $MapBoxId = $_COOKIE['MapTypeId'];
381
-			    ?>
381
+				?>
382 382
 			    <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') print ' selected'; ?>>Mapbox GL</option>
383 383
 			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option>
384 384
 			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option>
@@ -393,17 +393,17 @@  discard block
 block discarded – undo
393 393
 			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option>
394 394
 			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option>
395 395
 			    <?php
396
-				    }
397
-			    ?>
396
+					}
397
+				?>
398 398
 			    <!--<option value="OpenSeaMap"<?php if ($MapType == 'OpenSeaMap') print ' selected'; ?>>OpenSeaMap</option>-->
399 399
 			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option>
400 400
 			    <?php
401 401
 				}
402
-			    ?>
402
+				?>
403 403
 			</select>
404 404
 		    </li>
405 405
 <?php
406
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d' && (!isset($globalMapOffline) || $globalMapOffline === FALSE)) {
406
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d' && (!isset($globalMapOffline) || $globalMapOffline === FALSE)) {
407 407
 ?>
408 408
 		    <li><?php echo _("Type of Terrain:"); ?>
409 409
 			<select  class="selectpicker" onchange="terrainType(this);">
@@ -414,18 +414,18 @@  discard block
 block discarded – undo
414 414
 			</select>
415 415
 		    </li>
416 416
 <?php
417
-    }
417
+	}
418 418
 ?>
419 419
 
420 420
 <?php
421
-    if (isset($globalMap3D) && $globalMap3D) {
421
+	if (isset($globalMap3D) && $globalMap3D) {
422 422
 ?>
423 423
 		    <li><div class="checkbox"><label><input type="checkbox" name="synchro2d3d" value="1" onclick="clickSyncMap2D3D(this)" <?php if (isset($_COOKIE['Map2D3DSync']) && $_COOKIE['Map2D3DSync'] == 'true') print 'checked'; ?> ><?php echo _("Use same type of map for 2D & 3D"); ?></label></div></li>
424 424
 <?php
425
-    }
425
+	}
426 426
 ?>
427 427
 <?php
428
-    if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
428
+	if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
429 429
 ?>
430 430
 		    <li><div class="checkbox"><label><input type="checkbox" name="display2dbuildings" value="1" onclick="clickDisplay2DBuildings(this)" <?php if (isset($_COOKIE['Map2DBuildings']) && $_COOKIE['Map2DBuildings'] == 'true') print 'checked'; ?> ><?php echo _("Display 2.5D buidings on map"); ?></label></div></li>
431 431
 
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
 		    <li><div class="checkbox"><label><input type="checkbox" name="satelliteestimation" value="1" onclick="clickSatelliteEstimation(this)" <?php if ((isset($_COOKIE['satelliteestimation']) && $_COOKIE['satelliteestimation'] == 'true') || (!isset($_COOKIE['satelliteestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['satelliteestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Satellites animate between updates"); ?></label></div></li>
449 449
 <?php
450 450
 	}
451
-    }
451
+	}
452 452
 ?>
453 453
 		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true' || !isset($_COOKIE['displayairports'])) print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li>
454 454
 		    <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) print 'checked'; ?> ><?php echo _("Display ground station on map"); ?></label></div></li>
@@ -467,82 +467,82 @@  discard block
 block discarded – undo
467 467
 	}
468 468
 ?>
469 469
 <?php
470
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
470
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
471 471
 ?>
472 472
 		    <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>
473 473
 		    <li><div class="checkbox"><label><input type="checkbox" name="shadows" value="1" onclick="clickShadows(this)" <?php if ((!isset($_COOKIE['map3dnoshadows']) && (!isset($globalMap3DShadows) || $globalMap3DShadows)) || (isset($_COOKIE['map3dnoshadows']) && $_COOKIE['map3dnoshadows'] == 'false')) print 'checked'; ?> ><?php echo _("Use shadows"); ?></label></div></li>
474 474
 		    <li><div class="checkbox"><label><input type="checkbox" name="one3dmodel" value="1" onclick="useOne3Dmodel(this)" <?php if ((isset($_COOKIE['one3dmodel']) && $_COOKIE['one3dmodel'] == 'true') || (!isset($_COOKIE['one3dmodel']) && isset($globalMap3DOneModel) && $globalMap3DOneModel)) print 'checked'; ?> ><?php echo _("Use same 3D model for all aircraft (use fewer resources)"); ?></label></div></li>
475 475
 		    <li><div class="checkbox"><label><input type="checkbox" name="updaterealtime" value="1" onclick="clickUpdateRealtime(this)" <?php if ((isset($_COOKIE['updaterealtime']) && $_COOKIE['updaterealtime'] == 'true') || !isset($_COOKIE['updaterealtime'])) print 'checked'; ?> ><?php echo _("Display realtime data in infobox"); ?></label></div></li>
476 476
 <?php
477
-    }
478
-    if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
477
+	}
478
+	if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
479 479
 ?>
480 480
 		    <li><div class="checkbox"><label><input type="checkbox" name="displaysanta" value="1" onclick="clickSanta(this)"><i class="fa fa-snowflake-o" aria-hidden="true"></i> <?php echo _("Show Santa Claus now"); ?> <i class="fa fa-snowflake-o" aria-hidden="true"></i></label></div></li>
481 481
 <?php
482
-    }
482
+	}
483 483
 ?>
484 484
 		    <?php
485 485
 			if (function_exists('array_column')) {
486
-			    if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
487
-		    ?>
486
+				if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
487
+			?>
488 488
 		    <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>
489 489
 		    <?php
490
-			    }
490
+				}
491 491
 			} elseif (isset($globalSources)) {
492
-			    $dispolar = false;
493
-			    foreach ($globalSources as $testsource) {
494
-			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
495
-			    }
496
-			    if ($dispolar) {
497
-		    ?>
492
+				$dispolar = false;
493
+				foreach ($globalSources as $testsource) {
494
+					if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
495
+				}
496
+				if ($dispolar) {
497
+			?>
498 498
 		    <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>
499 499
 		    <?php
500
-			    }
501
-		        }
502
-		    ?>
500
+				}
501
+				}
502
+			?>
503 503
 <?php
504
-    if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
504
+	if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
505 505
 ?>
506 506
 
507 507
 		    <?php
508 508
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
509
-		    	    if (extension_loaded('gd') && function_exists('gd_info')) {
510
-		    ?>
509
+					if (extension_loaded('gd') && function_exists('gd_info')) {
510
+			?>
511 511
 		    <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>
512 512
 		    <?php 
513 513
 				if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') {
514
-		    ?>
514
+			?>
515 515
 			<li><?php echo _("Aircraft icon color:"); ?><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'; ?>"></li>
516 516
 		    <?php
517 517
 				}
518
-			    }
519
-		        }
520
-		    ?>
518
+				}
519
+				}
520
+			?>
521 521
 		    <?php
522 522
 			if (isset($globalMarine) && $globalMarine === TRUE) {
523
-			    if (extension_loaded('gd') && function_exists('gd_info')) {
524
-		    ?>
523
+				if (extension_loaded('gd') && function_exists('gd_info')) {
524
+			?>
525 525
 		    <li><?php echo _("Marine icon color:"); ?>
526 526
 			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print '1a3151'; ?>">
527 527
 		    </li>
528 528
 		    <?php
529
-			    }
530
-		        }
531
-		    ?>
529
+				}
530
+				}
531
+			?>
532 532
 		    <?php
533 533
 			if (isset($globalTracker) && $globalTracker === TRUE) {
534
-			    if (extension_loaded('gd') && function_exists('gd_info')) {
535
-		    ?>
534
+				if (extension_loaded('gd') && function_exists('gd_info')) {
535
+			?>
536 536
 		    <li><?php echo _("Tracker icon color:"); ?>
537 537
 			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) print $_COOKIE['TrackerIconColor']; elseif (isset($globalTrackerIconColor)) print $globalTrackerIconColor; else print '1a3151'; ?>">
538 538
 		    </li>
539 539
 		    <?php
540
-			    }
541
-		        }
542
-		    ?>
540
+				}
541
+				}
542
+			?>
543 543
 		    <?php
544 544
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
545
-		    ?>
545
+			?>
546 546
 		    <li><?php echo _("Show airport icon at zoom level:"); ?>
547 547
 			<div class="range">
548 548
 			    <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'; ?>">
@@ -551,9 +551,9 @@  discard block
 block discarded – undo
551 551
 		    </li>
552 552
 		    <?php
553 553
 			}
554
-		    ?>
554
+			?>
555 555
 <?php
556
-    } elseif (isset($_COOKIE['MapFormat']) || $_COOKIE['MapFOrmat'] == '3d') {
556
+	} elseif (isset($_COOKIE['MapFormat']) || $_COOKIE['MapFOrmat'] == '3d') {
557 557
 ?>
558 558
 		    <li><?php echo _("Set scaling factor for rendering resolution:"); ?>
559 559
 			<div class="range">
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
 		    </li>
592 592
 <?php
593 593
 	}
594
-    }
594
+	}
595 595
 ?>
596 596
 		    <li><?php echo _("Distance unit:"); ?>
597 597
 			<select class="selectpicker" onchange="unitdistance(this);">
@@ -624,19 +624,19 @@  discard block
 block discarded – undo
624 624
 		    <ul>
625 625
 		    <?php
626 626
 			if (!isset($globalAircraft) || $globalAircraft) {
627
-		    ?>
627
+			?>
628 628
 		    <?php
629 629
 			if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) {
630
-		    ?>
630
+			?>
631 631
 			<?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 } ?>
632 632
 			<?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 } ?>
633 633
 			<?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 } ?>
634 634
 		    <?php
635 635
 			}
636
-		    ?>
636
+			?>
637 637
 		    <?php
638 638
 			if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) {
639
-		    ?>
639
+			?>
640 640
 			<?php if (isset($globalSBS1) && $globalSBS1) { ?>
641 641
 			    <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>
642 642
 			<?php } ?>
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
 			<?php } ?>
646 646
 		    <?php
647 647
 			}
648
-		    ?>
648
+			?>
649 649
 		    <li><?php echo _("Display airlines:"); ?>
650 650
 		    <br/>
651 651
 			<select class="selectpicker" multiple onchange="airlines(this);" id="display_airlines">
@@ -665,14 +665,14 @@  discard block
 block discarded – undo
665 665
 						echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>';
666 666
 					}
667 667
 				}
668
-			    ?>
668
+				?>
669 669
 			</select>
670 670
 		    </li>
671 671
 		    <?php
672 672
 			$Spotter = new Spotter();
673 673
 			$allalliancenames = $Spotter->getAllAllianceNames();
674 674
 			if (!empty($allalliancenames)) {
675
-		    ?>
675
+			?>
676 676
 		    <li><?php echo _("Display alliance:"); ?>
677 677
 		    <br/>
678 678
 			<select class="selectpicker" onchange="alliance(this);" id="display_alliance">
@@ -686,18 +686,18 @@  discard block
 block discarded – undo
686 686
 						echo '<option value="'.$alliance_name.'">'.$alliance_name.'</option>';
687 687
 					}
688 688
 				}
689
-			    ?>
689
+				?>
690 690
 			</select>
691 691
 		    </li>
692 692
 		    <?php
693 693
 			}
694
-		    ?>
694
+			?>
695 695
 		    <?php
696 696
 			}
697
-		    ?>
697
+			?>
698 698
 		    <?php
699 699
 			if (isset($globalAPRS) && $globalAPRS) {
700
-		    ?>
700
+			?>
701 701
 		    <li><?php echo _("Display APRS sources name:"); ?>
702 702
 			<select class="selectpicker" multiple onchange="sources(this);">
703 703
 			    <?php
@@ -721,18 +721,18 @@  discard block
 block discarded – undo
721 721
 						echo '<option value="'.$src['name'].'">'.$src['name'].'</option>';
722 722
 					}
723 723
 				}
724
-			    ?>
724
+				?>
725 725
 			</select>
726 726
 		    </li>
727 727
 		    <?php
728 728
 			}
729
-		    ?>
729
+			?>
730 730
 		    <?php
731 731
 			if (!isset($globalAircraft) || $globalAircraft) {
732
-		    ?>
732
+			?>
733 733
 		    <?php
734
-			    if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS)) {
735
-		    ?>
734
+				if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS)) {
735
+			?>
736 736
 		    <li><?php echo _("Display airlines of type:"); ?><br/>
737 737
 			<select class="selectpicker" onchange="airlinestype(this);">
738 738
 			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
@@ -742,14 +742,14 @@  discard block
 block discarded – undo
742 742
 			</select>
743 743
 		    </li>
744 744
 		    <?php
745
-			    }
746
-		    ?>
745
+				}
746
+			?>
747 747
 		    <?php
748 748
 			}
749
-		    ?>
749
+			?>
750 750
 		    <?php
751 751
 			if (isset($globalMarine) && $globalMarine) {
752
-		    ?>
752
+			?>
753 753
 		    <li>
754 754
 			<?php echo _("Display vessels with MMSI:"); ?>
755 755
 			<input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) print $_COOKIE['filter_mmsi']; ?>" />
@@ -768,7 +768,7 @@  discard block
 block discarded – undo
768 768
 						foreach ($races as $race) {
769 769
 							print '<option value="'.$race['race_id'].'">'.$race['race_name'].'</option>';
770 770
 						}
771
-			    ?>
771
+				?>
772 772
 			</select>
773 773
 		    </li>
774 774
 
@@ -776,7 +776,7 @@  discard block
 block discarded – undo
776 776
 					}
777 777
 				}
778 778
 			}
779
-		    ?>
779
+			?>
780 780
 		    <li>
781 781
 			<?php echo _("Display with ident:"); ?>
782 782
 			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" />
@@ -789,7 +789,7 @@  discard block
 block discarded – undo
789 789
 	    </form>
790 790
     	</div>
791 791
 <?php
792
-    if (isset($globalSatellite) && $globalSatellite) {
792
+	if (isset($globalSatellite) && $globalSatellite) {
793 793
 ?>
794 794
         <div class="sidebar-pane" id="satellites">
795 795
 	    <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
@@ -829,14 +829,14 @@  discard block
 block discarded – undo
829 829
 						print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>';
830 830
 					}
831 831
 				}
832
-			    ?>
832
+				?>
833 833
 			</select>
834 834
 		    </li>
835 835
 		</ul>
836 836
 	    </form>
837 837
 	</div>
838 838
 <?php
839
-    }
839
+	}
840 840
 ?>
841 841
     </div>
842 842
 </div>
Please login to merge, or discard this patch.
Braces   +558 added lines, -141 removed lines patch added patch discarded remove patch
@@ -52,7 +52,10 @@  discard block
 block discarded – undo
52 52
 <?php
53 53
     if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
54 54
 ?>
55
-<script src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) print '?tsk='.$tsk; ?>"></script>
55
+<script src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) {
56
+	print '?tsk='.$tsk;
57
+}
58
+?>"></script>
56 59
 <?php
57 60
 	if (!isset($globalAircraft) || $globalAircraft) {
58 61
 ?>
@@ -142,7 +145,10 @@  discard block
 block discarded – undo
142 145
 ?>
143 146
 			<h1>Weather</h1>
144 147
 			<ul>
145
-				<li><div class="checkbox"><label><input type="checkbox" name="displayweather" value="1" onclick="clickDisplayWeather(this)" <?php if ((isset($_COOKIE['show_Weather']) && $_COOKIE['show_Weather'] == 'true') || (!isset($_COOKIE['show_Weather']) && (isset($globalMapWeather) && $globalMapWeather === TRUE))) print 'checked'; ?> ><?php echo _("Display weather on 3D map"); ?></label></div></li>
148
+				<li><div class="checkbox"><label><input type="checkbox" name="displayweather" value="1" onclick="clickDisplayWeather(this)" <?php if ((isset($_COOKIE['show_Weather']) && $_COOKIE['show_Weather'] == 'true') || (!isset($_COOKIE['show_Weather']) && (isset($globalMapWeather) && $globalMapWeather === TRUE))) {
149
+	print 'checked';
150
+}
151
+?> ><?php echo _("Display weather on 3D map"); ?></label></div></li>
146 152
 			</ul>
147 153
 <?php
148 154
 	}
@@ -159,13 +165,22 @@  discard block
 block discarded – undo
159 165
 <?php
160 166
 		if (!isset($globalAircraft) || $globalAircraft) {
161 167
 ?>
162
-				<li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') print 'checked'; ?> /><?php echo _("Display waypoints"); ?></label></div></li>
163
-				<li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') print 'checked'; ?> /><?php echo _("Display airspace"); ?></label></div></li>
168
+				<li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') {
169
+	print 'checked';
170
+}
171
+?> /><?php echo _("Display waypoints"); ?></label></div></li>
172
+				<li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') {
173
+	print 'checked';
174
+}
175
+?> /><?php echo _("Display airspace"); ?></label></div></li>
164 176
 <?php
165 177
 		}
166 178
 		if (isset($globalMarine) && $globalMarine) {
167 179
 ?>
168
-				<li><div class="checkbox"><label><input type="checkbox" name="openseamap" value="1" onclick="loadOpenSeaMap(this);" <?php if (isset($_COOKIE['openseamap']) && $_COOKIE['openseamap'] == 'true') print 'checked'; ?> /><?php echo _("Display OpenSeaMap"); ?></label></div></li>
180
+				<li><div class="checkbox"><label><input type="checkbox" name="openseamap" value="1" onclick="loadOpenSeaMap(this);" <?php if (isset($_COOKIE['openseamap']) && $_COOKIE['openseamap'] == 'true') {
181
+	print 'checked';
182
+}
183
+?> /><?php echo _("Display OpenSeaMap"); ?></label></div></li>
169 184
 <?php
170 185
 		}
171 186
 ?>
@@ -179,8 +194,14 @@  discard block
 block discarded – undo
179 194
 <?php
180 195
 		if (!isset($globalAircraft) || $globalAircraft) {
181 196
 ?>
182
-				<li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') print 'checked'; ?> /><?php echo _("Display waypoints"); ?> Beta</label></div></li>
183
-				<li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') print 'checked'; ?> /><?php echo _("Display airspace"); ?> Beta</label></div></li>
197
+				<li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') {
198
+	print 'checked';
199
+}
200
+?> /><?php echo _("Display waypoints"); ?> Beta</label></div></li>
201
+				<li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') {
202
+	print 'checked';
203
+}
204
+?> /><?php echo _("Display airspace"); ?> Beta</label></div></li>
184 205
 <?php
185 206
 		}
186 207
 ?>
@@ -194,14 +215,32 @@  discard block
 block discarded – undo
194 215
 		<h1>NOTAM</h1>
195 216
 		<form>
196 217
 			<ul>
197
-				<li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam(this);" <?php if (isset($_COOKIE['notam']) && $_COOKIE['notam'] == 'true') print 'checked'; ?> /><?php echo _("Display NOTAM"); ?></label></div></li>
218
+				<li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam(this);" <?php if (isset($_COOKIE['notam']) && $_COOKIE['notam'] == 'true') {
219
+	print 'checked';
220
+}
221
+?> /><?php echo _("Display NOTAM"); ?></label></div></li>
198 222
 				<li><?php echo _("NOTAM scope:"); ?>
199 223
 					<select class="selectpicker" onchange="notamscope(this);">
200
-						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') print ' selected'; ?>>All</option>
201
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') print ' selected'; ?>>Airport/Enroute warning</option>
202
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') print ' selected'; ?>>Airport warning</option>
203
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') print ' selected'; ?>>Navigation warning</option>
204
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') print ' selected'; ?>>Enroute warning</option>
224
+						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') {
225
+	print ' selected';
226
+}
227
+?>>All</option>
228
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') {
229
+	print ' selected';
230
+}
231
+?>>Airport/Enroute warning</option>
232
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') {
233
+	print ' selected';
234
+}
235
+?>>Airport warning</option>
236
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') {
237
+	print ' selected';
238
+}
239
+?>>Navigation warning</option>
240
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') {
241
+	print ' selected';
242
+}
243
+?>>Enroute warning</option>
205 244
 					</select
206 245
 				</li>
207 246
 			</ul>
@@ -229,7 +268,10 @@  discard block
 block discarded – undo
229 268
 		    <div class="form-group">
230 269
 			<label><?php echo _("From:"); ?></label>
231 270
 			<div class='input-group date' id='datetimepicker1'>
232
-			    <input type='text' id="start_date" name="start_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') print date("Y-m-d H:i",$_COOKIE['archive_begin']).' UTC'; ?>" required />
271
+			    <input type='text' id="start_date" name="start_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') {
272
+	print date("Y-m-d H:i",$_COOKIE['archive_begin']).' UTC';
273
+}
274
+?>" required />
233 275
 			    <span class="input-group-addon">
234 276
 				<span class="glyphicon glyphicon-calendar"></span>
235 277
 			    </span>
@@ -238,7 +280,10 @@  discard block
 block discarded – undo
238 280
 		    <div class="form-group">
239 281
 			<label><?php echo _("To:"); ?></label>
240 282
 			<div class='input-group date' id='datetimepicker2'>
241
-			    <input type='text' id="end_date" name="end_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_end']) && $_COOKIE['archive_end'] != '') print date("Y-m-d H:i",$_COOKIE['archive_end']).' UTC'; ?>" />
283
+			    <input type='text' id="end_date" name="end_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_end']) && $_COOKIE['archive_end'] != '') {
284
+	print date("Y-m-d H:i",$_COOKIE['archive_end']).' UTC';
285
+}
286
+?>" />
242 287
 			    <span class="input-group-addon">
243 288
 				<span class="glyphicon glyphicon-calendar"></span>
244 289
 			    </span>
@@ -270,8 +315,20 @@  discard block
 block discarded – undo
270 315
 		    </script>
271 316
 		<li><?php echo _("Playback speed:"); ?>
272 317
 		    <div class="range">
273
-			<input type="range" min="0" max="50" step="1" id="archivespeed" 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'; ?>">
274
-			<output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?></output>
318
+			<input type="range" min="0" max="50" step="1" id="archivespeed" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php  if (isset($_POST['archivespeed'])) {
319
+	print $_POST['archivespeed'];
320
+} elseif (isset($_COOKIE['archive_speed'])) {
321
+	print $_COOKIE['archive_speed'];
322
+} else {
323
+	print '1';
324
+}
325
+?>">
326
+			<output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) {
327
+	print $_COOKIE['archive_speed'];
328
+} else {
329
+	print '1';
330
+}
331
+?></output>
275 332
 		    </div>
276 333
 		</li>
277 334
 		<?php
@@ -300,14 +357,20 @@  discard block
 block discarded – undo
300 357
 		    <li><?php echo _("Type of Map:"); ?>
301 358
 			    <?php
302 359
 				if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
303
-					if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider;
304
-					else $MapType = $_COOKIE['MapType'];
360
+					if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') {
361
+						$MapType = $globalMapProvider;
362
+					} else {
363
+						$MapType = $_COOKIE['MapType'];
364
+					}
305 365
 			    ?>
306 366
 			<select  class="selectpicker" onchange="mapType(this);">
307 367
 			    <?php
308 368
 				} else {
309
-					if (!isset($_COOKIE['MapType3D']) || $_COOKIE['MapType3D'] == '') $MapType = $globalMapProvider;
310
-					else $MapType = $_COOKIE['MapType3D'];
369
+					if (!isset($_COOKIE['MapType3D']) || $_COOKIE['MapType3D'] == '') {
370
+						$MapType = $globalMapProvider;
371
+					} else {
372
+						$MapType = $_COOKIE['MapType3D'];
373
+					}
311 374
 			    ?>
312 375
 			<select  class="selectpicker" onchange="mapType3D(this);">
313 376
 			    <?php
@@ -316,24 +379,48 @@  discard block
 block discarded – undo
316 379
 			    <?php
317 380
 				if (isset($globalMapOffline) && $globalMapOffline === TRUE) {
318 381
 			    ?>
319
-			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option>
382
+			    <option value="offline"<?php if ($MapType == 'offline') {
383
+	print ' selected';
384
+}
385
+?>>Natural Earth (local)</option>
320 386
 			    <?php
321 387
 				} else {
322 388
 				    if (file_exists(dirname(__FILE__).'/js/Cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml')) {
323 389
 			    ?>
324
-			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option>
390
+			    <option value="offline"<?php if ($MapType == 'offline') {
391
+	print ' selected';
392
+}
393
+?>>Natural Earth (local)</option>
325 394
 			    <?php
326 395
 				    }
327 396
 			    ?>
328
-			    <option value="ArcGIS-Streetmap"<?php if ($MapType == 'ArcGIS-Streetmap') print ' selected'; ?>>ArcGIS Streetmap</option>
329
-			    <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Satellite') print ' selected'; ?>>ArcGIS Satellite</option>
330
-			    <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Ocean') print ' selected'; ?>>ArcGIS Ocean</option>
397
+			    <option value="ArcGIS-Streetmap"<?php if ($MapType == 'ArcGIS-Streetmap') {
398
+	print ' selected';
399
+}
400
+?>>ArcGIS Streetmap</option>
401
+			    <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Satellite') {
402
+	print ' selected';
403
+}
404
+?>>ArcGIS Satellite</option>
405
+			    <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Ocean') {
406
+	print ' selected';
407
+}
408
+?>>ArcGIS Ocean</option>
331 409
 			    <?php
332 410
 				    if (isset($globalBingMapKey) && $globalBingMapKey != '') {
333 411
 			    ?>
334
-			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option>
335
-			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option>
336
-			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option>
412
+			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') {
413
+	print ' selected';
414
+}
415
+?>>Bing-Aerial</option>
416
+			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') {
417
+	print ' selected';
418
+}
419
+?>>Bing-Hybrid</option>
420
+			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') {
421
+	print ' selected';
422
+}
423
+?>>Bing-Road</option>
337 424
 			    <?php
338 425
 				    }
339 426
 			    ?>
@@ -343,60 +430,147 @@  discard block
 block discarded – undo
343 430
 			    <?php
344 431
 					if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
345 432
 			    ?>
346
-			    <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option>
347
-			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option>
348
-			    <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option>
433
+			    <option value="Here-Aerial"<?php if ($MapType == 'Here') {
434
+	print ' selected';
435
+}
436
+?>>Here-Aerial</option>
437
+			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') {
438
+	print ' selected';
439
+}
440
+?>>Here-Hybrid</option>
441
+			    <option value="Here-Road"<?php if ($MapType == 'Here') {
442
+	print ' selected';
443
+}
444
+?>>Here-Road</option>
349 445
 			    <?php
350 446
 					}
351 447
 			    ?>
352 448
 			    <?php
353 449
 					if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
354 450
 			    ?>
355
-			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option>
356
-			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option>
357
-			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option>
358
-			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option>
451
+			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') {
452
+	print ' selected';
453
+}
454
+?>>Google Roadmap</option>
455
+			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') {
456
+	print ' selected';
457
+}
458
+?>>Google Satellite</option>
459
+			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') {
460
+	print ' selected';
461
+}
462
+?>>Google Hybrid</option>
463
+			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') {
464
+	print ' selected';
465
+}
466
+?>>Google Terrain</option>
359 467
 			    <?php
360 468
 					}
361 469
 			    ?>
362 470
 			    <?php
363 471
 					if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
364 472
 			    ?>
365
-			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option>
366
-			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option>
367
-			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option>
473
+			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') {
474
+	print ' selected';
475
+}
476
+?>>MapQuest-OSM</option>
477
+			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') {
478
+	print ' selected';
479
+}
480
+?>>MapQuest-Aerial</option>
481
+			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') {
482
+	print ' selected';
483
+}
484
+?>>MapQuest-Hybrid</option>
368 485
 			    <?php
369 486
 					}
370 487
 			    ?>
371
-			    <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option>
372
-			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth</option>
488
+			    <option value="Yandex"<?php if ($MapType == 'Yandex') {
489
+	print ' selected';
490
+}
491
+?>>Yandex</option>
492
+			    <option value="offline"<?php if ($MapType == 'offline') {
493
+	print ' selected';
494
+}
495
+?>>Natural Earth</option>
373 496
 			    <?php
374 497
 				    }
375 498
 			    ?>
376
-			    <option value="NatGeo-Street"<?php if ($MapType == 'NatGeo-Street') print ' selected'; ?>>National Geographic Street</option>
499
+			    <option value="NatGeo-Street"<?php if ($MapType == 'NatGeo-Street') {
500
+	print ' selected';
501
+}
502
+?>>National Geographic Street</option>
377 503
 			    <?php
378 504
 				    if (isset($globalMapboxToken) && $globalMapboxToken != '') {
379
-					if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default';
380
-					else $MapBoxId = $_COOKIE['MapTypeId'];
505
+					if (!isset($_COOKIE['MapTypeId'])) {
506
+						$MapBoxId = 'default';
507
+					} else {
508
+						$MapBoxId = $_COOKIE['MapTypeId'];
509
+					}
381 510
 			    ?>
382
-			    <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') print ' selected'; ?>>Mapbox GL</option>
383
-			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option>
384
-			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option>
385
-			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option>
386
-			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') print ' selected'; ?>>Mapbox dark</option>
387
-			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') print ' selected'; ?>>Mapbox satellite</option>
388
-			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') print ' selected'; ?>>Mapbox streets-satellite</option>
389
-			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') print ' selected'; ?>>Mapbox streets-basic</option>
390
-			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') print ' selected'; ?>>Mapbox comic</option>
391
-			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') print ' selected'; ?>>Mapbox outdoors</option>
392
-			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') print ' selected'; ?>>Mapbox pencil</option>
393
-			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option>
394
-			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option>
511
+			    <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') {
512
+	print ' selected';
513
+}
514
+?>>Mapbox GL</option>
515
+			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') {
516
+	print ' selected';
517
+}
518
+?>>Mapbox default</option>
519
+			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') {
520
+	print ' selected';
521
+}
522
+?>>Mapbox streets</option>
523
+			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') {
524
+	print ' selected';
525
+}
526
+?>>Mapbox light</option>
527
+			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') {
528
+	print ' selected';
529
+}
530
+?>>Mapbox dark</option>
531
+			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') {
532
+	print ' selected';
533
+}
534
+?>>Mapbox satellite</option>
535
+			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') {
536
+	print ' selected';
537
+}
538
+?>>Mapbox streets-satellite</option>
539
+			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') {
540
+	print ' selected';
541
+}
542
+?>>Mapbox streets-basic</option>
543
+			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') {
544
+	print ' selected';
545
+}
546
+?>>Mapbox comic</option>
547
+			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') {
548
+	print ' selected';
549
+}
550
+?>>Mapbox outdoors</option>
551
+			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') {
552
+	print ' selected';
553
+}
554
+?>>Mapbox pencil</option>
555
+			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') {
556
+	print ' selected';
557
+}
558
+?>>Mapbox pirates</option>
559
+			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') {
560
+	print ' selected';
561
+}
562
+?>>Mapbox emerald</option>
395 563
 			    <?php
396 564
 				    }
397 565
 			    ?>
398
-			    <!--<option value="OpenSeaMap"<?php if ($MapType == 'OpenSeaMap') print ' selected'; ?>>OpenSeaMap</option>-->
399
-			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option>
566
+			    <!--<option value="OpenSeaMap"<?php if ($MapType == 'OpenSeaMap') {
567
+	print ' selected';
568
+}
569
+?>>OpenSeaMap</option>-->
570
+			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') {
571
+	print ' selected';
572
+}
573
+?>>OpenStreetMap</option>
400 574
 			    <?php
401 575
 				}
402 576
 			    ?>
@@ -407,10 +581,22 @@  discard block
 block discarded – undo
407 581
 ?>
408 582
 		    <li><?php echo _("Type of Terrain:"); ?>
409 583
 			<select  class="selectpicker" onchange="terrainType(this);">
410
-			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option>
411
-			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option>
412
-			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option>
413
-			    <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected';?>>ArticDEM</option>
584
+			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') {
585
+	print ' selected';
586
+}
587
+?>>stk terrain</option>
588
+			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') {
589
+	print ' selected';
590
+}
591
+?>>ellipsoid</option>
592
+			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') {
593
+	print ' selected';
594
+}
595
+?>>vr terrain</option>
596
+			    <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') {
597
+	print ' selected';
598
+}
599
+?>>ArticDEM</option>
414 600
 			</select>
415 601
 		    </li>
416 602
 <?php
@@ -420,59 +606,116 @@  discard block
 block discarded – undo
420 606
 <?php
421 607
     if (isset($globalMap3D) && $globalMap3D) {
422 608
 ?>
423
-		    <li><div class="checkbox"><label><input type="checkbox" name="synchro2d3d" value="1" onclick="clickSyncMap2D3D(this)" <?php if (isset($_COOKIE['Map2D3DSync']) && $_COOKIE['Map2D3DSync'] == 'true') print 'checked'; ?> ><?php echo _("Use same type of map for 2D & 3D"); ?></label></div></li>
609
+		    <li><div class="checkbox"><label><input type="checkbox" name="synchro2d3d" value="1" onclick="clickSyncMap2D3D(this)" <?php if (isset($_COOKIE['Map2D3DSync']) && $_COOKIE['Map2D3DSync'] == 'true') {
610
+	print 'checked';
611
+}
612
+?> ><?php echo _("Use same type of map for 2D & 3D"); ?></label></div></li>
424 613
 <?php
425 614
     }
426 615
 ?>
427 616
 <?php
428 617
     if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
429 618
 ?>
430
-		    <li><div class="checkbox"><label><input type="checkbox" name="display2dbuildings" value="1" onclick="clickDisplay2DBuildings(this)" <?php if (isset($_COOKIE['Map2DBuildings']) && $_COOKIE['Map2DBuildings'] == 'true') print 'checked'; ?> ><?php echo _("Display 2.5D buidings on map"); ?></label></div></li>
619
+		    <li><div class="checkbox"><label><input type="checkbox" name="display2dbuildings" value="1" onclick="clickDisplay2DBuildings(this)" <?php if (isset($_COOKIE['Map2DBuildings']) && $_COOKIE['Map2DBuildings'] == 'true') {
620
+	print 'checked';
621
+}
622
+?> ><?php echo _("Display 2.5D buidings on map"); ?></label></div></li>
431 623
 
432 624
 <?php
433 625
 	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
434 626
 ?>
435
-		    <!--<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>-->
436
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true')) print 'checked'; ?> ><?php echo _("Display flight path"); ?></label></div></li>
437
-		    <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']) && isset($globalMapRoute) && $globalMapRoute)) print 'checked'; ?> ><?php echo _("Display flight route on click"); ?></label></div></li>
438
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightremainingroute" value="1" onclick="clickFlightRemainingRoute(this)" <?php if ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == 'true') || (!isset($_COOKIE['MapRemainingRoute']) && isset($globalMapRemainingRoute) && $globalMapRemainingRoute)) print 'checked'; ?> ><?php echo _("Display flight remaining route on click"); ?></label></div></li>
439
-		    <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>
627
+		    <!--<li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') {
628
+	print 'checked';
629
+}
630
+?> ><?php echo _("Display flight info as popup"); ?></label></div></li>-->
631
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true')) {
632
+	print 'checked';
633
+}
634
+?> ><?php echo _("Display flight path"); ?></label></div></li>
635
+		    <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']) && isset($globalMapRoute) && $globalMapRoute)) {
636
+	print 'checked';
637
+}
638
+?> ><?php echo _("Display flight route on click"); ?></label></div></li>
639
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightremainingroute" value="1" onclick="clickFlightRemainingRoute(this)" <?php if ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == 'true') || (!isset($_COOKIE['MapRemainingRoute']) && isset($globalMapRemainingRoute) && $globalMapRemainingRoute)) {
640
+	print 'checked';
641
+}
642
+?> ><?php echo _("Display flight remaining route on click"); ?></label></div></li>
643
+		    <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)) {
644
+	print 'checked';
645
+}
646
+?> ><?php echo _("Planes animate between updates"); ?></label></div></li>
440 647
 <?php
441 648
 	} elseif (!isset($globalTracker) || $globalTracker === TRUE) {
442 649
 ?>
443
-		    <li><div class="checkbox"><label><input type="checkbox" name="mapmatching" value="1" onclick="clickMapMatching(this)" <?php if ((isset($_COOKIE['mapmatching']) && $_COOKIE['mapmatching'] == 'true') || (!isset($_COOKIE['mapmatching']) && isset($globalMapMatching) && $globalMapMatching)) print 'checked'; ?> ><?php echo _("Enable map matching"); ?></label></div></li>
650
+		    <li><div class="checkbox"><label><input type="checkbox" name="mapmatching" value="1" onclick="clickMapMatching(this)" <?php if ((isset($_COOKIE['mapmatching']) && $_COOKIE['mapmatching'] == 'true') || (!isset($_COOKIE['mapmatching']) && isset($globalMapMatching) && $globalMapMatching)) {
651
+	print 'checked';
652
+}
653
+?> ><?php echo _("Enable map matching"); ?></label></div></li>
444 654
 <?php
445 655
 	}
446 656
 	if (isset($globalSatellite) && $globalSatellite === TRUE) {
447 657
 ?>
448
-		    <li><div class="checkbox"><label><input type="checkbox" name="satelliteestimation" value="1" onclick="clickSatelliteEstimation(this)" <?php if ((isset($_COOKIE['satelliteestimation']) && $_COOKIE['satelliteestimation'] == 'true') || (!isset($_COOKIE['satelliteestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['satelliteestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Satellites animate between updates"); ?></label></div></li>
658
+		    <li><div class="checkbox"><label><input type="checkbox" name="satelliteestimation" value="1" onclick="clickSatelliteEstimation(this)" <?php if ((isset($_COOKIE['satelliteestimation']) && $_COOKIE['satelliteestimation'] == 'true') || (!isset($_COOKIE['satelliteestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['satelliteestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) {
659
+	print 'checked';
660
+}
661
+?> ><?php echo _("Satellites animate between updates"); ?></label></div></li>
449 662
 <?php
450 663
 	}
451 664
     }
452 665
 ?>
453
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true' || !isset($_COOKIE['displayairports'])) print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li>
454
-		    <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) print 'checked'; ?> ><?php echo _("Display ground station on map"); ?></label></div></li>
455
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayweatherstation" value="1" onclick="clickDisplayWeatherStation(this)" <?php if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) print 'checked'; ?> ><?php echo _("Display weather station on map"); ?></label></div></li>
456
-		    <li><div class="checkbox"><label><input type="checkbox" name="displaylightning" value="1" onclick="clickDisplayLightning(this)" <?php if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') || (!isset($_COOKIE['show_Lightning']) && (isset($globalMapLightning) && $globalMapLightning === TRUE))) print 'checked'; ?> ><?php echo _("Display lightning on map"); ?></label></div></li>
666
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true' || !isset($_COOKIE['displayairports'])) {
667
+	print 'checked';
668
+}
669
+?> ><?php echo _("Display airports on map"); ?></label></div></li>
670
+		    <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) {
671
+	print 'checked';
672
+}
673
+?> ><?php echo _("Display ground station on map"); ?></label></div></li>
674
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayweatherstation" value="1" onclick="clickDisplayWeatherStation(this)" <?php if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) {
675
+	print 'checked';
676
+}
677
+?> ><?php echo _("Display weather station on map"); ?></label></div></li>
678
+		    <li><div class="checkbox"><label><input type="checkbox" name="displaylightning" value="1" onclick="clickDisplayLightning(this)" <?php if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') || (!isset($_COOKIE['show_Lightning']) && (isset($globalMapLightning) && $globalMapLightning === TRUE))) {
679
+	print 'checked';
680
+}
681
+?> ><?php echo _("Display lightning on map"); ?></label></div></li>
457 682
 <?php
458 683
 	if (isset($globalFires)) {
459 684
 ?>
460
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayfires" value="1" onclick="clickDisplayFires(this)" <?php if ((isset($_COOKIE['show_Fires']) && $_COOKIE['show_Fires'] == 'true') || (!isset($_COOKIE['show_Fires']) && (isset($globalMapFires) && $globalMapFires === TRUE))) print 'checked'; ?> ><?php echo _("Display fires on map"); ?></label></div></li>
685
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayfires" value="1" onclick="clickDisplayFires(this)" <?php if ((isset($_COOKIE['show_Fires']) && $_COOKIE['show_Fires'] == 'true') || (!isset($_COOKIE['show_Fires']) && (isset($globalMapFires) && $globalMapFires === TRUE))) {
686
+	print 'checked';
687
+}
688
+?> ><?php echo _("Display fires on map"); ?></label></div></li>
461 689
 <?php
462 690
 	}
463 691
 	if (isset($globalMap3D) && $globalMap3D) {
464 692
 ?>
465
-		    <li><div class="checkbox"><label><input type="checkbox" name="singlemodel" value="1" onclick="clickSingleModel(this)" <?php if (isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') print 'checked'; ?> ><?php echo _("Only display selected flight on 3D mode"); ?></label></div></li>
693
+		    <li><div class="checkbox"><label><input type="checkbox" name="singlemodel" value="1" onclick="clickSingleModel(this)" <?php if (isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') {
694
+	print 'checked';
695
+}
696
+?> ><?php echo _("Only display selected flight on 3D mode"); ?></label></div></li>
466 697
 <?php
467 698
 	}
468 699
 ?>
469 700
 <?php
470 701
     if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
471 702
 ?>
472
-		    <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>
473
-		    <li><div class="checkbox"><label><input type="checkbox" name="shadows" value="1" onclick="clickShadows(this)" <?php if ((!isset($_COOKIE['map3dnoshadows']) && (!isset($globalMap3DShadows) || $globalMap3DShadows)) || (isset($_COOKIE['map3dnoshadows']) && $_COOKIE['map3dnoshadows'] == 'false')) print 'checked'; ?> ><?php echo _("Use shadows"); ?></label></div></li>
474
-		    <li><div class="checkbox"><label><input type="checkbox" name="one3dmodel" value="1" onclick="useOne3Dmodel(this)" <?php if ((isset($_COOKIE['one3dmodel']) && $_COOKIE['one3dmodel'] == 'true') || (!isset($_COOKIE['one3dmodel']) && isset($globalMap3DOneModel) && $globalMap3DOneModel)) print 'checked'; ?> ><?php echo _("Use same 3D model for all aircraft (use fewer resources)"); ?></label></div></li>
475
-		    <li><div class="checkbox"><label><input type="checkbox" name="updaterealtime" value="1" onclick="clickUpdateRealtime(this)" <?php if ((isset($_COOKIE['updaterealtime']) && $_COOKIE['updaterealtime'] == 'true') || !isset($_COOKIE['updaterealtime'])) print 'checked'; ?> ><?php echo _("Display realtime data in infobox"); ?></label></div></li>
703
+		    <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')) {
704
+	print 'checked';
705
+}
706
+?> ><?php echo _("Show mini-map"); ?></label></div></li>
707
+		    <li><div class="checkbox"><label><input type="checkbox" name="shadows" value="1" onclick="clickShadows(this)" <?php if ((!isset($_COOKIE['map3dnoshadows']) && (!isset($globalMap3DShadows) || $globalMap3DShadows)) || (isset($_COOKIE['map3dnoshadows']) && $_COOKIE['map3dnoshadows'] == 'false')) {
708
+	print 'checked';
709
+}
710
+?> ><?php echo _("Use shadows"); ?></label></div></li>
711
+		    <li><div class="checkbox"><label><input type="checkbox" name="one3dmodel" value="1" onclick="useOne3Dmodel(this)" <?php if ((isset($_COOKIE['one3dmodel']) && $_COOKIE['one3dmodel'] == 'true') || (!isset($_COOKIE['one3dmodel']) && isset($globalMap3DOneModel) && $globalMap3DOneModel)) {
712
+	print 'checked';
713
+}
714
+?> ><?php echo _("Use same 3D model for all aircraft (use fewer resources)"); ?></label></div></li>
715
+		    <li><div class="checkbox"><label><input type="checkbox" name="updaterealtime" value="1" onclick="clickUpdateRealtime(this)" <?php if ((isset($_COOKIE['updaterealtime']) && $_COOKIE['updaterealtime'] == 'true') || !isset($_COOKIE['updaterealtime'])) {
716
+	print 'checked';
717
+}
718
+?> ><?php echo _("Display realtime data in infobox"); ?></label></div></li>
476 719
 <?php
477 720
     }
478 721
     if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
@@ -485,17 +728,25 @@  discard block
 block discarded – undo
485 728
 			if (function_exists('array_column')) {
486 729
 			    if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
487 730
 		    ?>
488
-		    <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>
731
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
732
+	print 'checked';
733
+}
734
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
489 735
 		    <?php
490 736
 			    }
491 737
 			} elseif (isset($globalSources)) {
492 738
 			    $dispolar = false;
493 739
 			    foreach ($globalSources as $testsource) {
494
-			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
740
+			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) {
741
+			        	$dispolar = true;
742
+			        }
495 743
 			    }
496 744
 			    if ($dispolar) {
497 745
 		    ?>
498
-		    <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>
746
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
747
+	print 'checked';
748
+}
749
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
499 750
 		    <?php
500 751
 			    }
501 752
 		        }
@@ -508,11 +759,21 @@  discard block
 block discarded – undo
508 759
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
509 760
 		    	    if (extension_loaded('gd') && function_exists('gd_info')) {
510 761
 		    ?>
511
-		    <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>
762
+		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') {
763
+	print 'checked';
764
+}
765
+?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
512 766
 		    <?php 
513 767
 				if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') {
514 768
 		    ?>
515
-			<li><?php echo _("Aircraft icon color:"); ?><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'; ?>"></li>
769
+			<li><?php echo _("Aircraft icon color:"); ?><input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) {
770
+	print $_COOKIE['IconColor'];
771
+} elseif (isset($globalAircraftIconColor)) {
772
+	print $globalAircraftIconColor;
773
+} else {
774
+	print '1a3151';
775
+}
776
+?>"></li>
516 777
 		    <?php
517 778
 				}
518 779
 			    }
@@ -523,7 +784,14 @@  discard block
 block discarded – undo
523 784
 			    if (extension_loaded('gd') && function_exists('gd_info')) {
524 785
 		    ?>
525 786
 		    <li><?php echo _("Marine icon color:"); ?>
526
-			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print '1a3151'; ?>">
787
+			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) {
788
+	print $_COOKIE['MarineIconColor'];
789
+} elseif (isset($globalMarineIconColor)) {
790
+	print $globalMarineIconColor;
791
+} else {
792
+	print '1a3151';
793
+}
794
+?>">
527 795
 		    </li>
528 796
 		    <?php
529 797
 			    }
@@ -534,7 +802,14 @@  discard block
 block discarded – undo
534 802
 			    if (extension_loaded('gd') && function_exists('gd_info')) {
535 803
 		    ?>
536 804
 		    <li><?php echo _("Tracker icon color:"); ?>
537
-			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) print $_COOKIE['TrackerIconColor']; elseif (isset($globalTrackerIconColor)) print $globalTrackerIconColor; else print '1a3151'; ?>">
805
+			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) {
806
+	print $_COOKIE['TrackerIconColor'];
807
+} elseif (isset($globalTrackerIconColor)) {
808
+	print $globalTrackerIconColor;
809
+} else {
810
+	print '1a3151';
811
+}
812
+?>">
538 813
 		    </li>
539 814
 		    <?php
540 815
 			    }
@@ -545,8 +820,22 @@  discard block
 block discarded – undo
545 820
 		    ?>
546 821
 		    <li><?php echo _("Show airport icon at zoom level:"); ?>
547 822
 			<div class="range">
548
-			    <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'; ?>">
549
-			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?></output>
823
+			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) {
824
+	print $_COOKIE['AirportZoom'];
825
+} elseif (isset($globalAirportZoom)) {
826
+	print $globalAirportZoom;
827
+} else {
828
+	print '7';
829
+}
830
+?>">
831
+			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) {
832
+	print $_COOKIE['AirportZoom'];
833
+} elseif (isset($globalAirportZoom)) {
834
+	print $globalAirportZoom;
835
+} else {
836
+	print '7';
837
+}
838
+?></output>
550 839
 			</div>
551 840
 		    </li>
552 841
 		    <?php
@@ -557,17 +846,40 @@  discard block
 block discarded – undo
557 846
 ?>
558 847
 		    <li><?php echo _("Set scaling factor for rendering resolution:"); ?>
559 848
 			<div class="range">
560
-			    <input type="range" min="0.5" max="2" step="0.5" name="resolutionscale" onchange="scale.value=value;resolutionScale(resolutionscale.value);" value="<?php if (isset($_COOKIE['resolutionScale'])) print $_COOKIE['resolutionScale']; else print '1'; ?>">
561
-			    <output id="scale"><?php if (isset($_COOKIE['resolutionScale'])) print $_COOKIE['resolutionScale']; else print '1'; ?></output>
849
+			    <input type="range" min="0.5" max="2" step="0.5" name="resolutionscale" onchange="scale.value=value;resolutionScale(resolutionscale.value);" value="<?php if (isset($_COOKIE['resolutionScale'])) {
850
+	print $_COOKIE['resolutionScale'];
851
+} else {
852
+	print '1';
853
+}
854
+?>">
855
+			    <output id="scale"><?php if (isset($_COOKIE['resolutionScale'])) {
856
+	print $_COOKIE['resolutionScale'];
857
+} else {
858
+	print '1';
859
+}
860
+?></output>
562 861
 			</div>
563 862
 		    </li>
564 863
 <?php
565 864
 	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
566 865
 ?>
567
-		    <li><input type="checkbox" name="useliveries" value="1" onclick="useLiveries(this)" <?php if (isset($_COOKIE['UseLiveries']) && $_COOKIE['UseLiveries'] == 'true') print 'checked'; ?> > <?php echo _("Use airlines liveries"); ?></li>
568
-		    <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') print 'checked'; ?> > <?php echo _("Force Aircraft color"); ?>&nbsp;
866
+		    <li><input type="checkbox" name="useliveries" value="1" onclick="useLiveries(this)" <?php if (isset($_COOKIE['UseLiveries']) && $_COOKIE['UseLiveries'] == 'true') {
867
+	print 'checked';
868
+}
869
+?> > <?php echo _("Use airlines liveries"); ?></li>
870
+		    <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') {
871
+	print 'checked';
872
+}
873
+?> > <?php echo _("Force Aircraft color"); ?>&nbsp;
569 874
 		    <!--<li><?php echo _("Aircraft icon color:"); ?>-->
570
-			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print 'ff0000'; ?>">
875
+			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) {
876
+	print $_COOKIE['IconColor'];
877
+} elseif (isset($globalAircraftIconColor)) {
878
+	print $globalAircraftIconColor;
879
+} else {
880
+	print 'ff0000';
881
+}
882
+?>">
571 883
 		    </li>
572 884
 <?php
573 885
 	}
@@ -575,9 +887,19 @@  discard block
 block discarded – undo
575 887
 <?php
576 888
 	if (isset($globalMarine) && $globalMarine === TRUE) {
577 889
 ?>
578
-		    <li><input type="checkbox" name="marinecolorforce" value="1" onclick="MarineiconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Marine color"); ?>&nbsp;
890
+		    <li><input type="checkbox" name="marinecolorforce" value="1" onclick="MarineiconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') {
891
+	print 'checked';
892
+}
893
+?> ><?php echo _("Force Marine color"); ?>&nbsp;
579 894
 		    <!--<li><?php echo _("Marine icon color:"); ?>-->
580
-			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print 'ff0000'; ?>">
895
+			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) {
896
+	print $_COOKIE['MarineIconColor'];
897
+} elseif (isset($globalMarineIconColor)) {
898
+	print $globalMarineIconColor;
899
+} else {
900
+	print 'ff0000';
901
+}
902
+?>">
581 903
 		    </li>
582 904
 <?php
583 905
 	}
@@ -585,9 +907,19 @@  discard block
 block discarded – undo
585 907
 <?php
586 908
 	if (isset($globalTracker) && $globalTracker === TRUE) {
587 909
 ?>
588
-		    <li><input type="checkbox" name="trackercolorforce" value="1" onclick="TrackericonColorForce(this)" <?php if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Tracker color"); ?>&nbsp;
910
+		    <li><input type="checkbox" name="trackercolorforce" value="1" onclick="TrackericonColorForce(this)" <?php if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true') {
911
+	print 'checked';
912
+}
913
+?> ><?php echo _("Force Tracker color"); ?>&nbsp;
589 914
 		    <!--<li><?php echo _("Tracker icon color:"); ?>-->
590
-			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) print $_COOKIE['TrackerIconColor']; elseif (isset($globalTrackerIconColor)) print $globalTrackerIconColor; else print 'ff0000'; ?>">
915
+			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) {
916
+	print $_COOKIE['TrackerIconColor'];
917
+} elseif (isset($globalTrackerIconColor)) {
918
+	print $globalTrackerIconColor;
919
+} else {
920
+	print 'ff0000';
921
+}
922
+?>">
591 923
 		    </li>
592 924
 <?php
593 925
 	}
@@ -595,22 +927,46 @@  discard block
 block discarded – undo
595 927
 ?>
596 928
 		    <li><?php echo _("Distance unit:"); ?>
597 929
 			<select class="selectpicker" onchange="unitdistance(this);">
598
-			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) echo ' selected'; ?>>km</option>
599
-			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) echo ' selected'; ?>>nm</option>
600
-			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) echo ' selected'; ?>>mi</option>
930
+			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) {
931
+	echo ' selected';
932
+}
933
+?>>km</option>
934
+			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
935
+	echo ' selected';
936
+}
937
+?>>nm</option>
938
+			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
939
+	echo ' selected';
940
+}
941
+?>>mi</option>
601 942
 		        </select>
602 943
 		    </li>
603 944
 		    <li><?php echo _("Altitude unit:"); ?>
604 945
 			<select class="selectpicker" onchange="unitaltitude(this);">
605
-			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) echo ' selected'; ?>>m</option>
606
-			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) echo ' selected'; ?>>feet</option>
946
+			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) {
947
+	echo ' selected';
948
+}
949
+?>>m</option>
950
+			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) {
951
+	echo ' selected';
952
+}
953
+?>>feet</option>
607 954
 		        </select>
608 955
 		    </li>
609 956
 		    <li><?php echo _("Speed unit:"); ?>
610 957
 			<select class="selectpicker" onchange="unitspeed(this);">
611
-			    <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>
612
-			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) echo ' selected'; ?>>mph</option>
613
-			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) echo ' selected'; ?>>knots</option>
958
+			    <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) {
959
+	echo ' selected';
960
+}
961
+?>>km/h</option>
962
+			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) {
963
+	echo ' selected';
964
+}
965
+?>>mph</option>
966
+			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) {
967
+	echo ' selected';
968
+}
969
+?>>knots</option>
614 970
 		        </select>
615 971
 		    </li>
616 972
 
@@ -628,9 +984,18 @@  discard block
 block discarded – undo
628 984
 		    <?php
629 985
 			if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) {
630 986
 		    ?>
631
-			<?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 } ?>
632
-			<?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 } ?>
633
-			<?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 } ?>
987
+			<?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'])) {
988
+	print 'checked';
989
+}
990
+?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
991
+			<?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'])) {
992
+	print 'checked';
993
+}
994
+?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
995
+			<?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'])) {
996
+	print 'checked';
997
+}
998
+?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
634 999
 		    <?php
635 1000
 			}
636 1001
 		    ?>
@@ -638,10 +1003,16 @@  discard block
 block discarded – undo
638 1003
 			if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) {
639 1004
 		    ?>
640 1005
 			<?php if (isset($globalSBS1) && $globalSBS1) { ?>
641
-			    <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>
1006
+			    <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'])) {
1007
+	print 'checked';
1008
+}
1009
+?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
642 1010
 			<?php } ?>
643 1011
 			<?php if (isset($globalAPRS) && $globalAPRS) { ?>
644
-			    <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>
1012
+			    <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'])) {
1013
+	print 'checked';
1014
+}
1015
+?> ><?php echo _("Display APRS data"); ?></label></div></li>
645 1016
 			<?php } ?>
646 1017
 		    <?php
647 1018
 			}
@@ -658,7 +1029,9 @@  discard block
 block discarded – undo
658 1029
 				}
659 1030
 				foreach($allairlinenames as $airline) {
660 1031
 					$airline_name = $airline['airline_name'];
661
-					if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...';
1032
+					if (strlen($airline_name) > 30) {
1033
+						$airline_name = substr($airline_name,0,30).'...';
1034
+					}
662 1035
 					if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['filter_Airlines']))) {
663 1036
 						echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>';
664 1037
 					} else {
@@ -676,7 +1049,10 @@  discard block
 block discarded – undo
676 1049
 		    <li><?php echo _("Display alliance:"); ?>
677 1050
 		    <br/>
678 1051
 			<select class="selectpicker" onchange="alliance(this);" id="display_alliance">
679
-			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
1052
+			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') {
1053
+	echo ' selected';
1054
+}
1055
+?>><?php echo _("All"); ?></option>
680 1056
 			    <?php
681 1057
 				foreach($allalliancenames as $alliance) {
682 1058
 					$alliance_name = $alliance['alliance'];
@@ -735,10 +1111,22 @@  discard block
 block discarded – undo
735 1111
 		    ?>
736 1112
 		    <li><?php echo _("Display airlines of type:"); ?><br/>
737 1113
 			<select class="selectpicker" onchange="airlinestype(this);">
738
-			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
739
-			    <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') echo ' selected'; ?>><?php echo _("Passenger"); ?></option>
740
-			    <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') echo ' selected'; ?>><?php echo _("Cargo"); ?></option>
741
-			    <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') echo ' selected'; ?>><?php echo _("Military"); ?></option>
1114
+			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') {
1115
+	echo ' selected';
1116
+}
1117
+?>><?php echo _("All"); ?></option>
1118
+			    <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') {
1119
+	echo ' selected';
1120
+}
1121
+?>><?php echo _("Passenger"); ?></option>
1122
+			    <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') {
1123
+	echo ' selected';
1124
+}
1125
+?>><?php echo _("Cargo"); ?></option>
1126
+			    <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') {
1127
+	echo ' selected';
1128
+}
1129
+?>><?php echo _("Military"); ?></option>
742 1130
 			</select>
743 1131
 		    </li>
744 1132
 		    <?php
@@ -752,7 +1140,10 @@  discard block
 block discarded – undo
752 1140
 		    ?>
753 1141
 		    <li>
754 1142
 			<?php echo _("Display vessels with MMSI:"); ?>
755
-			<input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) print $_COOKIE['filter_mmsi']; ?>" />
1143
+			<input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) {
1144
+	print $_COOKIE['filter_mmsi'];
1145
+}
1146
+?>" />
756 1147
 		    </li>
757 1148
 			<?php
758 1149
 				if (isset($globalVM) && $globalVM) {
@@ -779,7 +1170,10 @@  discard block
 block discarded – undo
779 1170
 		    ?>
780 1171
 		    <li>
781 1172
 			<?php echo _("Display with ident:"); ?>
782
-			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" />
1173
+			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) {
1174
+	print $_COOKIE['filter_ident'];
1175
+}
1176
+?>" />
783 1177
 		    </li>
784 1178
 		</ul>
785 1179
 	    </form>
@@ -795,7 +1189,10 @@  discard block
 block discarded – undo
795 1189
 	    <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
796 1190
 	    <form>
797 1191
 		<ul>
798
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if ((isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') || !isset($_COOKIE['displayiss'])) print 'checked'; ?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li>
1192
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if ((isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') || !isset($_COOKIE['displayiss'])) {
1193
+	print 'checked';
1194
+}
1195
+?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li>
799 1196
 		    <li><?php echo _("Type:"); ?>
800 1197
 			<select class="selectpicker" multiple onchange="sattypes(this);">
801 1198
 			    <?php
@@ -803,25 +1200,45 @@  discard block
 block discarded – undo
803 1200
 				$types = $Satellite->get_tle_types();
804 1201
 				foreach ($types as $type) {
805 1202
 					$type_name = $type['tle_type'];
806
-					if ($type_name == 'musson') $type_name = 'Russian LEO Navigation';
807
-					else if ($type_name == 'nnss') $type_name = 'Navi Navigation Satellite System';
808
-					else if ($type_name == 'sbas') $type_name = 'Satellite-Based Augmentation System';
809
-					else if ($type_name == 'glo-ops') $type_name = 'Glonass Operational';
810
-					else if ($type_name == 'gps-ops') $type_name = 'GPS Operational';
811
-					else if ($type_name == 'argos') $type_name = 'ARGOS Data Collection System';
812
-					else if ($type_name == 'tdrss') $type_name = 'Tracking and Data Relay Satellite System';
813
-					else if ($type_name == 'sarsat') $type_name = 'Search & Rescue';
814
-					else if ($type_name == 'dmc') $type_name = 'Disaster Monitoring';
815
-					else if ($type_name == 'resource') $type_name = 'Earth Resources';
816
-					else if ($type_name == 'stations') $type_name = 'Space Stations';
817
-					else if ($type_name == 'geo') $type_name = 'Geostationary';
818
-					else if ($type_name == 'amateur') $type_name = 'Amateur Radio';
819
-					else if ($type_name == 'x-comm') $type_name = 'Experimental';
820
-					else if ($type_name == 'other-comm') $type_name = 'Other Comm';
821
-					else if ($type_name == 'science') $type_name = 'Space & Earth Science';
822
-					else if ($type_name == 'military') $type_name = 'Miscellaneous Military';
823
-					else if ($type_name == 'radar') $type_name = 'Radar Calibration';
824
-					else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches';
1203
+					if ($type_name == 'musson') {
1204
+						$type_name = 'Russian LEO Navigation';
1205
+					} else if ($type_name == 'nnss') {
1206
+						$type_name = 'Navi Navigation Satellite System';
1207
+					} else if ($type_name == 'sbas') {
1208
+						$type_name = 'Satellite-Based Augmentation System';
1209
+					} else if ($type_name == 'glo-ops') {
1210
+						$type_name = 'Glonass Operational';
1211
+					} else if ($type_name == 'gps-ops') {
1212
+						$type_name = 'GPS Operational';
1213
+					} else if ($type_name == 'argos') {
1214
+						$type_name = 'ARGOS Data Collection System';
1215
+					} else if ($type_name == 'tdrss') {
1216
+						$type_name = 'Tracking and Data Relay Satellite System';
1217
+					} else if ($type_name == 'sarsat') {
1218
+						$type_name = 'Search & Rescue';
1219
+					} else if ($type_name == 'dmc') {
1220
+						$type_name = 'Disaster Monitoring';
1221
+					} else if ($type_name == 'resource') {
1222
+						$type_name = 'Earth Resources';
1223
+					} else if ($type_name == 'stations') {
1224
+						$type_name = 'Space Stations';
1225
+					} else if ($type_name == 'geo') {
1226
+						$type_name = 'Geostationary';
1227
+					} else if ($type_name == 'amateur') {
1228
+						$type_name = 'Amateur Radio';
1229
+					} else if ($type_name == 'x-comm') {
1230
+						$type_name = 'Experimental';
1231
+					} else if ($type_name == 'other-comm') {
1232
+						$type_name = 'Other Comm';
1233
+					} else if ($type_name == 'science') {
1234
+						$type_name = 'Space & Earth Science';
1235
+					} else if ($type_name == 'military') {
1236
+						$type_name = 'Miscellaneous Military';
1237
+					} else if ($type_name == 'radar') {
1238
+						$type_name = 'Radar Calibration';
1239
+					} else if ($type_name == 'tle-new') {
1240
+						$type_name = 'Last 30 days launches';
1241
+					}
825 1242
 					
826 1243
 					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) {
827 1244
 						print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>';
Please login to merge, or discard this patch.