Completed
Push — master ( 3627f6...11ce7e )
by Yannick
30:00
created
require/class.SpotterLive.php 1 patch
Spacing   +143 added lines, -143 removed lines patch added patch discarded remove patch
@@ -17,62 +17,62 @@  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['airlines']) && !empty($flt['airlines'])) {
38 38
 				if ($flt['airlines'][0] != '' && $flt['airlines'][0] != 'all') {
39 39
 					if (isset($flt['source'])) {
40
-						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id";
40
+						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id";
41 41
 					} else {
42
-						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id";
42
+						$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id";
43 43
 					}
44 44
 				}
45 45
 			}
46 46
 			if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) {
47 47
 				if (isset($flt['source'])) {
48
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id";
48
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id";
49 49
 				} else {
50
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id";
50
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id";
51 51
 				}
52 52
 			}
53 53
 			if (isset($flt['idents']) && !empty($flt['idents'])) {
54 54
 				if (isset($flt['source'])) {
55
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id";
55
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id";
56 56
 				} else {
57
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id";
57
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id";
58 58
 				}
59 59
 			}
60 60
 			if (isset($flt['registrations']) && !empty($flt['registrations'])) {
61 61
 				if (isset($flt['source'])) {
62
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','",$flt['registrations'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id";
62
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','", $flt['registrations'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id";
63 63
 				} else {
64
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','",$flt['registrations'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id";
64
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','", $flt['registrations'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id";
65 65
 				}
66 66
 			}
67 67
 			if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id']) && isset($flt['idents']) && empty($flt['idents'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']) && !isset($flt['idents']) && !isset($flt['registrations']))) {
68 68
 				if (isset($flt['source'])) {
69
-					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) ssf ON ssf.flightaware_id = spotter_live.flightaware_id";
69
+					$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) ssf ON ssf.flightaware_id = spotter_live.flightaware_id";
70 70
 				}
71 71
 			}
72 72
 		}
73 73
 		if (isset($filter['airlines']) && !empty($filter['airlines'])) {
74 74
 			if ($filter['airlines'][0] != '' && $filter['airlines'][0] != 'all') {
75
-				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) sai ON sai.flightaware_id = spotter_live.flightaware_id";
75
+				$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) sai ON sai.flightaware_id = spotter_live.flightaware_id";
76 76
 			}
77 77
 		}
78 78
 		if (isset($filter['alliance']) && !empty($filter['alliance'])) {
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_live.flightaware_id ";
83 83
 		}
84 84
 		if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) {
85
-			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) sp ON sp.flightaware_id = spotter_live.flightaware_id";
85
+			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) sp ON sp.flightaware_id = spotter_live.flightaware_id";
86 86
 		}
87 87
 		if (isset($filter['blocked']) && $filter['blocked'] == true) {
88 88
 			$filter_query_join .= " INNER JOIN (SELECT callsign FROM aircraft_block) cblk ON cblk.callsign = spotter_live.ident";
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 			if (count($filter['source']) == 1) {
92 92
 				$filter_query_where .= " AND format_source = '".$filter['source'][0]."'";
93 93
 			} else {
94
-				$filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')";
94
+				$filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')";
95 95
 			}
96 96
 		}
97 97
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
@@ -124,15 +124,15 @@  discard block
 block discarded – undo
124 124
 					$filter_query_date .= " AND EXTRACT(DAY FROM spotter_output.date) = '".$filter['day']."'";
125 125
 				}
126 126
 			}
127
-			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.flightaware_id = spotter_live.flightaware_id";
127
+			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.flightaware_id = spotter_live.flightaware_id";
128 128
 		}
129 129
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
130
-			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
130
+			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
131 131
 		}
132 132
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
133 133
 		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
134 134
 		if ($filter_query_where != '') {
135
-			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
135
+			$filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where);
136 136
 		}
137 137
 		$filter_query = $filter_query_join.$filter_query_where;
138 138
 		return $filter_query;
@@ -155,8 +155,8 @@  discard block
 block discarded – undo
155 155
 		if ($limit != '')
156 156
 		{
157 157
 			$limit_array = explode(',', $limit);
158
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
159
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
158
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
159
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
160 160
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
161 161
 			{
162 162
 				$limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0];
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 		} else {
181 181
 			$query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate".$filter_query.$orderby_query;
182 182
 		}
183
-		$spotter_array = $Spotter->getDataFromDB($query.$limit_query,array(),'',true);
183
+		$spotter_array = $Spotter->getDataFromDB($query.$limit_query, array(), '', true);
184 184
 
185 185
 		return $spotter_array;
186 186
 	}
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 	{
196 196
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
197 197
 		date_default_timezone_set('UTC');
198
-		$filter_query = $this->getFilter($filter,true,true);
198
+		$filter_query = $this->getFilter($filter, true, true);
199 199
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
200 200
 		if ($globalDBdriver == 'mysql') {
201 201
 			if (isset($globalArchive) && $globalArchive === TRUE) {
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 		try {
219 219
 			$sth = $this->db->prepare($query);
220 220
 			$sth->execute();
221
-		} catch(PDOException $e) {
221
+		} catch (PDOException $e) {
222 222
 			echo $e->getMessage();
223 223
 			die;
224 224
 		}
@@ -232,20 +232,20 @@  discard block
 block discarded – undo
232 232
 	* @return Array the spotter information
233 233
 	*
234 234
 	*/
235
-	public function getMinLastLiveSpotterData($coord = array(),$filter = array(), $limit = false, $id = '')
235
+	public function getMinLastLiveSpotterData($coord = array(), $filter = array(), $limit = false, $id = '')
236 236
 	{
237 237
 		global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap3DAircraftsLimit;
238 238
 		date_default_timezone_set('UTC');
239 239
 		$usecoord = false;
240 240
 		if (is_array($coord) && !empty($coord)) {
241
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
242
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
243
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
244
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
241
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
242
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
243
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
244
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
245 245
 			$usecoord = true;
246 246
 		}
247
-		$id = filter_var($id,FILTER_SANITIZE_STRING);
248
-		$filter_query = $this->getFilter($filter,true,true);
247
+		$id = filter_var($id, FILTER_SANITIZE_STRING);
248
+		$filter_query = $this->getFilter($filter, true, true);
249 249
 
250 250
 		if (!isset($globalLiveInterval) || $globalLiveInterval == '') $globalLiveInterval = '200';
251 251
 		if (!isset($globalMap3DAircraftsLimit) || $globalMap3DAircraftsLimit == '') $globalMap3DAircraftsLimit = '300';
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 				WHERE spotter_archive.latitude <> '0' AND spotter_archive.longitude <> '0' 
258 258
 				ORDER BY spotter_archive.flightaware_id, spotter_archive.date";
259 259
 				*/
260
-				$query  = 'SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source, spotter_archive.registration 
260
+				$query = 'SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source, spotter_archive.registration 
261 261
 				FROM spotter_archive INNER JOIN (SELECT flightaware_id FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date) l ON l.flightaware_id = spotter_archive.flightaware_id ";
262 262
 				if ($usecoord) $query .= "AND (spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
263 263
 				if ($id != '') $query .= "OR spotter_archive.flightaware_id = :id ";
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 				ORDER BY flightaware_id, date";
272 272
 				if ($limit) $query .= " LIMIT ".$globalMap3DAircraftsLimit;
273 273
 			} else {
274
-				$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
274
+				$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
275 275
 				FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date ";
276 276
 				if ($usecoord) $query .= "AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
277 277
 				if ($id != '') $query .= "OR spotter_live.flightaware_id = :id ";
@@ -287,13 +287,13 @@  discard block
 block discarded – undo
287 287
 				WHERE spotter_archive.latitude <> '0' AND spotter_archive.longitude <> '0' 
288 288
 				ORDER BY spotter_archive.flightaware_id, spotter_archive.date";
289 289
                                */
290
-				$query  = "SELECT * FROM (
290
+				$query = "SELECT * FROM (
291 291
 				SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source, spotter_archive.registration 
292 292
 				FROM spotter_archive 
293 293
 				INNER JOIN (
294 294
 				    SELECT flightaware_id 
295 295
 				    FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date";
296
-				$query.= ") l ON l.flightaware_id = spotter_archive.flightaware_id ";
296
+				$query .= ") l ON l.flightaware_id = spotter_archive.flightaware_id ";
297 297
 				if ($usecoord) $query .= "AND (spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
298 298
 				if ($id != '') $query .= "OR spotter_archive.flightaware_id = :id ";
299 299
 				$query .= "UNION
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 		try {
320 320
 			$sth = $this->db->prepare($query);
321 321
 			$sth->execute($query_values);
322
-		} catch(PDOException $e) {
322
+		} catch (PDOException $e) {
323 323
 			echo $e->getMessage();
324 324
 			die;
325 325
 		}
@@ -333,12 +333,12 @@  discard block
 block discarded – undo
333 333
 	* @return Array the spotter information
334 334
 	*
335 335
 	*/
336
-	public function getMinLastLiveSpotterDataByID($id = '',$filter = array(), $limit = false)
336
+	public function getMinLastLiveSpotterDataByID($id = '', $filter = array(), $limit = false)
337 337
 	{
338 338
 		global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap3DAircraftsLimit;
339 339
 		date_default_timezone_set('UTC');
340
-		$id = filter_var($id,FILTER_SANITIZE_STRING);
341
-		$filter_query = $this->getFilter($filter,true,true);
340
+		$id = filter_var($id, FILTER_SANITIZE_STRING);
341
+		$filter_query = $this->getFilter($filter, true, true);
342 342
 
343 343
 		if (!isset($globalLiveInterval) || $globalLiveInterval == '') $globalLiveInterval = '200';
344 344
 		if (!isset($globalMap3DAircraftsLimit) || $globalMap3DAircraftsLimit == '') $globalMap3DAircraftsLimit = '300';
@@ -362,13 +362,13 @@  discard block
 block discarded – undo
362 362
 			}
363 363
 		} else {
364 364
 			if (isset($globalArchive) && $globalArchive === TRUE) {
365
-				$query  = "SELECT * FROM (
365
+				$query = "SELECT * FROM (
366 366
 				SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source, spotter_archive.registration 
367 367
 				FROM spotter_archive 
368 368
 				INNER JOIN (
369 369
 				    SELECT flightaware_id 
370 370
 				    FROM spotter_live".$filter_query." spotter_live.flightaware_id = :id";
371
-				$query.= ") l ON l.flightaware_id = spotter_archive.flightaware_id ";
371
+				$query .= ") l ON l.flightaware_id = spotter_archive.flightaware_id ";
372 372
 				$query .= "UNION
373 373
 				    SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
374 374
 				    FROM spotter_live".$filter_query." spotter_live.flightaware_id = :id";
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 		try {
389 389
 			$sth = $this->db->prepare($query);
390 390
 			$sth->execute($query_values);
391
-		} catch(PDOException $e) {
391
+		} catch (PDOException $e) {
392 392
 			echo $e->getMessage();
393 393
 			die;
394 394
 		}
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
 	public function getLiveSpotterCount($filter = array())
406 406
 	{
407 407
 		global $globalDBdriver, $globalLiveInterval;
408
-		$filter_query = $this->getFilter($filter,true,true);
408
+		$filter_query = $this->getFilter($filter, true, true);
409 409
 
410 410
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
411 411
 		if ($globalDBdriver == 'mysql') {
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 		try {
419 419
 			$sth = $this->db->prepare($query);
420 420
 			$sth->execute();
421
-		} catch(PDOException $e) {
421
+		} catch (PDOException $e) {
422 422
 			echo $e->getMessage();
423 423
 			die;
424 424
 		}
@@ -441,10 +441,10 @@  discard block
 block discarded – undo
441 441
 		$filter_query = $this->getFilter($filter);
442 442
 
443 443
 		if (is_array($coord)) {
444
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
445
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
446
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
447
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
444
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
445
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
446
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
447
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
448 448
 		} else return array();
449 449
 		if ($globalDBdriver == 'mysql') {
450 450
 			$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY spotter_live.flightaware_id'.$filter_query;
@@ -467,23 +467,23 @@  discard block
 block discarded – undo
467 467
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
468 468
 		$Spotter = new Spotter($this->db);
469 469
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
470
-		$filter_query = $this->getFilter($filter,true,true);
470
+		$filter_query = $this->getFilter($filter, true, true);
471 471
 
472 472
 		if (is_array($coord)) {
473
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
474
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
475
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
476
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
473
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
474
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
475
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
476
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
477 477
 		} else return array();
478 478
 		if ($globalDBdriver == 'mysql') {
479 479
 			if (isset($globalArchive) && $globalArchive === TRUE) {
480
-				$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
480
+				$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
481 481
 				FROM spotter_live 
482 482
 				'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= spotter_live.date 
483 483
 				AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.'
484 484
 				AND spotter_live.latitude <> 0 AND spotter_live.longitude <> 0 ORDER BY date DESC';
485 485
 			} else {
486
-				$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
486
+				$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
487 487
 				FROM spotter_live 
488 488
 				INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate 
489 489
 				    FROM spotter_live l 
@@ -495,14 +495,14 @@  discard block
 block discarded – undo
495 495
 			}
496 496
 		} else {
497 497
 			if (isset($globalArchive) && $globalArchive === TRUE) {
498
-				$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
498
+				$query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
499 499
 				FROM spotter_live 
500 500
 				".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date 
501 501
 				AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." 
502 502
 				AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong." 
503 503
 				AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' ORDER BY date DESC";
504 504
 			} else {
505
-				$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
505
+				$query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
506 506
 				FROM spotter_live 
507 507
 				INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate 
508 508
 				    FROM spotter_live l 
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
 		try {
518 518
 			$sth = $this->db->prepare($query);
519 519
 			$sth->execute();
520
-		} catch(PDOException $e) {
520
+		} catch (PDOException $e) {
521 521
 			echo $e->getMessage();
522 522
 			die;
523 523
 		}
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
                 if ($interval == '1m')
567 567
                 {
568 568
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
569
-                } else if ($interval == '15m'){
569
+                } else if ($interval == '15m') {
570 570
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date ';
571 571
                 } 
572 572
             }
@@ -574,14 +574,14 @@  discard block
 block discarded – undo
574 574
          $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';   
575 575
         }
576 576
 
577
-                $query  = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live 
577
+                $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live 
578 578
                    WHERE spotter_live.latitude <> '' 
579 579
                                    AND spotter_live.longitude <> '' 
580 580
                    ".$additional_query."
581 581
                    HAVING distance < :radius  
582 582
                                    ORDER BY distance";
583 583
 
584
-                $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
584
+                $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius));
585 585
 
586 586
                 return $spotter_array;
587 587
         }
@@ -599,9 +599,9 @@  discard block
 block discarded – undo
599 599
 		date_default_timezone_set('UTC');
600 600
 
601 601
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
602
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
602
+                $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
603 603
 
604
-		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true);
604
+		$spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident), '', true);
605 605
 
606 606
 		return $spotter_array;
607 607
 	}
@@ -612,16 +612,16 @@  discard block
 block discarded – undo
612 612
 	* @return Array the spotter information
613 613
 	*
614 614
 	*/
615
-	public function getDateLiveSpotterDataByIdent($ident,$date)
615
+	public function getDateLiveSpotterDataByIdent($ident, $date)
616 616
 	{
617 617
 		$Spotter = new Spotter($this->db);
618 618
 		date_default_timezone_set('UTC');
619 619
 
620 620
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
621
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
621
+                $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
622 622
 
623
-                $date = date('c',$date);
624
-		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
623
+                $date = date('c', $date);
624
+		$spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date));
625 625
 
626 626
 		return $spotter_array;
627 627
 	}
@@ -637,8 +637,8 @@  discard block
 block discarded – undo
637 637
 		$Spotter = new Spotter($this->db);
638 638
 		date_default_timezone_set('UTC');
639 639
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
640
-		$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
641
-		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id),'',true);
640
+		$query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
641
+		$spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id), '', true);
642 642
 		return $spotter_array;
643 643
 	}
644 644
 
@@ -648,15 +648,15 @@  discard block
 block discarded – undo
648 648
 	* @return Array the spotter information
649 649
 	*
650 650
 	*/
651
-	public function getDateLiveSpotterDataById($id,$date)
651
+	public function getDateLiveSpotterDataById($id, $date)
652 652
 	{
653 653
 		$Spotter = new Spotter($this->db);
654 654
 		date_default_timezone_set('UTC');
655 655
 
656 656
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
657
-		$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
658
-		$date = date('c',$date);
659
-		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
657
+		$query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
658
+		$date = date('c', $date);
659
+		$spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true);
660 660
 		return $spotter_array;
661 661
 	}
662 662
 
@@ -672,13 +672,13 @@  discard block
 block discarded – undo
672 672
 		date_default_timezone_set('UTC');
673 673
 
674 674
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
675
-                $query  = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
675
+                $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
676 676
 
677 677
     		try {
678 678
 			
679 679
 			$sth = $this->db->prepare($query);
680 680
 			$sth->execute(array(':ident' => $ident));
681
-		} catch(PDOException $e) {
681
+		} catch (PDOException $e) {
682 682
 			echo $e->getMessage();
683 683
 			die;
684 684
 		}
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
 	* @return Array the spotter information
694 694
 	*
695 695
 	*/
696
-	public function getAllLiveSpotterDataById($id,$liveinterval = false)
696
+	public function getAllLiveSpotterDataById($id, $liveinterval = false)
697 697
 	{
698 698
 		global $globalDBdriver, $globalLiveInterval;
699 699
 		date_default_timezone_set('UTC');
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
 		try {
713 713
 			$sth = $this->db->prepare($query);
714 714
 			$sth->execute(array(':id' => $id));
715
-		} catch(PDOException $e) {
715
+		} catch (PDOException $e) {
716 716
 			echo $e->getMessage();
717 717
 			die;
718 718
 		}
@@ -730,12 +730,12 @@  discard block
 block discarded – undo
730 730
 	{
731 731
 		date_default_timezone_set('UTC');
732 732
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
733
-		$query  = self::$global_query.' WHERE spotter_live.ident = :ident';
733
+		$query = self::$global_query.' WHERE spotter_live.ident = :ident';
734 734
     		try {
735 735
 			
736 736
 			$sth = $this->db->prepare($query);
737 737
 			$sth->execute(array(':ident' => $ident));
738
-		} catch(PDOException $e) {
738
+		} catch (PDOException $e) {
739 739
 			echo $e->getMessage();
740 740
 			die;
741 741
 		}
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
 			
766 766
 			$sth = $this->db->prepare($query);
767 767
 			$sth->execute();
768
-		} catch(PDOException $e) {
768
+		} catch (PDOException $e) {
769 769
 			return "error";
770 770
 		}
771 771
 
@@ -788,14 +788,14 @@  discard block
 block discarded – undo
788 788
 				
789 789
 				$sth = $this->db->prepare($query);
790 790
 				$sth->execute();
791
-			} catch(PDOException $e) {
791
+			} catch (PDOException $e) {
792 792
 				return "error";
793 793
 			}
794 794
 			$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
795 795
                         $i = 0;
796
-                        $j =0;
796
+                        $j = 0;
797 797
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
798
-			foreach($all as $row)
798
+			foreach ($all as $row)
799 799
 			{
800 800
 				$i++;
801 801
 				$j++;
@@ -803,9 +803,9 @@  discard block
 block discarded – undo
803 803
 					if ($globalDebug) echo ".";
804 804
 				    	try {
805 805
 						
806
-						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
806
+						$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
807 807
 						$sth->execute();
808
-					} catch(PDOException $e) {
808
+					} catch (PDOException $e) {
809 809
 						return "error";
810 810
 					}
811 811
                                 	$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
@@ -816,9 +816,9 @@  discard block
 block discarded – undo
816 816
 			if ($i > 0) {
817 817
     				try {
818 818
 					
819
-					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
819
+					$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
820 820
 					$sth->execute();
821
-				} catch(PDOException $e) {
821
+				} catch (PDOException $e) {
822 822
 					return "error";
823 823
 				}
824 824
 			}
@@ -831,7 +831,7 @@  discard block
 block discarded – undo
831 831
 				
832 832
 				$sth = $this->db->prepare($query);
833 833
 				$sth->execute();
834
-			} catch(PDOException $e) {
834
+			} catch (PDOException $e) {
835 835
 				return "error";
836 836
 			}
837 837
 /*			$query_delete = "DELETE FROM spotter_live WHERE flightaware_id IN (";
@@ -879,13 +879,13 @@  discard block
 block discarded – undo
879 879
 	public function deleteLiveSpotterDataByIdent($ident)
880 880
 	{
881 881
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
882
-		$query  = 'DELETE FROM spotter_live WHERE ident = :ident';
882
+		$query = 'DELETE FROM spotter_live WHERE ident = :ident';
883 883
         
884 884
     		try {
885 885
 			
886 886
 			$sth = $this->db->prepare($query);
887 887
 			$sth->execute(array(':ident' => $ident));
888
-		} catch(PDOException $e) {
888
+		} catch (PDOException $e) {
889 889
 			return "error";
890 890
 		}
891 891
 
@@ -901,13 +901,13 @@  discard block
 block discarded – undo
901 901
 	public function deleteLiveSpotterDataById($id)
902 902
 	{
903 903
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
904
-		$query  = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
904
+		$query = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
905 905
         
906 906
     		try {
907 907
 			
908 908
 			$sth = $this->db->prepare($query);
909 909
 			$sth->execute(array(':id' => $id));
910
-		} catch(PDOException $e) {
910
+		} catch (PDOException $e) {
911 911
 			return "error";
912 912
 		}
913 913
 
@@ -925,13 +925,13 @@  discard block
 block discarded – undo
925 925
 	{
926 926
 		global $globalDBdriver, $globalTimezone;
927 927
 		if ($globalDBdriver == 'mysql') {
928
-			$query  = 'SELECT spotter_live.ident FROM spotter_live 
928
+			$query = 'SELECT spotter_live.ident FROM spotter_live 
929 929
 				WHERE spotter_live.ident = :ident 
930 930
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
931 931
 				AND spotter_live.date < UTC_TIMESTAMP()';
932 932
 			$query_data = array(':ident' => $ident);
933 933
 		} else {
934
-			$query  = "SELECT spotter_live.ident FROM spotter_live 
934
+			$query = "SELECT spotter_live.ident FROM spotter_live 
935 935
 				WHERE spotter_live.ident = :ident 
936 936
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
937 937
 				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -940,8 +940,8 @@  discard block
 block discarded – undo
940 940
 		
941 941
 		$sth = $this->db->prepare($query);
942 942
 		$sth->execute($query_data);
943
-		$ident_result='';
944
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
943
+		$ident_result = '';
944
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
945 945
 		{
946 946
 			$ident_result = $row['ident'];
947 947
 		}
@@ -958,13 +958,13 @@  discard block
 block discarded – undo
958 958
 	{
959 959
 		global $globalDBdriver, $globalTimezone;
960 960
 		if ($globalDBdriver == 'mysql') {
961
-			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
961
+			$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
962 962
 				WHERE spotter_live.ident = :ident 
963 963
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 MINUTE)'; 
964 964
 //				AND spotter_live.date < UTC_TIMESTAMP()";
965 965
 			$query_data = array(':ident' => $ident);
966 966
 		} else {
967
-			$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
967
+			$query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
968 968
 				WHERE spotter_live.ident = :ident 
969 969
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '20 MINUTES'";
970 970
 //				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -973,8 +973,8 @@  discard block
 block discarded – undo
973 973
 		
974 974
 		$sth = $this->db->prepare($query);
975 975
 		$sth->execute($query_data);
976
-		$ident_result='';
977
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
976
+		$ident_result = '';
977
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
978 978
 		{
979 979
 			$ident_result = $row['flightaware_id'];
980 980
 		}
@@ -991,13 +991,13 @@  discard block
 block discarded – undo
991 991
 	{
992 992
 		global $globalDBdriver, $globalTimezone;
993 993
 		if ($globalDBdriver == 'mysql') {
994
-			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
994
+			$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
995 995
 				WHERE spotter_live.flightaware_id = :id 
996 996
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; 
997 997
 //				AND spotter_live.date < UTC_TIMESTAMP()";
998 998
 			$query_data = array(':id' => $id);
999 999
 		} else {
1000
-			$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
1000
+			$query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live 
1001 1001
 				WHERE spotter_live.flightaware_id = :id 
1002 1002
 				AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'";
1003 1003
 //				AND spotter_live.date < now() AT TIME ZONE 'UTC'";
@@ -1006,8 +1006,8 @@  discard block
 block discarded – undo
1006 1006
 		
1007 1007
 		$sth = $this->db->prepare($query);
1008 1008
 		$sth->execute($query_data);
1009
-		$ident_result='';
1010
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1009
+		$ident_result = '';
1010
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1011 1011
 		{
1012 1012
 			$ident_result = $row['flightaware_id'];
1013 1013
 		}
@@ -1024,13 +1024,13 @@  discard block
 block discarded – undo
1024 1024
 	{
1025 1025
 		global $globalDBdriver, $globalTimezone;
1026 1026
 		if ($globalDBdriver == 'mysql') {
1027
-			$query  = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
1027
+			$query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
1028 1028
 				WHERE spotter_live.ModeS = :modes 
1029 1029
 				AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 MINUTE)'; 
1030 1030
 //				AND spotter_live.date < UTC_TIMESTAMP()";
1031 1031
 			$query_data = array(':modes' => $modes);
1032 1032
 		} else {
1033
-			$query  = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
1033
+			$query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live 
1034 1034
 				WHERE spotter_live.ModeS = :modes 
1035 1035
 				AND spotter_live.date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 MINUTE'";
1036 1036
 //			//	AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
@@ -1039,8 +1039,8 @@  discard block
 block discarded – undo
1039 1039
 		
1040 1040
 		$sth = $this->db->prepare($query);
1041 1041
 		$sth->execute($query_data);
1042
-		$ident_result='';
1043
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1042
+		$ident_result = '';
1043
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1044 1044
 		{
1045 1045
 			//$ident_result = $row['spotter_live_id'];
1046 1046
 			$ident_result = $row['flightaware_id'];
@@ -1065,8 +1065,8 @@  discard block
 block discarded – undo
1065 1065
 				return array();
1066 1066
 			} else {
1067 1067
 				$q_array = explode(" ", $q);
1068
-				foreach ($q_array as $q_item){
1069
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
1068
+				foreach ($q_array as $q_item) {
1069
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
1070 1070
 					$additional_query .= " AND (";
1071 1071
 					$additional_query .= "(spotter_live.aircraft_icao like '%".$q_item."%') OR ";
1072 1072
 					$additional_query .= "(spotter_live.aircraft_name like '%".$q_item."%') OR ";
@@ -1081,11 +1081,11 @@  discard block
 block discarded – undo
1081 1081
 			}
1082 1082
 		}
1083 1083
 		if ($globalDBdriver == 'mysql') {
1084
-			$query  = "SELECT spotter_live.* FROM spotter_live 
1084
+			$query = "SELECT spotter_live.* FROM spotter_live 
1085 1085
 			    WHERE spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." 
1086 1086
 			    AND spotter_live.date < UTC_TIMESTAMP()";
1087 1087
 		} else {
1088
-			$query  = "SELECT spotter_live.* FROM spotter_live 
1088
+			$query = "SELECT spotter_live.* FROM spotter_live 
1089 1089
 			    WHERE spotter_live.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." 
1090 1090
 			    AND spotter_live.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
1091 1091
 		}
@@ -1105,7 +1105,7 @@  discard block
 block discarded – undo
1105 1105
 	* @return String success or false
1106 1106
 	*
1107 1107
 	*/
1108
-	public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '',$heading = '', $groundspeed = '', $date = '',$departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false,$registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false,$format_source = '', $source_name = '', $over_country = '')
1108
+	public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false, $registration = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false, $format_source = '', $source_name = '', $over_country = '')
1109 1109
 	{
1110 1110
 		global $globalURL, $globalArchive, $globalDebug;
1111 1111
 		$Common = new Common();
@@ -1205,27 +1205,27 @@  discard block
 block discarded – undo
1205 1205
 		if ($date == '') $date = date("Y-m-d H:i:s", time());
1206 1206
 
1207 1207
         
1208
-		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
1209
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
1210
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
1211
-		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
1212
-		$arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING);
1213
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1214
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1215
-		$waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING);
1216
-		$altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1217
-		$altitude_real = filter_var($altitude_real,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1218
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
1219
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1220
-		$squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT);
1221
-		$route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING);
1222
-		$ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING);
1223
-		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING);
1224
-		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
1225
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
1226
-		$source_name = filter_var($source_name,FILTER_SANITIZE_STRING);
1227
-		$over_country = filter_var($over_country,FILTER_SANITIZE_STRING);
1228
-		$verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT);
1208
+		$flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING);
1209
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
1210
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
1211
+		$departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING);
1212
+		$arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING);
1213
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1214
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1215
+		$waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING);
1216
+		$altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1217
+		$altitude_real = filter_var($altitude_real, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1218
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
1219
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1220
+		$squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT);
1221
+		$route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING);
1222
+		$ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING);
1223
+		$pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING);
1224
+		$pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
1225
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
1226
+		$source_name = filter_var($source_name, FILTER_SANITIZE_STRING);
1227
+		$over_country = filter_var($over_country, FILTER_SANITIZE_STRING);
1228
+		$verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT);
1229 1229
 
1230 1230
 		$airline_name = '';
1231 1231
 		$airline_icao = '';
@@ -1247,10 +1247,10 @@  discard block
 block discarded – undo
1247 1247
 		$arrival_airport_country = '';
1248 1248
 		
1249 1249
             	
1250
-            	if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
1251
-            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
1252
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
1253
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
1250
+            	if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL;
1251
+            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL;
1252
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
1253
+            	if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
1254 1254
 		
1255 1255
 		$query = '';
1256 1256
 		if ($globalArchive) {
@@ -1261,19 +1261,19 @@  discard block
 block discarded – undo
1261 1261
 		$query  .= 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country, real_altitude) 
1262 1262
 		VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_shadow,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name, :departure_airport_city, :departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date,:departure_airport_time,:arrival_airport_time,:squawk,:route_stop,:ModeS, :pilot_id, :pilot_name, :verticalrate, :ground, :format_source, :source_name, :over_country, :real_altitude)';
1263 1263
 
1264
-		$query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_shadow' => $aircraft_shadow,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk,':route_stop' => $route_stop,':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source,':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country,':real_altitude' => $altitude_real);
1264
+		$query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_shadow' => $aircraft_shadow, ':aircraft_type' => $aircraft_type, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country, ':real_altitude' => $altitude_real);
1265 1265
 		try {
1266 1266
 			
1267 1267
 			$sth = $this->db->prepare($query);
1268 1268
 			$sth->execute($query_values);
1269 1269
 			$sth->closeCursor();
1270
-		} catch(PDOException $e) {
1270
+		} catch (PDOException $e) {
1271 1271
 			return "error : ".$e->getMessage();
1272 1272
 		}
1273 1273
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
1274 1274
 		    if ($globalDebug) echo '(Add to SBS archive : ';
1275 1275
 		    $SpotterArchive = new SpotterArchive($this->db);
1276
-		    $result =  $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $altitude_real,$heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country);
1276
+		    $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time, $arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date, $latitude, $longitude, $waypoints, $altitude, $altitude_real, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name, $verticalrate, $format_source, $source_name, $over_country);
1277 1277
 		    if ($globalDebug) echo $result.')';
1278 1278
 		} elseif ($globalDebug && $putinarchive !== true) {
1279 1279
 			echo '(Not adding to archive)';
@@ -1286,7 +1286,7 @@  discard block
 block discarded – undo
1286 1286
 
1287 1287
 	public function getOrderBy()
1288 1288
 	{
1289
-		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC"));
1289
+		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC"));
1290 1290
 		return $orderby;
1291 1291
 	}
1292 1292
 
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
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     <?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 } ?>
56 56
 </tr></table></div>
57 57
 <?php
58
-    if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
58
+	if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
59 59
 ?>
60 60
 <script src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) print '?tsk='.$tsk; ?>"></script>
61 61
 <script src="<?php echo $globalURL; ?>/js/meuusjs.1.0.3.min.js"></script>
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 <script src="<?php echo $globalURL; ?>/js/map-marine.3d.js.php"></script>
82 82
 <?php
83 83
 	}
84
-    }
84
+	}
85 85
 ?>
86 86
 
87 87
 <div id="sidebar" class="sidebar collapsed">
@@ -92,13 +92,13 @@  discard block
 block discarded – undo
92 92
 	<li><a href="" onclick="getUserLocation(); return false;" title="<?php echo _("Plot your Location"); ?>"><i class="fa fa-map-marker"></i></a></li>
93 93
 	<li><a href="" onclick="getCompassDirection(); return false;" title="<?php echo _("Compass Mode"); ?>"><i class="fa fa-compass"></i></a></li>
94 94
 <?php
95
-    //if ((isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') || (isset($globalBeta) && $globalBeta === TRUE)) {
95
+	//if ((isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') || (isset($globalBeta) && $globalBeta === TRUE)) {
96 96
 	if (isset($globalArchive) && $globalArchive == TRUE && (!isset($globalAircraft) || $globalAircraft === TRUE)) {
97 97
 ?>
98 98
 	<li><a href="#archive" role="tab" title="<?php echo _("Archive"); ?>"><i class="fa fa-archive"></i></a></li>
99 99
 <?php
100 100
 	}
101
-    //}
101
+	//}
102 102
 ?>
103 103
 	<li><a href="#home" role="tab" title="<?php echo _("Layers"); ?>"><i class="fa fa-map"></i></a></li>
104 104
 	<li><a href="#filters" role="tab" title="<?php echo _("Filters"); ?>"><i class="fa fa-filter"></i></a></li>
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 ?>
113 113
 
114 114
 <?php
115
-    if (isset($globalMap3D) && $globalMap3D) {
115
+	if (isset($globalMap3D) && $globalMap3D) {
116 116
 	if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
117 117
 ?>
118 118
 	<li><a href="" onclick="show3D(); return false;" role="tab" title="3D"><b>3D</b></a></li>
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	<li><a href="" onclick="show2D(); return false;" role="tab" title="2D"><b>2D</b></a></li>
123 123
 <?php
124 124
 	}
125
-    }
125
+	}
126 126
 ?>
127 127
     </ul>
128 128
 
@@ -299,15 +299,15 @@  discard block
 block discarded – undo
299 299
 		    </div>
300 300
 		</li>
301 301
 		<?php
302
-		    if (isset($globalDemo) && $globalDemo) {
302
+			if (isset($globalDemo) && $globalDemo) {
303 303
 		?>
304 304
 		<li><button type="button" class="btn btn-primary disabled"><?php echo _("Show archive"); ?></button> Disabled in Demo mode</li>
305 305
 		<?php
306
-		    } else {
306
+			} else {
307 307
 		?>
308 308
 		<li><button type="button" onclick="addarchive(begindate,enddate);" class="btn btn-primary"><?php echo _("Show archive"); ?></button></li>
309 309
 		<?php
310
-		    }
310
+			}
311 311
 		?>
312 312
 	    </ul>
313 313
 	    <ul>
@@ -326,83 +326,83 @@  discard block
 block discarded – undo
326 326
 				if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
327 327
 					if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider;
328 328
 					else $MapType = $_COOKIE['MapType'];
329
-			    ?>
329
+				?>
330 330
 			<select  class="selectpicker" onchange="mapType(this);">
331 331
 			    <?php
332 332
 				} else {
333 333
 					if (!isset($_COOKIE['MapType3D']) || $_COOKIE['MapType3D'] == '') $MapType = $globalMapProvider;
334 334
 					else $MapType = $_COOKIE['MapType3D'];
335
-			    ?>
335
+				?>
336 336
 			<select  class="selectpicker" onchange="mapType3D(this);">
337 337
 			    <?php
338 338
 				}
339
-			    ?>
339
+				?>
340 340
 			    <?php
341 341
 				if (isset($globalMapOffline) && $globalMapOffline === TRUE) {
342
-			    ?>
342
+				?>
343 343
 			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option>
344 344
 			    <?php
345 345
 				} else {
346
-				    if (file_exists(dirname(__FILE__).'/js/Cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml')) {
347
-			    ?>
346
+					if (file_exists(dirname(__FILE__).'/js/Cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml')) {
347
+				?>
348 348
 			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option>
349 349
 			    <?php
350
-				    }
351
-			    ?>
350
+					}
351
+				?>
352 352
 			    <option value="ArcGIS-Streetmap"<?php if ($MapType == 'ArcGIS-Streetmap') print ' selected'; ?>>ArcGIS Streetmap</option>
353 353
 			    <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Satellite') print ' selected'; ?>>ArcGIS Satellite</option>
354 354
 			    <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Ocean') print ' selected'; ?>>ArcGIS Ocean</option>
355 355
 			    <?php
356
-				    if (isset($globalBingMapKey) && $globalBingMapKey != '') {
357
-			    ?>
356
+					if (isset($globalBingMapKey) && $globalBingMapKey != '') {
357
+				?>
358 358
 			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option>
359 359
 			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option>
360 360
 			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option>
361 361
 			    <?php
362
-				    }
363
-			    ?>
362
+					}
363
+				?>
364 364
 			    <?php
365
-				    if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
366
-			    ?>
365
+					if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
366
+				?>
367 367
 			    <?php
368 368
 					if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
369
-			    ?>
369
+				?>
370 370
 			    <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option>
371 371
 			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option>
372 372
 			    <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option>
373 373
 			    <?php
374 374
 					}
375
-			    ?>
375
+				?>
376 376
 			    <?php
377 377
 					if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
378
-			    ?>
378
+				?>
379 379
 			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option>
380 380
 			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option>
381 381
 			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option>
382 382
 			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option>
383 383
 			    <?php
384 384
 					}
385
-			    ?>
385
+				?>
386 386
 			    <?php
387 387
 					if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
388
-			    ?>
388
+				?>
389 389
 			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option>
390 390
 			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option>
391 391
 			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option>
392 392
 			    <?php
393 393
 					}
394
-			    ?>
394
+				?>
395 395
 			    <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option>
396 396
 			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth</option>
397 397
 			    <?php
398
-				    }
399
-			    ?>
398
+					}
399
+				?>
400 400
 			    <option value="NatGeo-Street"<?php if ($MapType == 'NatGeo-Street') print ' selected'; ?>>National Geographic Street</option>
401 401
 			    <?php
402
-				    if (isset($globalMapboxToken) && $globalMapboxToken != '') {
402
+					if (isset($globalMapboxToken) && $globalMapboxToken != '') {
403 403
 					if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default';
404 404
 					else $MapBoxId = $_COOKIE['MapTypeId'];
405
-			    ?>
405
+				?>
406 406
 			    <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') print ' selected'; ?>>Mapbox GL</option>
407 407
 			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option>
408 408
 			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option>
@@ -417,16 +417,16 @@  discard block
 block discarded – undo
417 417
 			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option>
418 418
 			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option>
419 419
 			    <?php
420
-				    }
421
-			    ?>
420
+					}
421
+				?>
422 422
 			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option>
423 423
 			    <?php
424 424
 				}
425
-			    ?>
425
+				?>
426 426
 			</select>
427 427
 		    </li>
428 428
 <?php
429
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d' && (!isset($globalMapOffline) || $globalMapOffline === FALSE)) {
429
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d' && (!isset($globalMapOffline) || $globalMapOffline === FALSE)) {
430 430
 ?>
431 431
 		    <li><?php echo _("Type of Terrain:"); ?>
432 432
 			<select  class="selectpicker" onchange="terrainType(this);">
@@ -437,18 +437,18 @@  discard block
 block discarded – undo
437 437
 			</select>
438 438
 		    </li>
439 439
 <?php
440
-    }
440
+	}
441 441
 ?>
442 442
 
443 443
 <?php
444
-    if (isset($globalMap3D) && $globalMap3D) {
444
+	if (isset($globalMap3D) && $globalMap3D) {
445 445
 ?>
446 446
 		    <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>
447 447
 <?php
448
-    }
448
+	}
449 449
 ?>
450 450
 <?php
451
-    if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
451
+	if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
452 452
 ?>
453 453
 		    <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>
454 454
 
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
 		    <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>
472 472
 <?php
473 473
 	}
474
-    }
474
+	}
475 475
 ?>
476 476
 		    <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>
477 477
 		    <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>
@@ -490,82 +490,82 @@  discard block
 block discarded – undo
490 490
 	}
491 491
 ?>
492 492
 <?php
493
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
493
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
494 494
 ?>
495 495
 		    <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>
496 496
 		    <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>
497 497
 		    <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>
498 498
 		    <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>
499 499
 <?php
500
-    }
501
-    if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
500
+	}
501
+	if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
502 502
 ?>
503 503
 		    <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>
504 504
 <?php
505
-    }
505
+	}
506 506
 ?>
507 507
 		    <?php
508 508
 			if (function_exists('array_column')) {
509
-			    if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
510
-		    ?>
509
+				if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
510
+			?>
511 511
 		    <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>
512 512
 		    <?php
513
-			    }
513
+				}
514 514
 			} elseif (isset($globalSources)) {
515
-			    $dispolar = false;
516
-			    foreach ($globalSources as $testsource) {
517
-			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
518
-			    }
519
-			    if ($dispolar) {
520
-		    ?>
515
+				$dispolar = false;
516
+				foreach ($globalSources as $testsource) {
517
+					if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
518
+				}
519
+				if ($dispolar) {
520
+			?>
521 521
 		    <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>
522 522
 		    <?php
523
-			    }
524
-		        }
525
-		    ?>
523
+				}
524
+				}
525
+			?>
526 526
 <?php
527
-    if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
527
+	if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
528 528
 ?>
529 529
 
530 530
 		    <?php
531 531
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
532
-		    	    if (extension_loaded('gd') && function_exists('gd_info')) {
533
-		    ?>
532
+					if (extension_loaded('gd') && function_exists('gd_info')) {
533
+			?>
534 534
 		    <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>
535 535
 		    <?php 
536 536
 				if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') {
537
-		    ?>
537
+			?>
538 538
 			<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>
539 539
 		    <?php
540 540
 				}
541
-			    }
542
-		        }
543
-		    ?>
541
+				}
542
+				}
543
+			?>
544 544
 		    <?php
545 545
 			if (isset($globalMarine) && $globalMarine === TRUE) {
546
-			    if (extension_loaded('gd') && function_exists('gd_info')) {
547
-		    ?>
546
+				if (extension_loaded('gd') && function_exists('gd_info')) {
547
+			?>
548 548
 		    <li><?php echo _("Marine icon color:"); ?>
549 549
 			<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'; ?>">
550 550
 		    </li>
551 551
 		    <?php
552
-			    }
553
-		        }
554
-		    ?>
552
+				}
553
+				}
554
+			?>
555 555
 		    <?php
556 556
 			if (isset($globalTracker) && $globalTracker === TRUE) {
557
-			    if (extension_loaded('gd') && function_exists('gd_info')) {
558
-		    ?>
557
+				if (extension_loaded('gd') && function_exists('gd_info')) {
558
+			?>
559 559
 		    <li><?php echo _("Tracker icon color:"); ?>
560 560
 			<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'; ?>">
561 561
 		    </li>
562 562
 		    <?php
563
-			    }
564
-		        }
565
-		    ?>
563
+				}
564
+				}
565
+			?>
566 566
 		    <?php
567 567
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
568
-		    ?>
568
+			?>
569 569
 		    <li><?php echo _("Show airport icon at zoom level:"); ?>
570 570
 			<div class="range">
571 571
 			    <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'; ?>">
@@ -574,9 +574,9 @@  discard block
 block discarded – undo
574 574
 		    </li>
575 575
 		    <?php
576 576
 			}
577
-		    ?>
577
+			?>
578 578
 <?php
579
-    } elseif (isset($_COOKIE['MapFormat']) || $_COOKIE['MapFOrmat'] == '3d') {
579
+	} elseif (isset($_COOKIE['MapFormat']) || $_COOKIE['MapFOrmat'] == '3d') {
580 580
 ?>
581 581
 		    <li><?php echo _("Set scaling factor for rendering resolution:"); ?>
582 582
 			<div class="range">
@@ -614,7 +614,7 @@  discard block
 block discarded – undo
614 614
 		    </li>
615 615
 <?php
616 616
 	}
617
-    }
617
+	}
618 618
 ?>
619 619
 		    <li><?php echo _("Distance unit:"); ?>
620 620
 			<select class="selectpicker" onchange="unitdistance(this);">
@@ -654,19 +654,19 @@  discard block
 block discarded – undo
654 654
 		    <ul>
655 655
 		    <?php
656 656
 			if (!isset($globalAircraft) || $globalAircraft) {
657
-		    ?>
657
+			?>
658 658
 		    <?php
659 659
 			if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) {
660
-		    ?>
660
+			?>
661 661
 			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') || !isset($_COOKIE['filter_ShowVATSIM'])) print 'checked'; ?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
662 662
 			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') || !isset($_COOKIE['filter_ShowIVAO'])) print 'checked'; ?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
663 663
 			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') || !isset($_COOKIE['filter_ShowVMS'])) print 'checked'; ?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
664 664
 		    <?php
665 665
 			}
666
-		    ?>
666
+			?>
667 667
 		    <?php
668 668
 			if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) {
669
-		    ?>
669
+			?>
670 670
 			<?php if (isset($globalSBS1) && $globalSBS1) { ?>
671 671
 			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') || !isset($_COOKIE['filter_ShowSBS1'])) print 'checked'; ?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
672 672
 			<?php } ?>
@@ -676,7 +676,7 @@  discard block
 block discarded – undo
676 676
 			<li><div class="checkbox"><label><input type="checkbox" name="blocked" value="1" onclick="clickBlocked(this)" <?php if (isset($_COOKIE['filter_blocked']) && $_COOKIE['filter_blocked'] == 'true') print 'checked'; ?> ><?php echo _("Only display FAA ASDI blocked aircrafts"); ?></label></div></li>
677 677
 		    <?php
678 678
 			}
679
-		    ?>
679
+			?>
680 680
 		    <li><?php echo _("Display airlines:"); ?>
681 681
 		    <br/>
682 682
 			<select class="selectpicker" multiple onchange="airlines(this);" id="display_airlines">
@@ -696,14 +696,14 @@  discard block
 block discarded – undo
696 696
 						echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>';
697 697
 					}
698 698
 				}
699
-			    ?>
699
+				?>
700 700
 			</select>
701 701
 		    </li>
702 702
 		    <?php
703 703
 			$Spotter = new Spotter();
704 704
 			$allalliancenames = $Spotter->getAllAllianceNames();
705 705
 			if (!empty($allalliancenames)) {
706
-		    ?>
706
+			?>
707 707
 		    <li><?php echo _("Display alliance:"); ?>
708 708
 		    <br/>
709 709
 			<select class="selectpicker" onchange="alliance(this);" id="display_alliance">
@@ -717,18 +717,18 @@  discard block
 block discarded – undo
717 717
 						echo '<option value="'.$alliance_name.'">'.$alliance_name.'</option>';
718 718
 					}
719 719
 				}
720
-			    ?>
720
+				?>
721 721
 			</select>
722 722
 		    </li>
723 723
 		    <?php
724 724
 			}
725
-		    ?>
725
+			?>
726 726
 		    <?php
727 727
 			}
728
-		    ?>
728
+			?>
729 729
 		    <?php
730 730
 			if (isset($globalAPRS) && $globalAPRS) {
731
-		    ?>
731
+			?>
732 732
 		    <li><?php echo _("Display APRS sources name:"); ?>
733 733
 			<select class="selectpicker" multiple onchange="sources(this);">
734 734
 			    <?php
@@ -752,18 +752,18 @@  discard block
 block discarded – undo
752 752
 						echo '<option value="'.$src['name'].'">'.$src['name'].'</option>';
753 753
 					}
754 754
 				}
755
-			    ?>
755
+				?>
756 756
 			</select>
757 757
 		    </li>
758 758
 		    <?php
759 759
 			}
760
-		    ?>
760
+			?>
761 761
 		    <?php
762 762
 			if (!isset($globalAircraft) || $globalAircraft) {
763
-		    ?>
763
+			?>
764 764
 		    <?php
765
-			    if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS)) {
766
-		    ?>
765
+				if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS)) {
766
+			?>
767 767
 		    <li><?php echo _("Display airlines of type:"); ?><br/>
768 768
 			<select class="selectpicker" onchange="airlinestype(this);">
769 769
 			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
@@ -773,14 +773,14 @@  discard block
 block discarded – undo
773 773
 			</select>
774 774
 		    </li>
775 775
 		    <?php
776
-			    }
777
-		    ?>
776
+				}
777
+			?>
778 778
 		    <?php
779 779
 			}
780
-		    ?>
780
+			?>
781 781
 		    <?php
782 782
 			if (isset($globalMarine) && $globalMarine) {
783
-		    ?>
783
+			?>
784 784
 		    <li>
785 785
 			<?php echo _("Display vessels with MMSI:"); ?>
786 786
 			<input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) print $_COOKIE['filter_mmsi']; ?>" />
@@ -803,7 +803,7 @@  discard block
 block discarded – undo
803 803
 								print '<option value="'.$race['race_id'].'">'.$race['race_name'].'</option>';
804 804
 							}
805 805
 						}
806
-			    ?>
806
+				?>
807 807
 			</select>
808 808
 		    </li>
809 809
 
@@ -811,7 +811,7 @@  discard block
 block discarded – undo
811 811
 					}
812 812
 				}
813 813
 			}
814
-		    ?>
814
+			?>
815 815
 		    <li>
816 816
 			<?php echo _("Display with ident:"); ?>
817 817
 			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" />
@@ -824,7 +824,7 @@  discard block
 block discarded – undo
824 824
 	    </form>
825 825
     	</div>
826 826
 <?php
827
-    if (isset($globalSatellite) && $globalSatellite) {
827
+	if (isset($globalSatellite) && $globalSatellite) {
828 828
 ?>
829 829
         <div class="sidebar-pane" id="satellites">
830 830
 	    <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
@@ -864,14 +864,14 @@  discard block
 block discarded – undo
864 864
 						print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>';
865 865
 					}
866 866
 				}
867
-			    ?>
867
+				?>
868 868
 			</select>
869 869
 		    </li>
870 870
 		</ul>
871 871
 	    </form>
872 872
 	</div>
873 873
 <?php
874
-    }
874
+	}
875 875
 ?>
876 876
     </div>
877 877
 </div>
Please login to merge, or discard this patch.
Braces   +586 added lines, -148 removed lines patch added patch discarded remove patch
@@ -57,7 +57,10 @@  discard block
 block discarded – undo
57 57
 <?php
58 58
     if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
59 59
 ?>
60
-<script src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) print '?tsk='.$tsk; ?>"></script>
60
+<script src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) {
61
+	print '?tsk='.$tsk;
62
+}
63
+?>"></script>
61 64
 <script src="<?php echo $globalURL; ?>/js/meuusjs.1.0.3.min.js"></script>
62 65
 <script src="<?php echo $globalURL; ?>/js/map.3d.weather.js"></script>
63 66
 <?php
@@ -137,9 +140,18 @@  discard block
 block discarded – undo
137 140
 			<h1>Weather</h1>
138 141
 			<ul>
139 142
 			
140
-				<li><div class="checkbox"><label><input type="checkbox" name="wind" value="1" onclick="clickWind(this);" <?php if (isset($_COOKIE['weather_wind']) && $_COOKIE['weather_wind'] == 'true') print 'checked'; ?> /><?php echo _("Weather Winds"); ?></label></div></li>
141
-				<li><div class="checkbox"><label><input type="checkbox" name="wave" value="1" onclick="clickWave(this);" <?php if (isset($_COOKIE['weather_wave']) && $_COOKIE['weather_wave'] == 'true') print 'checked'; ?> /><?php echo _("Ocean surface currents"); ?></label></div></li>
142
-				<!-- <li><div class="checkbox"><label><input type="checkbox" name="backwave" value="1" onclick="clickBackWave(this);" <?php if (isset($_COOKIE['weather_backwave']) && $_COOKIE['weather_backwave'] == 'true') print 'checked'; ?> /><?php echo _("Weather Waves height background"); ?></label></div></li> -->
143
+				<li><div class="checkbox"><label><input type="checkbox" name="wind" value="1" onclick="clickWind(this);" <?php if (isset($_COOKIE['weather_wind']) && $_COOKIE['weather_wind'] == 'true') {
144
+	print 'checked';
145
+}
146
+?> /><?php echo _("Weather Winds"); ?></label></div></li>
147
+				<li><div class="checkbox"><label><input type="checkbox" name="wave" value="1" onclick="clickWave(this);" <?php if (isset($_COOKIE['weather_wave']) && $_COOKIE['weather_wave'] == 'true') {
148
+	print 'checked';
149
+}
150
+?> /><?php echo _("Ocean surface currents"); ?></label></div></li>
151
+				<!-- <li><div class="checkbox"><label><input type="checkbox" name="backwave" value="1" onclick="clickBackWave(this);" <?php if (isset($_COOKIE['weather_backwave']) && $_COOKIE['weather_backwave'] == 'true') {
152
+	print 'checked';
153
+}
154
+?> /><?php echo _("Weather Waves height background"); ?></label></div></li> -->
143 155
 			
144 156
 <?php
145 157
 		if (isset($globalOpenWeatherMapKey) && $globalOpenWeatherMapKey != '') {
@@ -158,7 +170,10 @@  discard block
 block discarded – undo
158 170
 ?>
159 171
 			<h1>Weather</h1>
160 172
 			<ul>
161
-				<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>
173
+				<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))) {
174
+	print 'checked';
175
+}
176
+?> ><?php echo _("Display weather on 3D map"); ?></label></div></li>
162 177
 			<!--	<li><div class="checkbox"><label><input type="checkbox" name="displayrain" value="1" onclick="clickDisplayRain(this)" ><?php echo _("Display rain on 3D map"); ?></label></div></li>-->
163 178
 			</ul>
164 179
 <?php
@@ -176,13 +191,22 @@  discard block
 block discarded – undo
176 191
 <?php
177 192
 		if (!isset($globalAircraft) || $globalAircraft) {
178 193
 ?>
179
-				<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>
180
-				<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>
194
+				<li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') {
195
+	print 'checked';
196
+}
197
+?> /><?php echo _("Display waypoints"); ?></label></div></li>
198
+				<li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') {
199
+	print 'checked';
200
+}
201
+?> /><?php echo _("Display airspace"); ?></label></div></li>
181 202
 <?php
182 203
 		}
183 204
 		if (isset($globalMarine) && $globalMarine) {
184 205
 ?>
185
-				<li><div class="checkbox"><label><input type="checkbox" name="openseamap" value="1" onclick="clickOpenSeaMap(this);" <?php if (isset($_COOKIE['openseamap']) && $_COOKIE['openseamap'] == 'true') print 'checked'; ?> /><?php echo _("Display OpenSeaMap"); ?></label></div></li>
206
+				<li><div class="checkbox"><label><input type="checkbox" name="openseamap" value="1" onclick="clickOpenSeaMap(this);" <?php if (isset($_COOKIE['openseamap']) && $_COOKIE['openseamap'] == 'true') {
207
+	print 'checked';
208
+}
209
+?> /><?php echo _("Display OpenSeaMap"); ?></label></div></li>
186 210
 <?php
187 211
 		}
188 212
 ?>
@@ -197,13 +221,22 @@  discard block
 block discarded – undo
197 221
 <?php
198 222
 		if (!isset($globalAircraft) || $globalAircraft) {
199 223
 ?>
200
-				<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>
201
-				<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>
224
+				<li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') {
225
+	print 'checked';
226
+}
227
+?> /><?php echo _("Display waypoints"); ?> Beta</label></div></li>
228
+				<li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') {
229
+	print 'checked';
230
+}
231
+?> /><?php echo _("Display airspace"); ?> Beta</label></div></li>
202 232
 <?php
203 233
 		}
204 234
 		if (isset($globalMarine) && $globalMarine) {
205 235
 ?>
206
-				<li><div class="checkbox"><label><input type="checkbox" name="openseamap" value="1" onclick="clickOpenSeaMap(this);" <?php if (isset($_COOKIE['openseamap']) && $_COOKIE['openseamap'] == 'true') print 'checked'; ?> /><?php echo _("Display OpenSeaMap"); ?></label></div></li>
236
+				<li><div class="checkbox"><label><input type="checkbox" name="openseamap" value="1" onclick="clickOpenSeaMap(this);" <?php if (isset($_COOKIE['openseamap']) && $_COOKIE['openseamap'] == 'true') {
237
+	print 'checked';
238
+}
239
+?> /><?php echo _("Display OpenSeaMap"); ?></label></div></li>
207 240
 <?php
208 241
 		}
209 242
 ?>
@@ -218,14 +251,32 @@  discard block
 block discarded – undo
218 251
 		<h1>NOTAM</h1>
219 252
 		<form>
220 253
 			<ul>
221
-				<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>
254
+				<li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam(this);" <?php if (isset($_COOKIE['notam']) && $_COOKIE['notam'] == 'true') {
255
+	print 'checked';
256
+}
257
+?> /><?php echo _("Display NOTAM"); ?></label></div></li>
222 258
 				<li><?php echo _("NOTAM scope:"); ?>
223 259
 					<select class="selectpicker" onchange="notamscope(this);">
224
-						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') print ' selected'; ?>>All</option>
225
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') print ' selected'; ?>>Airport/Enroute warning</option>
226
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') print ' selected'; ?>>Airport warning</option>
227
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') print ' selected'; ?>>Navigation warning</option>
228
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') print ' selected'; ?>>Enroute warning</option>
260
+						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') {
261
+	print ' selected';
262
+}
263
+?>>All</option>
264
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') {
265
+	print ' selected';
266
+}
267
+?>>Airport/Enroute warning</option>
268
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') {
269
+	print ' selected';
270
+}
271
+?>>Airport warning</option>
272
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') {
273
+	print ' selected';
274
+}
275
+?>>Navigation warning</option>
276
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') {
277
+	print ' selected';
278
+}
279
+?>>Enroute warning</option>
229 280
 					</select
230 281
 				</li>
231 282
 			</ul>
@@ -253,7 +304,10 @@  discard block
 block discarded – undo
253 304
 		    <div class="form-group">
254 305
 			<label><?php echo _("From:"); ?></label>
255 306
 			<div class='input-group date' id='datetimepicker1'>
256
-			    <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 />
307
+			    <input type='text' id="start_date" name="start_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') {
308
+	print date("Y-m-d H:i",$_COOKIE['archive_begin']).' UTC';
309
+}
310
+?>" required />
257 311
 			    <span class="input-group-addon">
258 312
 				<span class="glyphicon glyphicon-calendar"></span>
259 313
 			    </span>
@@ -262,7 +316,10 @@  discard block
 block discarded – undo
262 316
 		    <div class="form-group">
263 317
 			<label><?php echo _("To:"); ?></label>
264 318
 			<div class='input-group date' id='datetimepicker2'>
265
-			    <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'; ?>" />
319
+			    <input type='text' id="end_date" name="end_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_end']) && $_COOKIE['archive_end'] != '') {
320
+	print date("Y-m-d H:i",$_COOKIE['archive_end']).' UTC';
321
+}
322
+?>" />
266 323
 			    <span class="input-group-addon">
267 324
 				<span class="glyphicon glyphicon-calendar"></span>
268 325
 			    </span>
@@ -294,8 +351,20 @@  discard block
 block discarded – undo
294 351
 		    </script>
295 352
 		<li><?php echo _("Playback speed:"); ?>
296 353
 		    <div class="range">
297
-			<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'; ?>">
298
-			<output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?></output>
354
+			<input type="range" min="0" max="50" step="1" id="archivespeed" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php  if (isset($_POST['archivespeed'])) {
355
+	print $_POST['archivespeed'];
356
+} elseif (isset($_COOKIE['archive_speed'])) {
357
+	print $_COOKIE['archive_speed'];
358
+} else {
359
+	print '1';
360
+}
361
+?>">
362
+			<output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) {
363
+	print $_COOKIE['archive_speed'];
364
+} else {
365
+	print '1';
366
+}
367
+?></output>
299 368
 		    </div>
300 369
 		</li>
301 370
 		<?php
@@ -324,14 +393,20 @@  discard block
 block discarded – undo
324 393
 		    <li><?php echo _("Type of Map:"); ?>
325 394
 			    <?php
326 395
 				if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
327
-					if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider;
328
-					else $MapType = $_COOKIE['MapType'];
396
+					if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') {
397
+						$MapType = $globalMapProvider;
398
+					} else {
399
+						$MapType = $_COOKIE['MapType'];
400
+					}
329 401
 			    ?>
330 402
 			<select  class="selectpicker" onchange="mapType(this);">
331 403
 			    <?php
332 404
 				} else {
333
-					if (!isset($_COOKIE['MapType3D']) || $_COOKIE['MapType3D'] == '') $MapType = $globalMapProvider;
334
-					else $MapType = $_COOKIE['MapType3D'];
405
+					if (!isset($_COOKIE['MapType3D']) || $_COOKIE['MapType3D'] == '') {
406
+						$MapType = $globalMapProvider;
407
+					} else {
408
+						$MapType = $_COOKIE['MapType3D'];
409
+					}
335 410
 			    ?>
336 411
 			<select  class="selectpicker" onchange="mapType3D(this);">
337 412
 			    <?php
@@ -340,24 +415,48 @@  discard block
 block discarded – undo
340 415
 			    <?php
341 416
 				if (isset($globalMapOffline) && $globalMapOffline === TRUE) {
342 417
 			    ?>
343
-			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option>
418
+			    <option value="offline"<?php if ($MapType == 'offline') {
419
+	print ' selected';
420
+}
421
+?>>Natural Earth (local)</option>
344 422
 			    <?php
345 423
 				} else {
346 424
 				    if (file_exists(dirname(__FILE__).'/js/Cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml')) {
347 425
 			    ?>
348
-			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option>
426
+			    <option value="offline"<?php if ($MapType == 'offline') {
427
+	print ' selected';
428
+}
429
+?>>Natural Earth (local)</option>
349 430
 			    <?php
350 431
 				    }
351 432
 			    ?>
352
-			    <option value="ArcGIS-Streetmap"<?php if ($MapType == 'ArcGIS-Streetmap') print ' selected'; ?>>ArcGIS Streetmap</option>
353
-			    <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Satellite') print ' selected'; ?>>ArcGIS Satellite</option>
354
-			    <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Ocean') print ' selected'; ?>>ArcGIS Ocean</option>
433
+			    <option value="ArcGIS-Streetmap"<?php if ($MapType == 'ArcGIS-Streetmap') {
434
+	print ' selected';
435
+}
436
+?>>ArcGIS Streetmap</option>
437
+			    <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Satellite') {
438
+	print ' selected';
439
+}
440
+?>>ArcGIS Satellite</option>
441
+			    <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Ocean') {
442
+	print ' selected';
443
+}
444
+?>>ArcGIS Ocean</option>
355 445
 			    <?php
356 446
 				    if (isset($globalBingMapKey) && $globalBingMapKey != '') {
357 447
 			    ?>
358
-			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option>
359
-			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option>
360
-			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option>
448
+			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') {
449
+	print ' selected';
450
+}
451
+?>>Bing-Aerial</option>
452
+			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') {
453
+	print ' selected';
454
+}
455
+?>>Bing-Hybrid</option>
456
+			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') {
457
+	print ' selected';
458
+}
459
+?>>Bing-Road</option>
361 460
 			    <?php
362 461
 				    }
363 462
 			    ?>
@@ -367,59 +466,143 @@  discard block
 block discarded – undo
367 466
 			    <?php
368 467
 					if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
369 468
 			    ?>
370
-			    <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option>
371
-			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option>
372
-			    <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option>
469
+			    <option value="Here-Aerial"<?php if ($MapType == 'Here') {
470
+	print ' selected';
471
+}
472
+?>>Here-Aerial</option>
473
+			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') {
474
+	print ' selected';
475
+}
476
+?>>Here-Hybrid</option>
477
+			    <option value="Here-Road"<?php if ($MapType == 'Here') {
478
+	print ' selected';
479
+}
480
+?>>Here-Road</option>
373 481
 			    <?php
374 482
 					}
375 483
 			    ?>
376 484
 			    <?php
377 485
 					if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
378 486
 			    ?>
379
-			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option>
380
-			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option>
381
-			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option>
382
-			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option>
487
+			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') {
488
+	print ' selected';
489
+}
490
+?>>Google Roadmap</option>
491
+			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') {
492
+	print ' selected';
493
+}
494
+?>>Google Satellite</option>
495
+			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') {
496
+	print ' selected';
497
+}
498
+?>>Google Hybrid</option>
499
+			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') {
500
+	print ' selected';
501
+}
502
+?>>Google Terrain</option>
383 503
 			    <?php
384 504
 					}
385 505
 			    ?>
386 506
 			    <?php
387 507
 					if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
388 508
 			    ?>
389
-			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option>
390
-			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option>
391
-			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option>
509
+			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') {
510
+	print ' selected';
511
+}
512
+?>>MapQuest-OSM</option>
513
+			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') {
514
+	print ' selected';
515
+}
516
+?>>MapQuest-Aerial</option>
517
+			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') {
518
+	print ' selected';
519
+}
520
+?>>MapQuest-Hybrid</option>
392 521
 			    <?php
393 522
 					}
394 523
 			    ?>
395
-			    <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option>
396
-			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth</option>
524
+			    <option value="Yandex"<?php if ($MapType == 'Yandex') {
525
+	print ' selected';
526
+}
527
+?>>Yandex</option>
528
+			    <option value="offline"<?php if ($MapType == 'offline') {
529
+	print ' selected';
530
+}
531
+?>>Natural Earth</option>
397 532
 			    <?php
398 533
 				    }
399 534
 			    ?>
400
-			    <option value="NatGeo-Street"<?php if ($MapType == 'NatGeo-Street') print ' selected'; ?>>National Geographic Street</option>
535
+			    <option value="NatGeo-Street"<?php if ($MapType == 'NatGeo-Street') {
536
+	print ' selected';
537
+}
538
+?>>National Geographic Street</option>
401 539
 			    <?php
402 540
 				    if (isset($globalMapboxToken) && $globalMapboxToken != '') {
403
-					if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default';
404
-					else $MapBoxId = $_COOKIE['MapTypeId'];
541
+					if (!isset($_COOKIE['MapTypeId'])) {
542
+						$MapBoxId = 'default';
543
+					} else {
544
+						$MapBoxId = $_COOKIE['MapTypeId'];
545
+					}
405 546
 			    ?>
406
-			    <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') print ' selected'; ?>>Mapbox GL</option>
407
-			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option>
408
-			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option>
409
-			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option>
410
-			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') print ' selected'; ?>>Mapbox dark</option>
411
-			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') print ' selected'; ?>>Mapbox satellite</option>
412
-			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') print ' selected'; ?>>Mapbox streets-satellite</option>
413
-			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') print ' selected'; ?>>Mapbox streets-basic</option>
414
-			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') print ' selected'; ?>>Mapbox comic</option>
415
-			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') print ' selected'; ?>>Mapbox outdoors</option>
416
-			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') print ' selected'; ?>>Mapbox pencil</option>
417
-			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option>
418
-			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option>
547
+			    <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') {
548
+	print ' selected';
549
+}
550
+?>>Mapbox GL</option>
551
+			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') {
552
+	print ' selected';
553
+}
554
+?>>Mapbox default</option>
555
+			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') {
556
+	print ' selected';
557
+}
558
+?>>Mapbox streets</option>
559
+			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') {
560
+	print ' selected';
561
+}
562
+?>>Mapbox light</option>
563
+			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') {
564
+	print ' selected';
565
+}
566
+?>>Mapbox dark</option>
567
+			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') {
568
+	print ' selected';
569
+}
570
+?>>Mapbox satellite</option>
571
+			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') {
572
+	print ' selected';
573
+}
574
+?>>Mapbox streets-satellite</option>
575
+			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') {
576
+	print ' selected';
577
+}
578
+?>>Mapbox streets-basic</option>
579
+			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') {
580
+	print ' selected';
581
+}
582
+?>>Mapbox comic</option>
583
+			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') {
584
+	print ' selected';
585
+}
586
+?>>Mapbox outdoors</option>
587
+			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') {
588
+	print ' selected';
589
+}
590
+?>>Mapbox pencil</option>
591
+			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') {
592
+	print ' selected';
593
+}
594
+?>>Mapbox pirates</option>
595
+			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') {
596
+	print ' selected';
597
+}
598
+?>>Mapbox emerald</option>
419 599
 			    <?php
420 600
 				    }
421 601
 			    ?>
422
-			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option>
602
+			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') {
603
+	print ' selected';
604
+}
605
+?>>OpenStreetMap</option>
423 606
 			    <?php
424 607
 				}
425 608
 			    ?>
@@ -430,10 +613,22 @@  discard block
 block discarded – undo
430 613
 ?>
431 614
 		    <li><?php echo _("Type of Terrain:"); ?>
432 615
 			<select  class="selectpicker" onchange="terrainType(this);">
433
-			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option>
434
-			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option>
435
-			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option>
436
-			    <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected';?>>ArticDEM</option>
616
+			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') {
617
+	print ' selected';
618
+}
619
+?>>stk terrain</option>
620
+			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') {
621
+	print ' selected';
622
+}
623
+?>>ellipsoid</option>
624
+			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') {
625
+	print ' selected';
626
+}
627
+?>>vr terrain</option>
628
+			    <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') {
629
+	print ' selected';
630
+}
631
+?>>ArticDEM</option>
437 632
 			</select>
438 633
 		    </li>
439 634
 <?php
@@ -443,59 +638,116 @@  discard block
 block discarded – undo
443 638
 <?php
444 639
     if (isset($globalMap3D) && $globalMap3D) {
445 640
 ?>
446
-		    <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>
641
+		    <li><div class="checkbox"><label><input type="checkbox" name="synchro2d3d" value="1" onclick="clickSyncMap2D3D(this)" <?php if (isset($_COOKIE['Map2D3DSync']) && $_COOKIE['Map2D3DSync'] == 'true') {
642
+	print 'checked';
643
+}
644
+?> ><?php echo _("Use same type of map for 2D & 3D"); ?></label></div></li>
447 645
 <?php
448 646
     }
449 647
 ?>
450 648
 <?php
451 649
     if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
452 650
 ?>
453
-		    <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>
651
+		    <li><div class="checkbox"><label><input type="checkbox" name="display2dbuildings" value="1" onclick="clickDisplay2DBuildings(this)" <?php if (isset($_COOKIE['Map2DBuildings']) && $_COOKIE['Map2DBuildings'] == 'true') {
652
+	print 'checked';
653
+}
654
+?> ><?php echo _("Display 2.5D buidings on map"); ?></label></div></li>
454 655
 
455 656
 <?php
456 657
 	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
457 658
 ?>
458
-		    <!--<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>-->
459
-		    <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>
460
-		    <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>
461
-		    <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>
462
-		    <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>
659
+		    <!--<li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') {
660
+	print 'checked';
661
+}
662
+?> ><?php echo _("Display flight info as popup"); ?></label></div></li>-->
663
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true')) {
664
+	print 'checked';
665
+}
666
+?> ><?php echo _("Display flight path"); ?></label></div></li>
667
+		    <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)) {
668
+	print 'checked';
669
+}
670
+?> ><?php echo _("Display flight route on click"); ?></label></div></li>
671
+		    <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)) {
672
+	print 'checked';
673
+}
674
+?> ><?php echo _("Display flight remaining route on click"); ?></label></div></li>
675
+		    <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)) {
676
+	print 'checked';
677
+}
678
+?> ><?php echo _("Planes animate between updates"); ?></label></div></li>
463 679
 <?php
464 680
 	} elseif (!isset($globalTracker) || $globalTracker === TRUE) {
465 681
 ?>
466
-		    <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>
682
+		    <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)) {
683
+	print 'checked';
684
+}
685
+?> ><?php echo _("Enable map matching"); ?></label></div></li>
467 686
 <?php
468 687
 	}
469 688
 	if (isset($globalSatellite) && $globalSatellite === TRUE) {
470 689
 ?>
471
-		    <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>
690
+		    <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)) {
691
+	print 'checked';
692
+}
693
+?> ><?php echo _("Satellites animate between updates"); ?></label></div></li>
472 694
 <?php
473 695
 	}
474 696
     }
475 697
 ?>
476
-		    <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>
477
-		    <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>
478
-		    <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>
479
-		    <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>
698
+		    <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'])) {
699
+	print 'checked';
700
+}
701
+?> ><?php echo _("Display airports on map"); ?></label></div></li>
702
+		    <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))) {
703
+	print 'checked';
704
+}
705
+?> ><?php echo _("Display ground station on map"); ?></label></div></li>
706
+		    <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))) {
707
+	print 'checked';
708
+}
709
+?> ><?php echo _("Display weather station on map"); ?></label></div></li>
710
+		    <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))) {
711
+	print 'checked';
712
+}
713
+?> ><?php echo _("Display lightning on map"); ?></label></div></li>
480 714
 <?php
481 715
 	if (isset($globalFires)) {
482 716
 ?>
483
-		    <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>
717
+		    <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))) {
718
+	print 'checked';
719
+}
720
+?> ><?php echo _("Display fires on map"); ?></label></div></li>
484 721
 <?php
485 722
 	}
486 723
 	if (isset($globalMap3D) && $globalMap3D) {
487 724
 ?>
488
-		    <li><div class="checkbox"><label><input type="checkbox" name="singlemodel" value="1" onclick="clickSingleModel(this)" <?php if ((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') || (!isset($_COOKIE['singlemodel']) && isset($globalMap3DSelected) && $globalMap3DSelected)) print 'checked'; ?> ><?php echo _("Only display selected flight on 3D mode"); ?></label></div></li>
725
+		    <li><div class="checkbox"><label><input type="checkbox" name="singlemodel" value="1" onclick="clickSingleModel(this)" <?php if ((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') || (!isset($_COOKIE['singlemodel']) && isset($globalMap3DSelected) && $globalMap3DSelected)) {
726
+	print 'checked';
727
+}
728
+?> ><?php echo _("Only display selected flight on 3D mode"); ?></label></div></li>
489 729
 <?php
490 730
 	}
491 731
 ?>
492 732
 <?php
493 733
     if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
494 734
 ?>
495
-		    <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>
496
-		    <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>
497
-		    <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>
498
-		    <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>
735
+		    <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')) {
736
+	print 'checked';
737
+}
738
+?> ><?php echo _("Show mini-map"); ?></label></div></li>
739
+		    <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')) {
740
+	print 'checked';
741
+}
742
+?> ><?php echo _("Use shadows"); ?></label></div></li>
743
+		    <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)) {
744
+	print 'checked';
745
+}
746
+?> ><?php echo _("Use same 3D model for all aircraft (use fewer resources)"); ?></label></div></li>
747
+		    <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'])) {
748
+	print 'checked';
749
+}
750
+?> ><?php echo _("Display realtime data in infobox"); ?></label></div></li>
499 751
 <?php
500 752
     }
501 753
     if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
@@ -508,17 +760,25 @@  discard block
 block discarded – undo
508 760
 			if (function_exists('array_column')) {
509 761
 			    if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
510 762
 		    ?>
511
-		    <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>
763
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
764
+	print 'checked';
765
+}
766
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
512 767
 		    <?php
513 768
 			    }
514 769
 			} elseif (isset($globalSources)) {
515 770
 			    $dispolar = false;
516 771
 			    foreach ($globalSources as $testsource) {
517
-			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
772
+			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) {
773
+			        	$dispolar = true;
774
+			        }
518 775
 			    }
519 776
 			    if ($dispolar) {
520 777
 		    ?>
521
-		    <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>
778
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
779
+	print 'checked';
780
+}
781
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
522 782
 		    <?php
523 783
 			    }
524 784
 		        }
@@ -531,11 +791,21 @@  discard block
 block discarded – undo
531 791
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
532 792
 		    	    if (extension_loaded('gd') && function_exists('gd_info')) {
533 793
 		    ?>
534
-		    <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>
794
+		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') {
795
+	print 'checked';
796
+}
797
+?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
535 798
 		    <?php 
536 799
 				if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') {
537 800
 		    ?>
538
-			<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>
801
+			<li><?php echo _("Aircraft icon color:"); ?><input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) {
802
+	print $_COOKIE['IconColor'];
803
+} elseif (isset($globalAircraftIconColor)) {
804
+	print $globalAircraftIconColor;
805
+} else {
806
+	print '1a3151';
807
+}
808
+?>"></li>
539 809
 		    <?php
540 810
 				}
541 811
 			    }
@@ -546,7 +816,14 @@  discard block
 block discarded – undo
546 816
 			    if (extension_loaded('gd') && function_exists('gd_info')) {
547 817
 		    ?>
548 818
 		    <li><?php echo _("Marine icon color:"); ?>
549
-			<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'; ?>">
819
+			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) {
820
+	print $_COOKIE['MarineIconColor'];
821
+} elseif (isset($globalMarineIconColor)) {
822
+	print $globalMarineIconColor;
823
+} else {
824
+	print '1a3151';
825
+}
826
+?>">
550 827
 		    </li>
551 828
 		    <?php
552 829
 			    }
@@ -557,7 +834,14 @@  discard block
 block discarded – undo
557 834
 			    if (extension_loaded('gd') && function_exists('gd_info')) {
558 835
 		    ?>
559 836
 		    <li><?php echo _("Tracker icon color:"); ?>
560
-			<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'; ?>">
837
+			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) {
838
+	print $_COOKIE['TrackerIconColor'];
839
+} elseif (isset($globalTrackerIconColor)) {
840
+	print $globalTrackerIconColor;
841
+} else {
842
+	print '1a3151';
843
+}
844
+?>">
561 845
 		    </li>
562 846
 		    <?php
563 847
 			    }
@@ -568,8 +852,22 @@  discard block
 block discarded – undo
568 852
 		    ?>
569 853
 		    <li><?php echo _("Show airport icon at zoom level:"); ?>
570 854
 			<div class="range">
571
-			    <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'; ?>">
572
-			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?></output>
855
+			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) {
856
+	print $_COOKIE['AirportZoom'];
857
+} elseif (isset($globalAirportZoom)) {
858
+	print $globalAirportZoom;
859
+} else {
860
+	print '7';
861
+}
862
+?>">
863
+			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) {
864
+	print $_COOKIE['AirportZoom'];
865
+} elseif (isset($globalAirportZoom)) {
866
+	print $globalAirportZoom;
867
+} else {
868
+	print '7';
869
+}
870
+?></output>
573 871
 			</div>
574 872
 		    </li>
575 873
 		    <?php
@@ -580,17 +878,40 @@  discard block
 block discarded – undo
580 878
 ?>
581 879
 		    <li><?php echo _("Set scaling factor for rendering resolution:"); ?>
582 880
 			<div class="range">
583
-			    <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'; ?>">
584
-			    <output id="scale"><?php if (isset($_COOKIE['resolutionScale'])) print $_COOKIE['resolutionScale']; else print '1'; ?></output>
881
+			    <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'])) {
882
+	print $_COOKIE['resolutionScale'];
883
+} else {
884
+	print '1';
885
+}
886
+?>">
887
+			    <output id="scale"><?php if (isset($_COOKIE['resolutionScale'])) {
888
+	print $_COOKIE['resolutionScale'];
889
+} else {
890
+	print '1';
891
+}
892
+?></output>
585 893
 			</div>
586 894
 		    </li>
587 895
 <?php
588 896
 	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
589 897
 ?>
590
-		    <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>
591
-		    <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;
898
+		    <li><input type="checkbox" name="useliveries" value="1" onclick="useLiveries(this)" <?php if (isset($_COOKIE['UseLiveries']) && $_COOKIE['UseLiveries'] == 'true') {
899
+	print 'checked';
900
+}
901
+?> > <?php echo _("Use airlines liveries"); ?></li>
902
+		    <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') {
903
+	print 'checked';
904
+}
905
+?> > <?php echo _("Force Aircraft color"); ?>&nbsp;
592 906
 		    <!--<li><?php echo _("Aircraft icon color:"); ?>-->
593
-			<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'; ?>">
907
+			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) {
908
+	print $_COOKIE['IconColor'];
909
+} elseif (isset($globalAircraftIconColor)) {
910
+	print $globalAircraftIconColor;
911
+} else {
912
+	print 'ff0000';
913
+}
914
+?>">
594 915
 		    </li>
595 916
 <?php
596 917
 	}
@@ -598,9 +919,19 @@  discard block
 block discarded – undo
598 919
 <?php
599 920
 	if (isset($globalMarine) && $globalMarine === TRUE) {
600 921
 ?>
601
-		    <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;
922
+		    <li><input type="checkbox" name="marinecolorforce" value="1" onclick="MarineiconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') {
923
+	print 'checked';
924
+}
925
+?> ><?php echo _("Force Marine color"); ?>&nbsp;
602 926
 		    <!--<li><?php echo _("Marine icon color:"); ?>-->
603
-			<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'; ?>">
927
+			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) {
928
+	print $_COOKIE['MarineIconColor'];
929
+} elseif (isset($globalMarineIconColor)) {
930
+	print $globalMarineIconColor;
931
+} else {
932
+	print 'ff0000';
933
+}
934
+?>">
604 935
 		    </li>
605 936
 <?php
606 937
 	}
@@ -608,9 +939,19 @@  discard block
 block discarded – undo
608 939
 <?php
609 940
 	if (isset($globalTracker) && $globalTracker === TRUE) {
610 941
 ?>
611
-		    <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;
942
+		    <li><input type="checkbox" name="trackercolorforce" value="1" onclick="TrackericonColorForce(this)" <?php if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true') {
943
+	print 'checked';
944
+}
945
+?> ><?php echo _("Force Tracker color"); ?>&nbsp;
612 946
 		    <!--<li><?php echo _("Tracker icon color:"); ?>-->
613
-			<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'; ?>">
947
+			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) {
948
+	print $_COOKIE['TrackerIconColor'];
949
+} elseif (isset($globalTrackerIconColor)) {
950
+	print $globalTrackerIconColor;
951
+} else {
952
+	print 'ff0000';
953
+}
954
+?>">
614 955
 		    </li>
615 956
 <?php
616 957
 	}
@@ -618,29 +959,62 @@  discard block
 block discarded – undo
618 959
 ?>
619 960
 		    <li><?php echo _("Distance unit:"); ?>
620 961
 			<select class="selectpicker" onchange="unitdistance(this);">
621
-			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) echo ' selected'; ?>>km</option>
622
-			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) echo ' selected'; ?>>nm</option>
623
-			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) echo ' selected'; ?>>mi</option>
962
+			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) {
963
+	echo ' selected';
964
+}
965
+?>>km</option>
966
+			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
967
+	echo ' selected';
968
+}
969
+?>>nm</option>
970
+			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
971
+	echo ' selected';
972
+}
973
+?>>mi</option>
624 974
 		        </select>
625 975
 		    </li>
626 976
 		    <li><?php echo _("Altitude unit:"); ?>
627 977
 			<select class="selectpicker" onchange="unitaltitude(this);">
628
-			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) echo ' selected'; ?>>m</option>
629
-			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) echo ' selected'; ?>>feet</option>
978
+			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) {
979
+	echo ' selected';
980
+}
981
+?>>m</option>
982
+			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) {
983
+	echo ' selected';
984
+}
985
+?>>feet</option>
630 986
 		        </select>
631 987
 		    </li>
632 988
 		    <li><?php echo _("Speed unit:"); ?>
633 989
 			<select class="selectpicker" onchange="unitspeed(this);">
634
-			    <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>
635
-			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) echo ' selected'; ?>>mph</option>
636
-			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) echo ' selected'; ?>>knots</option>
990
+			    <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) {
991
+	echo ' selected';
992
+}
993
+?>>km/h</option>
994
+			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) {
995
+	echo ' selected';
996
+}
997
+?>>mph</option>
998
+			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) {
999
+	echo ' selected';
1000
+}
1001
+?>>knots</option>
637 1002
 		        </select>
638 1003
 		    </li>
639 1004
 		    <li><?php echo _("Coordinate unit:"); ?>
640 1005
 			<select class="selectpicker" onchange="unitcoordinate(this);">
641
-			    <option value="dd"<?php if ((!isset($_COOKIE['unitcoordinate']) && (!isset($globalUnitCoordinate) || (isset($globalUnitCoordinate) && $globalUnitCoordinate == 'dd'))) || (isset($_COOKIE['unitcoordinate']) && $_COOKIE['unitcoordinate'] == 'dd')) echo ' selected'; ?>>DD</option>
642
-			    <option value="dms"<?php if ((!isset($_COOKIE['unitcoordinate']) && isset($globalUnitCoordinate) && $globalUnitCoordinate == 'dms') || (isset($_COOKIE['unitcoordinate']) && $_COOKIE['unitcoordinate'] == 'dms')) echo ' selected'; ?>>DMS</option>
643
-			    <option value="dm"<?php if ((!isset($_COOKIE['unitcoordinate']) && isset($globalUnitCoordinate) && $globalUnitCoordinate == 'dm') || (isset($_COOKIE['unitcoordinate']) && $_COOKIE['unitcoordinate'] == 'dm')) echo ' selected'; ?>>DM</option>
1006
+			    <option value="dd"<?php if ((!isset($_COOKIE['unitcoordinate']) && (!isset($globalUnitCoordinate) || (isset($globalUnitCoordinate) && $globalUnitCoordinate == 'dd'))) || (isset($_COOKIE['unitcoordinate']) && $_COOKIE['unitcoordinate'] == 'dd')) {
1007
+	echo ' selected';
1008
+}
1009
+?>>DD</option>
1010
+			    <option value="dms"<?php if ((!isset($_COOKIE['unitcoordinate']) && isset($globalUnitCoordinate) && $globalUnitCoordinate == 'dms') || (isset($_COOKIE['unitcoordinate']) && $_COOKIE['unitcoordinate'] == 'dms')) {
1011
+	echo ' selected';
1012
+}
1013
+?>>DMS</option>
1014
+			    <option value="dm"<?php if ((!isset($_COOKIE['unitcoordinate']) && isset($globalUnitCoordinate) && $globalUnitCoordinate == 'dm') || (isset($_COOKIE['unitcoordinate']) && $_COOKIE['unitcoordinate'] == 'dm')) {
1015
+	echo ' selected';
1016
+}
1017
+?>>DM</option>
644 1018
 		        </select>
645 1019
 		    </li>
646 1020
 
@@ -658,9 +1032,18 @@  discard block
 block discarded – undo
658 1032
 		    <?php
659 1033
 			if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) {
660 1034
 		    ?>
661
-			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') || !isset($_COOKIE['filter_ShowVATSIM'])) print 'checked'; ?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
662
-			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') || !isset($_COOKIE['filter_ShowIVAO'])) print 'checked'; ?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
663
-			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') || !isset($_COOKIE['filter_ShowVMS'])) print 'checked'; ?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
1035
+			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') || !isset($_COOKIE['filter_ShowVATSIM'])) {
1036
+	print 'checked';
1037
+}
1038
+?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
1039
+			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') || !isset($_COOKIE['filter_ShowIVAO'])) {
1040
+	print 'checked';
1041
+}
1042
+?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
1043
+			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') || !isset($_COOKIE['filter_ShowVMS'])) {
1044
+	print 'checked';
1045
+}
1046
+?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
664 1047
 		    <?php
665 1048
 			}
666 1049
 		    ?>
@@ -668,12 +1051,21 @@  discard block
 block discarded – undo
668 1051
 			if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) {
669 1052
 		    ?>
670 1053
 			<?php if (isset($globalSBS1) && $globalSBS1) { ?>
671
-			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') || !isset($_COOKIE['filter_ShowSBS1'])) print 'checked'; ?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
1054
+			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') || !isset($_COOKIE['filter_ShowSBS1'])) {
1055
+	print 'checked';
1056
+}
1057
+?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
672 1058
 			<?php } ?>
673 1059
 			<?php if (isset($globalAPRS) && $globalAPRS) { ?>
674
-			    <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') || !isset($_COOKIE['filter_ShowAPRS'])) print 'checked'; ?> ><?php echo _("Display APRS data"); ?></label></div></li>
1060
+			    <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') || !isset($_COOKIE['filter_ShowAPRS'])) {
1061
+	print 'checked';
1062
+}
1063
+?> ><?php echo _("Display APRS data"); ?></label></div></li>
675 1064
 			<?php } ?>
676
-			<li><div class="checkbox"><label><input type="checkbox" name="blocked" value="1" onclick="clickBlocked(this)" <?php if (isset($_COOKIE['filter_blocked']) && $_COOKIE['filter_blocked'] == 'true') print 'checked'; ?> ><?php echo _("Only display FAA ASDI blocked aircrafts"); ?></label></div></li>
1065
+			<li><div class="checkbox"><label><input type="checkbox" name="blocked" value="1" onclick="clickBlocked(this)" <?php if (isset($_COOKIE['filter_blocked']) && $_COOKIE['filter_blocked'] == 'true') {
1066
+	print 'checked';
1067
+}
1068
+?> ><?php echo _("Only display FAA ASDI blocked aircrafts"); ?></label></div></li>
677 1069
 		    <?php
678 1070
 			}
679 1071
 		    ?>
@@ -689,7 +1081,9 @@  discard block
 block discarded – undo
689 1081
 				}
690 1082
 				foreach($allairlinenames as $airline) {
691 1083
 					$airline_name = $airline['airline_name'];
692
-					if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...';
1084
+					if (strlen($airline_name) > 30) {
1085
+						$airline_name = substr($airline_name,0,30).'...';
1086
+					}
693 1087
 					if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['filter_Airlines']))) {
694 1088
 						echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>';
695 1089
 					} else {
@@ -707,7 +1101,10 @@  discard block
 block discarded – undo
707 1101
 		    <li><?php echo _("Display alliance:"); ?>
708 1102
 		    <br/>
709 1103
 			<select class="selectpicker" onchange="alliance(this);" id="display_alliance">
710
-			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
1104
+			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') {
1105
+	echo ' selected';
1106
+}
1107
+?>><?php echo _("All"); ?></option>
711 1108
 			    <?php
712 1109
 				foreach($allalliancenames as $alliance) {
713 1110
 					$alliance_name = $alliance['alliance'];
@@ -766,10 +1163,22 @@  discard block
 block discarded – undo
766 1163
 		    ?>
767 1164
 		    <li><?php echo _("Display airlines of type:"); ?><br/>
768 1165
 			<select class="selectpicker" onchange="airlinestype(this);">
769
-			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
770
-			    <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') echo ' selected'; ?>><?php echo _("Passenger"); ?></option>
771
-			    <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') echo ' selected'; ?>><?php echo _("Cargo"); ?></option>
772
-			    <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') echo ' selected'; ?>><?php echo _("Military"); ?></option>
1166
+			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') {
1167
+	echo ' selected';
1168
+}
1169
+?>><?php echo _("All"); ?></option>
1170
+			    <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') {
1171
+	echo ' selected';
1172
+}
1173
+?>><?php echo _("Passenger"); ?></option>
1174
+			    <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') {
1175
+	echo ' selected';
1176
+}
1177
+?>><?php echo _("Cargo"); ?></option>
1178
+			    <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') {
1179
+	echo ' selected';
1180
+}
1181
+?>><?php echo _("Military"); ?></option>
773 1182
 			</select>
774 1183
 		    </li>
775 1184
 		    <?php
@@ -783,7 +1192,10 @@  discard block
 block discarded – undo
783 1192
 		    ?>
784 1193
 		    <li>
785 1194
 			<?php echo _("Display vessels with MMSI:"); ?>
786
-			<input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) print $_COOKIE['filter_mmsi']; ?>" />
1195
+			<input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) {
1196
+	print $_COOKIE['filter_mmsi'];
1197
+}
1198
+?>" />
787 1199
 		    </li>
788 1200
 			<?php
789 1201
 				if (isset($globalVM) && $globalVM) {
@@ -814,7 +1226,10 @@  discard block
 block discarded – undo
814 1226
 		    ?>
815 1227
 		    <li>
816 1228
 			<?php echo _("Display with ident:"); ?>
817
-			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" />
1229
+			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) {
1230
+	print $_COOKIE['filter_ident'];
1231
+}
1232
+?>" />
818 1233
 		    </li>
819 1234
 		</ul>
820 1235
 	    </form>
@@ -830,7 +1245,10 @@  discard block
 block discarded – undo
830 1245
 	    <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
831 1246
 	    <form>
832 1247
 		<ul>
833
-		    <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>
1248
+		    <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'])) {
1249
+	print 'checked';
1250
+}
1251
+?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li>
834 1252
 		    <li><?php echo _("Type:"); ?>
835 1253
 			<select class="selectpicker" multiple onchange="sattypes(this);">
836 1254
 			    <?php
@@ -838,25 +1256,45 @@  discard block
 block discarded – undo
838 1256
 				$types = $Satellite->get_tle_types();
839 1257
 				foreach ($types as $type) {
840 1258
 					$type_name = $type['tle_type'];
841
-					if ($type_name == 'musson') $type_name = 'Russian LEO Navigation';
842
-					else if ($type_name == 'nnss') $type_name = 'Navi Navigation Satellite System';
843
-					else if ($type_name == 'sbas') $type_name = 'Satellite-Based Augmentation System';
844
-					else if ($type_name == 'glo-ops') $type_name = 'Glonass Operational';
845
-					else if ($type_name == 'gps-ops') $type_name = 'GPS Operational';
846
-					else if ($type_name == 'argos') $type_name = 'ARGOS Data Collection System';
847
-					else if ($type_name == 'tdrss') $type_name = 'Tracking and Data Relay Satellite System';
848
-					else if ($type_name == 'sarsat') $type_name = 'Search & Rescue';
849
-					else if ($type_name == 'dmc') $type_name = 'Disaster Monitoring';
850
-					else if ($type_name == 'resource') $type_name = 'Earth Resources';
851
-					else if ($type_name == 'stations') $type_name = 'Space Stations';
852
-					else if ($type_name == 'geo') $type_name = 'Geostationary';
853
-					else if ($type_name == 'amateur') $type_name = 'Amateur Radio';
854
-					else if ($type_name == 'x-comm') $type_name = 'Experimental';
855
-					else if ($type_name == 'other-comm') $type_name = 'Other Comm';
856
-					else if ($type_name == 'science') $type_name = 'Space & Earth Science';
857
-					else if ($type_name == 'military') $type_name = 'Miscellaneous Military';
858
-					else if ($type_name == 'radar') $type_name = 'Radar Calibration';
859
-					else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches';
1259
+					if ($type_name == 'musson') {
1260
+						$type_name = 'Russian LEO Navigation';
1261
+					} else if ($type_name == 'nnss') {
1262
+						$type_name = 'Navi Navigation Satellite System';
1263
+					} else if ($type_name == 'sbas') {
1264
+						$type_name = 'Satellite-Based Augmentation System';
1265
+					} else if ($type_name == 'glo-ops') {
1266
+						$type_name = 'Glonass Operational';
1267
+					} else if ($type_name == 'gps-ops') {
1268
+						$type_name = 'GPS Operational';
1269
+					} else if ($type_name == 'argos') {
1270
+						$type_name = 'ARGOS Data Collection System';
1271
+					} else if ($type_name == 'tdrss') {
1272
+						$type_name = 'Tracking and Data Relay Satellite System';
1273
+					} else if ($type_name == 'sarsat') {
1274
+						$type_name = 'Search & Rescue';
1275
+					} else if ($type_name == 'dmc') {
1276
+						$type_name = 'Disaster Monitoring';
1277
+					} else if ($type_name == 'resource') {
1278
+						$type_name = 'Earth Resources';
1279
+					} else if ($type_name == 'stations') {
1280
+						$type_name = 'Space Stations';
1281
+					} else if ($type_name == 'geo') {
1282
+						$type_name = 'Geostationary';
1283
+					} else if ($type_name == 'amateur') {
1284
+						$type_name = 'Amateur Radio';
1285
+					} else if ($type_name == 'x-comm') {
1286
+						$type_name = 'Experimental';
1287
+					} else if ($type_name == 'other-comm') {
1288
+						$type_name = 'Other Comm';
1289
+					} else if ($type_name == 'science') {
1290
+						$type_name = 'Space & Earth Science';
1291
+					} else if ($type_name == 'military') {
1292
+						$type_name = 'Miscellaneous Military';
1293
+					} else if ($type_name == 'radar') {
1294
+						$type_name = 'Radar Calibration';
1295
+					} else if ($type_name == 'tle-new') {
1296
+						$type_name = 'Last 30 days launches';
1297
+					}
860 1298
 					
861 1299
 					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) {
862 1300
 						print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>';
Please login to merge, or discard this patch.
live-czml.php 2 patches
Spacing   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -66,11 +66,11 @@  discard block
 block discarded – undo
66 66
     $s3 = sin($bank/2);
67 67
     $c1c2 = $c1*$c2;
68 68
     $s1s2 = $s1*$s2;
69
-    $w =$c1c2*$c3 - $s1s2*$s3;
70
-    $x =$c1c2*$s3 + $s1s2*$c3;
71
-    $y =$s1*$c2*$c3 + $c1*$s2*$s3;
72
-    $z =$c1*$s2*$c3 - $s1*$c2*$s3;
73
-    return array('x' => $x,'y' => $y,'z' => $z,'w' => $w);
69
+    $w = $c1c2*$c3 - $s1s2*$s3;
70
+    $x = $c1c2*$s3 + $s1s2*$c3;
71
+    $y = $s1*$c2*$c3 + $c1*$s2*$s3;
72
+    $z = $c1*$s2*$c3 - $s1*$c2*$s3;
73
+    return array('x' => $x, 'y' => $y, 'z' => $z, 'w' => $w);
74 74
 //    return array('x' => '0.0','y' => '-0.931','z' => '0.0','w' => '0.365');
75 75
 
76 76
 }
@@ -91,18 +91,18 @@  discard block
 block discarded – undo
91 91
 $min = false;
92 92
 $allhistory = false;
93 93
 $filter['source'] = array();
94
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
95
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
96
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
97
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
98
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
99
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
100
-if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
101
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
102
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
103
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
104
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
105
-if (isset($_COOKIE['filter_race']) && $_COOKIE['filter_race'] != 'all') $filter['race'] = filter_var($_COOKIE['filter_race'],FILTER_SANITIZE_NUMBER_INT);
94
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt'));
95
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup'));
96
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars'));
97
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs'));
98
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs'));
99
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING);
100
+if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'], FILTER_SANITIZE_STRING);
101
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING);
102
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING);
103
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING);
104
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING);
105
+if (isset($_COOKIE['filter_race']) && $_COOKIE['filter_race'] != 'all') $filter['race'] = filter_var($_COOKIE['filter_race'], FILTER_SANITIZE_NUMBER_INT);
106 106
 if (isset($_COOKIE['filter_blocked']) && $_COOKIE['filter_blocked'] == 'true') $filter['blocked'] = true;
107 107
 /*
108 108
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
@@ -150,17 +150,17 @@  discard block
 block discarded – undo
150 150
 	$from_archive = true;
151 151
 //	$begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
152 152
 //	$enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
153
-	$begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT);
154
-	$enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT);
155
-	$archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT);
156
-	$begindate = date('Y-m-d H:i:s',$begindate);
157
-	$enddate = date('Y-m-d H:i:s',$enddate);
153
+	$begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT);
154
+	$enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT);
155
+	$archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT);
156
+	$begindate = date('Y-m-d H:i:s', $begindate);
157
+	$enddate = date('Y-m-d H:i:s', $enddate);
158 158
 	if ($tracker) {
159
-		$spotter_array = $TrackerArchive->getMinLiveTrackerDataPlayback($begindate,$enddate,$filter);
159
+		$spotter_array = $TrackerArchive->getMinLiveTrackerDataPlayback($begindate, $enddate, $filter);
160 160
 	} elseif ($marine) {
161
-		$spotter_array = $MarineArchive->getMinLiveMarineDataPlayback($begindate,$enddate,$filter);
161
+		$spotter_array = $MarineArchive->getMinLiveMarineDataPlayback($begindate, $enddate, $filter);
162 162
 	} else {
163
-		$spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter);
163
+		$spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate, $enddate, $filter);
164 164
 	}
165 165
 } elseif (isset($_COOKIE['archive']) && isset($_COOKIE['archive_begin']) && isset($_COOKIE['archive_end']) && isset($_COOKIE['archive_speed'])) {
166 166
 	$from_archive = true;
@@ -177,36 +177,36 @@  discard block
 block discarded – undo
177 177
 	}
178 178
 	$enddate = $_COOKIE['archive_end'];
179 179
 	$enddateinitial = $_COOKIE['archive_end'];
180
-	$archivespeed = filter_var($_COOKIE['archive_speed'],FILTER_SANITIZE_NUMBER_INT);
181
-	$begindate = date('Y-m-d H:i:s',$begindate);
182
-	$enddate = date('Y-m-d H:i:s',$enddate);
180
+	$archivespeed = filter_var($_COOKIE['archive_speed'], FILTER_SANITIZE_NUMBER_INT);
181
+	$begindate = date('Y-m-d H:i:s', $begindate);
182
+	$enddate = date('Y-m-d H:i:s', $enddate);
183 183
 	//echo 'Begin : '.$begindate.' - End : '.$enddate."\n";
184 184
 	if ($tracker) {
185
-		$spotter_array = $TrackerArchive->getMinLiveTrackerData($begindate,$enddate,$filter);
185
+		$spotter_array = $TrackerArchive->getMinLiveTrackerData($begindate, $enddate, $filter);
186 186
 	} elseif ($marine) {
187
-		$spotter_array = $MarineArchive->getMinLiveMarineData($begindate,$enddate,$filter);
187
+		$spotter_array = $MarineArchive->getMinLiveMarineData($begindate, $enddate, $filter);
188 188
 	} else {
189
-		$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter);
189
+		$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter);
190 190
 	}
191 191
 } elseif ($tracker) {
192 192
 	$coord = array();
193 193
 	if (isset($_GET['coord']) && $_GET['coord'] != '') {
194
-		$coord = explode(',',$_GET['coord']);
195
-		if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) 
194
+		$coord = explode(',', $_GET['coord']);
195
+		if (!(filter_var($coord[0], FILTER_VALIDATE_FLOAT) && filter_var($coord[1], FILTER_VALIDATE_FLOAT) && filter_var($coord[2], FILTER_VALIDATE_FLOAT) && filter_var($coord[3], FILTER_VALIDATE_FLOAT) 
196 196
 		    && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) {
197 197
 			$coord = array();
198 198
 		}
199 199
 	}
200 200
 	$previous_filter = $filter;
201 201
 	if ((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrackTracker']) && $_COOKIE['MapTrackTracker'] != '')) {
202
-		$filter = array_merge($filter,array('id' => $_COOKIE['MapTrackTracker']));
203
-		$spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord,$filter,false);
202
+		$filter = array_merge($filter, array('id' => $_COOKIE['MapTrackTracker']));
203
+		$spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord, $filter, false);
204 204
 	/*
205 205
 	} elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && !empty($coord)) {
206 206
 		$spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord,$filter,true,$_COOKIE['MapTrack']);
207 207
 	*/
208 208
 	} elseif (!isset($_COOKIE['singlemodel']) || $_COOKIE['singlemodel'] == 'false') {
209
-		$spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord,$filter,false);
209
+		$spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord, $filter, false);
210 210
 	} else {
211 211
 		$spotter_array = array();
212 212
 	}
@@ -215,8 +215,8 @@  discard block
 block discarded – undo
215 215
 	$coord = array();
216 216
 	//if (isset($_GET['coord']) && $_GET['coord'] != '') {
217 217
 	if (!((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrackMarine']) && $_COOKIE['MapTrackMarine'] != '')) && isset($_GET['coord']) && $_GET['coord'] != '') {
218
-		$coord = explode(',',$_GET['coord']);
219
-		if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) 
218
+		$coord = explode(',', $_GET['coord']);
219
+		if (!(filter_var($coord[0], FILTER_VALIDATE_FLOAT) && filter_var($coord[1], FILTER_VALIDATE_FLOAT) && filter_var($coord[2], FILTER_VALIDATE_FLOAT) && filter_var($coord[3], FILTER_VALIDATE_FLOAT) 
220 220
 		    && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) {
221 221
 			$coord = array();
222 222
 		}
@@ -225,11 +225,11 @@  discard block
 block discarded – undo
225 225
 	if (((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') || (!isset($_COOKIE['singlemodel']) && isset($globalMap3DSelected) && $globalMap3DSelected)) && (isset($_COOKIE['MapTrackMarine']) && $_COOKIE['MapTrackMarine'] != '')) {
226 226
 		//$filter = array_merge($filter,array('id' => $_COOKIE['MapTrackMarine']));
227 227
 		//$spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,false);
228
-		$spotter_array = $MarineLive->getMinLastLiveMarineDataByID($_COOKIE['MapTrackMarine'],$filter,false);
228
+		$spotter_array = $MarineLive->getMinLastLiveMarineDataByID($_COOKIE['MapTrackMarine'], $filter, false);
229 229
 	} elseif (isset($_COOKIE['MapTrackMarine']) && $_COOKIE['MapTrackMarine'] != '' && !empty($coord)) {
230
-		$spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,false,$_COOKIE['MapTrack']);
230
+		$spotter_array = $MarineLive->getMinLastLiveMarineData($coord, $filter, false, $_COOKIE['MapTrack']);
231 231
 	} elseif (!isset($_COOKIE['singlemodel']) || $_COOKIE['singlemodel'] == 'false') {
232
-		$spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,false);
232
+		$spotter_array = $MarineLive->getMinLastLiveMarineData($coord, $filter, false);
233 233
 	} else {
234 234
 		$spotter_array = array();
235 235
 	}
@@ -237,8 +237,8 @@  discard block
 block discarded – undo
237 237
 } else {
238 238
 	$coord = array();
239 239
 	if (!((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '')) && isset($_GET['coord']) && $_GET['coord'] != '') {
240
-		$coord = explode(',',$_GET['coord']);
241
-		if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) 
240
+		$coord = explode(',', $_GET['coord']);
241
+		if (!(filter_var($coord[0], FILTER_VALIDATE_FLOAT) && filter_var($coord[1], FILTER_VALIDATE_FLOAT) && filter_var($coord[2], FILTER_VALIDATE_FLOAT) && filter_var($coord[3], FILTER_VALIDATE_FLOAT) 
242 242
 		    && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) {
243 243
 			$coord = array();
244 244
 		}
@@ -246,14 +246,14 @@  discard block
 block discarded – undo
246 246
 	$previous_filter = $filter;
247 247
 	if (((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') || (!isset($_COOKIE['singlemodel']) && isset($globalMap3DSelected) && $globalMap3DSelected)) && (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '')) {
248 248
 		//$filter = array_merge($filter,array('id' => $_COOKIE['MapTrack']));
249
-		$spotter_array = $SpotterLive->getMinLastLiveSpotterDataByID($_COOKIE['MapTrack'],$filter,false);
249
+		$spotter_array = $SpotterLive->getMinLastLiveSpotterDataByID($_COOKIE['MapTrack'], $filter, false);
250 250
 		//$spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,false);
251 251
 	} elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '') {
252 252
 		//$spotter_array = $SpotterLive->getMinLastLiveSpotterDataByID($_COOKIE['MapTrack'],$filter,false);
253 253
 		//if (empty($spotter_array)) $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,false,$_COOKIE['MapTrack']);
254
-		$spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,false,$_COOKIE['MapTrack']);
254
+		$spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord, $filter, false, $_COOKIE['MapTrack']);
255 255
 	} elseif (!isset($_COOKIE['singlemodel']) || $_COOKIE['singlemodel'] == 'false') {
256
-		$spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,false);
256
+		$spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord, $filter, false);
257 257
 	} else {
258 258
 		$spotter_array = array();
259 259
 	}
@@ -263,19 +263,19 @@  discard block
 block discarded – undo
263 263
 if (!empty($spotter_array) && isset($coord)) {
264 264
 	if ($tracker) {
265 265
 		if (isset($_GET['archive'])) {
266
-			$flightcnt = $TrackerArchive->getLiveTrackerCount($begindate,$enddate,$filter);
266
+			$flightcnt = $TrackerArchive->getLiveTrackerCount($begindate, $enddate, $filter);
267 267
 		} else {
268 268
 			$flightcnt = $TrackerLive->getLiveTrackerCount($filter);
269 269
 		}
270 270
 	} elseif ($marine) {
271 271
 		if (isset($_GET['archive'])) {
272
-			$flightcnt = $MarineArchive->getLiveMarineCount($begindate,$enddate,$filter);
272
+			$flightcnt = $MarineArchive->getLiveMarineCount($begindate, $enddate, $filter);
273 273
 		} else {
274 274
 			$flightcnt = $MarineLive->getLiveMarineCount($filter);
275 275
 		}
276 276
 	} else {
277 277
 		if (isset($_GET['archive'])) {
278
-			$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter);
278
+			$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter);
279 279
 		} else {
280 280
 			$flightcnt = $SpotterLive->getLiveSpotterCount($filter);
281 281
 		}
@@ -283,17 +283,17 @@  discard block
 block discarded – undo
283 283
 	if ($flightcnt == '') $flightcnt = 0;
284 284
 } else $flightcnt = 0;
285 285
 
286
-$sqltime = round(microtime(true)-$begintime,2);
286
+$sqltime = round(microtime(true) - $begintime, 2);
287 287
 $minitime = time();
288 288
 $minitracktime_begin = time();
289 289
 $minitracktime = $minitracktime_begin;
290 290
 $maxitime = 0;
291
-$lastupdate = filter_input(INPUT_GET,'update',FILTER_SANITIZE_NUMBER_INT);
291
+$lastupdate = filter_input(INPUT_GET, 'update', FILTER_SANITIZE_NUMBER_INT);
292 292
 $modelsdb = array();
293 293
 if (file_exists(dirname(__FILE__).'/models/modelsdb')) {
294
-	if (($handle = fopen(dirname(__FILE__).'/models/modelsdb','r')) !== FALSE) {
295
-		while (($row = fgetcsv($handle,1000)) !== FALSE) {
296
-			if (isset($row[1]) ){
294
+	if (($handle = fopen(dirname(__FILE__).'/models/modelsdb', 'r')) !== FALSE) {
295
+		while (($row = fgetcsv($handle, 1000)) !== FALSE) {
296
+			if (isset($row[1])) {
297 297
 				$model = $row[0];
298 298
 				$modelsdb[$model] = $row[1];
299 299
 			}
@@ -303,9 +303,9 @@  discard block
 block discarded – undo
303 303
 }
304 304
 $modelsdb2 = array();
305 305
 if (file_exists(dirname(__FILE__).'/models/gltf2/modelsdb')) {
306
-	if (($handle = fopen(dirname(__FILE__).'/models/gltf2/modelsdb','r')) !== FALSE) {
307
-		while (($row = fgetcsv($handle,1000)) !== FALSE) {
308
-			if (isset($row[1]) ){
306
+	if (($handle = fopen(dirname(__FILE__).'/models/gltf2/modelsdb', 'r')) !== FALSE) {
307
+		while (($row = fgetcsv($handle, 1000)) !== FALSE) {
308
+			if (isset($row[1])) {
309 309
 				$model = $row[0];
310 310
 				$glb = $row[1];
311 311
 				if (isset($row[2])) {
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 if (!empty($spotter_array) && is_array($spotter_array))
352 352
 {
353 353
 	$nblatlong = 0;
354
-	foreach($spotter_array as $spotter_item)
354
+	foreach ($spotter_array as $spotter_item)
355 355
 	{
356 356
 		$j++;
357 357
 		//if (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'airwhere') $heightrelative = 'RELATIVE_TO_GROUND';
@@ -405,16 +405,16 @@  discard block
 block discarded – undo
405 405
 			}
406 406
 			if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",';
407 407
 			if (isset($spotter_item['format_source'])) $output .= '"format": "'.$spotter_item['format_source'].'",';
408
-			if (isset($spotter_item['ident'])) $output.= '"ident": '.json_encode($spotter_item['ident']).',';
408
+			if (isset($spotter_item['ident'])) $output .= '"ident": '.json_encode($spotter_item['ident']).',';
409 409
 			if ($tracker) {
410 410
 				if (isset($spotter_item['type'])) $output .= '"tracker_type": '.json_encode($spotter_item['type']).',';
411
-				$output.= '"type": "tracker"';
411
+				$output .= '"type": "tracker"';
412 412
 			} elseif ($marine) {
413 413
 				if (isset($spotter_item['type'])) $output .= '"marine_type": '.json_encode($spotter_item['type']).',';
414 414
 				if (isset($spotter_item['captain_name'])) $output .= '"captain": '.json_encode($spotter_item['captain_name']).',';
415 415
 				if (isset($spotter_item['race_name'])) $output .= '"race": '.json_encode($spotter_item['race_name']).',';
416 416
 				if (isset($spotter_item['race_rank'])) $output .= '"rank": "'.$spotter_item['race_rank'].'",';
417
-				$output.= '"type": "marine"';
417
+				$output .= '"type": "marine"';
418 418
 			} else {
419 419
 				if ($one3dmodel === false && isset($globalMap3DLiveries) && $globalMap3DLiveries) {
420 420
 					$aircraft_icao = $spotter_item['aircraft_icao'];
@@ -428,14 +428,14 @@  discard block
 block discarded – undo
428 428
 						if (isset($airline_icao)) {
429 429
 							$imagefile = $aircraft_icao.'-'.$airline_icao.'.png';
430 430
 							if (file_exists(dirname(__FILE__).'/models/gltf2/liveries/'.$imagefile)) {
431
-								$output.= '"liveries": "'.$globalURL.'/models/gltf2/liveries/'.$imagefile.'",';
431
+								$output .= '"liveries": "'.$globalURL.'/models/gltf2/liveries/'.$imagefile.'",';
432 432
 							}
433 433
 						}
434 434
 					}
435 435
 					//if ($ident != '') $output.= '"ident": "'.$ident.'",';
436 436
 				}
437
-				$output.= '"gltf2": %gltf2%,';
438
-				$output.= '"type": "flight"';
437
+				$output .= '"gltf2": %gltf2%,';
438
+				$output .= '"type": "flight"';
439 439
 			}
440 440
 			$output .= '},';
441 441
 
@@ -810,8 +810,8 @@  discard block
 block discarded – undo
810 810
 					$output .= '},';
811 811
 				}
812 812
 			}
813
-			if (isset($onground) && $onground) $output = str_replace('%onground%','true',$output);
814
-			else $output = str_replace('%onground%','false',$output);
813
+			if (isset($onground) && $onground) $output = str_replace('%onground%', 'true', $output);
814
+			else $output = str_replace('%onground%', 'false', $output);
815 815
 
816 816
 	//		$output .= '"heightReference": "CLAMP_TO_GROUND",';
817 817
 			//$output .= '"heightReference": "'.$heightrelative.'",';
@@ -827,7 +827,7 @@  discard block
 block discarded – undo
827 827
 			if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']);
828 828
 			if (isset($_COOKIE['MapTrack']) && $id == $_COOKIE['MapTrack'] && $minitracktime > strtotime($spotter_item['date'])) $minitracktime = strtotime($spotter_item['date']);
829 829
 			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
830
-			$output .= '"'.date("c",strtotime($spotter_item['date'])).'", ';
830
+			$output .= '"'.date("c", strtotime($spotter_item['date'])).'", ';
831 831
 			$output .= $spotter_item['longitude'].', ';
832 832
 			$output .= $spotter_item['latitude'];
833 833
 			$prevlong = $spotter_item['longitude'];
@@ -855,8 +855,8 @@  discard block
 block discarded – undo
855 855
 			//$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0));
856 856
 			//$orientation .= '"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w'];
857 857
 		} else {
858
-			$nblatlong = $nblatlong+1;
859
-			$output .= ',"'.date("c",strtotime($spotter_item['date'])).'", ';
858
+			$nblatlong = $nblatlong + 1;
859
+			$output .= ',"'.date("c", strtotime($spotter_item['date'])).'", ';
860 860
 			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
861 861
 			if ($spotter_item['ground_speed'] == 0) {
862 862
 				$output .= $prevlong.', ';
@@ -897,26 +897,26 @@  discard block
 block discarded – undo
897 897
 $output .= ']';
898 898
 if (isset($globalArchive) && $globalArchive === TRUE) {
899 899
 	if (isset($begindateinitial)) {
900
-		$output = str_replace('%minitime%',date("c",$begindateinitial),$output);
901
-	} elseif ((time()-$globalLiveInterval) > $minitime) {
902
-		if (time()-$globalLiveInterval > $maxitime) {
903
-			$output = str_replace('%minitime%',date("c",$maxitime),$output);
900
+		$output = str_replace('%minitime%', date("c", $begindateinitial), $output);
901
+	} elseif ((time() - $globalLiveInterval) > $minitime) {
902
+		if (time() - $globalLiveInterval > $maxitime) {
903
+			$output = str_replace('%minitime%', date("c", $maxitime), $output);
904 904
 		} else {
905
-			$output = str_replace('%minitime%',date("c",time()-$globalLiveInterval),$output);
905
+			$output = str_replace('%minitime%', date("c", time() - $globalLiveInterval), $output);
906 906
 		}
907 907
 	}
908
-	else $output = str_replace('%minitime%',date("c",$minitime),$output);
908
+	else $output = str_replace('%minitime%', date("c", $minitime), $output);
909 909
 } elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && $minitracktime != $minitracktime_begin) {
910
-	$output = str_replace('%minitime%',date("c",$minitracktime),$output);
910
+	$output = str_replace('%minitime%', date("c", $minitracktime), $output);
911 911
 } else {
912
-	$output = str_replace('%minitime%',date("c",$minitime),$output);
912
+	$output = str_replace('%minitime%', date("c", $minitime), $output);
913 913
 }
914 914
 if (isset($enddateinitial)) {
915
-	$output = str_replace('%maxitime%',date("c",$enddateinitial),$output);
915
+	$output = str_replace('%maxitime%', date("c", $enddateinitial), $output);
916 916
 } else {
917
-	$output = str_replace('%maxitime%',date("c",$maxitime),$output);
917
+	$output = str_replace('%maxitime%', date("c", $maxitime), $output);
918 918
 }
919
-if ($gltf2) $output = str_replace('%gltf2%','true',$output);
920
-else $output = str_replace('%gltf2%','false',$output);
919
+if ($gltf2) $output = str_replace('%gltf2%', 'true', $output);
920
+else $output = str_replace('%gltf2%', 'false', $output);
921 921
 print $output;
922 922
 ?>
Please login to merge, or discard this patch.
Braces   +147 added lines, -53 removed lines patch added patch discarded remove patch
@@ -26,8 +26,12 @@  discard block
 block discarded – undo
26 26
 }
27 27
 $tracker = false;
28 28
 $marine = false;
29
-if (isset($_GET['tracker'])) $tracker = true;
30
-if (isset($_GET['marine'])) $marine = true;
29
+if (isset($_GET['tracker'])) {
30
+	$tracker = true;
31
+}
32
+if (isset($_GET['marine'])) {
33
+	$marine = true;
34
+}
31 35
 if ($tracker) {
32 36
 	require_once('require/class.Tracker.php');
33 37
 	require_once('require/class.TrackerLive.php');
@@ -84,26 +88,55 @@  discard block
 block discarded – undo
84 88
 }
85 89
 header('Content-Type: text/javascript');
86 90
 
87
-if (!isset($globalJsonCompress)) $compress = true;
88
-else $compress = $globalJsonCompress;
91
+if (!isset($globalJsonCompress)) {
92
+	$compress = true;
93
+} else {
94
+	$compress = $globalJsonCompress;
95
+}
89 96
 
90 97
 $from_archive = false;
91 98
 $min = false;
92 99
 $allhistory = false;
93 100
 $filter['source'] = array();
94
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
95
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
96
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
97
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
98
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
99
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
100
-if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
101
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
102
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
103
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
104
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
105
-if (isset($_COOKIE['filter_race']) && $_COOKIE['filter_race'] != 'all') $filter['race'] = filter_var($_COOKIE['filter_race'],FILTER_SANITIZE_NUMBER_INT);
106
-if (isset($_COOKIE['filter_blocked']) && $_COOKIE['filter_blocked'] == 'true') $filter['blocked'] = true;
101
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') {
102
+	$filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
103
+}
104
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') {
105
+	$filter['source'] = array_merge($filter['source'],array('whazzup'));
106
+}
107
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') {
108
+	$filter['source'] = array_merge($filter['source'],array('phpvmacars'));
109
+}
110
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') {
111
+	$filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
112
+}
113
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') {
114
+	$filter['source'] = array_merge($filter['source'],array('aprs'));
115
+}
116
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') {
117
+	$filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
118
+}
119
+if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') {
120
+	$filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
121
+}
122
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') {
123
+	$filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
124
+}
125
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') {
126
+	$filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
127
+}
128
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') {
129
+	$filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
130
+}
131
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') {
132
+	$filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
133
+}
134
+if (isset($_COOKIE['filter_race']) && $_COOKIE['filter_race'] != 'all') {
135
+	$filter['race'] = filter_var($_COOKIE['filter_race'],FILTER_SANITIZE_NUMBER_INT);
136
+}
137
+if (isset($_COOKIE['filter_blocked']) && $_COOKIE['filter_blocked'] == 'true') {
138
+	$filter['blocked'] = true;
139
+}
107 140
 /*
108 141
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
109 142
 	$min = true;
@@ -280,8 +313,12 @@  discard block
 block discarded – undo
280 313
 			$flightcnt = $SpotterLive->getLiveSpotterCount($filter);
281 314
 		}
282 315
 	}
283
-	if ($flightcnt == '') $flightcnt = 0;
284
-} else $flightcnt = 0;
316
+	if ($flightcnt == '') {
317
+		$flightcnt = 0;
318
+	}
319
+	} else {
320
+	$flightcnt = 0;
321
+}
285 322
 
286 323
 $sqltime = round(microtime(true)-$begintime,2);
287 324
 $minitime = time();
@@ -327,7 +364,9 @@  discard block
 block discarded – undo
327 364
 $gltf2 = false;
328 365
 $scale = 1.0;
329 366
 $minimumpixelsize = 20;
330
-if (isset($archivespeed)) $speed = $archivespeed;
367
+if (isset($archivespeed)) {
368
+	$speed = $archivespeed;
369
+}
331 370
 $output = '[';
332 371
 if ($tracker) {
333 372
 	$output .= '{"id" : "document", "name" : "tracker","version" : "1.0"';
@@ -363,9 +402,13 @@  discard block
 block discarded – undo
363 402
 			$image = "images/placeholder_thumb.png";
364 403
 		}
365 404
 
366
-                if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id'];
367
-                elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid'];
368
-                elseif (isset($spotter_item['fammarine_id'])) $id = $spotter_item['fammarine_id'];
405
+                if (isset($spotter_item['flightaware_id'])) {
406
+                	$id = $spotter_item['flightaware_id'];
407
+                } elseif (isset($spotter_item['famtrackid'])) {
408
+                	$id = $spotter_item['famtrackid'];
409
+                } elseif (isset($spotter_item['fammarine_id'])) {
410
+                	$id = $spotter_item['fammarine_id'];
411
+                }
369 412
                 if ($prev_flightaware_id != $id) {
370 413
 			if ($prev_flightaware_id != '') {
371 414
 				/*
@@ -403,17 +446,33 @@  discard block
 block discarded – undo
403 446
 			if (isset($spotter_item['squawk'])) {
404 447
 				$output .= '"squawk": "'.$spotter_item['squawk'].'",';
405 448
 			}
406
-			if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",';
407
-			if (isset($spotter_item['format_source'])) $output .= '"format": "'.$spotter_item['format_source'].'",';
408
-			if (isset($spotter_item['ident'])) $output.= '"ident": '.json_encode($spotter_item['ident']).',';
449
+			if (isset($spotter_item['registration'])) {
450
+				$output .= '"registration": "'.$spotter_item['registration'].'",';
451
+			}
452
+			if (isset($spotter_item['format_source'])) {
453
+				$output .= '"format": "'.$spotter_item['format_source'].'",';
454
+			}
455
+			if (isset($spotter_item['ident'])) {
456
+				$output.= '"ident": '.json_encode($spotter_item['ident']).',';
457
+			}
409 458
 			if ($tracker) {
410
-				if (isset($spotter_item['type'])) $output .= '"tracker_type": '.json_encode($spotter_item['type']).',';
459
+				if (isset($spotter_item['type'])) {
460
+					$output .= '"tracker_type": '.json_encode($spotter_item['type']).',';
461
+				}
411 462
 				$output.= '"type": "tracker"';
412 463
 			} elseif ($marine) {
413
-				if (isset($spotter_item['type'])) $output .= '"marine_type": '.json_encode($spotter_item['type']).',';
414
-				if (isset($spotter_item['captain_name'])) $output .= '"captain": '.json_encode($spotter_item['captain_name']).',';
415
-				if (isset($spotter_item['race_name'])) $output .= '"race": '.json_encode($spotter_item['race_name']).',';
416
-				if (isset($spotter_item['race_rank'])) $output .= '"rank": "'.$spotter_item['race_rank'].'",';
464
+				if (isset($spotter_item['type'])) {
465
+					$output .= '"marine_type": '.json_encode($spotter_item['type']).',';
466
+				}
467
+				if (isset($spotter_item['captain_name'])) {
468
+					$output .= '"captain": '.json_encode($spotter_item['captain_name']).',';
469
+				}
470
+				if (isset($spotter_item['race_name'])) {
471
+					$output .= '"race": '.json_encode($spotter_item['race_name']).',';
472
+				}
473
+				if (isset($spotter_item['race_rank'])) {
474
+					$output .= '"rank": "'.$spotter_item['race_rank'].'",';
475
+				}
417 476
 				$output.= '"type": "marine"';
418 477
 			} else {
419 478
 				if ($one3dmodel === false && isset($globalMap3DLiveries) && $globalMap3DLiveries) {
@@ -464,7 +523,9 @@  discard block
 block discarded – undo
464 523
 							$spotter_item['engine_type'] = $aircraft_info[0]['engine_type'];
465 524
 							$spotter_item['wake_category'] = $aircraft_info[0]['wake_category'];
466 525
 							$spotter_item['engine_count'] = $aircraft_info[0]['engine_count'];
467
-						} else $aircraft_shadow = '';
526
+						} else {
527
+							$aircraft_shadow = '';
528
+						}
468 529
 	    					$output .= ' "billboard" : {"image" : "'.$globalURL.'/images/aircrafts/new/'.$aircraft_shadow.'","scale" : 0.5';
469 530
 						if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true' && isset($_COOKIE['IconColor'])) {
470 531
 							$rgb = $Common->hex2rgb($_COOKIE['IconColor']);
@@ -472,7 +533,9 @@  discard block
 block discarded – undo
472 533
 						}
473 534
 						$output .= '},';
474 535
 					}
475
-				} else $output .= ' "billboard" : {"image" : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAfCAYAAACVgY94AAAACXBIWXMAAC4jAAAuIwF4pT92AAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAA7VJREFUeNrEl2uIlWUQx39nXUu0m2uQbZYrbabdLKMs/VBkmHQjioqFIhBS+hKEQpQRgVAf2u5RQkGBRUllRH4I2e5ZUBJlEZVt5i0tTfHStrZ6fn35L70d9n7Obg88vOedmWfmf2bmmZkXlRrtq9V16mZ1iVqqhd5agXvQf1c5zw/V8dXqrqO6dQKwBrgdWApsCb0VqAc2AnOrMVANwIsD4BLgTOBPYB2wHJgEzAG+ANqAu4ZsZYiuX5QwfqI2hvaNulA9J7zLQn8o76vUuuHOwXHqSzH4aIF+TWjnBkSH+nCBf716SP1KPWO4AJ6ltgfIjRW8p9U/1KPz/ry6RT2mIDNF3Zjz19Ya4G1R/J16dgWvQd2pPlXhMdVZPUTgxfCW1wJgXUJpQlvfg8zs8K8r0Caom9QHetG7NGfa1ElDBThRXRtFd/Qh16puKIS3e7+clBjdy7kL1b3q4fzJQQGck5z6Nb97kxujblWf64HXov7Vl/E4YXWccP9AAd6dAx+ox/WTArNzY1t64B0f8K0DyLXuUvRGZfcpCo1VX4tg6wB76WMB0dALf526foAX8cqUot2pGP8B2Kz+krBeNYjS8636dh/8Beo2deoA9TWp76pd6g0q9cDNwKvAD8A84EfglLRBe2g+JWAfcEF68bPABOCoAl/gIPA5MA64FVgGnNhP292W3r0SeB1YVlJXAjcBP8XwyQUj9AKwAzg2+/fQSsBhoJxBAaALaIzenZGnD911wA7gEDAD2FFSpwOzgDHZ5T7+ZSlGd2d6AXgi5+qAn+O5U0PbBVwKtAD3AHuB8f3YGBUdncCGoQ4LE9XtGRqK9LnduVPRIu2BPqwD65IYbS7Qpql7Ql9YoJcy9bwzkgPrfOCj5G33+h54E/g0PAr5thq4ApgyEgNrc27aWwVaPTA1QJ4BjgTGFvhteV40EgPrgvTP7qlmZqFnl9WD+b2posN83E/NrEkOjlI/U1fkfUYa/pe5IE3qZPW8jFOqiyN7p3pAPX04c7AxYSoDDcAjKT2LgLXA6IR2M3Bviv59wDTgQGTPH84Qd8+HXfHcoUws2zM0HMjuUPep+xP2PWpnwtw0GJsldbBpewQwE/gbeDyt7H1gcW53O7AC+A3Yn6+/W+Ld9SnWA15DAVhc8xK2TuA9YHrCuhV4EngFuBx4YagG6qv8cF+T52kB2Zy+e1I8taUacNV+uBdXO7ABmJwJpwx8XQvF9TUCWM64tiQhbq/oMv+7BwFWpQzNT8vbVQul/wwAGzzdmXU1xuUAAAAASUVORK5CYII=","scale" : 0.5},';
536
+				} else {
537
+					$output .= ' "billboard" : {"image" : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAfCAYAAACVgY94AAAACXBIWXMAAC4jAAAuIwF4pT92AAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAA7VJREFUeNrEl2uIlWUQx39nXUu0m2uQbZYrbabdLKMs/VBkmHQjioqFIhBS+hKEQpQRgVAf2u5RQkGBRUllRH4I2e5ZUBJlEZVt5i0tTfHStrZ6fn35L70d9n7Obg88vOedmWfmf2bmmZkXlRrtq9V16mZ1iVqqhd5agXvQf1c5zw/V8dXqrqO6dQKwBrgdWApsCb0VqAc2AnOrMVANwIsD4BLgTOBPYB2wHJgEzAG+ANqAu4ZsZYiuX5QwfqI2hvaNulA9J7zLQn8o76vUuuHOwXHqSzH4aIF+TWjnBkSH+nCBf716SP1KPWO4AJ6ltgfIjRW8p9U/1KPz/ry6RT2mIDNF3Zjz19Ya4G1R/J16dgWvQd2pPlXhMdVZPUTgxfCW1wJgXUJpQlvfg8zs8K8r0Caom9QHetG7NGfa1ElDBThRXRtFd/Qh16puKIS3e7+clBjdy7kL1b3q4fzJQQGck5z6Nb97kxujblWf64HXov7Vl/E4YXWccP9AAd6dAx+ox/WTArNzY1t64B0f8K0DyLXuUvRGZfcpCo1VX4tg6wB76WMB0dALf526foAX8cqUot2pGP8B2Kz+krBeNYjS8636dh/8Beo2deoA9TWp76pd6g0q9cDNwKvAD8A84EfglLRBe2g+JWAfcEF68bPABOCoAl/gIPA5MA64FVgGnNhP292W3r0SeB1YVlJXAjcBP8XwyQUj9AKwAzg2+/fQSsBhoJxBAaALaIzenZGnD911wA7gEDAD2FFSpwOzgDHZ5T7+ZSlGd2d6AXgi5+qAn+O5U0PbBVwKtAD3AHuB8f3YGBUdncCGoQ4LE9XtGRqK9LnduVPRIu2BPqwD65IYbS7Qpql7Ql9YoJcy9bwzkgPrfOCj5G33+h54E/g0PAr5thq4ApgyEgNrc27aWwVaPTA1QJ4BjgTGFvhteV40EgPrgvTP7qlmZqFnl9WD+b2posN83E/NrEkOjlI/U1fkfUYa/pe5IE3qZPW8jFOqiyN7p3pAPX04c7AxYSoDDcAjKT2LgLXA6IR2M3Bviv59wDTgQGTPH84Qd8+HXfHcoUws2zM0HMjuUPep+xP2PWpnwtw0GJsldbBpewQwE/gbeDyt7H1gcW53O7AC+A3Yn6+/W+Ld9SnWA15DAVhc8xK2TuA9YHrCuhV4EngFuBx4YagG6qv8cF+T52kB2Zy+e1I8taUacNV+uBdXO7ABmJwJpwx8XQvF9TUCWM64tiQhbq/oMv+7BwFWpQzNT8vbVQul/wwAGzzdmXU1xuUAAAAASUVORK5CYII=","scale" : 0.5},';
538
+				}
476 539
 			} elseif ($one3dmodel) {
477 540
 				if (isset($globalMap3DForceModel) && $globalMap3DForceModel != '') {
478 541
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$globalMap3DForceModel.'","scale" : '.$scale.',"minimumPixelSize": '.$minimumpixelsize.'';
@@ -512,7 +575,9 @@  discard block
 block discarded – undo
512 575
 							$spotter_item['engine_type'] = $aircraft_info[0]['engine_type'];
513 576
 							$spotter_item['wake_category'] = $aircraft_info[0]['wake_category'];
514 577
 							$spotter_item['engine_count'] = $aircraft_info[0]['engine_count'];
515
-						} else $aircraft_shadow = '';
578
+						} else {
579
+							$aircraft_shadow = '';
580
+						}
516 581
 						if ($aircraft_shadow != '') {
517 582
 							if (isset($modelsdb2[$aircraft_shadow])) {
518 583
 								$output .= '"model": {"gltf" : "'.$globalURL.'/models/gltf2/'.$modelsdb2[$aircraft_shadow]['glb'].'","scale" : '.$scale.',"minimumPixelSize": '.$modelsdb2[$aircraft_shadow]['size'];
@@ -667,7 +732,9 @@  discard block
 block discarded – undo
667 732
 								}
668 733
 								$output .= '},';
669 734
 								//if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
670
-								if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
735
+								if ($spotter_item['aircraft_icao'] != '') {
736
+									$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
737
+								}
671 738
 								$modelsdb[$aircraft_icao] = 'Cesium_Air.glb';
672 739
 							}
673 740
 						} elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') {
@@ -689,7 +756,9 @@  discard block
 block discarded – undo
689 756
 							}
690 757
 							$output .= '},';
691 758
 							//if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
692
-							if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
759
+							if ($spotter_item['aircraft_icao'] != '') {
760
+								$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
761
+							}
693 762
 							$modelsdb[$aircraft_icao] = 'Cesium_Air.glb';
694 763
 						}
695 764
 					} else {
@@ -702,7 +771,9 @@  discard block
 block discarded – undo
702 771
 						}
703 772
 						$output .= '},';
704 773
 						//if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
705
-						if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
774
+						if ($spotter_item['aircraft_icao'] != '') {
775
+							$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
776
+						}
706 777
 						$modelsdb[$aircraft_icao] = 'Cesium_Air.glb';
707 778
 					}
708 779
 				} elseif ($tracker && isset($spotter_item['type'])) {
@@ -810,8 +881,11 @@  discard block
 block discarded – undo
810 881
 					$output .= '},';
811 882
 				}
812 883
 			}
813
-			if (isset($onground) && $onground) $output = str_replace('%onground%','true',$output);
814
-			else $output = str_replace('%onground%','false',$output);
884
+			if (isset($onground) && $onground) {
885
+				$output = str_replace('%onground%','true',$output);
886
+			} else {
887
+				$output = str_replace('%onground%','false',$output);
888
+			}
815 889
 
816 890
 	//		$output .= '"heightReference": "CLAMP_TO_GROUND",';
817 891
 			//$output .= '"heightReference": "'.$heightrelative.'",';
@@ -824,9 +898,15 @@  discard block
 block discarded – undo
824 898
 	//		$output .= '"interpolationDegree" : 5,';
825 899
 	//		$output .= '"epoch" : "'.date("c",strtotime($spotter_item['date'])).'", ';
826 900
 			$output .= '"cartographicDegrees": [';
827
-			if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']);
828
-			if (isset($_COOKIE['MapTrack']) && $id == $_COOKIE['MapTrack'] && $minitracktime > strtotime($spotter_item['date'])) $minitracktime = strtotime($spotter_item['date']);
829
-			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
901
+			if ($minitime > strtotime($spotter_item['date'])) {
902
+				$minitime = strtotime($spotter_item['date']);
903
+			}
904
+			if (isset($_COOKIE['MapTrack']) && $id == $_COOKIE['MapTrack'] && $minitracktime > strtotime($spotter_item['date'])) {
905
+				$minitracktime = strtotime($spotter_item['date']);
906
+			}
907
+			if ($maxitime < strtotime($spotter_item['date'])) {
908
+				$maxitime = strtotime($spotter_item['date']);
909
+			}
830 910
 			$output .= '"'.date("c",strtotime($spotter_item['date'])).'", ';
831 911
 			$output .= $spotter_item['longitude'].', ';
832 912
 			$output .= $spotter_item['latitude'];
@@ -849,7 +929,9 @@  discard block
 block discarded – undo
849 929
 					$output .= ', '.round($spotter_item['altitude']*30.48);
850 930
 					$prevalt = round($spotter_item['altitude']*30.48);
851 931
 				}
852
-			} else $output .= ', 0';
932
+			} else {
933
+				$output .= ', 0';
934
+			}
853 935
 			//$orientation = '"orientation" : { ';
854 936
 			//$orientation .= '"unitQuaternion": [';
855 937
 			//$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0));
@@ -857,13 +939,18 @@  discard block
 block discarded – undo
857 939
 		} else {
858 940
 			$nblatlong = $nblatlong+1;
859 941
 			$output .= ',"'.date("c",strtotime($spotter_item['date'])).'", ';
860
-			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
942
+			if ($maxitime < strtotime($spotter_item['date'])) {
943
+				$maxitime = strtotime($spotter_item['date']);
944
+			}
861 945
 			if ($spotter_item['ground_speed'] == 0) {
862 946
 				$output .= $prevlong.', ';
863 947
 				$output .= $prevlat;
864 948
 				//if (!$marine && (!isset($onground) || !$onground)) $output .= ', '.$prevalt;
865
-				if (!$marine) $output .= ', '.$prevalt;
866
-				else $output .= ', 0';
949
+				if (!$marine) {
950
+					$output .= ', '.$prevalt;
951
+				} else {
952
+					$output .= ', 0';
953
+				}
867 954
 			} else {
868 955
 				$output .= $spotter_item['longitude'].', ';
869 956
 				$output .= $spotter_item['latitude'];
@@ -876,14 +963,17 @@  discard block
 block discarded – undo
876 963
 							$output .= ', 0';
877 964
 						}
878 965
 					} else {
879
-						if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') $output .= ', '.round($spotter_item['real_altitude']*0.3048);
880
-						elseif ($tracker) {
966
+						if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') {
967
+							$output .= ', '.round($spotter_item['real_altitude']*0.3048);
968
+						} elseif ($tracker) {
881 969
 							$output .= ', '.round($spotter_item['altitude']*0.3048);
882 970
 						} else {
883 971
 							$output .= ', '.round($spotter_item['altitude']*30.48);
884 972
 						}
885 973
 					}
886
-				} else $output .= ', 0';
974
+				} else {
975
+					$output .= ', 0';
976
+				}
887 977
 			}
888 978
 			//$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0));
889 979
 			//$orientation .= ',"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w'];
@@ -904,9 +994,10 @@  discard block
 block discarded – undo
904 994
 		} else {
905 995
 			$output = str_replace('%minitime%',date("c",time()-$globalLiveInterval),$output);
906 996
 		}
997
+	} else {
998
+		$output = str_replace('%minitime%',date("c",$minitime),$output);
907 999
 	}
908
-	else $output = str_replace('%minitime%',date("c",$minitime),$output);
909
-} elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && $minitracktime != $minitracktime_begin) {
1000
+	} elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && $minitracktime != $minitracktime_begin) {
910 1001
 	$output = str_replace('%minitime%',date("c",$minitracktime),$output);
911 1002
 } else {
912 1003
 	$output = str_replace('%minitime%',date("c",$minitime),$output);
@@ -916,7 +1007,10 @@  discard block
 block discarded – undo
916 1007
 } else {
917 1008
 	$output = str_replace('%maxitime%',date("c",$maxitime),$output);
918 1009
 }
919
-if ($gltf2) $output = str_replace('%gltf2%','true',$output);
920
-else $output = str_replace('%gltf2%','false',$output);
1010
+if ($gltf2) {
1011
+	$output = str_replace('%gltf2%','true',$output);
1012
+} else {
1013
+	$output = str_replace('%gltf2%','false',$output);
1014
+}
921 1015
 print $output;
922 1016
 ?>
Please login to merge, or discard this patch.
live-geojson.php 2 patches
Spacing   +90 added lines, -90 removed lines patch added patch discarded remove patch
@@ -64,18 +64,18 @@  discard block
 block discarded – undo
64 64
 $min = true;
65 65
 $allhistory = false;
66 66
 $filter['source'] = array();
67
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
68
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
69
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
70
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
71
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
72
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
73
-if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
74
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
75
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
76
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
77
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
78
-if (isset($_COOKIE['filter_race']) && $_COOKIE['filter_race'] != 'all') $filter['race'] = filter_var($_COOKIE['filter_race'],FILTER_SANITIZE_NUMBER_INT);
67
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt'));
68
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup'));
69
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars'));
70
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs'));
71
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs'));
72
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING);
73
+if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'], FILTER_SANITIZE_STRING);
74
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING);
75
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING);
76
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING);
77
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING);
78
+if (isset($_COOKIE['filter_race']) && $_COOKIE['filter_race'] != 'all') $filter['race'] = filter_var($_COOKIE['filter_race'], FILTER_SANITIZE_NUMBER_INT);
79 79
 if (isset($_COOKIE['filter_blocked']) && $_COOKIE['filter_blocked'] == 'true') $filter['blocked'] = true;
80 80
 
81 81
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 $spotter_array = array();
86 86
 
87 87
 if (isset($_GET['ident'])) {
88
-	$ident = urldecode(filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING));
88
+	$ident = urldecode(filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING));
89 89
 	if ($tracker) {
90 90
 		$spotter_array = $TrackerLive->getLastLiveTrackerDataByIdent($ident);
91 91
 	} elseif ($marine) {
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	}
100 100
 	$allhistory = true;
101 101
 } elseif (isset($_GET['flightaware_id'])) {
102
-	$flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
102
+	$flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING);
103 103
 	$spotter_array = $SpotterLive->getLastLiveSpotterDataById($flightaware_id);
104 104
 	if (empty($spotter_array)) {
105 105
 		$from_archive = true;
@@ -107,11 +107,11 @@  discard block
 block discarded – undo
107 107
 	}
108 108
 	$allhistory = true;
109 109
 } elseif (isset($_GET['famtrack_id'])) {
110
-	$famtrack_id = urldecode(filter_input(INPUT_GET,'famtrack_id',FILTER_SANITIZE_STRING));
110
+	$famtrack_id = urldecode(filter_input(INPUT_GET, 'famtrack_id', FILTER_SANITIZE_STRING));
111 111
 	$spotter_array = $TrackerLive->getLastLiveTrackerDataById($famtrack_id);
112 112
 	$allhistory = true;
113 113
 } elseif (isset($_GET['fammarine_id'])) {
114
-	$fammarine_id = urldecode(filter_input(INPUT_GET,'fammarine_id',FILTER_SANITIZE_STRING));
114
+	$fammarine_id = urldecode(filter_input(INPUT_GET, 'fammarine_id', FILTER_SANITIZE_STRING));
115 115
 	$spotter_array = $MarineLive->getLastLiveMarineDataById($fammarine_id);
116 116
 	$allhistory = true;
117 117
 /*
@@ -131,15 +131,15 @@  discard block
 block discarded – undo
131 131
 */
132 132
 } elseif (isset($globalMapUseBbox) && $globalMapUseBbox && isset($_GET['coord']) && $min && !isset($_GET['archive'])) {
133 133
 	$usecoord = true;
134
-	$coord = explode(',',$_GET['coord']);
135
-	if (filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) 
134
+	$coord = explode(',', $_GET['coord']);
135
+	if (filter_var($coord[0], FILTER_VALIDATE_FLOAT) && filter_var($coord[1], FILTER_VALIDATE_FLOAT) && filter_var($coord[2], FILTER_VALIDATE_FLOAT) && filter_var($coord[3], FILTER_VALIDATE_FLOAT) 
136 136
 	    && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0) {
137 137
 		if ($tracker) {
138
-			$spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord,$filter);
138
+			$spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord, $filter);
139 139
 		} elseif ($marine) {
140
-			$spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord,$filter);
140
+			$spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord, $filter);
141 141
 		} else {
142
-			$spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord,$filter);
142
+			$spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord, $filter);
143 143
 		}
144 144
 	} else {
145 145
 		if ($tracker) {
@@ -154,12 +154,12 @@  discard block
 block discarded – undo
154 154
 	$from_archive = true;
155 155
 //	$begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
156 156
 //	$enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
157
-	$begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT);
158
-	$enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT);
159
-	$archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT);
160
-	$begindate = date('Y-m-d H:i:s',$begindate);
161
-	$enddate = date('Y-m-d H:i:s',$enddate);
162
-	$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter);
157
+	$begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT);
158
+	$enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT);
159
+	$archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT);
160
+	$begindate = date('Y-m-d H:i:s', $begindate);
161
+	$enddate = date('Y-m-d H:i:s', $enddate);
162
+	$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter);
163 163
 } elseif ($min) {
164 164
 	if ($tracker) {
165 165
 		$spotter_array = $TrackerLive->getMinLiveTrackerData($filter);
@@ -171,17 +171,17 @@  discard block
 block discarded – undo
171 171
 #	$min = true;
172 172
 } else {
173 173
 	if ($tracker) {
174
-		$spotter_array = $TrackerLive->getLiveTrackerData('','',$filter);
174
+		$spotter_array = $TrackerLive->getLiveTrackerData('', '', $filter);
175 175
 	} elseif ($marine) {
176
-		$spotter_array = $marineLive->getLiveMarineData('','',$filter);
176
+		$spotter_array = $marineLive->getLiveMarineData('', '', $filter);
177 177
 	} else {
178
-		$spotter_array = $SpotterLive->getLiveSpotterData('','',$filter);
178
+		$spotter_array = $SpotterLive->getLiveSpotterData('', '', $filter);
179 179
 	}
180 180
 }
181 181
 
182 182
 if ($usecoord) {
183 183
 	if (isset($_GET['archive'])) {
184
-		$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter);
184
+		$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter);
185 185
 	} else {
186 186
 		if ($tracker) {
187 187
 			$flightcnt = $TrackerLive->getLiveTrackerCount($filter);
@@ -194,9 +194,9 @@  discard block
 block discarded – undo
194 194
 	if ($flightcnt == '') $flightcnt = 0;
195 195
 } else $flightcnt = 0;
196 196
 
197
-$sqltime = round(microtime(true)-$begintime,2);
197
+$sqltime = round(microtime(true) - $begintime, 2);
198 198
 
199
-$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
199
+$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT);
200 200
 if ($currenttime != '') $currenttime = round($currenttime/1000);
201 201
 
202 202
 if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false;
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 		if (!empty($spotter_array) && is_array($spotter_array))
216 216
 		{
217 217
 			$output .= '"features": [';
218
-			foreach($spotter_array as $spotter_item)
218
+			foreach ($spotter_array as $spotter_item)
219 219
 			{
220 220
 				$j++;
221 221
 				unset($idistance);
@@ -272,8 +272,8 @@  discard block
 block discarded – undo
272 272
 */
273 273
 							//$output .= '"fc": "'.$spotter_item['nb'].'",';
274 274
 						if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') {
275
-							if ($compress) $output .= '"c": '.json_encode(str_replace('\\','',$spotter_item['ident'])).',';
276
-							else $output .= '"callsign": '.json_encode(str_replace('\\','',$spotter_item['ident'])).',';
275
+							if ($compress) $output .= '"c": '.json_encode(str_replace('\\', '', $spotter_item['ident'])).',';
276
+							else $output .= '"callsign": '.json_encode(str_replace('\\', '', $spotter_item['ident'])).',';
277 277
 							//'
278 278
 						} else {
279 279
 							if ($compress) $output .= '"c": "NA",';
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 						}
286 286
 						if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) {
287 287
 							$output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",';
288
-							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",';
288
+							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ', '_', $spotter_item['aircraft_name'])).'",';
289 289
 						} elseif (isset($spotter_item['aircraft_type'])) {
290 290
 							$output .= '"aircraft_name": "NA ('.$spotter_item['aircraft_type'].')",';
291 291
 						} elseif (!$min) {
@@ -371,19 +371,19 @@  discard block
 block discarded – undo
371 371
 									else $output .= '"aircraft_shadow": "car.png",';
372 372
 								}
373 373
 							} elseif ($marine) {
374
-								if (isset($spotter_item['type']) && ($spotter_item['type']  == '50&#39; Performance Cruiser' || $spotter_item['type']  == '50\' Performance Cruiser' || $spotter_item['type'] == 'Sail')) {
374
+								if (isset($spotter_item['type']) && ($spotter_item['type'] == '50&#39; Performance Cruiser' || $spotter_item['type'] == '50\' Performance Cruiser' || $spotter_item['type'] == 'Sail')) {
375 375
 									if ($compress) $output .= '"as": "50perfcruiser.png",';
376 376
 									else $output .= '"aircraft_shadow": "50perfcruiser.png",';
377
-								} elseif (isset($spotter_item['type']) && $spotter_item['type']  == 'Sailaway Cruiser 38') {
377
+								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Sailaway Cruiser 38') {
378 378
 									if ($compress) $output .= '"as": "cruiser38.png",';
379 379
 									else $output .= '"aircraft_shadow": "cruiser38.png",';
380
-								} elseif (isset($spotter_item['type']) && $spotter_item['type']  == 'Mini Transat') {
380
+								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Mini Transat') {
381 381
 									if ($compress) $output .= '"as": "transat.png",';
382 382
 									else $output .= '"aircraft_shadow": "transat.png",';
383
-								} elseif (isset($spotter_item['type']) && $spotter_item['type']  == '52&#39; Cruising Cat') {
383
+								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == '52&#39; Cruising Cat') {
384 384
 									if ($compress) $output .= '"as": "catamaran.png",';
385 385
 									else $output .= '"aircraft_shadow": "catamaran.png",';
386
-								} elseif (isset($spotter_item['type']) && $spotter_item['type']  == 'Caribbean Rose') {
386
+								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Caribbean Rose') {
387 387
 									if ($compress) $output .= '"as": "carib.png",';
388 388
 									else $output .= '"aircraft_shadow": "carib.png",';
389 389
 								} else {
@@ -449,15 +449,15 @@  discard block
 block discarded – undo
449 449
 						if (isset($archivespeed) || $usenextlatlon) {
450 450
 							if (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
451 451
 								if (isset($spotter_item['arrival_airport_latitude'])) {
452
-									$cheading = $Common->getHeading($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['arrival_airport_latitude'],$spotter_item['arrival_airport_longitude']);
453
-									$idistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['arrival_airport_latitude'],$spotter_item['arrival_airport_longitude']);
452
+									$cheading = $Common->getHeading($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['arrival_airport_latitude'], $spotter_item['arrival_airport_longitude']);
453
+									$idistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['arrival_airport_latitude'], $spotter_item['arrival_airport_longitude']);
454 454
 									$farr_lat = $spotter_item['arrival_airport_latitude'];
455 455
 									$farr_lon = $spotter_item['arrival_airport_longitude'];
456 456
 								} else {
457 457
 									$aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']);
458 458
 									if (isset($aairport[0]['latitude'])) {
459
-										$cheading = $Common->getHeading($spotter_item['latitude'],$spotter_item['longitude'],$aairport[0]['latitude'],$aairport[0]['longitude']);
460
-										$idistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$aairport[0]['latitude'],$aairport[0]['longitude']);
459
+										$cheading = $Common->getHeading($spotter_item['latitude'], $spotter_item['longitude'], $aairport[0]['latitude'], $aairport[0]['longitude']);
460
+										$idistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $aairport[0]['latitude'], $aairport[0]['longitude']);
461 461
 										$farr_lat = $aairport[0]['latitude'];
462 462
 										$farr_lon = $aairport[0]['longitude'];
463 463
 									}
@@ -470,59 +470,59 @@  discard block
 block discarded – undo
470 470
 						if ($currenttime != '') {
471 471
 							if (strtotime($spotter_item['date']) < $currenttime) {
472 472
 								if (isset($archivespeed)) {
473
-									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
474
-									$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
473
+									$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh));
474
+									$fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']);
475 475
 									if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
476 476
 									else {
477
-										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
478
-										$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
477
+										$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, $archivespeed, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh));
478
+										$fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']);
479 479
 										if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
480 480
 										else {
481
-											$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed);
481
+											$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed);
482 482
 											$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
483 483
 										}
484 484
 									}
485 485
 								} elseif ($usenextlatlon) {
486
-									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
487
-									$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
486
+									$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, 1, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh));
487
+									$fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']);
488 488
 									if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
489 489
 									else {
490
-										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
491
-										$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
490
+										$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, 1, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh));
491
+										$fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']);
492 492
 										if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
493 493
 										else {
494
-											$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading);
494
+											$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading);
495 495
 											$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
496 496
 										}
497 497
 									}
498 498
 								}
499 499
 							} else {
500 500
 								if (isset($archivespeed)) {
501
-									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed);
501
+									$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed);
502 502
 									$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
503 503
 								} elseif ($usenextlatlon) {
504
-									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading);
504
+									$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading);
505 505
 									$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
506 506
 								}
507 507
 							}
508 508
 						} else {
509 509
 							if (isset($archivespeed)) {
510
-								$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed);
511
-								$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
510
+								$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed);
511
+								$fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']);
512 512
 								if (!isset($idistance) || $fdistance < $idistance) {
513 513
 									$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
514 514
 								} else {
515
-									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed);
515
+									$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, $archivespeed);
516 516
 									//$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
517 517
 									$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
518 518
 								}
519 519
 							} elseif ($usenextlatlon) {
520
-								$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading);
521
-								$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
520
+								$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading);
521
+								$fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']);
522 522
 								if (!isset($idistance) || $fdistance < $idistance) {
523 523
 										$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
524 524
 								} else {
525
-									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading);
525
+									$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading);
526 526
 									//$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
527 527
 									$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
528 528
 								}
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
 
532 532
 						if (!$min) $output .= '"image": "'.$image.'",';
533 533
 						if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') {
534
-							$output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",';
534
+							$output .= '"image_copyright": "'.str_replace('"', "'", trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $spotter_item['image_copyright']))).'",';
535 535
 						}
536 536
 						if (isset($spotter_item['image_source_website'])) {
537 537
 							$output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",';
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
 							$output .= '"waypoints": "'.$spotter_item['waypoints'].'",';
566 566
 						}
567 567
 						if (isset($spotter_item['acars'])) {
568
-							$output .= '"acars": "'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"), '<br />',$spotter_item['acars']['message'])).'",';
568
+							$output .= '"acars": "'.trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '<br />', $spotter_item['acars']['message'])).'",';
569 569
 						}
570 570
 						// type when not aircraft ?
571 571
 						if (isset($spotter_item['type'])) {
@@ -585,12 +585,12 @@  discard block
 block discarded – undo
585 585
 								if ($currenttime != '') {
586 586
 									if (strtotime($spotter_item['date']) < $currenttime) {
587 587
 										if (!isset($archivespeed)) $archivespeed = 1;
588
-										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date'])));
589
-										$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
588
+										$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed, ($currenttime - strtotime($spotter_item['date'])));
589
+										$fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']);
590 590
 										if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
591 591
 										else {
592
-											$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date'])));
593
-											$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
592
+											$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, $archivespeed, ($currenttime - strtotime($spotter_item['date'])));
593
+											$fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']);
594 594
 											if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
595 595
 											else {
596 596
 												$output .= $spotter_item['longitude'].', ';
@@ -669,7 +669,7 @@  discard block
 block discarded – undo
669 669
                 
670 670
 			}
671 671
 */
672
-				$history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING);
672
+				$history = filter_input(INPUT_GET, 'history', FILTER_SANITIZE_STRING);
673 673
 				if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history'];
674 674
 				
675 675
 				if (
@@ -677,11 +677,11 @@  discard block
 block discarded – undo
677 677
 				    || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory)
678 678
 				//    || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id']))
679 679
 				//    || (isset($history) && $history != '' && $history != 'NA' && $history == $spotter_item['ident'])
680
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
680
+				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id']))
681 681
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])
682
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id']))
682
+				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['fammarine_id']))
683 683
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id'])
684
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid']))
684
+				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['famtrackid']))
685 685
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid'])
686 686
 				    ) {
687 687
 					if ($tracker) {
@@ -710,9 +710,9 @@  discard block
 block discarded – undo
710 710
 							require(dirname(__FILE__).'/require/class.MapMatching.php');
711 711
 							$MapMatching = new MapMatching();
712 712
 							if (isset($spotter_item['date_iso_8601'])) {
713
-								$spotter_history_array_mm = array_merge($spotter_history_array,array(array('latitude' => $spotter_item['latitude'],'longitude' => $spotter_item['longitude'],'date' => date('c',strtotime($spotter_item['date_iso_8601'])))));
713
+								$spotter_history_array_mm = array_merge($spotter_history_array, array(array('latitude' => $spotter_item['latitude'], 'longitude' => $spotter_item['longitude'], 'date' => date('c', strtotime($spotter_item['date_iso_8601'])))));
714 714
 							} else {
715
-								$spotter_history_array_mm = array_merge($spotter_history_array,array(array('latitude' => $spotter_item['latitude'],'longitude' => $spotter_item['longitude'],'date' => date('c',strtotime($spotter_item['date'])))));
715
+								$spotter_history_array_mm = array_merge($spotter_history_array, array(array('latitude' => $spotter_item['latitude'], 'longitude' => $spotter_item['longitude'], 'date' => date('c', strtotime($spotter_item['date'])))));
716 716
 							}
717 717
 							$spotter_history_array = $MapMatching->match($spotter_history_array_mm);
718 718
 						}
@@ -744,9 +744,9 @@  discard block
 block discarded – undo
744 744
 								else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
745 745
 							}
746 746
 							$output_history .= '[';
747
-							$output_history .=  $spotter_history['longitude'].', ';
748
-							$output_history .=  $spotter_history['latitude'].', ';
749
-							$output_history .=  $spotter_history['altitude']*30.48;
747
+							$output_history .= $spotter_history['longitude'].', ';
748
+							$output_history .= $spotter_history['latitude'].', ';
749
+							$output_history .= $spotter_history['altitude']*30.48;
750 750
 							$output_history .= '],';
751 751
 							/*
752 752
 							if ($from_archive === false) {
@@ -769,8 +769,8 @@  discard block
 block discarded – undo
769 769
 								$d = true;
770 770
 							}
771 771
 							$output_history .= '[';
772
-							$output_history .=  $spotter_history['longitude'].', ';
773
-							$output_history .=  $spotter_history['latitude'];
772
+							$output_history .= $spotter_history['longitude'].', ';
773
+							$output_history .= $spotter_history['latitude'];
774 774
 							$output_history .= '],';
775 775
 							/*
776 776
 							if ($from_archive === false) {
@@ -786,9 +786,9 @@  discard block
 block discarded – undo
786 786
 						//echo $output_history;
787 787
 						if ($from_archive === false && !isset($spotter_history_array[0]['mapmatching_engine'])) {
788 788
 							$output_historyd = '[';
789
-							$output_historyd .=  $spotter_item['longitude'].', ';
790
-							$output_historyd .=  $spotter_item['latitude'];
791
-							if (isset($spotter_history['altitude'])) $output_historyd .=  ','.$spotter_item['altitude']*30.48;
789
+							$output_historyd .= $spotter_item['longitude'].', ';
790
+							$output_historyd .= $spotter_item['latitude'];
791
+							if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48;
792 792
 							$output_historyd .= '],';
793 793
 							//$output_history = $output_historyd.$output_history;
794 794
 							$output_history = $output_history.$output_historyd;
@@ -796,7 +796,7 @@  discard block
 block discarded – undo
796 796
 							$last = array_pop($spotter_history_array);
797 797
 							$latitude = $last['latitude'];
798 798
 							$longitude = $last['longitude'];
799
-							$output = str_replace('"coordinates": ['.$spotter_item['longitude'].', '.$spotter_item['latitude'].']}','"coordinates": ['.$longitude.', '.$latitude.']}',$output);
799
+							$output = str_replace('"coordinates": ['.$spotter_item['longitude'].', '.$spotter_item['latitude'].']}', '"coordinates": ['.$longitude.', '.$latitude.']}', $output);
800 800
 						}
801 801
 						
802 802
 						$output_history  = substr($output_history, 0, -1);
@@ -808,7 +808,7 @@  discard block
 block discarded – undo
808 808
 					
809 809
 				}
810 810
 				
811
-				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
811
+				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id']))
812 812
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
813 813
 				     && (isset($spotter_item['departure_airport']) 
814 814
 				        && $spotter_item['departure_airport'] != 'NA' 
@@ -842,7 +842,7 @@  discard block
 block discarded – undo
842 842
 
843 843
 				//if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA' && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) {
844 844
 				//if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) {
845
-				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
845
+				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id']))
846 846
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
847 847
 				     && (isset($spotter_item['arrival_airport']) 
848 848
 				        && $spotter_item['arrival_airport'] != 'NA' 
@@ -869,11 +869,11 @@  discard block
 block discarded – undo
869 869
 					}
870 870
 				    }
871 871
 				    if ($havedata) {
872
-					$line = $Common->greatCircle($spotter_item['latitude'],$spotter_item['longitude'],$end_lat,$end_lon);
872
+					$line = $Common->greatCircle($spotter_item['latitude'], $spotter_item['longitude'], $end_lat, $end_lon);
873 873
 					foreach ($line[0] as $coord) {
874 874
 						$output_dest .= '['.$coord[0].','.$coord[1].'],';
875 875
 					}
876
-					$output_dest  = substr($output_dest, 0, -1);
876
+					$output_dest = substr($output_dest, 0, -1);
877 877
 				    }
878 878
 				    $output_dest .= ']}},';
879 879
 				    if ($havedata) $output .= $output_dest;
@@ -883,7 +883,7 @@  discard block
 block discarded – undo
883 883
 			$output  = substr($output, 0, -1);
884 884
 			$output .= ']';
885 885
 			$output .= ',"initial_sqltime": "'.$sqltime.'",';
886
-			$output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",';
886
+			$output .= '"totaltime": "'.round(microtime(true) - $begintime, 2).'",';
887 887
 			if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
888 888
 			$output .= '"fc": "'.$j.'"';
889 889
 		} else {
Please login to merge, or discard this patch.
Braces   +364 added lines, -147 removed lines patch added patch discarded remove patch
@@ -12,7 +12,9 @@  discard block
 block discarded – undo
12 12
 $tracker = false;
13 13
 $marine = false;
14 14
 $usecoord = false;
15
-if (isset($_GET['test'])) exit();
15
+if (isset($_GET['test'])) {
16
+	exit();
17
+}
16 18
 if (isset($_GET['tracker'])) {
17 19
     $tracker = true;
18 20
 }
@@ -57,30 +59,61 @@  discard block
 block discarded – undo
57 59
 }
58 60
 header('Content-Type: text/javascript');
59 61
 
60
-if (!isset($globalJsonCompress)) $compress = true;
61
-else $compress = $globalJsonCompress;
62
+if (!isset($globalJsonCompress)) {
63
+	$compress = true;
64
+} else {
65
+	$compress = $globalJsonCompress;
66
+}
62 67
 
63 68
 $from_archive = false;
64 69
 $min = true;
65 70
 $allhistory = false;
66 71
 $filter['source'] = array();
67
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
68
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
69
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
70
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
71
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
72
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
73
-if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
74
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
75
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
76
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
77
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
78
-if (isset($_COOKIE['filter_race']) && $_COOKIE['filter_race'] != 'all') $filter['race'] = filter_var($_COOKIE['filter_race'],FILTER_SANITIZE_NUMBER_INT);
79
-if (isset($_COOKIE['filter_blocked']) && $_COOKIE['filter_blocked'] == 'true') $filter['blocked'] = true;
72
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') {
73
+	$filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
74
+}
75
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') {
76
+	$filter['source'] = array_merge($filter['source'],array('whazzup'));
77
+}
78
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') {
79
+	$filter['source'] = array_merge($filter['source'],array('phpvmacars'));
80
+}
81
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') {
82
+	$filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
83
+}
84
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') {
85
+	$filter['source'] = array_merge($filter['source'],array('aprs'));
86
+}
87
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') {
88
+	$filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
89
+}
90
+if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') {
91
+	$filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
92
+}
93
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') {
94
+	$filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
95
+}
96
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') {
97
+	$filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
98
+}
99
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') {
100
+	$filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
101
+}
102
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') {
103
+	$filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
104
+}
105
+if (isset($_COOKIE['filter_race']) && $_COOKIE['filter_race'] != 'all') {
106
+	$filter['race'] = filter_var($_COOKIE['filter_race'],FILTER_SANITIZE_NUMBER_INT);
107
+}
108
+if (isset($_COOKIE['filter_blocked']) && $_COOKIE['filter_blocked'] == 'true') {
109
+	$filter['blocked'] = true;
110
+}
80 111
 
81 112
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
82 113
 	$min = true;
83
-} else $min = false;
114
+} else {
115
+	$min = false;
116
+}
84 117
 
85 118
 $spotter_array = array();
86 119
 
@@ -191,24 +224,38 @@  discard block
 block discarded – undo
191 224
 			$flightcnt = $SpotterLive->getLiveSpotterCount($filter);
192 225
 		}
193 226
 	}
194
-	if ($flightcnt == '') $flightcnt = 0;
195
-} else $flightcnt = 0;
227
+	if ($flightcnt == '') {
228
+		$flightcnt = 0;
229
+	}
230
+	} else {
231
+	$flightcnt = 0;
232
+}
196 233
 
197 234
 $sqltime = round(microtime(true)-$begintime,2);
198 235
 
199 236
 $currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
200
-if ($currenttime != '') $currenttime = round($currenttime/1000);
237
+if ($currenttime != '') {
238
+	$currenttime = round($currenttime/1000);
239
+}
201 240
 
202
-if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false;
203
-else $usenextlatlon = true;
204
-if ($usenextlatlon === false) $currenttime = '';
241
+if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) {
242
+	$usenextlatlon = false;
243
+} else {
244
+	$usenextlatlon = true;
245
+}
246
+if ($usenextlatlon === false) {
247
+	$currenttime = '';
248
+}
205 249
 $j = 0;
206 250
 $prev_flightaware_id = '';
207 251
 $aircrafts_shadow = array();
208 252
 $output = '{';
209 253
 	$output .= '"type": "FeatureCollection",';
210
-		if ($min) $output .= '"minimal": "true",';
211
-		else $output .= '"minimal": "false",';
254
+		if ($min) {
255
+			$output .= '"minimal": "true",';
256
+		} else {
257
+			$output .= '"minimal": "false",';
258
+		}
212 259
 		//$output .= '"fc": "'.$flightcnt.'",';
213 260
 		$output .= '"sqt": "'.$sqltime.'",';
214 261
 
@@ -253,18 +300,29 @@  discard block
 block discarded – undo
253 300
 						}
254 301
 						$output .= '"properties": {';
255 302
 						if (isset($spotter_item['flightaware_id'])) {
256
-							if ($compress) $output .= '"fi": "'.$spotter_item['flightaware_id'].'",';
257
-							else $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",';
303
+							if ($compress) {
304
+								$output .= '"fi": "'.$spotter_item['flightaware_id'].'",';
305
+							} else {
306
+								$output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",';
307
+							}
258 308
 						} elseif (isset($spotter_item['famtrackid'])) {
259
-							if ($compress) $output .= '"fti": "'.$spotter_item['famtrackid'].'",';
260
-							else $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",';
309
+							if ($compress) {
310
+								$output .= '"fti": "'.$spotter_item['famtrackid'].'",';
311
+							} else {
312
+								$output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",';
313
+							}
261 314
 						} elseif (isset($spotter_item['fammarine_id'])) {
262
-							if ($compress) $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",';
263
-							else $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",';
315
+							if ($compress) {
316
+								$output .= '"fmi": "'.$spotter_item['fammarine_id'].'",';
317
+							} else {
318
+								$output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",';
319
+							}
264 320
 						}
265 321
 						$output .= '"fc": "'.$flightcnt.'",';
266 322
 						$output .= '"sqt": "'.$sqltime.'",';
267
-						if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
323
+						if (isset($begindate)) {
324
+							$output .= '"archive_date": "'.$begindate.'",';
325
+						}
268 326
 
269 327
 /*
270 328
 							if ($min) $output .= '"minimal": "true",';
@@ -272,16 +330,25 @@  discard block
 block discarded – undo
272 330
 */
273 331
 							//$output .= '"fc": "'.$spotter_item['nb'].'",';
274 332
 						if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') {
275
-							if ($compress) $output .= '"c": '.json_encode(str_replace('\\','',$spotter_item['ident'])).',';
276
-							else $output .= '"callsign": '.json_encode(str_replace('\\','',$spotter_item['ident'])).',';
333
+							if ($compress) {
334
+								$output .= '"c": '.json_encode(str_replace('\\','',$spotter_item['ident'])).',';
335
+							} else {
336
+								$output .= '"callsign": '.json_encode(str_replace('\\','',$spotter_item['ident'])).',';
337
+							}
277 338
 							//'
278 339
 						} else {
279
-							if ($compress) $output .= '"c": "NA",';
280
-							else $output .= '"callsign": "NA",';
340
+							if ($compress) {
341
+								$output .= '"c": "NA",';
342
+							} else {
343
+								$output .= '"callsign": "NA",';
344
+							}
281 345
 						}
282 346
 						if (isset($spotter_item['registration'])) {
283
-							if ($compress) $output .= '"reg": '.json_encode($spotter_item['registration']).',';
284
-							else $output .= '"registration": '.json_encode($spotter_item['registration']).',';
347
+							if ($compress) {
348
+								$output .= '"reg": '.json_encode($spotter_item['registration']).',';
349
+							} else {
350
+								$output .= '"registration": '.json_encode($spotter_item['registration']).',';
351
+							}
285 352
 						}
286 353
 						if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) {
287 354
 							$output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",';
@@ -292,20 +359,30 @@  discard block
 block discarded – undo
292 359
 							$output .= '"aircraft_name": "NA",';
293 360
 						}
294 361
 						if (isset($spotter_item['aircraft_icao'])) {
295
-							if ($compress) $output .= '"ai": "'.$spotter_item['aircraft_icao'].'",';
296
-							else $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
362
+							if ($compress) {
363
+								$output .= '"ai": "'.$spotter_item['aircraft_icao'].'",';
364
+							} else {
365
+								$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
366
+							}
297 367
 						}
298 368
 						if (!isset($spotter_item['aircraft_shadow']) && !$tracker && !$marine) {
299
-							if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = '';
300
-							else {
369
+							if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') {
370
+								$spotter_item['aircraft_shadow'] = '';
371
+							} else {
301 372
 								$aircraft_icao = $spotter_item['aircraft_icao'];
302
-								if (isset($aircrafts_shadow[$aircraft_icao])) $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao];
303
-								else {
373
+								if (isset($aircrafts_shadow[$aircraft_icao])) {
374
+									$spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao];
375
+								} else {
304 376
 									$aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']);
305
-									if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
306
-									elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png';
307
-									elseif ($aircraft_icao == 'PARAGLIDER') $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png';
308
-									else $spotter_item['aircraft_shadow'] = '';
377
+									if (count($aircraft_info) > 0) {
378
+										$spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
379
+									} elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') {
380
+										$spotter_item['aircraft_shadow'] = 'PA18.png';
381
+									} elseif ($aircraft_icao == 'PARAGLIDER') {
382
+										$spotter_item['aircraft_shadow'] = 'PARAGLIDER.png';
383
+									} else {
384
+										$spotter_item['aircraft_shadow'] = '';
385
+									}
309 386
 									$aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow'];
310 387
 								}
311 388
 							}
@@ -313,90 +390,171 @@  discard block
 block discarded – undo
313 390
 						if (!isset($spotter_item['aircraft_shadow']) || $spotter_item['aircraft_shadow'] == '') {
314 391
 							if ($tracker) {
315 392
 								if (isset($spotter_item['type']) && $spotter_item['type'] == 'Ambulance') {
316
-									if ($compress) $output .= '"as": "ambulance.png",';
317
-									else $output .= '"aircraft_shadow": "ambulance.png",';
393
+									if ($compress) {
394
+										$output .= '"as": "ambulance.png",';
395
+									} else {
396
+										$output .= '"aircraft_shadow": "ambulance.png",';
397
+									}
318 398
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') {
319
-									if ($compress) $output .= '"as": "police.png",';
320
-									else $output .= '"aircraft_shadow": "police.png",';
399
+									if ($compress) {
400
+										$output .= '"as": "police.png",';
401
+									} else {
402
+										$output .= '"aircraft_shadow": "police.png",';
403
+									}
321 404
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') {
322
-									if ($compress) $output .= '"as": "ship.png",';
323
-									else $output .= '"aircraft_shadow": "ship.png",';
405
+									if ($compress) {
406
+										$output .= '"as": "ship.png",';
407
+									} else {
408
+										$output .= '"aircraft_shadow": "ship.png",';
409
+									}
324 410
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') {
325
-									if ($compress) $output .= '"as": "ship.png",';
326
-									else $output .= '"aircraft_shadow": "ship.png",';
411
+									if ($compress) {
412
+										$output .= '"as": "ship.png",';
413
+									} else {
414
+										$output .= '"aircraft_shadow": "ship.png",';
415
+									}
327 416
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') {
328
-									if ($compress) $output .= '"as": "ship.png",';
329
-									else $output .= '"aircraft_shadow": "ship.png",';
417
+									if ($compress) {
418
+										$output .= '"as": "ship.png",';
419
+									} else {
420
+										$output .= '"aircraft_shadow": "ship.png",';
421
+									}
330 422
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') {
331
-									if ($compress) $output .= '"as": "truck.png",';
332
-									else $output .= '"aircraft_shadow": "truck.png",';
423
+									if ($compress) {
424
+										$output .= '"as": "truck.png",';
425
+									} else {
426
+										$output .= '"aircraft_shadow": "truck.png",';
427
+									}
333 428
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') {
334
-									if ($compress) $output .= '"as": "truck.png",';
335
-									else $output .= '"aircraft_shadow": "truck.png",';
429
+									if ($compress) {
430
+										$output .= '"as": "truck.png",';
431
+									} else {
432
+										$output .= '"aircraft_shadow": "truck.png",';
433
+									}
336 434
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') {
337
-									if ($compress) $output .= '"as": "aircraft.png",';
338
-									else $output .= '"aircraft_shadow": "aircraft.png",';
435
+									if ($compress) {
436
+										$output .= '"as": "aircraft.png",';
437
+									} else {
438
+										$output .= '"aircraft_shadow": "aircraft.png",';
439
+									}
339 440
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') {
340
-									if ($compress) $output .= '"as": "aircraft.png",';
341
-									else $output .= '"aircraft_shadow": "aircraft.png",';
441
+									if ($compress) {
442
+										$output .= '"as": "aircraft.png",';
443
+									} else {
444
+										$output .= '"aircraft_shadow": "aircraft.png",';
445
+									}
342 446
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') {
343
-									if ($compress) $output .= '"as": "helico.png",';
344
-									else $output .= '"aircraft_shadow": "helico.png",';
447
+									if ($compress) {
448
+										$output .= '"as": "helico.png",';
449
+									} else {
450
+										$output .= '"aircraft_shadow": "helico.png",';
451
+									}
345 452
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') {
346
-									if ($compress) $output .= '"as": "rail.png",';
347
-									else $output .= '"aircraft_shadow": "rail.png",';
453
+									if ($compress) {
454
+										$output .= '"as": "rail.png",';
455
+									} else {
456
+										$output .= '"aircraft_shadow": "rail.png",';
457
+									}
348 458
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') {
349
-									if ($compress) $output .= '"as": "firetruck.png",';
350
-									else $output .= '"aircraft_shadow": "firetruck.png",';
459
+									if ($compress) {
460
+										$output .= '"as": "firetruck.png",';
461
+									} else {
462
+										$output .= '"aircraft_shadow": "firetruck.png",';
463
+									}
351 464
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') {
352
-									if ($compress) $output .= '"as": "bus.png",';
353
-									else $output .= '"aircraft_shadow": "bus.png",';
465
+									if ($compress) {
466
+										$output .= '"as": "bus.png",';
467
+									} else {
468
+										$output .= '"aircraft_shadow": "bus.png",';
469
+									}
354 470
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') {
355
-									if ($compress) $output .= '"as": "phone.png",';
356
-									else $output .= '"aircraft_shadow": "phone.png",';
471
+									if ($compress) {
472
+										$output .= '"as": "phone.png",';
473
+									} else {
474
+										$output .= '"aircraft_shadow": "phone.png",';
475
+									}
357 476
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') {
358
-									if ($compress) $output .= '"as": "jogger.png",';
359
-									else $output .= '"aircraft_shadow": "jogger.png",';
477
+									if ($compress) {
478
+										$output .= '"as": "jogger.png",';
479
+									} else {
480
+										$output .= '"aircraft_shadow": "jogger.png",';
481
+									}
360 482
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') {
361
-									if ($compress) $output .= '"as": "bike.png",';
362
-									else $output .= '"aircraft_shadow": "bike.png",';
483
+									if ($compress) {
484
+										$output .= '"as": "bike.png",';
485
+									} else {
486
+										$output .= '"aircraft_shadow": "bike.png",';
487
+									}
363 488
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') {
364
-									if ($compress) $output .= '"as": "motorcycle.png",';
365
-									else $output .= '"aircraft_shadow": "motorcycle.png",';
489
+									if ($compress) {
490
+										$output .= '"as": "motorcycle.png",';
491
+									} else {
492
+										$output .= '"aircraft_shadow": "motorcycle.png",';
493
+									}
366 494
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') {
367
-									if ($compress) $output .= '"as": "balloon.png",';
368
-									else $output .= '"aircraft_shadow": "balloon.png",';
495
+									if ($compress) {
496
+										$output .= '"as": "balloon.png",';
497
+									} else {
498
+										$output .= '"aircraft_shadow": "balloon.png",';
499
+									}
369 500
 								} else {
370
-									if ($compress) $output .= '"as": "car.png",';
371
-									else $output .= '"aircraft_shadow": "car.png",';
501
+									if ($compress) {
502
+										$output .= '"as": "car.png",';
503
+									} else {
504
+										$output .= '"aircraft_shadow": "car.png",';
505
+									}
372 506
 								}
373 507
 							} elseif ($marine) {
374 508
 								if (isset($spotter_item['type']) && ($spotter_item['type']  == '50&#39; Performance Cruiser' || $spotter_item['type']  == '50\' Performance Cruiser' || $spotter_item['type'] == 'Sail')) {
375
-									if ($compress) $output .= '"as": "50perfcruiser.png",';
376
-									else $output .= '"aircraft_shadow": "50perfcruiser.png",';
509
+									if ($compress) {
510
+										$output .= '"as": "50perfcruiser.png",';
511
+									} else {
512
+										$output .= '"aircraft_shadow": "50perfcruiser.png",';
513
+									}
377 514
 								} elseif (isset($spotter_item['type']) && $spotter_item['type']  == 'Sailaway Cruiser 38') {
378
-									if ($compress) $output .= '"as": "cruiser38.png",';
379
-									else $output .= '"aircraft_shadow": "cruiser38.png",';
515
+									if ($compress) {
516
+										$output .= '"as": "cruiser38.png",';
517
+									} else {
518
+										$output .= '"aircraft_shadow": "cruiser38.png",';
519
+									}
380 520
 								} elseif (isset($spotter_item['type']) && $spotter_item['type']  == 'Mini Transat') {
381
-									if ($compress) $output .= '"as": "transat.png",';
382
-									else $output .= '"aircraft_shadow": "transat.png",';
521
+									if ($compress) {
522
+										$output .= '"as": "transat.png",';
523
+									} else {
524
+										$output .= '"aircraft_shadow": "transat.png",';
525
+									}
383 526
 								} elseif (isset($spotter_item['type']) && $spotter_item['type']  == '52&#39; Cruising Cat') {
384
-									if ($compress) $output .= '"as": "catamaran.png",';
385
-									else $output .= '"aircraft_shadow": "catamaran.png",';
527
+									if ($compress) {
528
+										$output .= '"as": "catamaran.png",';
529
+									} else {
530
+										$output .= '"aircraft_shadow": "catamaran.png",';
531
+									}
386 532
 								} elseif (isset($spotter_item['type']) && $spotter_item['type']  == 'Caribbean Rose') {
387
-									if ($compress) $output .= '"as": "carib.png",';
388
-									else $output .= '"aircraft_shadow": "carib.png",';
533
+									if ($compress) {
534
+										$output .= '"as": "carib.png",';
535
+									} else {
536
+										$output .= '"aircraft_shadow": "carib.png",';
537
+									}
389 538
 								} else {
390
-									if ($compress) $output .= '"as": "ship.png",';
391
-									else $output .= '"aircraft_shadow": "ship.png",';
539
+									if ($compress) {
540
+										$output .= '"as": "ship.png",';
541
+									} else {
542
+										$output .= '"aircraft_shadow": "ship.png",';
543
+									}
392 544
 								}
393 545
 							} else {
394
-								if ($compress) $output .= '"as": "default.png",';
395
-								else $output .= '"aircraft_shadow": "default.png",';
546
+								if ($compress) {
547
+									$output .= '"as": "default.png",';
548
+								} else {
549
+									$output .= '"aircraft_shadow": "default.png",';
550
+								}
396 551
 							}
397 552
 						} else {
398
-							if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
399
-							else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
553
+							if ($compress) {
554
+								$output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
555
+							} else {
556
+								$output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
557
+							}
400 558
 						}
401 559
 						if (isset($spotter_item['airline_name'])) {
402 560
 							$output .= '"airline_name": "'.$spotter_item['airline_name'].'",';
@@ -404,8 +562,11 @@  discard block
 block discarded – undo
404 562
 							$output .= '"airline_name": "NA",';
405 563
 						}
406 564
 						if (isset($spotter_item['departure_airport'])) {
407
-							if ($compress) $output .= '"dac": "'.$spotter_item['departure_airport'].'",';
408
-							else $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",';
565
+							if ($compress) {
566
+								$output .= '"dac": "'.$spotter_item['departure_airport'].'",';
567
+							} else {
568
+								$output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",';
569
+							}
409 570
 						}
410 571
 						if (isset($spotter_item['departure_airport_city'])) {
411 572
 							$output .= '"departure_airport": "'.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_country'].'",';
@@ -417,8 +578,11 @@  discard block
 block discarded – undo
417 578
 							$output .= '"arrival_airport_time": "'.$spotter_item['arrival_airport_time'].'",';
418 579
 						}
419 580
 						if (isset($spotter_item['arrival_airport'])) {
420
-							if ($compress) $output .= '"aac": "'.$spotter_item['arrival_airport'].'",';
421
-							else $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",';
581
+							if ($compress) {
582
+								$output .= '"aac": "'.$spotter_item['arrival_airport'].'",';
583
+							} else {
584
+								$output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",';
585
+							}
422 586
 						}
423 587
 						if (isset($spotter_item['arrival_airport_city'])) {
424 588
 							$output .= '"arrival_airport": "'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].'",';
@@ -437,11 +601,17 @@  discard block
 block discarded – undo
437 601
 						}
438 602
 						
439 603
 						if (isset($spotter_item['real_altitude'])) {
440
-							if ($compress) $output .= '"a": "'.($spotter_item['real_altitude']/100).'",';
441
-							else $output .= '"altitude": "'.($spotter_item['real_altitude']/100).'",';
604
+							if ($compress) {
605
+								$output .= '"a": "'.($spotter_item['real_altitude']/100).'",';
606
+							} else {
607
+								$output .= '"altitude": "'.($spotter_item['real_altitude']/100).'",';
608
+							}
442 609
 						} elseif (isset($spotter_item['altitude'])) {
443
-							if ($compress) $output .= '"a": "'.$spotter_item['altitude'].'",';
444
-							else $output .= '"altitude": "'.$spotter_item['altitude'].'",';
610
+							if ($compress) {
611
+								$output .= '"a": "'.$spotter_item['altitude'].'",';
612
+							} else {
613
+								$output .= '"altitude": "'.$spotter_item['altitude'].'",';
614
+							}
445 615
 						}
446 616
 						
447 617
 						$heading = $spotter_item['heading'];
@@ -465,19 +635,24 @@  discard block
 block discarded – undo
465 635
 							}
466 636
 						}
467 637
 						
468
-						if ($compress)$output .= '"h": "'.$heading.'",';
469
-						else $output .= '"heading": "'.$heading.'",';
638
+						if ($compress) {
639
+							$output .= '"h": "'.$heading.'",';
640
+						} else {
641
+							$output .= '"heading": "'.$heading.'",';
642
+						}
470 643
 						if ($currenttime != '') {
471 644
 							if (strtotime($spotter_item['date']) < $currenttime) {
472 645
 								if (isset($archivespeed)) {
473 646
 									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
474 647
 									$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
475
-									if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
476
-									else {
648
+									if (!isset($idistance) || $fdistance < $idistance) {
649
+										$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
650
+									} else {
477 651
 										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
478 652
 										$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
479
-										if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
480
-										else {
653
+										if (!isset($idistance) || $fdistance < $idistance) {
654
+											$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
655
+										} else {
481 656
 											$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed);
482 657
 											$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
483 658
 										}
@@ -485,12 +660,14 @@  discard block
 block discarded – undo
485 660
 								} elseif ($usenextlatlon) {
486 661
 									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
487 662
 									$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
488
-									if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
489
-									else {
663
+									if (!isset($idistance) || $fdistance < $idistance) {
664
+										$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
665
+									} else {
490 666
 										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
491 667
 										$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
492
-										if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
493
-										else {
668
+										if (!isset($idistance) || $fdistance < $idistance) {
669
+											$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
670
+										} else {
494 671
 											$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading);
495 672
 											$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
496 673
 										}
@@ -529,7 +706,9 @@  discard block
 block discarded – undo
529 706
 							}
530 707
 						}
531 708
 
532
-						if (!$min) $output .= '"image": "'.$image.'",';
709
+						if (!$min) {
710
+							$output .= '"image": "'.$image.'",';
711
+						}
533 712
 						if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') {
534 713
 							$output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",';
535 714
 						}
@@ -537,8 +716,11 @@  discard block
 block discarded – undo
537 716
 							$output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",';
538 717
 						}
539 718
 						if (isset($spotter_item['squawk'])) {
540
-							if ($compress) $output .= '"sq": "'.$spotter_item['squawk'].'",';
541
-							else $output .= '"squawk": "'.$spotter_item['squawk'].'",';
719
+							if ($compress) {
720
+								$output .= '"sq": "'.$spotter_item['squawk'].'",';
721
+							} else {
722
+								$output .= '"squawk": "'.$spotter_item['squawk'].'",';
723
+							}
542 724
 						}
543 725
 						if (isset($spotter_item['squawk_usage'])) {
544 726
 							$output .= '"squawk_usage": "'.$spotter_item['squawk_usage'].'",';
@@ -569,14 +751,23 @@  discard block
 block discarded – undo
569 751
 						}
570 752
 						// type when not aircraft ?
571 753
 						if (isset($spotter_item['type'])) {
572
-							if ($compress) $output .= '"t": "'.$spotter_item['type'].'"';
573
-							else $output .= '"type": "'.$spotter_item['type'].'"';
754
+							if ($compress) {
755
+								$output .= '"t": "'.$spotter_item['type'].'"';
756
+							} else {
757
+								$output .= '"type": "'.$spotter_item['type'].'"';
758
+							}
574 759
 						} elseif ($marine) {
575
-							if ($compress) $output .= '"t": "ship"';
576
-							else $output .= '"type": "ship"';
760
+							if ($compress) {
761
+								$output .= '"t": "ship"';
762
+							} else {
763
+								$output .= '"type": "ship"';
764
+							}
577 765
 						} else {
578
-							if ($compress) $output .= '"t": "aircraft"';
579
-							else $output .= '"type": "aircraft"';
766
+							if ($compress) {
767
+								$output .= '"t": "aircraft"';
768
+							} else {
769
+								$output .= '"type": "aircraft"';
770
+							}
580 771
 						}
581 772
 						$output .= '},';
582 773
 						$output .= '"geometry": {';
@@ -584,15 +775,19 @@  discard block
 block discarded – undo
584 775
 								$output .= '"coordinates": [';
585 776
 								if ($currenttime != '') {
586 777
 									if (strtotime($spotter_item['date']) < $currenttime) {
587
-										if (!isset($archivespeed)) $archivespeed = 1;
778
+										if (!isset($archivespeed)) {
779
+											$archivespeed = 1;
780
+										}
588 781
 										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date'])));
589 782
 										$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
590
-										if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
591
-										else {
783
+										if (!isset($idistance) || $fdistance < $idistance) {
784
+											$output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
785
+										} else {
592 786
 											$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date'])));
593 787
 											$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
594
-											if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
595
-											else {
788
+											if (!isset($idistance) || $fdistance < $idistance) {
789
+												$output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
790
+											} else {
596 791
 												$output .= $spotter_item['longitude'].', ';
597 792
 												$output .= $spotter_item['latitude'];
598 793
 											}
@@ -670,7 +865,9 @@  discard block
 block discarded – undo
670 865
 			}
671 866
 */
672 867
 				$history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING);
673
-				if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history'];
868
+				if ($history == '' && isset($_COOKIE['history'])) {
869
+					$history = $_COOKIE['history'];
870
+				}
674 871
 				
675 872
 				if (
676 873
 				    (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') 
@@ -740,8 +937,11 @@  discard block
 block discarded – undo
740 937
 									$output_history .= ']}},';
741 938
 									$output .= $output_history;
742 939
 								}
743
-								if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
744
-								else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
940
+								if ($compress) {
941
+									$output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
942
+								} else {
943
+									$output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
944
+								}
745 945
 							}
746 946
 							$output_history .= '[';
747 947
 							$output_history .=  $spotter_history['longitude'].', ';
@@ -762,10 +962,15 @@  discard block
 block discarded – undo
762 962
 							if ($d == false) {
763 963
 								if ($compress) {
764 964
 									$output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'",';
765
-									if (isset($spotter_history_array[0]['mapmatching_engine']) && $spotter_history_array[0]['mapmatching_engine'] == 'graphhopper') $output_history .= '"atr": "Powered by <a href=\"https://www.graphhopper.com/\">GraphHopper API</a>", Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",';
766
-									elseif (isset($spotter_history_array[0]['mapmatching_engine'])) $output_history .= '"atr": "Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",';
965
+									if (isset($spotter_history_array[0]['mapmatching_engine']) && $spotter_history_array[0]['mapmatching_engine'] == 'graphhopper') {
966
+										$output_history .= '"atr": "Powered by <a href=\"https://www.graphhopper.com/\">GraphHopper API</a>", Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",';
967
+									} elseif (isset($spotter_history_array[0]['mapmatching_engine'])) {
968
+										$output_history .= '"atr": "Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",';
969
+									}
767 970
 									$output_history .= '"t": "history"},"geometry": {"type": "LineString","coordinates": [';
768
-								} else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": [';
971
+								} else {
972
+									$output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": [';
973
+								}
769 974
 								$d = true;
770 975
 							}
771 976
 							$output_history .= '[';
@@ -788,7 +993,9 @@  discard block
 block discarded – undo
788 993
 							$output_historyd = '[';
789 994
 							$output_historyd .=  $spotter_item['longitude'].', ';
790 995
 							$output_historyd .=  $spotter_item['latitude'];
791
-							if (isset($spotter_history['altitude'])) $output_historyd .=  ','.$spotter_item['altitude']*30.48;
996
+							if (isset($spotter_history['altitude'])) {
997
+								$output_historyd .=  ','.$spotter_item['altitude']*30.48;
998
+							}
792 999
 							$output_historyd .= '],';
793 1000
 							//$output_history = $output_historyd.$output_history;
794 1001
 							$output_history = $output_history.$output_historyd;
@@ -816,8 +1023,11 @@  discard block
 block discarded – undo
816 1023
 				        && $spotter_item['arrival_airport'] != 'NA' 
817 1024
 				        && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") 
818 1025
 				    	    || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) {
819
-				    if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
820
-				    else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
1026
+				    if ($compress) {
1027
+				    	$output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
1028
+				    } else {
1029
+				    	$output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
1030
+				    }
821 1031
 				    if (isset($spotter_item['departure_airport_latitude'])) {
822 1032
 					$output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],';
823 1033
 				    } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') {
@@ -850,8 +1060,11 @@  discard block
 block discarded – undo
850 1060
 				    	    || (!isset($_COOKIE['MapRemainingRoute']) && (!isset($globalMapRemainingRoute) 
851 1061
 				    	    || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) {
852 1062
 				    $havedata = false;
853
-				    if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
854
-				    else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
1063
+				    if ($compress) {
1064
+				    	$output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
1065
+				    } else {
1066
+				    	$output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
1067
+				    }
855 1068
 				    
856 1069
 				    //$output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],';
857 1070
 				    if (isset($spotter_item['arrival_airport_latitude'])) {
@@ -876,7 +1089,9 @@  discard block
 block discarded – undo
876 1089
 					$output_dest  = substr($output_dest, 0, -1);
877 1090
 				    }
878 1091
 				    $output_dest .= ']}},';
879
-				    if ($havedata) $output .= $output_dest;
1092
+				    if ($havedata) {
1093
+				    	$output .= $output_dest;
1094
+				    }
880 1095
 				    unset($output_dest);
881 1096
 				}
882 1097
 			}
@@ -884,7 +1099,9 @@  discard block
 block discarded – undo
884 1099
 			$output .= ']';
885 1100
 			$output .= ',"initial_sqltime": "'.$sqltime.'",';
886 1101
 			$output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",';
887
-			if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
1102
+			if (isset($begindate)) {
1103
+				$output .= '"archive_date": "'.$begindate.'",';
1104
+			}
888 1105
 			$output .= '"fc": "'.$j.'"';
889 1106
 		} else {
890 1107
 			$output .= '"features": ';
Please login to merge, or discard this patch.