Completed
Push — master ( e14a40...cfb98e )
by Yannick
54:46 queued 27:34
created
require/class.TrackerArchive.php 1 patch
Braces   +42 added lines, -15 removed lines patch added patch discarded remove patch
@@ -6,7 +6,9 @@  discard block
 block discarded – undo
6 6
 	public function __construct($dbc = null) {
7 7
 		$Connection = new Connection($dbc);
8 8
 		$this->db = $Connection->db;
9
-		if ($this->db === null) die('Error: No DB connection. (TrackerArchive)');
9
+		if ($this->db === null) {
10
+			die('Error: No DB connection. (TrackerArchive)');
11
+		}
10 12
 	}
11 13
 
12 14
 	/**
@@ -27,7 +29,9 @@  discard block
 block discarded – undo
27 29
 		if (isset($filter[0]['source'])) {
28 30
 			$filters = array_merge($filters,$filter);
29 31
 		}
30
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
32
+		if (is_array($globalFilter)) {
33
+			$filter = array_merge($filter,$globalFilter);
34
+		}
31 35
 		$filter_query_join = '';
32 36
 		$filter_query_where = '';
33 37
 		foreach($filters as $flt) {
@@ -73,8 +77,11 @@  discard block
 block discarded – undo
73 77
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
74 78
 			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
75 79
 		}
76
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
77
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
80
+		if ($filter_query_where == '' && $where) {
81
+			$filter_query_where = ' WHERE';
82
+		} elseif ($filter_query_where != '' && $and) {
83
+			$filter_query_where .= ' AND';
84
+		}
78 85
 		if ($filter_query_where != '') {
79 86
 			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
80 87
 		}
@@ -88,9 +95,14 @@  discard block
 block discarded – undo
88 95
 		if ($over_country == '') {
89 96
 			$Tracker = new Tracker($this->db);
90 97
 			$data_country = $Tracker->getCountryFromLatitudeLongitude($latitude,$longitude);
91
-			if (!empty($data_country)) $country = $data_country['iso2'];
92
-			else $country = '';
93
-		} else $country = $over_country;
98
+			if (!empty($data_country)) {
99
+				$country = $data_country['iso2'];
100
+			} else {
101
+				$country = '';
102
+			}
103
+		} else {
104
+			$country = $over_country;
105
+		}
94 106
 		// Route is not added in tracker_archive
95 107
 		$query  = 'INSERT INTO tracker_archive (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) 
96 108
 		    VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:comment,:type)';
@@ -168,8 +180,11 @@  discard block
 block discarded – undo
168 180
 	{
169 181
                 date_default_timezone_set('UTC');
170 182
                 $id = filter_var($id, FILTER_SANITIZE_STRING);
171
-                if ($date == '') $query  = $this->global_query." WHERE tracker_archive.famtrackid = :id ORDER BY date";
172
-                else $query  = $this->global_query." WHERE tracker_archive.famtrackid = :id AND date < '".date('c',$date)."' ORDER BY date";
183
+                if ($date == '') {
184
+                	$query  = $this->global_query." WHERE tracker_archive.famtrackid = :id ORDER BY date";
185
+                } else {
186
+                	$query  = $this->global_query." WHERE tracker_archive.famtrackid = :id AND date < '".date('c',$date)."' ORDER BY date";
187
+                }
173 188
 
174 189
 //              $spotter_array = Tracker->getDataFromDB($query,array(':id' => $id));
175 190
 
@@ -593,7 +608,9 @@  discard block
 block discarded – undo
593 608
 		    $additional_query .= "(tracker_archive_output.pilot_name like '%".$q_item."%') OR ";
594 609
 		    $additional_query .= "(tracker_archive_output.ident like '%".$q_item."%') OR ";
595 610
 		    $translate = $Translation->ident2icao($q_item);
596
-		    if ($translate != $q_item) $additional_query .= "(tracker_archive_output.ident like '%".$translate."%') OR ";
611
+		    if ($translate != $q_item) {
612
+		    	$additional_query .= "(tracker_archive_output.ident like '%".$translate."%') OR ";
613
+		    }
597 614
 		    $additional_query .= "(tracker_archive_output.highlight like '%".$q_item."%')";
598 615
 		    $additional_query .= ")";
599 616
 		}
@@ -811,7 +828,9 @@  discard block
 block discarded – undo
811 828
 		date_default_timezone_set($globalTimezone);
812 829
 		$datetime = new DateTime();
813 830
 		$offset = $datetime->format('P');
814
-	    } else $offset = '+00:00';
831
+	    } else {
832
+	    	$offset = '+00:00';
833
+	    }
815 834
 
816 835
 
817 836
 	    if ($date_array[1] != "")
@@ -1087,9 +1106,13 @@  discard block
 block discarded – undo
1087 1106
 				$query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
1088 1107
 			}
1089 1108
 		}
1090
-                if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
1109
+                if ($sincedate != '') {
1110
+                	$query .= "AND date > '".$sincedate."' ";
1111
+                }
1091 1112
 	$query .= "GROUP BY c.name, c.iso3, c.iso2 ORDER BY nb DESC";
1092
-	if ($limit) $query .= " LIMIT 0,10";
1113
+	if ($limit) {
1114
+		$query .= " LIMIT 0,10";
1115
+	}
1093 1116
       
1094 1117
 	
1095 1118
 	$sth = $this->db->prepare($query);
@@ -1133,9 +1156,13 @@  discard block
 block discarded – undo
1133 1156
 				$query .= "AND s.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
1134 1157
 			}
1135 1158
 		}
1136
-                if ($sincedate != '') $query .= "AND s.date > '".$sincedate."' ";
1159
+                if ($sincedate != '') {
1160
+                	$query .= "AND s.date > '".$sincedate."' ";
1161
+                }
1137 1162
 	$query .= "GROUP BY o.airline_icao,c.name, c.iso3, c.iso2 ORDER BY nb DESC";
1138
-	if ($limit) $query .= " LIMIT 0,10";
1163
+	if ($limit) {
1164
+		$query .= " LIMIT 0,10";
1165
+	}
1139 1166
       
1140 1167
 	
1141 1168
 	$sth = $this->db->prepare($query);
Please login to merge, or discard this patch.
require/class.TrackerLive.php 1 patch
Braces   +114 added lines, -39 removed lines patch added patch discarded remove patch
@@ -8,7 +8,9 @@  discard block
 block discarded – undo
8 8
 	public function __construct($dbc = null) {
9 9
 		$Connection = new Connection($dbc);
10 10
 		$this->db = $Connection->db();
11
-		if ($this->db === null) die('Error: No DB connection. (TrackerLive)');
11
+		if ($this->db === null) {
12
+			die('Error: No DB connection. (TrackerLive)');
13
+		}
12 14
 	}
13 15
 
14 16
 
@@ -30,7 +32,9 @@  discard block
 block discarded – undo
30 32
 		if (isset($filter[0]['source'])) {
31 33
 			$filters = array_merge($filters,$filter);
32 34
 		}
33
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
35
+		if (is_array($globalFilter)) {
36
+			$filter = array_merge($filter,$globalFilter);
37
+		}
34 38
 		$filter_query_join = '';
35 39
 		$filter_query_where = '';
36 40
 		foreach($filters as $flt) {
@@ -77,8 +81,11 @@  discard block
 block discarded – undo
77 81
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
78 82
 			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
79 83
 		}
80
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
81
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
84
+		if ($filter_query_where == '' && $where) {
85
+			$filter_query_where = ' WHERE';
86
+		} elseif ($filter_query_where != '' && $and) {
87
+			$filter_query_where .= ' AND';
88
+		}
82 89
 		if ($filter_query_where != '') {
83 90
 			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
84 91
 		}
@@ -120,7 +127,9 @@  discard block
 block discarded – undo
120 127
 			}
121 128
 		}
122 129
 
123
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
130
+		if (!isset($globalLiveInterval)) {
131
+			$globalLiveInterval = '200';
132
+		}
124 133
 		if ($globalDBdriver == 'mysql') {
125 134
 			//$query  = "SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate";
126 135
 			$query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate'.$filter_query.$orderby_query;
@@ -145,7 +154,9 @@  discard block
 block discarded – undo
145 154
 
146 155
 		$filter_query = $this->getFilter($filter,true,true);
147 156
 
148
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
157
+		if (!isset($globalLiveInterval)) {
158
+			$globalLiveInterval = '200';
159
+		}
149 160
 		if ($globalDBdriver == 'mysql') {
150 161
 			$query  = 'SELECT tracker_live.ident, tracker_live.type,tracker_live.famtrackid, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
151 162
 			FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate'.$filter_query." tracker_live.latitude <> 0 AND tracker_live.longitude <> 0";
@@ -190,50 +201,74 @@  discard block
 block discarded – undo
190 201
 		}
191 202
 		$filter_query = $this->getFilter($filter,true,true);
192 203
 
193
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
194
-		if (!isset($globalMap3DTrackersLimit) || $globalMap3DTrackersLimit == '') $globalMap3DTrackersLimit = '300';
204
+		if (!isset($globalLiveInterval)) {
205
+			$globalLiveInterval = '200';
206
+		}
207
+		if (!isset($globalMap3DTrackersLimit) || $globalMap3DTrackersLimit == '') {
208
+			$globalMap3DTrackersLimit = '300';
209
+		}
195 210
 		if ($globalDBdriver == 'mysql') {
196 211
 			if (isset($globalArchive) && $globalArchive) {
197 212
 				$query  = "SELECT * FROM (
198 213
 					SELECT tracker_archive.ident, tracker_archive.famtrackid,tracker_archive.type,tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.date, tracker_archive.format_source 
199 214
 					FROM tracker_archive INNER JOIN (SELECT famtrackid FROM tracker_live".$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date) l ON l.famtrackid = tracker_archive.famtrackid ";
200
-				if ($usecoord) $query .= "AND tracker_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
215
+				if ($usecoord) {
216
+					$query .= "AND tracker_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
217
+				}
201 218
 				$query .= "UNION
202 219
 					SELECT tracker_live.ident, tracker_live.famtrackid, tracker_live.type,tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
203 220
 					FROM tracker_live".$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date ";
204
-				if ($usecoord) $query .= "AND tracker_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_live.longitude BETWEEN ".$minlong." AND ".$maxlong;
221
+				if ($usecoord) {
222
+					$query .= "AND tracker_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_live.longitude BETWEEN ".$minlong." AND ".$maxlong;
223
+				}
205 224
 				$query .= ") AS tracker
206 225
 				    WHERE latitude <> '0' AND longitude <> '0' 
207 226
 				    ORDER BY famtrackid, date";
208
-				if ($limit) $query .= " LIMIT ".$globalMap3DTrackersLimit;
227
+				if ($limit) {
228
+					$query .= " LIMIT ".$globalMap3DTrackersLimit;
229
+				}
209 230
 			} else {
210 231
 				$query  = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
211 232
 				    FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date ";
212
-				if ($usecoord) $query .= "AND tracker_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_live.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
233
+				if ($usecoord) {
234
+					$query .= "AND tracker_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_live.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
235
+				}
213 236
 				$query .= "AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' 
214 237
 				    ORDER BY tracker_live.famtrackid, tracker_live.date";
215
-				if ($limit) $query .= " LIMIT ".$globalMap3DTrackersLimit;
238
+				if ($limit) {
239
+					$query .= " LIMIT ".$globalMap3DTrackersLimit;
240
+				}
216 241
 			}
217 242
 		} else {
218 243
 			if (isset($globalArchive) && $globalArchive) {
219 244
 				$query  = "SELECT * FROM (
220 245
 					SELECT tracker_archive.ident, tracker_archive.famtrackid,tracker_archive.type,tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.date, tracker_archive.format_source 
221 246
 					FROM tracker_archive INNER JOIN (SELECT famtrackid FROM tracker_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= tracker_live.date) l ON l.famtrackid = tracker_archive.famtrackid ";
222
-				if ($usecoord) $query .= "AND tracker_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
247
+				if ($usecoord) {
248
+					$query .= "AND tracker_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
249
+				}
223 250
 				$query .= "UNION
224 251
 					SELECT tracker_live.ident, tracker_live.famtrackid, tracker_live.type,tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
225 252
 					FROM tracker_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= tracker_live.date";
226
-				if ($usecoord) $query .= " AND tracker_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_live.longitude BETWEEN ".$minlong." AND ".$maxlong;
253
+				if ($usecoord) {
254
+					$query .= " AND tracker_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_live.longitude BETWEEN ".$minlong." AND ".$maxlong;
255
+				}
227 256
 				$query .= ") AS tracker
228 257
 				    WHERE latitude <> '0' AND longitude <> '0' 
229 258
 				    ORDER BY famtrackid, date";
230
-				if ($limit) $query .= " LIMIT ".$globalMap3DTrackersLimit;
259
+				if ($limit) {
260
+					$query .= " LIMIT ".$globalMap3DTrackersLimit;
261
+				}
231 262
 			} else {
232 263
 				$query  = "SELECT tracker_live.ident, tracker_live.famtrackid, tracker_live.type,tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
233 264
 				    FROM tracker_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= tracker_live.date AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' ";
234
-				if ($usecoord) $query .= "AND tracker_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_live.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
265
+				if ($usecoord) {
266
+					$query .= "AND tracker_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_live.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
267
+				}
235 268
 				$query .= "ORDER BY tracker_live.famtrackid, tracker_live.date";
236
-				if ($limit) $query .= " LIMIT ".$globalMap3DTrackersLimit;
269
+				if ($limit) {
270
+					$query .= " LIMIT ".$globalMap3DTrackersLimit;
271
+				}
237 272
 			}
238 273
 		}
239 274
 
@@ -259,7 +294,9 @@  discard block
 block discarded – undo
259 294
 		global $globalDBdriver, $globalLiveInterval;
260 295
 		$filter_query = $this->getFilter($filter,true,true);
261 296
 
262
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
297
+		if (!isset($globalLiveInterval)) {
298
+			$globalLiveInterval = '200';
299
+		}
263 300
 		if ($globalDBdriver == 'mysql') {
264 301
 			$query = 'SELECT COUNT(DISTINCT tracker_live.famtrackid) as nb FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
265 302
 		} else {
@@ -287,7 +324,9 @@  discard block
 block discarded – undo
287 324
 	{
288 325
 		global $globalDBdriver, $globalLiveInterval;
289 326
 		$Tracker = new Tracker($this->db);
290
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
327
+		if (!isset($globalLiveInterval)) {
328
+			$globalLiveInterval = '200';
329
+		}
291 330
 		$filter_query = $this->getFilter($filter);
292 331
 
293 332
 		if (is_array($coord)) {
@@ -295,7 +334,9 @@  discard block
 block discarded – undo
295 334
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
296 335
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
297 336
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
298
-		} else return array();
337
+		} else {
338
+			return array();
339
+		}
299 340
 		if ($globalDBdriver == 'mysql') {
300 341
 			$query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate AND tracker_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND tracker_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY tracker_live.famtrackid'.$filter_query;
301 342
 		} else {
@@ -315,7 +356,9 @@  discard block
 block discarded – undo
315 356
 	{
316 357
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
317 358
 		$Tracker = new Tracker($this->db);
318
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
359
+		if (!isset($globalLiveInterval)) {
360
+			$globalLiveInterval = '200';
361
+		}
319 362
 		$filter_query = $this->getFilter($filter,true,true);
320 363
 
321 364
 		if (is_array($coord)) {
@@ -323,7 +366,9 @@  discard block
 block discarded – undo
323 366
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
324 367
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
325 368
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
326
-		} else return array();
369
+		} else {
370
+			return array();
371
+		}
327 372
 		/*
328 373
 		if ($globalDBdriver == 'mysql') {
329 374
 			$query  = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
@@ -557,13 +602,19 @@  discard block
 block discarded – undo
557 602
 		//$query  = self::$global_query.' WHERE tracker_live.famtrackid = :id ORDER BY date';
558 603
 		if ($globalDBdriver == 'mysql') {
559 604
 			$query = 'SELECT tracker_live.* FROM tracker_live WHERE tracker_live.famtrackid = :id';
560
-			if ($liveinterval === true) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
561
-			elseif ($liveinterval !== false) $query .= " AND date <= '".date('c',$liveinterval)."'";
605
+			if ($liveinterval === true) {
606
+				$query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
607
+			} elseif ($liveinterval !== false) {
608
+				$query .= " AND date <= '".date('c',$liveinterval)."'";
609
+			}
562 610
 			$query .= ' ORDER BY date';
563 611
 		} else {
564 612
 			$query = 'SELECT tracker_live.* FROM tracker_live WHERE tracker_live.famtrackid = :id';
565
-			if ($liveinterval === true) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
566
-			elseif ($liveinterval !== false) $query .= " AND date <= '".date('c',$liveinterval)."'";
613
+			if ($liveinterval === true) {
614
+				$query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
615
+			} elseif ($liveinterval !== false) {
616
+				$query .= " AND date <= '".date('c',$liveinterval)."'";
617
+			}
567 618
 			$query .= ' ORDER BY date';
568 619
 		}
569 620
 
@@ -658,7 +709,9 @@  discard block
 block discarded – undo
658 709
 				$i++;
659 710
 				$j++;
660 711
 				if ($j == 30) {
661
-					if ($globalDebug) echo ".";
712
+					if ($globalDebug) {
713
+						echo ".";
714
+					}
662 715
 				    	try {
663 716
 						
664 717
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
@@ -905,7 +958,9 @@  discard block
 block discarded – undo
905 958
 			{
906 959
 				return false;
907 960
 			}
908
-		} else return '';
961
+		} else {
962
+			return '';
963
+		}
909 964
 
910 965
 		if ($longitude != '')
911 966
 		{
@@ -913,7 +968,9 @@  discard block
 block discarded – undo
913 968
 			{
914 969
 				return false;
915 970
 			}
916
-		} else return '';
971
+		} else {
972
+			return '';
973
+		}
917 974
 
918 975
 		if ($altitude != '')
919 976
 		{
@@ -921,7 +978,9 @@  discard block
 block discarded – undo
921 978
 			{
922 979
 				return false;
923 980
 			}
924
-		} else $altitude = 0;
981
+		} else {
982
+			$altitude = 0;
983
+		}
925 984
 
926 985
 		if ($heading != '')
927 986
 		{
@@ -929,7 +988,9 @@  discard block
 block discarded – undo
929 988
 			{
930 989
 				return false;
931 990
 			}
932
-		} else $heading = 0;
991
+		} else {
992
+			$heading = 0;
993
+		}
933 994
 
934 995
 		if ($groundspeed != '')
935 996
 		{
@@ -937,9 +998,13 @@  discard block
 block discarded – undo
937 998
 			{
938 999
 				return false;
939 1000
 			}
940
-		} else $groundspeed = 0;
1001
+		} else {
1002
+			$groundspeed = 0;
1003
+		}
941 1004
 		date_default_timezone_set('UTC');
942
-		if ($date == '') $date = date("Y-m-d H:i:s", time());
1005
+		if ($date == '') {
1006
+			$date = date("Y-m-d H:i:s", time());
1007
+		}
943 1008
 
944 1009
         
945 1010
 		$famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING);
@@ -955,12 +1020,18 @@  discard block
 block discarded – undo
955 1020
 		$comment = filter_var($comment,FILTER_SANITIZE_STRING);
956 1021
 		$type = filter_var($type,FILTER_SANITIZE_STRING);
957 1022
 
958
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
959
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
1023
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) {
1024
+            		$groundspeed = 0;
1025
+            	}
1026
+            	if ($heading == '' || $Common->isInteger($heading) === false ) {
1027
+            		$heading = 0;
1028
+            	}
960 1029
             	
961 1030
 		$query = '';
962 1031
 		if ($globalArchive) {
963
-			if ($globalDebug) echo '-- Delete previous data -- ';
1032
+			if ($globalDebug) {
1033
+				echo '-- Delete previous data -- ';
1034
+			}
964 1035
 			$query .= 'DELETE FROM tracker_live WHERE famtrackid = :famtrackid;';
965 1036
 		}
966 1037
 		$query  .= 'INSERT INTO tracker_live (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) 
@@ -979,10 +1050,14 @@  discard block
 block discarded – undo
979 1050
                 echo 'noarchive : '.$noarchive."\n";
980 1051
                 */
981 1052
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
982
-		    if ($globalDebug) echo '(Add to Tracker archive '.$famtrackid.' : ';
1053
+		    if ($globalDebug) {
1054
+		    	echo '(Add to Tracker archive '.$famtrackid.' : ';
1055
+		    }
983 1056
 		    $TrackerArchive = new TrackerArchive($this->db);
984 1057
 		    $result =  $TrackerArchive->addTrackerArchiveData($famtrackid, $ident,$latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type,$noarchive,$format_source, $source_name, $over_country);
985
-		    if ($globalDebug) echo $result.')';
1058
+		    if ($globalDebug) {
1059
+		    	echo $result.')';
1060
+		    }
986 1061
 		}
987 1062
 
988 1063
 		return "success";
Please login to merge, or discard this patch.
header.php 1 patch
Braces   +90 added lines, -20 removed lines patch added patch discarded remove patch
@@ -6,12 +6,19 @@  discard block
 block discarded – undo
6 6
 //gets the page file and stores it in a variable
7 7
 $file_path = pathinfo($_SERVER['SCRIPT_NAME']);
8 8
 $current_page = $file_path['filename'];
9
-if ($globalTimezone == '') $globalTimezone = 'UTC';
9
+if ($globalTimezone == '') {
10
+	$globalTimezone = 'UTC';
11
+}
10 12
 date_default_timezone_set($globalTimezone);
11
-if (isset($_COOKIE['MapType']) && $_COOKIE['MapType'] != '') $MapType = $_COOKIE['MapType'];
12
-else $MapType = $globalMapProvider;
13
+if (isset($_COOKIE['MapType']) && $_COOKIE['MapType'] != '') {
14
+	$MapType = $_COOKIE['MapType'];
15
+} else {
16
+	$MapType = $globalMapProvider;
17
+}
13 18
 
14
-if (isset($globalMapOffline) && $globalMapOffline) $MapType = 'offline';
19
+if (isset($globalMapOffline) && $globalMapOffline) {
20
+	$MapType = 'offline';
21
+}
15 22
 
16 23
 if (isset($_GET['3d'])) {
17 24
 	setcookie('MapFormat','3d');
@@ -219,7 +226,10 @@  discard block
 block discarded – undo
219 226
 <?php
220 227
 //		}
221 228
 ?>
222
-<script src="<?php print $globalURL; ?>/js/map.2d.js.php?<?php print time(); ?><?php if (isset($tsk)) print '&tsk='.$tsk; ?>"></script>
229
+<script src="<?php print $globalURL; ?>/js/map.2d.js.php?<?php print time(); ?><?php if (isset($tsk)) {
230
+	print '&tsk='.$tsk;
231
+}
232
+?>"></script>
223 233
 <?php
224 234
 		if (!isset($globalAircraft) || $globalAircraft) {
225 235
 ?>
@@ -264,7 +274,13 @@  discard block
 block discarded – undo
264 274
 <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script>
265 275
 <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script>
266 276
 <script src="<?php print $globalURL; ?>/js/map.common.js"></script>
267
-<script src="<?php print $globalURL; ?>/js/map.2d.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script>
277
+<script src="<?php print $globalURL; ?>/js/map.2d.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) {
278
+	print '&latitude='.$latitude;
279
+}
280
+?><?php if(isset($longitude)) {
281
+	print '&longitude='.$longitude;
282
+}
283
+?>&<?php print time(); ?>"></script>
268 284
 <?php
269 285
 		if (!isset($type) || $type == 'aircraft') {
270 286
 ?>
@@ -337,7 +353,13 @@  discard block
 block discarded – undo
337 353
 <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script>
338 354
 <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script>
339 355
 <script src="<?php print $globalURL; ?>/js/map.common.js"></script>
340
-<script src="<?php print $globalURL; ?>/js/map.2d.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script>
356
+<script src="<?php print $globalURL; ?>/js/map.2d.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if(isset($latitude)) {
357
+	print '&latitude='.$latitude;
358
+}
359
+?><?php if(isset($longitude)) {
360
+	print '&longitude='.$longitude;
361
+}
362
+?>&<?php print time(); ?>"></script>
341 363
 <script src="<?php print $globalURL; ?>/js/map-aircraft.2d.js.php?flightaware_id=<?php print $flightaware_id; ?>&<?php print time(); ?>"></script>
342 364
 <?php
343 365
 		if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '' && ($MapType == 'Google-Roadmap' || $MapType == 'Google-Satellite' || $MapType == 'Google-Hybrid' || $MapType == 'Google-Terrain')) {
@@ -418,7 +440,12 @@  discard block
 block discarded – undo
418 440
         <span class="icon-bar"></span>
419 441
       </button>
420 442
       <a href="<?php print $globalURL; ?>/search" class="navbar-toggle search"><i class="fa fa-search"></i></a>
421
-      <a class="navbar-brand" href="<?php if ($globalURL == '') print '/'; else print $globalURL; ?>"><img src="<?php print $globalURL.$logoURL; ?>" height="30px" /></a>
443
+      <a class="navbar-brand" href="<?php if ($globalURL == '') {
444
+	print '/';
445
+} else {
446
+	print $globalURL;
447
+}
448
+?>"><img src="<?php print $globalURL.$logoURL; ?>" height="30px" /></a>
422 449
     </div>
423 450
     <div class="collapse navbar-collapse">
424 451
 
@@ -473,7 +500,10 @@  discard block
 block discarded – undo
473 500
 	}
474 501
 ?>
475 502
 
476
-          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
503
+          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) {
504
+	echo 'right-';
505
+}
506
+?>caret"></b></a>
477 507
           <ul class="dropdown-menu">
478 508
           	<li><a href="<?php print $globalURL; ?>/aircraft"><?php echo _("Aircrafts Types"); ?></a></li>
479 509
 <?php
@@ -544,8 +574,14 @@  discard block
 block discarded – undo
544 574
         </li>
545 575
       	<li><a href="<?php print $globalURL; ?>/search"><?php echo _("Search"); ?></a></li>
546 576
       	<li><a href="<?php print $globalURL; ?>/statistics"><?php echo _("Statistics"); ?></a></li>
547
-        <li class="dropdown<?php if ($sub) echo '-submenu'; ?>">
548
-          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Tools"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
577
+        <li class="dropdown<?php if ($sub) {
578
+	echo '-submenu';
579
+}
580
+?>">
581
+          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Tools"); ?> <b class="<?php if ($sub) {
582
+	echo 'right-';
583
+}
584
+?>caret"></b></a>
549 585
           <ul class="dropdown-menu">
550 586
           	<li><a href="<?php print $globalURL; ?>/tools/acars"><?php echo _("ACARS translator"); ?></a></li>
551 587
           	<li><a href="<?php print $globalURL; ?>/tools/metar"><?php echo _("METAR translator"); ?></a></li>
@@ -589,7 +625,10 @@  discard block
 block discarded – undo
589 625
 <?php
590 626
 	}
591 627
 ?>
592
-		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
628
+		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) {
629
+	echo 'right-';
630
+}
631
+?>caret"></b></a>
593 632
 		<ul class="dropdown-menu">
594 633
 		    <li><a href="<?php print $globalURL; ?>/marine/currently"><?php echo _("Current Activity"); ?></a></li>
595 634
 		    <li><a href="<?php print $globalURL; ?>/marine/latest"><?php echo _("Latest Activity"); ?></a></li>
@@ -630,7 +669,10 @@  discard block
 block discarded – undo
630 669
 <?php
631 670
 	}
632 671
 ?>
633
-		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
672
+		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) {
673
+	echo 'right-';
674
+}
675
+?>caret"></b></a>
634 676
 		<ul class="dropdown-menu">
635 677
 		    <li><a href="<?php print $globalURL; ?>/tracker/currently"><?php echo _("Current Activity"); ?></a></li>
636 678
 		    <li><a href="<?php print $globalURL; ?>/tracker/latest"><?php echo _("Latest Activity"); ?></a></li>
@@ -673,7 +715,10 @@  discard block
 block discarded – undo
673 715
 ?>
674 716
 
675 717
 <!--
676
-		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
718
+		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) {
719
+	echo 'right-';
720
+}
721
+?>caret"></b></a>
677 722
 		<ul class="dropdown-menu">
678 723
 		    <li><a href="<?php print $globalURL; ?>/satellite/currently"><?php echo _("Current Activity"); ?></a></li>
679 724
 		    <li><a href="<?php print $globalURL; ?>/satellite/latest"><?php echo _("Latest Activity"); ?></a></li>
@@ -730,7 +775,9 @@  discard block
 block discarded – undo
730 775
   		        $alllang = $Language->getLanguages();
731 776
   		        foreach ($alllang as $key => $lang) {
732 777
   		            print '<option value="'.$key.'"';
733
-  		            if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected ';
778
+  		            if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) {
779
+  		            	print ' selected ';
780
+  		            }
734 781
   		            print '>'.$lang[0].'</option>';
735 782
   		        }
736 783
   		    ?>
@@ -878,9 +925,24 @@  discard block
 block discarded – undo
878 925
 	$customid = $globalMapProvider;
879 926
 ?>
880 927
     L.tileLayer('<?php print $globalMapCustomLayer[$customid]['url']; ?>/{z}/{x}/{y}.png', {
881
-        maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) print $globalMapCustomLayer[$customid]['maxZoom']; else print '18'; ?>,
882
-        minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) print $globalMapCustomLayer[$customid]['minZoom']; else print '0'; ?>,
883
-        noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
928
+        maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) {
929
+	print $globalMapCustomLayer[$customid]['maxZoom'];
930
+} else {
931
+	print '18';
932
+}
933
+?>,
934
+        minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) {
935
+	print $globalMapCustomLayer[$customid]['minZoom'];
936
+} else {
937
+	print '0';
938
+}
939
+?>,
940
+        noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
941
+	print 'false';
942
+} else {
943
+	print 'true';
944
+}
945
+?>,
884 946
         attribution: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>'
885 947
     }).addTo(map);
886 948
 <?php
@@ -895,7 +957,12 @@  discard block
 block discarded – undo
895 957
         maxZoom: 5,
896 958
         tms : true,
897 959
         zindex : 3,
898
-        noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
960
+        noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
961
+	print 'false';
962
+} else {
963
+	print 'true';
964
+}
965
+?>,
899 966
         attribution: 'Natural Earth'
900 967
     }).addTo(map);
901 968
 <?php
@@ -918,4 +985,7 @@  discard block
 block discarded – undo
918 985
 
919 986
 ?>
920 987
 
921
-<section class="container main-content <?php if (strtolower($current_page) == 'index') print 'index '; ?>clear">
988
+<section class="container main-content <?php if (strtolower($current_page) == 'index') {
989
+	print 'index ';
990
+}
991
+?>clear">
Please login to merge, or discard this patch.
install/index.php 1 patch
Braces   +592 added lines, -159 removed lines patch added patch discarded remove patch
@@ -4,11 +4,19 @@  discard block
 block discarded – undo
4 4
 if (isset($_SESSION['error'])) {
5 5
 	header('Content-Encoding: none;');
6 6
 	echo 'Error : '.$_SESSION['error'].' - Resetting install... You need to fix the problem and run install again.';
7
-	if (isset($_SESSION['error'])) unset($_SESSION['error']);
8
-	if (isset($_SESSION['errorlst'])) unset($_SESSION['errorlst']);
9
-	if (isset($_SESSION['next'])) unset($_SESSION['next']);
10
-	if (isset($_SESSION['install'])) unset($_SESSION['install']);
11
-}
7
+	if (isset($_SESSION['error'])) {
8
+		unset($_SESSION['error']);
9
+	}
10
+	if (isset($_SESSION['errorlst'])) {
11
+		unset($_SESSION['errorlst']);
12
+	}
13
+	if (isset($_SESSION['next'])) {
14
+		unset($_SESSION['next']);
15
+	}
16
+	if (isset($_SESSION['install'])) {
17
+		unset($_SESSION['install']);
18
+	}
19
+	}
12 20
 /*
13 21
 if (isset($_SESSION['errorlst'])) {
14 22
 	header('Content-Encoding: none;');
@@ -159,31 +167,49 @@  discard block
 block discarded – undo
159 167
 			</div>
160 168
 			<p>
161 169
 				<label for="dbhost">Database hostname</label>
162
-				<input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) print $globalDBhost; ?>" />
170
+				<input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) {
171
+	print $globalDBhost;
172
+}
173
+?>" />
163 174
 			</p>
164 175
 			<p>
165 176
 				<label for="dbport">Database port</label>
166
-				<input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) print $globalDBport; ?>" />
177
+				<input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) {
178
+	print $globalDBport;
179
+}
180
+?>" />
167 181
 				<p class="help-block">Default is 3306 for MariaDB/MySQL, 5432 for PostgreSQL</p>
168 182
 			</p>
169 183
 			<p>
170 184
 				<label for="dbname">Database name</label>
171
-				<input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) print $globalDBname; ?>" />
185
+				<input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) {
186
+	print $globalDBname;
187
+}
188
+?>" />
172 189
 			</p>
173 190
 			<p>
174 191
 				<label for="dbuser">Database user</label>
175
-				<input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) print $globalDBuser; ?>" />
192
+				<input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) {
193
+	print $globalDBuser;
194
+}
195
+?>" />
176 196
 			</p>
177 197
 			<p>
178 198
 				<label for="dbuserpass">Database user password</label>
179
-				<input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) print $globalDBpass; ?>" />
199
+				<input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) {
200
+	print $globalDBpass;
201
+}
202
+?>" />
180 203
 			</p>
181 204
 		</fieldset>
182 205
 		<fieldset id="site">
183 206
 			<legend>Site configuration</legend>
184 207
 			<p>
185 208
 				<label for="sitename">Site name</label>
186
-				<input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) print $globalName; ?>" />
209
+				<input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) {
210
+	print $globalName;
211
+}
212
+?>" />
187 213
 			</p>
188 214
 			<p>
189 215
 				<label for="siteurl">Site directory</label>
@@ -196,18 +222,27 @@  discard block
 block discarded – undo
196 222
 					}
197 223
 				    }
198 224
 				?>
199
-				<input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) print $globalURL; ?>" />
225
+				<input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) {
226
+	print $globalURL;
227
+}
228
+?>" />
200 229
 				<p class="help-block">ex : <i>/flightairmap</i> if complete URL is <i>http://toto.com/flightairmap</i></p>
201 230
 				<p class="help-block">Can be empty</p>
202 231
 			</p>
203 232
 			<p>
204 233
 				<label for="timezone">Timezone</label>
205
-				<input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) print $globalTimezone; ?>" />
234
+				<input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) {
235
+	print $globalTimezone;
236
+}
237
+?>" />
206 238
 				<p class="help-block">ex : UTC, Europe/Paris,...</p>
207 239
 			</p>
208 240
 			<p>
209 241
 				<label for="language">Language</label>
210
-				<input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) print $globalLanguage; ?>" />
242
+				<input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) {
243
+	print $globalLanguage;
244
+}
245
+?>" />
211 246
 				<p class="help-block">Used only when link to wikipedia for now. Can be EN,DE,FR,...</p>
212 247
 			</p>
213 248
 		</fieldset>
@@ -227,11 +262,17 @@  discard block
 block discarded – undo
227 262
 			<div id="mapbox_data">
228 263
 				<p>
229 264
 					<label for="mapboxid">Mapbox id</label>
230
-					<input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) print $globalMapboxId; ?>" />
265
+					<input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) {
266
+	print $globalMapboxId;
267
+}
268
+?>" />
231 269
 				</p>
232 270
 				<p>
233 271
 					<label for="mapboxtoken">Mapbox token</label>
234
-					<input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) print $globalMapboxToken; ?>" />
272
+					<input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) {
273
+	print $globalMapboxToken;
274
+}
275
+?>" />
235 276
 				</p>
236 277
 				<p class="help-block">Get a key <a href="https://www.mapbox.com/developers/">here</a></p>
237 278
 			</div>
@@ -239,7 +280,10 @@  discard block
 block discarded – undo
239 280
 			<div id="google_data">
240 281
 				<p>
241 282
 					<label for="googlekey">Google API key</label>
242
-					<input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) print $globalGoogleAPIKey; ?>" />
283
+					<input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) {
284
+	print $globalGoogleAPIKey;
285
+}
286
+?>" />
243 287
 					<p class="help-block">Get a key <a href="https://developers.google.com/maps/documentation/javascript/get-api-key#get-an-api-key">here</a></p>
244 288
 				</p>
245 289
 			</div>
@@ -247,7 +291,10 @@  discard block
 block discarded – undo
247 291
 			<div id="bing_data">
248 292
 				<p>
249 293
 					<label for="bingkey">Bing Map key</label>
250
-					<input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) print $globalBingMapKey; ?>" />
294
+					<input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) {
295
+	print $globalBingMapKey;
296
+}
297
+?>" />
251 298
 					<p class="help-block">Get a key <a href="https://www.bingmapsportal.com/">here</a></p>
252 299
 				</p>
253 300
 			</div>
@@ -255,7 +302,10 @@  discard block
 block discarded – undo
255 302
 			<div id="mapquest_data">
256 303
 				<p>
257 304
 					<label for="mapquestkey">MapQuest key</label>
258
-					<input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) print $globalMapQuestKey; ?>" />
305
+					<input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) {
306
+	print $globalMapQuestKey;
307
+}
308
+?>" />
259 309
 					<p class="help-block">Get a key <a href="https://developer.mapquest.com/user/me/apps">here</a></p>
260 310
 				</p>
261 311
 			</div>
@@ -263,11 +313,17 @@  discard block
 block discarded – undo
263 313
 			<div id="here_data">
264 314
 				<p>
265 315
 					<label for="hereappid">Here App_Id</label>
266
-					<input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) print $globalHereappId; ?>" />
316
+					<input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) {
317
+	print $globalHereappId;
318
+}
319
+?>" />
267 320
 				</p>
268 321
 				<p>
269 322
 					<label for="hereappcode">Here App_Code</label>
270
-					<input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) print $globalHereappCode; ?>" />
323
+					<input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) {
324
+	print $globalHereappCode;
325
+}
326
+?>" />
271 327
 				</p>
272 328
 				<p class="help-block">Get a key <a href="https://developer.here.com/rest-apis/documentation/enterprise-map-tile/topics/quick-start.html">here</a></p>
273 329
 			</div>
@@ -275,7 +331,10 @@  discard block
 block discarded – undo
275 331
 			<div id="openweathermap_data">
276 332
 				<p>
277 333
 					<label for="openweathermapkey">OpenWeatherMap key (weather layer)</label>
278
-					<input type="text" name="openweathermapkey" id="openweathermapkey" value="<?php if (isset($globalOpenWeatherMapKey)) print $globalOpenWeatherMapKey; ?>" />
334
+					<input type="text" name="openweathermapkey" id="openweathermapkey" value="<?php if (isset($globalOpenWeatherMapKey)) {
335
+	print $globalOpenWeatherMapKey;
336
+}
337
+?>" />
279 338
 					<p class="help-block">Get a key <a href="https://openweathermap.org/">here</a></p>
280 339
 				</p>
281 340
 			</div>
@@ -304,42 +363,86 @@  discard block
 block discarded – undo
304 363
 			<legend>Coverage area</legend>
305 364
 			<p>
306 365
 				<label for="latitudemax">The maximum latitude (north)</label>
307
-				<input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) print $globalLatitudeMax; ?>" />
366
+				<input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) {
367
+	print $globalLatitudeMax;
368
+}
369
+?>" />
308 370
 			</p>
309 371
 			<p>
310 372
 				<label for="latitudemin">The minimum latitude (south)</label>
311
-				<input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) print $globalLatitudeMin; ?>" />
373
+				<input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) {
374
+	print $globalLatitudeMin;
375
+}
376
+?>" />
312 377
 			</p>
313 378
 			<p>
314 379
 				<label for="longitudemax">The maximum longitude (west)</label>
315
-				<input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) print $globalLongitudeMax; ?>" />
380
+				<input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) {
381
+	print $globalLongitudeMax;
382
+}
383
+?>" />
316 384
 			</p>
317 385
 			<p>
318 386
 				<label for="longitudemin">The minimum longitude (east)</label>
319
-				<input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) print $globalLongitudeMin; ?>" />
387
+				<input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) {
388
+	print $globalLongitudeMin;
389
+}
390
+?>" />
320 391
 			</p>
321 392
 			<p>
322 393
 				<label for="latitudecenter">The latitude center</label>
323
-				<input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) print $globalCenterLatitude; ?>" />
394
+				<input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) {
395
+	print $globalCenterLatitude;
396
+}
397
+?>" />
324 398
 			</p>
325 399
 			<p>
326 400
 				<label for="longitudecenter">The longitude center</label>
327
-				<input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) print $globalCenterLongitude; ?>" />
401
+				<input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) {
402
+	print $globalCenterLongitude;
403
+}
404
+?>" />
328 405
 			</p>
329 406
 			<p>
330 407
 				<label for="livezoom">Default Zoom on live map</label>
331
-				<input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) print $globalLiveZoom; else print '9'; ?>" />
408
+				<input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) {
409
+	print $globalLiveZoom;
410
+} else {
411
+	print '9';
412
+}
413
+?>" />
332 414
 			</p>
333 415
 			<p>
334 416
 				<label for="squawk_country">Country for squawk usage</label>
335 417
 				<select name="squawk_country" id="squawk_country">
336
-					<option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') print ' selected '; ?>>UK</option>
337
-					<option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') print ' selected '; ?>>NZ</option>
338
-					<option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') print ' selected '; ?>>US</option>
339
-					<option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') print ' selected '; ?>>AU</option>
340
-					<option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') print ' selected '; ?>>NL</option>
341
-					<option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') print ' selected '; ?>>FR</option>
342
-					<option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') print ' selected '; ?>>TR</option>
418
+					<option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') {
419
+	print ' selected ';
420
+}
421
+?>>UK</option>
422
+					<option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') {
423
+	print ' selected ';
424
+}
425
+?>>NZ</option>
426
+					<option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') {
427
+	print ' selected ';
428
+}
429
+?>>US</option>
430
+					<option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') {
431
+	print ' selected ';
432
+}
433
+?>>AU</option>
434
+					<option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') {
435
+	print ' selected ';
436
+}
437
+?>>NL</option>
438
+					<option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') {
439
+	print ' selected ';
440
+}
441
+?>>FR</option>
442
+					<option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') {
443
+	print ' selected ';
444
+}
445
+?>>TR</option>
343 446
 				</select>
344 447
 			</p>
345 448
 		</fieldset>
@@ -348,15 +451,24 @@  discard block
 block discarded – undo
348 451
 			<p><i>Only put in DB flights that are inside a circle</i></p>
349 452
 			<p>
350 453
 				<label for="latitude">Center latitude</label>
351
-				<input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) echo $globalDistanceIgnore['latitude']; ?>" />
454
+				<input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) {
455
+	echo $globalDistanceIgnore['latitude'];
456
+}
457
+?>" />
352 458
 			</p>
353 459
 			<p>
354 460
 				<label for="longitude">Center longitude</label>
355
-				<input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) echo $globalDistanceIgnore['longitude']; ?>" />
461
+				<input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) {
462
+	echo $globalDistanceIgnore['longitude'];
463
+}
464
+?>" />
356 465
 			</p>
357 466
 			<p>
358 467
 				<label for="Distance">Distance (in km)</label>
359
-				<input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) echo $globalDistanceIgnore['distance']; ?>" />
468
+				<input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) {
469
+	echo $globalDistanceIgnore['distance'];
470
+}
471
+?>" />
360 472
 			</p>
361 473
 		</fieldset>
362 474
 		<fieldset id="sourceloc">
@@ -472,11 +584,17 @@  discard block
 block discarded – undo
472 584
 			<div id="flightaware_data">
473 585
 				<p>
474 586
 					<label for="flightawareusername">FlightAware username</label>
475
-					<input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) print $globalFlightAwareUsername; ?>" />
587
+					<input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) {
588
+	print $globalFlightAwareUsername;
589
+}
590
+?>" />
476 591
 				</p>
477 592
 				<p>
478 593
 					<label for="flightawarepassword">FlightAware password/API key</label>
479
-					<input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) print $globalFlightAwarePassword; ?>" />
594
+					<input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) {
595
+	print $globalFlightAwarePassword;
596
+}
597
+?>" />
480 598
 				</p>
481 599
 			</div>
482 600
 -->
@@ -518,7 +636,10 @@  discard block
 block discarded – undo
518 636
 								    if (filter_var($source['host'],FILTER_VALIDATE_URL)) {
519 637
 								?>
520 638
 								<td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td>
521
-								<td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) print $source['port']; ?>" /></td>
639
+								<td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) {
640
+	print $source['port'];
641
+}
642
+?>" /></td>
522 643
 								<?php
523 644
 								    } else {
524 645
 									$hostport = explode(':',$source['host']);
@@ -537,35 +658,110 @@  discard block
 block discarded – undo
537 658
 								?>
538 659
 								<td>
539 660
 									<select name="format[]" id="format">
540
-										<option value="auto" <?php if (!isset($source['format'])) print 'selected'; ?>>Auto</option>
541
-										<option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') print 'selected'; ?>>SBS</option>
542
-										<option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') print 'selected'; ?>>TSV</option>
543
-										<option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') print 'selected'; ?>>Raw</option>
544
-										<option value="aircraftjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftjson') print 'selected'; ?>>Dump1090 aircraft.json</option>
545
-										<option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') print 'selected'; ?>>APRS</option>
546
-										<option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') print 'selected'; ?>>Radarcape deltadb.txt</option>
547
-										<option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') print 'selected'; ?>>Vatsim</option>
548
-										<option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') print 'selected'; ?>>Virtual Radar Server AircraftList.json</option>
549
-										<option value="vrstcp" <?php if (isset($source['format']) && $source['format'] == 'vrstcp') print 'selected'; ?>>Virtual Radar Server TCP</option>
550
-										<option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') print 'selected'; ?>>phpVMS</option>
551
-										<option value="vaos" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') print 'selected'; ?>>Virtual Airline Operations System (VAOS)</option>
552
-										<option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') print 'selected'; ?>>Virtual Airlines Manager</option>
553
-										<option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') print 'selected'; ?>>IVAO</option>
554
-										<option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') print 'selected'; ?>>FlightGear Multiplayer</option>
555
-										<option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') print 'selected'; ?>>FlightGear Singleplayer</option>
556
-										<option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') print 'selected'; ?>>ACARS from acarsdec/acarsdeco2 over UDP</option>
557
-										<option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') print 'selected'; ?>>ACARS SBS-3 over TCP</option>
558
-										<option value="ais" <?php if (isset($source['format']) && $source['format'] == 'ais') print 'selected'; ?>>NMEA AIS over TCP</option>
559
-										<option value="airwhere" <?php if (isset($source['format']) && $source['format'] == 'airwhere') print 'selected'; ?>>AirWhere website</option>
560
-										<option value="hidnseek_callback" <?php if (isset($source['format']) && $source['format'] == 'hidnseek_callback') print 'selected'; ?>>HidnSeek Callback</option>
561
-										<option value="blitzortung" <?php if (isset($source['format']) && $source['format'] == 'blitzortung') print 'selected'; ?>>Blitzortung</option>
661
+										<option value="auto" <?php if (!isset($source['format'])) {
662
+	print 'selected';
663
+}
664
+?>>Auto</option>
665
+										<option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') {
666
+	print 'selected';
667
+}
668
+?>>SBS</option>
669
+										<option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') {
670
+	print 'selected';
671
+}
672
+?>>TSV</option>
673
+										<option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') {
674
+	print 'selected';
675
+}
676
+?>>Raw</option>
677
+										<option value="aircraftjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftjson') {
678
+	print 'selected';
679
+}
680
+?>>Dump1090 aircraft.json</option>
681
+										<option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') {
682
+	print 'selected';
683
+}
684
+?>>APRS</option>
685
+										<option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') {
686
+	print 'selected';
687
+}
688
+?>>Radarcape deltadb.txt</option>
689
+										<option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') {
690
+	print 'selected';
691
+}
692
+?>>Vatsim</option>
693
+										<option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') {
694
+	print 'selected';
695
+}
696
+?>>Virtual Radar Server AircraftList.json</option>
697
+										<option value="vrstcp" <?php if (isset($source['format']) && $source['format'] == 'vrstcp') {
698
+	print 'selected';
699
+}
700
+?>>Virtual Radar Server TCP</option>
701
+										<option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') {
702
+	print 'selected';
703
+}
704
+?>>phpVMS</option>
705
+										<option value="vaos" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') {
706
+	print 'selected';
707
+}
708
+?>>Virtual Airline Operations System (VAOS)</option>
709
+										<option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') {
710
+	print 'selected';
711
+}
712
+?>>Virtual Airlines Manager</option>
713
+										<option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') {
714
+	print 'selected';
715
+}
716
+?>>IVAO</option>
717
+										<option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') {
718
+	print 'selected';
719
+}
720
+?>>FlightGear Multiplayer</option>
721
+										<option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') {
722
+	print 'selected';
723
+}
724
+?>>FlightGear Singleplayer</option>
725
+										<option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') {
726
+	print 'selected';
727
+}
728
+?>>ACARS from acarsdec/acarsdeco2 over UDP</option>
729
+										<option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') {
730
+	print 'selected';
731
+}
732
+?>>ACARS SBS-3 over TCP</option>
733
+										<option value="ais" <?php if (isset($source['format']) && $source['format'] == 'ais') {
734
+	print 'selected';
735
+}
736
+?>>NMEA AIS over TCP</option>
737
+										<option value="airwhere" <?php if (isset($source['format']) && $source['format'] == 'airwhere') {
738
+	print 'selected';
739
+}
740
+?>>AirWhere website</option>
741
+										<option value="hidnseek_callback" <?php if (isset($source['format']) && $source['format'] == 'hidnseek_callback') {
742
+	print 'selected';
743
+}
744
+?>>HidnSeek Callback</option>
745
+										<option value="blitzortung" <?php if (isset($source['format']) && $source['format'] == 'blitzortung') {
746
+	print 'selected';
747
+}
748
+?>>Blitzortung</option>
562 749
 									</select>
563 750
 								</td>
564 751
 								<td>
565
-									<input type="text" name="name[]" id="name" value="<?php if (isset($source['name'])) print $source['name']; ?>" />
752
+									<input type="text" name="name[]" id="name" value="<?php if (isset($source['name'])) {
753
+	print $source['name'];
754
+}
755
+?>" />
566 756
 								</td>
567
-								<td><input type="checkbox" name="sourcestats[]" id="sourcestats" title="Create statistics for the source like number of messages, distance,..." value="1" <?php if (isset($source['sourcestats']) && $source['sourcestats']) print 'checked'; ?> /></td>
568
-								<td><input type="checkbox" name="noarchive[]" id="noarchive" title="Don't archive this source" value="1" <?php if (isset($source['noarchive']) && $source['noarchive']) print 'checked'; ?> /></td>
757
+								<td><input type="checkbox" name="sourcestats[]" id="sourcestats" title="Create statistics for the source like number of messages, distance,..." value="1" <?php if (isset($source['sourcestats']) && $source['sourcestats']) {
758
+	print 'checked';
759
+}
760
+?> /></td>
761
+								<td><input type="checkbox" name="noarchive[]" id="noarchive" title="Don't archive this source" value="1" <?php if (isset($source['noarchive']) && $source['noarchive']) {
762
+	print 'checked';
763
+}
764
+?> /></td>
569 765
 								<td>
570 766
 									<select name="timezones[]" id="timezones">
571 767
 								<?php
@@ -575,7 +771,9 @@  discard block
 block discarded – undo
575 771
 											print '<option selected>'.$timezones.'</option>';
576 772
 										} elseif (!isset($source['timezone']) && $timezones == 'UTC') {
577 773
 											print '<option selected>'.$timezones.'</option>';
578
-										} else print '<option>'.$timezones.'</option>';
774
+										} else {
775
+											print '<option>'.$timezones.'</option>';
776
+										}
579 777
 									}
580 778
 								?>
581 779
 									</select>
@@ -627,7 +825,9 @@  discard block
 block discarded – undo
627 825
 									foreach($timezonelist as $timezones){
628 826
 										if ($timezones == 'UTC') {
629 827
 											print '<option selected>'.$timezones.'</option>';
630
-										} else print '<option>'.$timezones.'</option>';
828
+										} else {
829
+											print '<option>'.$timezones.'</option>';
830
+										}
631 831
 									}
632 832
 								?>
633 833
 									</select>
@@ -652,11 +852,17 @@  discard block
 block discarded – undo
652 852
 					<p>Listen UDP server for acarsdec/acarsdeco2/... with <i>daemon-acars.php</i> script</p>
653 853
 					<p>
654 854
 						<label for="acarshost">ACARS UDP host</label>
655
-						<input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) print $globalACARSHost; ?>" />
855
+						<input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) {
856
+	print $globalACARSHost;
857
+}
858
+?>" />
656 859
 					</p>
657 860
 					<p>
658 861
 						<label for="acarsport">ACARS UDP port</label>
659
-						<input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) print $globalACARSPort; ?>" />
862
+						<input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) {
863
+	print $globalACARSPort;
864
+}
865
+?>" />
660 866
 					</p>
661 867
 				</fieldset>
662 868
 			</div>
@@ -682,17 +888,38 @@  discard block
 block discarded – undo
682 888
 				    <td><input type="url" name="newsurl[]" value="<?php print $feed; ?>"/></td>
683 889
 				    <td>
684 890
 					<select name="newslang[]">
685
-					    <option value="en"<?php if ($lng == 'en') print ' selected'; ?>>English</option>
686
-					    <option value="fr"<?php if ($lng == 'fr') print ' selected'; ?>>French</option>
891
+					    <option value="en"<?php if ($lng == 'en') {
892
+	print ' selected';
893
+}
894
+?>>English</option>
895
+					    <option value="fr"<?php if ($lng == 'fr') {
896
+	print ' selected';
897
+}
898
+?>>French</option>
687 899
 					</select>
688 900
 				    </td>
689 901
 				    <td>
690 902
 					<select name="newstype[]">
691
-					    <option value="global"<?php if ($type == 'global') print ' selected'; ?>>Global</option>
692
-					    <option value="aircraft"<?php if ($type == 'aircraft') print ' selected'; ?>>Aircraft</option>
693
-					    <option value="marine"<?php if ($type == 'marine') print ' selected'; ?>>Marine</option>
694
-					    <option value="tracker"<?php if ($type == 'tracker') print ' selected'; ?>>Tracker</option>
695
-					    <option value="satellite"<?php if ($type == 'Satellite') print ' selected'; ?>>Satellite</option>
903
+					    <option value="global"<?php if ($type == 'global') {
904
+	print ' selected';
905
+}
906
+?>>Global</option>
907
+					    <option value="aircraft"<?php if ($type == 'aircraft') {
908
+	print ' selected';
909
+}
910
+?>>Aircraft</option>
911
+					    <option value="marine"<?php if ($type == 'marine') {
912
+	print ' selected';
913
+}
914
+?>>Marine</option>
915
+					    <option value="tracker"<?php if ($type == 'tracker') {
916
+	print ' selected';
917
+}
918
+?>>Tracker</option>
919
+					    <option value="satellite"<?php if ($type == 'Satellite') {
920
+	print ' selected';
921
+}
922
+?>>Satellite</option>
696 923
 					</select>
697 924
 				    </td>
698 925
 				    <td><input type="button" value="Delete" onclick="deleteRowNews(this)" /> <input type="button" value="Add" onclick="insRowNews()" /></td>
@@ -825,13 +1052,19 @@  discard block
 block discarded – undo
825 1052
 			<div id="schedules_options">
826 1053
 				<p>
827 1054
 					<label for="britishairways">British Airways API Key</label>
828
-					<input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) print $globalBritishAirwaysKey; ?>" />
1055
+					<input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) {
1056
+	print $globalBritishAirwaysKey;
1057
+}
1058
+?>" />
829 1059
 					<p class="help-block">Register an account on <a href="https://developer.ba.com/">https://developer.ba.com/</a></p>
830 1060
 				</p>
831 1061
 				<!--
832 1062
 				<p>
833 1063
 					<label for="transavia">Transavia Test API Consumer Key</label>
834
-					<input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) print $globalTransaviaKey; ?>" />
1064
+					<input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) {
1065
+	print $globalTransaviaKey;
1066
+}
1067
+?>" />
835 1068
 					<p class="help-block">Register an account on <a href="https://developer.transavia.com">https://developer.transavia.com</a></p>
836 1069
 				</p>
837 1070
 				-->
@@ -840,10 +1073,16 @@  discard block
 block discarded – undo
840 1073
 						<b>Lufthansa API Key</b>
841 1074
 						<p>
842 1075
 							<label for="lufthansakey">Key</label>
843
-							<input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) print $globalLufthansaKey['key']; ?>" />
1076
+							<input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) {
1077
+	print $globalLufthansaKey['key'];
1078
+}
1079
+?>" />
844 1080
 						</p><p>
845 1081
 							<label for="lufthansasecret">Secret</label>
846
-							<input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) print $globalLufthansaKey['secret']; ?>" />
1082
+							<input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) {
1083
+	print $globalLufthansaKey['secret'];
1084
+}
1085
+?>" />
847 1086
 						</p>
848 1087
 					</div>
849 1088
 					<p class="help-block">Register an account on <a href="https://developer.lufthansa.com/page">https://developer.lufthansa.com/page</a></p>
@@ -853,11 +1092,17 @@  discard block
 block discarded – undo
853 1092
 						<b>FlightAware API Key</b>
854 1093
 						<p>
855 1094
 							<label for="flightawareusername">Username</label>
856
-							<input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) print $globalFlightAwareUsername; ?>" />
1095
+							<input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) {
1096
+	print $globalFlightAwareUsername;
1097
+}
1098
+?>" />
857 1099
 						</p>
858 1100
 						<p>
859 1101
 							<label for="flightawarepassword">API key</label>
860
-							<input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) print $globalFlightAwarePassword; ?>" />
1102
+							<input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) {
1103
+	print $globalFlightAwarePassword;
1104
+}
1105
+?>" />
861 1106
 						</p>
862 1107
 					</div>
863 1108
 					<p class="help-block">Register an account on <a href="https://www.flightaware.com/">https://www.flightaware.com/</a></p>
@@ -874,10 +1119,22 @@  discard block
 block discarded – undo
874 1119
 				<p>
875 1120
 					<label for="mapmatchingsource">Map Matching source</label>
876 1121
 					<select name="mapmatchingsource" id="mapmatchingsource">
877
-						<option value="fam" <?php if ((isset($globalMapMatchingSource) && $globalMapMatchingSource == 'fam') || !isset($globalMatchingSource)) print 'selected="selected" '; ?>>FlightAirMap Map Matching</option>
878
-						<option value="graphhopper" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'graphhopper') print 'selected="selected" '; ?>>GraphHopper</option>
879
-						<option value="osmr" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'osmr') print 'selected="selected" '; ?>>OSMR</option>
880
-						<option value="mapbox" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'mapbox') print 'selected="selected" '; ?>>Mapbox</option>
1122
+						<option value="fam" <?php if ((isset($globalMapMatchingSource) && $globalMapMatchingSource == 'fam') || !isset($globalMatchingSource)) {
1123
+	print 'selected="selected" ';
1124
+}
1125
+?>>FlightAirMap Map Matching</option>
1126
+						<option value="graphhopper" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'graphhopper') {
1127
+	print 'selected="selected" ';
1128
+}
1129
+?>>GraphHopper</option>
1130
+						<option value="osmr" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'osmr') {
1131
+	print 'selected="selected" ';
1132
+}
1133
+?>>OSMR</option>
1134
+						<option value="mapbox" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'mapbox') {
1135
+	print 'selected="selected" ';
1136
+}
1137
+?>>Mapbox</option>
881 1138
 					</select>
882 1139
 					<p class="help-block">Mapbox need the API Key defined in map section.</p>
883 1140
 					<p class="help-block">FlightAirMap Map Matching is free, without API key but limited to about 100 input points to keep fast results.</p>
@@ -885,7 +1142,10 @@  discard block
 block discarded – undo
885 1142
 				<br />
886 1143
 				<p>
887 1144
 					<label for="graphhopper">GraphHopper API Key</label>
888
-					<input type="text" name="graphhopper" id="graphhopper" value="<?php if (isset($globalGraphHopperKey)) print $globalGraphHopperKey; ?>" />
1145
+					<input type="text" name="graphhopper" id="graphhopper" value="<?php if (isset($globalGraphHopperKey)) {
1146
+	print $globalGraphHopperKey;
1147
+}
1148
+?>" />
889 1149
 					<p class="help-block">Register an account on <a href="https://www.graphhopper.com/">https://www.graphhopper.com/</a></p>
890 1150
 				</p>
891 1151
 			</div>
@@ -903,7 +1163,10 @@  discard block
 block discarded – undo
903 1163
 			</p>
904 1164
 			<p>
905 1165
 				<label for="notamsource">URL of your feed from notaminfo.com</label>
906
-				<input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) print $globalNOTAMSource; ?>" />
1166
+				<input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) {
1167
+	print $globalNOTAMSource;
1168
+}
1169
+?>" />
907 1170
 				<p class="help-block">If you want to use world NOTAM from FlightAirMap website, leave it blank</p>
908 1171
 			</p>
909 1172
 			<br />
@@ -919,14 +1182,20 @@  discard block
 block discarded – undo
919 1182
 			<div id="metarsrc">
920 1183
 				<p>
921 1184
 					<label for="metarsource">URL of your METAR source</label>
922
-					<input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) print $globalMETARurl; ?>" />
1185
+					<input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) {
1186
+	print $globalMETARurl;
1187
+}
1188
+?>" />
923 1189
 					<p class="help-block">Use {icao} to specify where we replace by airport icao. ex : http://metar.vatsim.net/metar.php?id={icao}</p>
924 1190
 				</p>
925 1191
 			</div>
926 1192
 			<br />
927 1193
 			<p>
928 1194
 				<label for="bitly">Bit.ly access token api (used in search page)</label>
929
-				<input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) print $globalBitlyAccessToken; ?>" />
1195
+				<input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) {
1196
+	print $globalBitlyAccessToken;
1197
+}
1198
+?>" />
930 1199
 			</p>
931 1200
 			<br />
932 1201
 			<p>
@@ -942,11 +1211,26 @@  discard block
 block discarded – undo
942 1211
 			<p>
943 1212
 				<label for="geoid_source">Geoid Source</label>
944 1213
 				<select name="geoid_source" id="geoid_source">
945
-					<option value="egm96-15"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-15') print ' selected="selected"'; ?>>EGM96 15' (2.1MB)</option>
946
-					<option value="egm96-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-5') print ' selected="selected"'; ?>>EGM96 5' (19MB)</option>
947
-					<option value="egm2008-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-5') print ' selected="selected"'; ?>>EGM2008 5' (19MB)</option>
948
-					<option value="egm2008-2_5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-2_5') print ' selected="selected"'; ?>>EGM2008 2.5' (75MB)</option>
949
-					<option value="egm2008-1"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-1') print ' selected="selected"'; ?>>EGM2008 1' (470MB)</option>
1214
+					<option value="egm96-15"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-15') {
1215
+	print ' selected="selected"';
1216
+}
1217
+?>>EGM96 15' (2.1MB)</option>
1218
+					<option value="egm96-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-5') {
1219
+	print ' selected="selected"';
1220
+}
1221
+?>>EGM96 5' (19MB)</option>
1222
+					<option value="egm2008-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-5') {
1223
+	print ' selected="selected"';
1224
+}
1225
+?>>EGM2008 5' (19MB)</option>
1226
+					<option value="egm2008-2_5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-2_5') {
1227
+	print ' selected="selected"';
1228
+}
1229
+?>>EGM2008 2.5' (75MB)</option>
1230
+					<option value="egm2008-1"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-1') {
1231
+	print ' selected="selected"';
1232
+}
1233
+?>>EGM2008 1' (470MB)</option>
950 1234
 				</select>
951 1235
 				<p class="help-block">The geoid is approximated by an "earth gravity model" (EGM).</p>
952 1236
 			</p>
@@ -968,7 +1252,12 @@  discard block
 block discarded – undo
968 1252
 			</p>
969 1253
 			<p>
970 1254
 				<label for="archivemonths">Generate statistics, delete or put in archive flights older than xx months</label>
971
-				<input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) print $globalArchiveMonths; else echo '1'; ?>" />
1255
+				<input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) {
1256
+	print $globalArchiveMonths;
1257
+} else {
1258
+	echo '1';
1259
+}
1260
+?>" />
972 1261
 				<p class="help-block">0 to disable, delete old flight if <i>Archive all flights data</i> is disabled</p>
973 1262
 			</p>
974 1263
 			<p>
@@ -978,12 +1267,22 @@  discard block
 block discarded – undo
978 1267
 			</p>
979 1268
 			<p>
980 1269
 				<label for="archivekeepmonths">Keep flights data for xx months in archive</label>
981
-				<input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) print $globalArchiveKeepMonths; else echo '1'; ?>" />
1270
+				<input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) {
1271
+	print $globalArchiveKeepMonths;
1272
+} else {
1273
+	echo '1';
1274
+}
1275
+?>" />
982 1276
 				<p class="help-block">0 to disable</p>
983 1277
 			</p>
984 1278
 			<p>
985 1279
 				<label for="archivekeeptrackmonths">Keep flights track data for xx months in archive</label>
986
-				<input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) print $globalArchiveKeepTrackMonths; else echo '1'; ?>" />
1280
+				<input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) {
1281
+	print $globalArchiveKeepTrackMonths;
1282
+} else {
1283
+	echo '1';
1284
+}
1285
+?>" />
987 1286
 				<p class="help-block">0 to disable, should be less or egal to <i>Keep flights data</i> value</p>
988 1287
 			</p>
989 1288
 			<br />
@@ -993,7 +1292,12 @@  discard block
 block discarded – undo
993 1292
 				<p class="help-block">Uncheck if the script is running as cron job. You should always run it as daemon when it's possible.</p>
994 1293
 				<div id="cronends"> 
995 1294
 					<label for="cronend">Run script for xx seconds</label>
996
-					<input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) print $globalCronEnd; else print '0'; ?>" />
1295
+					<input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) {
1296
+	print $globalCronEnd;
1297
+} else {
1298
+	print '0';
1299
+}
1300
+?>" />
997 1301
 					<p class="help-block">Set to 0 to disable. Should be disabled if source is URL.</p>
998 1302
 				</div>
999 1303
 			</p>
@@ -1046,20 +1350,40 @@  discard block
 block discarded – undo
1046 1350
 			<br />
1047 1351
 			<p>
1048 1352
 				<label for="refresh">Show flights detected since xxx seconds</label>
1049
-				<input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) echo $globalLiveInterval; else echo '200'; ?>" />
1353
+				<input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) {
1354
+	echo $globalLiveInterval;
1355
+} else {
1356
+	echo '200';
1357
+}
1358
+?>" />
1050 1359
 			</p>
1051 1360
 			<p>
1052 1361
 				<label for="maprefresh">Live map refresh (in seconds)</label>
1053
-				<input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) echo $globalMapRefresh; else echo '30'; ?>" />
1362
+				<input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) {
1363
+	echo $globalMapRefresh;
1364
+} else {
1365
+	echo '30';
1366
+}
1367
+?>" />
1054 1368
 			</p>
1055 1369
 			<p>
1056 1370
 				<label for="mapidle">Map idle timeout (in minutes)</label>
1057
-				<input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) echo $globalMapIdleTimeout; else echo '30'; ?>" />
1371
+				<input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) {
1372
+	echo $globalMapIdleTimeout;
1373
+} else {
1374
+	echo '30';
1375
+}
1376
+?>" />
1058 1377
 				<p class="help-block">0 to disable</p>
1059 1378
 			</p>
1060 1379
 			<p>
1061 1380
 				<label for="minfetch">HTTP/file source fetch every xxx seconds</label>
1062
-				<input type="number" name="minfetch" id="minfetch" value="<?php if (isset($globalMinFetch)) echo $globalMinFetch; else echo '20'; ?>" />
1381
+				<input type="number" name="minfetch" id="minfetch" value="<?php if (isset($globalMinFetch)) {
1382
+	echo $globalMinFetch;
1383
+} else {
1384
+	echo '20';
1385
+}
1386
+?>" />
1063 1387
 			</p>
1064 1388
 			<p>
1065 1389
 				<label for="bbox">Only display flights that we can see on screen (bounding box)</label>
@@ -1073,12 +1397,20 @@  discard block
 block discarded – undo
1073 1397
 			<br />
1074 1398
 			<p>
1075 1399
 				<label for="closestmindist">Distance to airport set as arrival (in km)</label>
1076
-				<input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) echo $globalClosestMinDist; else echo '50'; ?>" />
1400
+				<input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) {
1401
+	echo $globalClosestMinDist;
1402
+} else {
1403
+	echo '50';
1404
+}
1405
+?>" />
1077 1406
 			</p>
1078 1407
 			<br />
1079 1408
 			<p>
1080 1409
 				<label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label>
1081
-				<input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" />
1410
+				<input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) {
1411
+	echo $globalAircraftSize;
1412
+}
1413
+?>" />
1082 1414
 			</p>
1083 1415
 			<br />
1084 1416
 			<p>
@@ -1097,7 +1429,12 @@  discard block
 block discarded – undo
1097 1429
 			    if (extension_loaded('gd') && function_exists('gd_info')) {
1098 1430
 			?>
1099 1431
 				<label for="aircrafticoncolor">Color of aircraft icon on map</label>
1100
-				<input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) echo $globalAircraftIconColor; else echo '1a3151'; ?>" />
1432
+				<input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) {
1433
+	echo $globalAircraftIconColor;
1434
+} else {
1435
+	echo '1a3151';
1436
+}
1437
+?>" />
1101 1438
 			<?php
1102 1439
 				if (!is_writable('../cache')) {
1103 1440
 			?>
@@ -1115,14 +1452,27 @@  discard block
 block discarded – undo
1115 1452
 			<p>
1116 1453
 				<label for="airportzoom">Zoom level minimum to see airports icons</label>
1117 1454
 				<div class="range">
1118
-					<input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?>" />
1119
-					<output id="range"><?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?></output>
1455
+					<input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) {
1456
+	echo $globalAirportZoom;
1457
+} else {
1458
+	echo '7';
1459
+}
1460
+?>" />
1461
+					<output id="range"><?php if (isset($globalAirportZoom)) {
1462
+	echo $globalAirportZoom;
1463
+} else {
1464
+	echo '7';
1465
+}
1466
+?></output>
1120 1467
 				</div>
1121 1468
 			</p>
1122 1469
 			<br />
1123 1470
 			<p>
1124 1471
 				<label for="customcss">Custom CSS web path</label>
1125
-				<input type="text" name="customcss" id="customcss" value="<?php if (isset($globalCustomCSS)) echo $globalCustomCSS; ?>" />
1472
+				<input type="text" name="customcss" id="customcss" value="<?php if (isset($globalCustomCSS)) {
1473
+	echo $globalCustomCSS;
1474
+}
1475
+?>" />
1126 1476
 			</p>
1127 1477
 		</fieldset>
1128 1478
 		<input type="submit" name="submit" value="Create/Update database & write setup" />
@@ -1149,8 +1499,12 @@  discard block
 block discarded – undo
1149 1499
 	$dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING);
1150 1500
 	$dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING);
1151 1501
 
1152
-	if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded';
1153
-	if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded';
1502
+	if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) {
1503
+		$error .= 'Mysql driver for PDO must be loaded';
1504
+	}
1505
+	if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) {
1506
+		$error .= 'PosgreSQL driver for PDO must be loaded';
1507
+	}
1154 1508
 	
1155 1509
 	$_SESSION['database_root'] = $dbroot;
1156 1510
 	$_SESSION['database_rootpass'] = $dbrootpass;
@@ -1218,15 +1572,23 @@  discard block
 block discarded – undo
1218 1572
 	$source_city = $_POST['source_city'];
1219 1573
 	$source_country = $_POST['source_country'];
1220 1574
 	$source_ref = $_POST['source_ref'];
1221
-	if (isset($source_id)) $source_id = $_POST['source_id'];
1222
-	else $source_id = array();
1575
+	if (isset($source_id)) {
1576
+		$source_id = $_POST['source_id'];
1577
+	} else {
1578
+		$source_id = array();
1579
+	}
1223 1580
 	
1224 1581
 	$sources = array();
1225 1582
 	foreach ($source_name as $keys => $name) {
1226
-	    if (isset($source_id[$keys])) $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]);
1227
-	    else $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]);
1583
+	    if (isset($source_id[$keys])) {
1584
+	    	$sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]);
1585
+	    } else {
1586
+	    	$sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]);
1587
+	    }
1588
+	}
1589
+	if (count($sources) > 0) {
1590
+		$_SESSION['sources'] = $sources;
1228 1591
 	}
1229
-	if (count($sources) > 0) $_SESSION['sources'] = $sources;
1230 1592
 
1231 1593
 	$newsurl = $_POST['newsurl'];
1232 1594
 	$newslng = $_POST['newslang'];
@@ -1239,7 +1601,9 @@  discard block
 block discarded – undo
1239 1601
 		$lng = $newslng[$newskey];
1240 1602
 		if (isset($newsfeeds[$type][$lng])) {
1241 1603
 		    $newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng],array($url));
1242
-		} else $newsfeeds[$type][$lng] = array($url);
1604
+		} else {
1605
+			$newsfeeds[$type][$lng] = array($url);
1606
+		}
1243 1607
 	    }
1244 1608
 	}
1245 1609
 	$settings = array_merge($settings,array('globalNewsFeeds' => $newsfeeds));
@@ -1263,17 +1627,29 @@  discard block
 block discarded – undo
1263 1627
 	$datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING);
1264 1628
 
1265 1629
 	$globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING);
1266
-	if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE'));
1267
-	else $settings = array_merge($settings,array('globalAircraft' => 'FALSE'));
1630
+	if ($globalaircraft == 'aircraft') {
1631
+		$settings = array_merge($settings,array('globalAircraft' => 'TRUE'));
1632
+	} else {
1633
+		$settings = array_merge($settings,array('globalAircraft' => 'FALSE'));
1634
+	}
1268 1635
 	$globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING);
1269
-	if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE'));
1270
-	else $settings = array_merge($settings,array('globalTracker' => 'FALSE'));
1636
+	if ($globaltracker == 'tracker') {
1637
+		$settings = array_merge($settings,array('globalTracker' => 'TRUE'));
1638
+	} else {
1639
+		$settings = array_merge($settings,array('globalTracker' => 'FALSE'));
1640
+	}
1271 1641
 	$globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING);
1272
-	if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE'));
1273
-	else $settings = array_merge($settings,array('globalMarine' => 'FALSE'));
1642
+	if ($globalmarine == 'marine') {
1643
+		$settings = array_merge($settings,array('globalMarine' => 'TRUE'));
1644
+	} else {
1645
+		$settings = array_merge($settings,array('globalMarine' => 'FALSE'));
1646
+	}
1274 1647
 	$globalsatellite = filter_input(INPUT_POST,'globalsatellite',FILTER_SANITIZE_STRING);
1275
-	if ($globalsatellite == 'satellite') $settings = array_merge($settings,array('globalSatellite' => 'TRUE'));
1276
-	else $settings = array_merge($settings,array('globalSatellite' => 'FALSE'));
1648
+	if ($globalsatellite == 'satellite') {
1649
+		$settings = array_merge($settings,array('globalSatellite' => 'TRUE'));
1650
+	} else {
1651
+		$settings = array_merge($settings,array('globalSatellite' => 'FALSE'));
1652
+	}
1277 1653
 
1278 1654
 /*	
1279 1655
 	$globalSBS1Hosts = array();
@@ -1295,23 +1671,37 @@  discard block
 block discarded – undo
1295 1671
 	$name = $_POST['name'];
1296 1672
 	$format = $_POST['format'];
1297 1673
 	$timezones = $_POST['timezones'];
1298
-	if (isset($_POST['sourcestats'])) $sourcestats = $_POST['sourcestats'];
1299
-	else $sourcestats = array();
1300
-	if (isset($_POST['noarchive'])) $noarchive = $_POST['noarchive'];
1301
-	else $noarchive = array();
1674
+	if (isset($_POST['sourcestats'])) {
1675
+		$sourcestats = $_POST['sourcestats'];
1676
+	} else {
1677
+		$sourcestats = array();
1678
+	}
1679
+	if (isset($_POST['noarchive'])) {
1680
+		$noarchive = $_POST['noarchive'];
1681
+	} else {
1682
+		$noarchive = array();
1683
+	}
1302 1684
 	$gSources = array();
1303 1685
 	$forcepilots = false;
1304 1686
 	foreach ($host as $key => $h) {
1305
-		if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) $cov = 'TRUE';
1306
-		else $cov = 'FALSE';
1307
-		if (isset($noarchive[$key]) && $noarchive[$key] == 1) $arch = 'TRUE';
1308
-		else $arch = 'FALSE';
1687
+		if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) {
1688
+			$cov = 'TRUE';
1689
+		} else {
1690
+			$cov = 'FALSE';
1691
+		}
1692
+		if (isset($noarchive[$key]) && $noarchive[$key] == 1) {
1693
+			$arch = 'TRUE';
1694
+		} else {
1695
+			$arch = 'FALSE';
1696
+		}
1309 1697
 		if (strpos($format[$key],'_callback')) {
1310 1698
 			$gSources[] = array('host' => $h, 'pass' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'TRUE');
1311 1699
 		} elseif ($h != '' || $name[$key] != '') {
1312 1700
 			$gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'FALSE');
1313 1701
 		}
1314
-		if ($format[$key] == 'airwhere') $forcepilots = true;
1702
+		if ($format[$key] == 'airwhere') {
1703
+			$forcepilots = true;
1704
+		}
1315 1705
 	}
1316 1706
 	$settings = array_merge($settings,array('globalSources' => $gSources));
1317 1707
 
@@ -1342,7 +1732,9 @@  discard block
 block discarded – undo
1342 1732
 	$zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT);
1343 1733
 	if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') {
1344 1734
 		$settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance)));
1345
-	} else $settings = array_merge($settings,array('globalDistanceIgnore' => array()));
1735
+	} else {
1736
+		$settings = array_merge($settings,array('globalDistanceIgnore' => array()));
1737
+	}
1346 1738
 
1347 1739
 	$refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT);
1348 1740
 	$settings = array_merge($settings,array('globalLiveInterval' => $refresh));
@@ -1383,7 +1775,9 @@  discard block
 block discarded – undo
1383 1775
 
1384 1776
 	// Create in settings.php keys not yet configurable if not already here
1385 1777
 	//if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => ''));
1386
-	if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE'));
1778
+	if (!isset($globalDebug)) {
1779
+		$settings = array_merge($settings,array('globalDebug' => 'TRUE'));
1780
+	}
1387 1781
 
1388 1782
 	$resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING);
1389 1783
 	if ($resetyearstats == 'resetyearstats') {
@@ -1426,37 +1820,56 @@  discard block
 block discarded – undo
1426 1820
 	}
1427 1821
 */
1428 1822
 	$settings = array_merge($settings,array('globalFlightAware' => 'FALSE'));
1429
-	if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE'));
1430
-	else $settings = array_merge($settings,array('globalSBS1' => 'FALSE'));
1431
-	if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE'));
1432
-	else $settings = array_merge($settings,array('globalAPRS' => 'FALSE'));
1823
+	if ($globalsbs == 'sbs') {
1824
+		$settings = array_merge($settings,array('globalSBS1' => 'TRUE'));
1825
+	} else {
1826
+		$settings = array_merge($settings,array('globalSBS1' => 'FALSE'));
1827
+	}
1828
+	if ($globalaprs == 'aprs') {
1829
+		$settings = array_merge($settings,array('globalAPRS' => 'TRUE'));
1830
+	} else {
1831
+		$settings = array_merge($settings,array('globalAPRS' => 'FALSE'));
1832
+	}
1433 1833
 	$va = false;
1434 1834
 	if ($globalivao == 'ivao') {
1435 1835
 		$settings = array_merge($settings,array('globalIVAO' => 'TRUE'));
1436 1836
 		$va = true;
1437
-	} else $settings = array_merge($settings,array('globalIVAO' => 'FALSE'));
1837
+	} else {
1838
+		$settings = array_merge($settings,array('globalIVAO' => 'FALSE'));
1839
+	}
1438 1840
 	if ($globalvatsim == 'vatsim') {
1439 1841
 		$settings = array_merge($settings,array('globalVATSIM' => 'TRUE'));
1440 1842
 		$va = true;
1441
-	} else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE'));
1843
+	} else {
1844
+		$settings = array_merge($settings,array('globalVATSIM' => 'FALSE'));
1845
+	}
1442 1846
 	if ($globalphpvms == 'phpvms') {
1443 1847
 		$settings = array_merge($settings,array('globalphpVMS' => 'TRUE'));
1444 1848
 		$va = true;
1445
-	} else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE'));
1849
+	} else {
1850
+		$settings = array_merge($settings,array('globalphpVMS' => 'FALSE'));
1851
+	}
1446 1852
 	if ($globalvam == 'vam') {
1447 1853
 		$settings = array_merge($settings,array('globalVAM' => 'TRUE'));
1448 1854
 		$va = true;
1449
-	} else $settings = array_merge($settings,array('globalVAM' => 'FALSE'));
1855
+	} else {
1856
+		$settings = array_merge($settings,array('globalVAM' => 'FALSE'));
1857
+	}
1450 1858
 	if ($va) {
1451 1859
 		$settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE'));
1452
-	} else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE'));
1860
+	} else {
1861
+		$settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE'));
1862
+	}
1453 1863
 	if ($globalva == 'va' || $va) {
1454 1864
 		$settings = array_merge($settings,array('globalVA' => 'TRUE'));
1455 1865
 		$settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE'));
1456 1866
 	} else {
1457 1867
 		$settings = array_merge($settings,array('globalVA' => 'FALSE'));
1458
-		if ($forcepilots) $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE'));
1459
-		else $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE'));
1868
+		if ($forcepilots) {
1869
+			$settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE'));
1870
+		} else {
1871
+			$settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE'));
1872
+		}
1460 1873
 	}
1461 1874
 	
1462 1875
 	
@@ -1679,7 +2092,9 @@  discard block
 block discarded – undo
1679 2092
 	$graphhopper = filter_input(INPUT_POST,'graphhopper',FILTER_SANITIZE_STRING);
1680 2093
 	$settings = array_merge($settings,array('globalGraphHopperKey' => $graphhopper));
1681 2094
 
1682
-	if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE'));
2095
+	if (!isset($globalTransaction)) {
2096
+		$settings = array_merge($settings,array('globalTransaction' => 'TRUE'));
2097
+	}
1683 2098
 
1684 2099
 	// Set some defaults values...
1685 2100
 	if (!isset($globalAircraftImageSources)) {
@@ -1694,15 +2109,23 @@  discard block
 block discarded – undo
1694 2109
 
1695 2110
 	$settings = array_merge($settings,array('globalInstalled' => 'TRUE'));
1696 2111
 
1697
-	if ($error == '') settings::modify_settings($settings);
1698
-	if ($error == '') settings::comment_settings($settings_comment);
2112
+	if ($error == '') {
2113
+		settings::modify_settings($settings);
2114
+	}
2115
+	if ($error == '') {
2116
+		settings::comment_settings($settings_comment);
2117
+	}
1699 2118
 	if ($error != '') {
1700 2119
 		print '<div class="info column">'.$error.'</div>';
1701 2120
 		require('../footer.php');
1702 2121
 		exit;
1703 2122
 	} else {
1704
-		if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') $_SESSION['waypoints'] = 1;
1705
-		if (isset($_POST['owner']) && $_POST['owner'] == 'owner') $_SESSION['owner'] = 1;
2123
+		if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') {
2124
+			$_SESSION['waypoints'] = 1;
2125
+		}
2126
+		if (isset($_POST['owner']) && $_POST['owner'] == 'owner') {
2127
+			$_SESSION['owner'] = 1;
2128
+		}
1706 2129
 		if (isset($_POST['createdb'])) {
1707 2130
 			$_SESSION['install'] = 'database_create';
1708 2131
 		} else {
@@ -1739,10 +2162,18 @@  discard block
 block discarded – undo
1739 2162
 	$popw = false;
1740 2163
 	foreach ($_SESSION['done'] as $done) {
1741 2164
 	    print '<li>'.$done.'....<strong>SUCCESS</strong></li>';
1742
-	    if ($done == 'Create database') $pop = true;
1743
-	    if ($_SESSION['install'] == 'database_create') $pop = true;
1744
-	    if ($_SESSION['install'] == 'database_import') $popi = true;
1745
-	    if ($_SESSION['install'] == 'waypoints') $popw = true;
2165
+	    if ($done == 'Create database') {
2166
+	    	$pop = true;
2167
+	    }
2168
+	    if ($_SESSION['install'] == 'database_create') {
2169
+	    	$pop = true;
2170
+	    }
2171
+	    if ($_SESSION['install'] == 'database_import') {
2172
+	    	$popi = true;
2173
+	    }
2174
+	    if ($_SESSION['install'] == 'waypoints') {
2175
+	    	$popw = true;
2176
+	    }
1746 2177
 	}
1747 2178
 	if ($pop) {
1748 2179
 	    sleep(5);
@@ -1753,7 +2184,9 @@  discard block
 block discarded – undo
1753 2184
 	} else if ($popw) {
1754 2185
 	    sleep(5);
1755 2186
 	    print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>';
1756
-	} else print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>';
2187
+	} else {
2188
+		print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>';
2189
+	}
1757 2190
 	print '</div></ul>';
1758 2191
 	print '<div id="error"></div>';
1759 2192
 /*	foreach ($_SESSION['done'] as $done) {
Please login to merge, or discard this patch.
require/class.MapMatching.php 1 patch
Braces   +54 added lines, -18 removed lines patch added patch discarded remove patch
@@ -46,7 +46,9 @@  discard block
 block discarded – undo
46 46
 		$gpx .= '<trkseg>';
47 47
 		foreach($spotter_history_array as $spotter_data) {
48 48
 			$gpx .= '<trkpt lat="'.sprintf("%.8f",$spotter_data['latitude']).'" lon="'.sprintf("%.8f",$spotter_data['longitude']).'">';
49
-			if (isset($spotter_data['altitude'])) $gpx .= '<ele>'.sprintf("%.6f",$spotter_data['altitude']).'</ele>';
49
+			if (isset($spotter_data['altitude'])) {
50
+				$gpx .= '<ele>'.sprintf("%.6f",$spotter_data['altitude']).'</ele>';
51
+			}
50 52
 			$gpx .= '<time>'.date("Y-m-d\TH:i:s\Z",strtotime($spotter_data['date'])).'</time>';
51 53
 			$gpx .= '</trkpt>';
52 54
 		}
@@ -82,9 +84,15 @@  discard block
 block discarded – undo
82 84
 
83 85
 	public function TrackMatching($spotter_history_array) {
84 86
 		global $globalMapMatchingMaxPts, $globalTrackMatchingAppKey, $globalTrackMatchingAppId;
85
-		if (!isset($globalMapMatchingMaxPts)) $globalMapMatchingMaxPts = 100;
86
-		if (count($spotter_history_array) < 2) return $spotter_history_array;
87
-		if (count($spotter_history_array) > $globalMapMatchingMaxPts) $spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts);
87
+		if (!isset($globalMapMatchingMaxPts)) {
88
+			$globalMapMatchingMaxPts = 100;
89
+		}
90
+		if (count($spotter_history_array) < 2) {
91
+			return $spotter_history_array;
92
+		}
93
+		if (count($spotter_history_array) > $globalMapMatchingMaxPts) {
94
+			$spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts);
95
+		}
88 96
 		$data = $this->create_gpx($spotter_history_array);
89 97
 		$url = 'https://test.roadmatching.com/rest/mapmatch/?app_id='.$globalTrackMatchingAppId.'&app_key='.$globalTrackMatchingAppKey.'&output.waypoints=true';
90 98
 		$Common = new Common();
@@ -111,8 +119,12 @@  discard block
 block discarded – undo
111 119
 	*/
112 120
 	public function GraphHopper($spotter_history_array) {
113 121
 		global $globalMapMatchingMaxPts, $globalGraphHopperKey;
114
-		if (!isset($globalMapMatchingMaxPts)) $globalMapMatchingMaxPts = 100;
115
-		if (count($spotter_history_array) < 2) return $spotter_history_array;
122
+		if (!isset($globalMapMatchingMaxPts)) {
123
+			$globalMapMatchingMaxPts = 100;
124
+		}
125
+		if (count($spotter_history_array) < 2) {
126
+			return $spotter_history_array;
127
+		}
116 128
 		$spotter_history_initial_array = array();
117 129
 		if (count($spotter_history_array) > $globalMapMatchingMaxPts) {
118 130
 			$spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts);
@@ -142,8 +154,12 @@  discard block
 block discarded – undo
142 154
 	*/
143 155
 	public function FAMMapMatching($spotter_history_array) {
144 156
 		global $globalMapMatchingMaxPts, $globalGraphHopperKey;
145
-		if (!isset($globalMapMatchingMaxPts)) $globalMapMatchingMaxPts = 100;
146
-		if (count($spotter_history_array) < 2) return $spotter_history_array;
157
+		if (!isset($globalMapMatchingMaxPts)) {
158
+			$globalMapMatchingMaxPts = 100;
159
+		}
160
+		if (count($spotter_history_array) < 2) {
161
+			return $spotter_history_array;
162
+		}
147 163
 		$spotter_history_initial_array = array();
148 164
 		if (count($spotter_history_array) > $globalMapMatchingMaxPts) {
149 165
 			$spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts);
@@ -174,8 +190,12 @@  discard block
 block discarded – undo
174 190
 	*/
175 191
 	public function osmr($spotter_history_array) {
176 192
 		global $globalMapMatchingMaxPts;
177
-		if (!isset($globalMapMatchingMaxPts)) $globalMapMatchingMaxPts = 50;
178
-		if (count($spotter_history_array) < 2) return $spotter_history_array;
193
+		if (!isset($globalMapMatchingMaxPts)) {
194
+			$globalMapMatchingMaxPts = 50;
195
+		}
196
+		if (count($spotter_history_array) < 2) {
197
+			return $spotter_history_array;
198
+		}
179 199
 		$spotter_history_initial_array = array();
180 200
 		if (count($spotter_history_array) > $globalMapMatchingMaxPts) {
181 201
 			$spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts);
@@ -185,11 +205,17 @@  discard block
 block discarded – undo
185 205
 		$ts = '';
186 206
 		$rd = '';
187 207
 		foreach ($spotter_history_array as $spotter_data) {
188
-			if ($coord != '') $coord .= ';';
208
+			if ($coord != '') {
209
+				$coord .= ';';
210
+			}
189 211
 			$coord .= $spotter_data['longitude'].','.$spotter_data['latitude'];
190
-			if ($ts != '') $ts .= ';';
212
+			if ($ts != '') {
213
+				$ts .= ';';
214
+			}
191 215
 			$ts .= strtotime($spotter_data['date']);
192
-			if ($rd != '') $rd .= ';';
216
+			if ($rd != '') {
217
+				$rd .= ';';
218
+			}
193 219
 			$rd .= '20';
194 220
 		}
195 221
 		$url = 'https://router.project-osrm.org/match/v1/driving/'.$coord.'?timestamps='.$ts.'&overview=full&geometries=geojson&tidy=true&gaps=ignore';
@@ -215,8 +241,12 @@  discard block
 block discarded – undo
215 241
 	*/
216 242
 	public function mapbox($spotter_history_array) {
217 243
 		global $globalMapMatchingMaxPts, $globalMapboxToken;
218
-		if (!isset($globalMapMatchingMaxPts)) $globalMapMatchingMaxPts = 60;
219
-		if (count($spotter_history_array) < 2) return $spotter_history_array;
244
+		if (!isset($globalMapMatchingMaxPts)) {
245
+			$globalMapMatchingMaxPts = 60;
246
+		}
247
+		if (count($spotter_history_array) < 2) {
248
+			return $spotter_history_array;
249
+		}
220 250
 		$spotter_history_initial_array = array();
221 251
 		if (count($spotter_history_array) > $globalMapMatchingMaxPts) {
222 252
 			$spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts);
@@ -226,11 +256,17 @@  discard block
 block discarded – undo
226 256
 		$ts = '';
227 257
 		$rd = '';
228 258
 		foreach ($spotter_history_array as $spotter_data) {
229
-			if ($coord != '') $coord .= ';';
259
+			if ($coord != '') {
260
+				$coord .= ';';
261
+			}
230 262
 			$coord .= $spotter_data['longitude'].','.$spotter_data['latitude'];
231
-			if ($ts != '') $ts .= ';';
263
+			if ($ts != '') {
264
+				$ts .= ';';
265
+			}
232 266
 			$ts .= strtotime($spotter_data['date']);
233
-			if ($rd != '') $rd .= ';';
267
+			if ($rd != '') {
268
+				$rd .= ';';
269
+			}
234 270
 			$rd .= '20';
235 271
 		}
236 272
 		//$url = 'https://api.mapbox.com/matching/v5/mapbox/driving/'.$coord.'?access_token='.$globalMapboxToken.'&timestamps='.$ts.'&overview=full&tidy=true&geometries=geojson&radiuses='.$rd;
Please login to merge, or discard this patch.
index.php 1 patch
Braces   +489 added lines, -123 removed lines patch added patch discarded remove patch
@@ -49,7 +49,10 @@  discard block
 block discarded – undo
49 49
 <?php
50 50
     if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
51 51
 ?>
52
-<script src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) print '?tsk='.$tsk; ?>"></script>
52
+<script src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) {
53
+	print '?tsk='.$tsk;
54
+}
55
+?>"></script>
53 56
 <?php
54 57
 	if (!isset($globalAircraft) || $globalAircraft) {
55 58
 ?>
@@ -163,11 +166,26 @@  discard block
 block discarded – undo
163 166
 				<li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam();" /><?php echo _("Display NOTAM"); ?></label></div></li>
164 167
 				<li><?php echo _("NOTAM scope:"); ?>
165 168
 					<select class="selectpicker" onchange="notamscope(this);">
166
-						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') print ' selected'; ?>>All</option>
167
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') print ' selected'; ?>>Airport/Enroute warning</option>
168
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') print ' selected'; ?>>Airport warning</option>
169
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') print ' selected'; ?>>Navigation warning</option>
170
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') print ' selected'; ?>>Enroute warning</option>
169
+						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') {
170
+	print ' selected';
171
+}
172
+?>>All</option>
173
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') {
174
+	print ' selected';
175
+}
176
+?>>Airport/Enroute warning</option>
177
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') {
178
+	print ' selected';
179
+}
180
+?>>Airport warning</option>
181
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') {
182
+	print ' selected';
183
+}
184
+?>>Navigation warning</option>
185
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') {
186
+	print ' selected';
187
+}
188
+?>>Enroute warning</option>
171 189
 					</select
172 190
 				</li>
173 191
 			</ul>
@@ -195,7 +213,12 @@  discard block
 block discarded – undo
195 213
 		        <div class="form-group">
196 214
 			    <label>From (UTC):</label>
197 215
 		            <div class='input-group date' id='datetimepicker1'>
198
-            			<input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) print $_POST['start_date']; elseif (isset($_COOKIE['archive_begin'])) print date("m/d/Y h:i a",$_COOKIE['archive_begin']); ?>" required />
216
+            			<input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) {
217
+	print $_POST['start_date'];
218
+} elseif (isset($_COOKIE['archive_begin'])) {
219
+	print date("m/d/Y h:i a",$_COOKIE['archive_begin']);
220
+}
221
+?>" required />
199 222
 		                <span class="input-group-addon">
200 223
             			    <span class="glyphicon glyphicon-calendar"></span>
201 224
 		                </span>
@@ -204,7 +227,12 @@  discard block
 block discarded – undo
204 227
 		        <div class="form-group">
205 228
 			    <label>To (UTC):</label>
206 229
 		            <div class='input-group date' id='datetimepicker2'>
207
-		                <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) print $_POST['end_date']; elseif (isset($_COOKIE['archive_end'])) print date("m/d/Y h:i a",$_COOKIE['archive_end']); ?>" />
230
+		                <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) {
231
+	print $_POST['end_date'];
232
+} elseif (isset($_COOKIE['archive_end'])) {
233
+	print date("m/d/Y h:i a",$_COOKIE['archive_end']);
234
+}
235
+?>" />
208 236
             			<span class="input-group-addon">
209 237
 		                    <span class="glyphicon glyphicon-calendar"></span>
210 238
             			</span>
@@ -229,8 +257,20 @@  discard block
 block discarded – undo
229 257
 			</script>
230 258
 		    <li><?php echo _("Playback speed:"); ?>
231 259
 			<div class="range">
232
-			    <input type="range" min="0" max="50" step="1" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php  if (isset($_POST['archivespeed'])) print $_POST['archivespeed']; elseif (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?>">
233
-			    <output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?></output>
260
+			    <input type="range" min="0" max="50" step="1" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php  if (isset($_POST['archivespeed'])) {
261
+	print $_POST['archivespeed'];
262
+} elseif (isset($_COOKIE['archive_speed'])) {
263
+	print $_COOKIE['archive_speed'];
264
+} else {
265
+	print '1';
266
+}
267
+?>">
268
+			    <output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) {
269
+	print $_COOKIE['archive_speed'];
270
+} else {
271
+	print '1';
272
+}
273
+?></output>
234 274
 			</div>
235 275
 		    </li>
236 276
 		    <li><input type="submit" name="archive" value="Show archive" class="btn btn-primary" /></li>
@@ -252,29 +292,53 @@  discard block
 block discarded – undo
252 292
 		    <li><?php echo _("Type of Map:"); ?>
253 293
 			<select  class="selectpicker" onchange="mapType(this);">
254 294
 			    <?php
255
-				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider;
256
-				else $MapType = $_COOKIE['MapType'];
295
+				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') {
296
+					$MapType = $globalMapProvider;
297
+				} else {
298
+					$MapType = $_COOKIE['MapType'];
299
+				}
257 300
 			    ?>
258 301
 			    <?php
259 302
 				if (isset($globalMapOffline) && $globalMapOffline === TRUE) {
260 303
 			    ?>
261
-			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option>
304
+			    <option value="offline"<?php if ($MapType == 'offline') {
305
+	print ' selected';
306
+}
307
+?>>Natural Earth (local)</option>
262 308
 			    <?php
263 309
 				} else {
264 310
 				    if (file_exists(dirname(__FILE__).'/js/Cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml')) {
265 311
 			    ?>
266
-			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option>
312
+			    <option value="offline"<?php if ($MapType == 'offline') {
313
+	print ' selected';
314
+}
315
+?>>Natural Earth (local)</option>
267 316
 			    <?php
268 317
 				    }
269 318
 			    ?>
270
-			    <option value="ArcGIS-Streetmap"<?php if ($MapType == 'ArcGIS-Streetmap') print ' selected'; ?>>ArcGIS Streetmap</option>
271
-			    <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Satellite') print ' selected'; ?>>ArcGIS Satellite</option>
319
+			    <option value="ArcGIS-Streetmap"<?php if ($MapType == 'ArcGIS-Streetmap') {
320
+	print ' selected';
321
+}
322
+?>>ArcGIS Streetmap</option>
323
+			    <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Satellite') {
324
+	print ' selected';
325
+}
326
+?>>ArcGIS Satellite</option>
272 327
 			    <?php
273 328
 				    if (isset($globalBingMapKey) && $globalBingMapKey != '') {
274 329
 			    ?>
275
-			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option>
276
-			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option>
277
-			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option>
330
+			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') {
331
+	print ' selected';
332
+}
333
+?>>Bing-Aerial</option>
334
+			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') {
335
+	print ' selected';
336
+}
337
+?>>Bing-Hybrid</option>
338
+			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') {
339
+	print ' selected';
340
+}
341
+?>>Bing-Road</option>
278 342
 			    <?php
279 343
 				    }
280 344
 			    ?>
@@ -284,59 +348,143 @@  discard block
 block discarded – undo
284 348
 			    <?php
285 349
 					if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
286 350
 			    ?>
287
-			    <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option>
288
-			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option>
289
-			    <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option>
351
+			    <option value="Here-Aerial"<?php if ($MapType == 'Here') {
352
+	print ' selected';
353
+}
354
+?>>Here-Aerial</option>
355
+			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') {
356
+	print ' selected';
357
+}
358
+?>>Here-Hybrid</option>
359
+			    <option value="Here-Road"<?php if ($MapType == 'Here') {
360
+	print ' selected';
361
+}
362
+?>>Here-Road</option>
290 363
 			    <?php
291 364
 					}
292 365
 			    ?>
293 366
 			    <?php
294 367
 					if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
295 368
 			    ?>
296
-			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option>
297
-			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option>
298
-			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option>
299
-			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option>
369
+			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') {
370
+	print ' selected';
371
+}
372
+?>>Google Roadmap</option>
373
+			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') {
374
+	print ' selected';
375
+}
376
+?>>Google Satellite</option>
377
+			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') {
378
+	print ' selected';
379
+}
380
+?>>Google Hybrid</option>
381
+			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') {
382
+	print ' selected';
383
+}
384
+?>>Google Terrain</option>
300 385
 			    <?php
301 386
 					}
302 387
 			    ?>
303 388
 			    <?php
304 389
 					if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
305 390
 			    ?>
306
-			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option>
307
-			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option>
308
-			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option>
391
+			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') {
392
+	print ' selected';
393
+}
394
+?>>MapQuest-OSM</option>
395
+			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') {
396
+	print ' selected';
397
+}
398
+?>>MapQuest-Aerial</option>
399
+			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') {
400
+	print ' selected';
401
+}
402
+?>>MapQuest-Hybrid</option>
309 403
 			    <?php
310 404
 					}
311 405
 			    ?>
312
-			    <option value="NatGeo-Street"<?php if ($MapType == 'NatGeo-Street') print ' selected'; ?>>National Geographic Street</option>
313
-			    <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option>
314
-			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth</option>
406
+			    <option value="NatGeo-Street"<?php if ($MapType == 'NatGeo-Street') {
407
+	print ' selected';
408
+}
409
+?>>National Geographic Street</option>
410
+			    <option value="Yandex"<?php if ($MapType == 'Yandex') {
411
+	print ' selected';
412
+}
413
+?>>Yandex</option>
414
+			    <option value="offline"<?php if ($MapType == 'offline') {
415
+	print ' selected';
416
+}
417
+?>>Natural Earth</option>
315 418
 			    <?php
316 419
 				    }
317 420
 			    ?>
318 421
 			    <?php
319 422
 				    if (isset($globalMapboxToken) && $globalMapboxToken != '') {
320
-					if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default';
321
-					else $MapBoxId = $_COOKIE['MapTypeId'];
423
+					if (!isset($_COOKIE['MapTypeId'])) {
424
+						$MapBoxId = 'default';
425
+					} else {
426
+						$MapBoxId = $_COOKIE['MapTypeId'];
427
+					}
322 428
 			    ?>
323
-			    <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') print ' selected'; ?>>Mapbox GL</option>
324
-			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option>
325
-			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option>
326
-			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option>
327
-			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') print ' selected'; ?>>Mapbox dark</option>
328
-			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') print ' selected'; ?>>Mapbox satellite</option>
329
-			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') print ' selected'; ?>>Mapbox streets-satellite</option>
330
-			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') print ' selected'; ?>>Mapbox streets-basic</option>
331
-			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') print ' selected'; ?>>Mapbox comic</option>
332
-			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') print ' selected'; ?>>Mapbox outdoors</option>
333
-			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') print ' selected'; ?>>Mapbox pencil</option>
334
-			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option>
335
-			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option>
429
+			    <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') {
430
+	print ' selected';
431
+}
432
+?>>Mapbox GL</option>
433
+			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') {
434
+	print ' selected';
435
+}
436
+?>>Mapbox default</option>
437
+			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') {
438
+	print ' selected';
439
+}
440
+?>>Mapbox streets</option>
441
+			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') {
442
+	print ' selected';
443
+}
444
+?>>Mapbox light</option>
445
+			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') {
446
+	print ' selected';
447
+}
448
+?>>Mapbox dark</option>
449
+			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') {
450
+	print ' selected';
451
+}
452
+?>>Mapbox satellite</option>
453
+			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') {
454
+	print ' selected';
455
+}
456
+?>>Mapbox streets-satellite</option>
457
+			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') {
458
+	print ' selected';
459
+}
460
+?>>Mapbox streets-basic</option>
461
+			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') {
462
+	print ' selected';
463
+}
464
+?>>Mapbox comic</option>
465
+			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') {
466
+	print ' selected';
467
+}
468
+?>>Mapbox outdoors</option>
469
+			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') {
470
+	print ' selected';
471
+}
472
+?>>Mapbox pencil</option>
473
+			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') {
474
+	print ' selected';
475
+}
476
+?>>Mapbox pirates</option>
477
+			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') {
478
+	print ' selected';
479
+}
480
+?>>Mapbox emerald</option>
336 481
 			    <?php
337 482
 				    }
338 483
 			    ?>
339
-			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option>
484
+			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') {
485
+	print ' selected';
486
+}
487
+?>>OpenStreetMap</option>
340 488
 			    <?php
341 489
 				}
342 490
 			    ?>
@@ -347,10 +495,22 @@  discard block
 block discarded – undo
347 495
 ?>
348 496
 		    <li><?php echo _("Type of Terrain:"); ?>
349 497
 			<select  class="selectpicker" onchange="terrainType(this);">
350
-			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option>
351
-			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option>
352
-			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option>
353
-			    <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected';?>>ArticDEM</option>
498
+			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') {
499
+	print ' selected';
500
+}
501
+?>>stk terrain</option>
502
+			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') {
503
+	print ' selected';
504
+}
505
+?>>ellipsoid</option>
506
+			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') {
507
+	print ' selected';
508
+}
509
+?>>vr terrain</option>
510
+			    <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') {
511
+	print ' selected';
512
+}
513
+?>>ArticDEM</option>
354 514
 			</select>
355 515
 		    </li>
356 516
 <?php
@@ -359,42 +519,84 @@  discard block
 block discarded – undo
359 519
 <?php
360 520
     if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
361 521
 ?>
362
-		    <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>
522
+		    <li><div class="checkbox"><label><input type="checkbox" name="display2dbuildings" value="1" onclick="clickDisplay2DBuildings(this)" <?php if (isset($_COOKIE['Map2DBuildings']) && $_COOKIE['Map2DBuildings'] == 'true') {
523
+	print 'checked';
524
+}
525
+?> ><?php echo _("Display 2.5D buidings on map"); ?></label></div></li>
363 526
 
364 527
 <?php
365 528
 	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
366 529
 ?>
367
-		    <!--<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>-->
368
-		    <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>
369
-		    <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>
370
-		    <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>
371
-		    <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>
530
+		    <!--<li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') {
531
+	print 'checked';
532
+}
533
+?> ><?php echo _("Display flight info as popup"); ?></label></div></li>-->
534
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true')) {
535
+	print 'checked';
536
+}
537
+?> ><?php echo _("Display flight path"); ?></label></div></li>
538
+		    <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)) {
539
+	print 'checked';
540
+}
541
+?> ><?php echo _("Display flight route on click"); ?></label></div></li>
542
+		    <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)) {
543
+	print 'checked';
544
+}
545
+?> ><?php echo _("Display flight remaining route on click"); ?></label></div></li>
546
+		    <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)) {
547
+	print 'checked';
548
+}
549
+?> ><?php echo _("Planes animate between updates"); ?></label></div></li>
372 550
 <?php
373 551
 	} elseif (!isset($globalTracker) || $globalTracker === TRUE) {
374 552
 ?>
375
-		    <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>
553
+		    <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)) {
554
+	print 'checked';
555
+}
556
+?> ><?php echo _("Enable map matching"); ?></label></div></li>
376 557
 <?php
377 558
 	}
378 559
 	if (isset($globalSatellite) && $globalSatellite === TRUE) {
379 560
 ?>
380
-		    <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>
561
+		    <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)) {
562
+	print 'checked';
563
+}
564
+?> ><?php echo _("Satellites animate between updates"); ?></label></div></li>
381 565
 <?php
382 566
 	}
383 567
     }
384 568
 ?>
385
-		    <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>
386
-		    <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>
387
-		    <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>
388
-		    <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>
569
+		    <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'])) {
570
+	print 'checked';
571
+}
572
+?> ><?php echo _("Display airports on map"); ?></label></div></li>
573
+		    <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))) {
574
+	print 'checked';
575
+}
576
+?> ><?php echo _("Display ground station on map"); ?></label></div></li>
577
+		    <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))) {
578
+	print 'checked';
579
+}
580
+?> ><?php echo _("Display weather station on map"); ?></label></div></li>
581
+		    <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))) {
582
+	print 'checked';
583
+}
584
+?> ><?php echo _("Display lightning on map"); ?></label></div></li>
389 585
 <?php
390 586
 	if (isset($globalFires)) {
391 587
 ?>
392
-		    <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>
588
+		    <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))) {
589
+	print 'checked';
590
+}
591
+?> ><?php echo _("Display fires on map"); ?></label></div></li>
393 592
 <?php
394 593
 	}
395 594
     if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
396 595
 ?>
397
-		    <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>
596
+		    <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')) {
597
+	print 'checked';
598
+}
599
+?> ><?php echo _("Show mini-map"); ?></label></div></li>
398 600
 <?php
399 601
     }
400 602
     if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
@@ -407,17 +609,25 @@  discard block
 block discarded – undo
407 609
 			if (function_exists('array_column')) {
408 610
 			    if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
409 611
 		    ?>
410
-		    <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>
612
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
613
+	print 'checked';
614
+}
615
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
411 616
 		    <?php
412 617
 			    }
413 618
 			} elseif (isset($globalSources)) {
414 619
 			    $dispolar = false;
415 620
 			    foreach ($globalSources as $testsource) {
416
-			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
621
+			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) {
622
+			        	$dispolar = true;
623
+			        }
417 624
 			    }
418 625
 			    if ($dispolar) {
419 626
 		    ?>
420
-		    <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>
627
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
628
+	print 'checked';
629
+}
630
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
421 631
 		    <?php
422 632
 			    }
423 633
 		        }
@@ -430,12 +640,22 @@  discard block
 block discarded – undo
430 640
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
431 641
 		    	    if (extension_loaded('gd') && function_exists('gd_info')) {
432 642
 		    ?>
433
-		    <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>
643
+		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') {
644
+	print 'checked';
645
+}
646
+?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
434 647
 		    <?php 
435 648
 				if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') {
436 649
 		    ?>
437 650
 		    <li><?php echo _("Aircraft icon color:"); ?>
438
-			<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'; ?>">
651
+			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) {
652
+	print $_COOKIE['IconColor'];
653
+} elseif (isset($globalAircraftIconColor)) {
654
+	print $globalAircraftIconColor;
655
+} else {
656
+	print '1a3151';
657
+}
658
+?>">
439 659
 		    </li>
440 660
 		    <?php
441 661
 				}
@@ -447,7 +667,14 @@  discard block
 block discarded – undo
447 667
 			    if (extension_loaded('gd') && function_exists('gd_info')) {
448 668
 		    ?>
449 669
 		    <li><?php echo _("Marine icon color:"); ?>
450
-			<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'; ?>">
670
+			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) {
671
+	print $_COOKIE['MarineIconColor'];
672
+} elseif (isset($globalMarineIconColor)) {
673
+	print $globalMarineIconColor;
674
+} else {
675
+	print '1a3151';
676
+}
677
+?>">
451 678
 		    </li>
452 679
 		    <?php
453 680
 			    }
@@ -458,7 +685,14 @@  discard block
 block discarded – undo
458 685
 			    if (extension_loaded('gd') && function_exists('gd_info')) {
459 686
 		    ?>
460 687
 		    <li><?php echo _("Tracker icon color:"); ?>
461
-			<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'; ?>">
688
+			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) {
689
+	print $_COOKIE['TrackerIconColor'];
690
+} elseif (isset($globalTrackerIconColor)) {
691
+	print $globalTrackerIconColor;
692
+} else {
693
+	print '1a3151';
694
+}
695
+?>">
462 696
 		    </li>
463 697
 		    <?php
464 698
 			    }
@@ -469,8 +703,22 @@  discard block
 block discarded – undo
469 703
 		    ?>
470 704
 		    <li><?php echo _("Show airport icon at zoom level:"); ?>
471 705
 			<div class="range">
472
-			    <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'; ?>">
473
-			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?></output>
706
+			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) {
707
+	print $_COOKIE['AirportZoom'];
708
+} elseif (isset($globalAirportZoom)) {
709
+	print $globalAirportZoom;
710
+} else {
711
+	print '7';
712
+}
713
+?>">
714
+			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) {
715
+	print $_COOKIE['AirportZoom'];
716
+} elseif (isset($globalAirportZoom)) {
717
+	print $globalAirportZoom;
718
+} else {
719
+	print '7';
720
+}
721
+?></output>
474 722
 			</div>
475 723
 		    </li>
476 724
 		    <?php
@@ -482,10 +730,23 @@  discard block
 block discarded – undo
482 730
 <?php
483 731
 	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
484 732
 ?>
485
-		    <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>
486
-		    <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Aircraft color"); ?></li>
733
+		    <li><input type="checkbox" name="useliveries" value="1" onclick="useLiveries(this)" <?php if (isset($_COOKIE['UseLiveries']) && $_COOKIE['UseLiveries'] == 'true') {
734
+	print 'checked';
735
+}
736
+?> ><?php echo _("Use airlines liveries"); ?></li>
737
+		    <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') {
738
+	print 'checked';
739
+}
740
+?> ><?php echo _("Force Aircraft color"); ?></li>
487 741
 		    <li><?php echo _("Aircraft icon color:"); ?>
488
-			<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'; ?>">
742
+			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) {
743
+	print $_COOKIE['IconColor'];
744
+} elseif (isset($globalAircraftIconColor)) {
745
+	print $globalAircraftIconColor;
746
+} else {
747
+	print 'ff0000';
748
+}
749
+?>">
489 750
 		    </li>
490 751
 <?php
491 752
 	}
@@ -493,9 +754,19 @@  discard block
 block discarded – undo
493 754
 <?php
494 755
 	if (isset($globalMarine) && $globalMarine === TRUE) {
495 756
 ?>
496
-		    <li><input type="checkbox" name="marinecolorforce" value="1" onclick="MarineiconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Marine color"); ?></li>
757
+		    <li><input type="checkbox" name="marinecolorforce" value="1" onclick="MarineiconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') {
758
+	print 'checked';
759
+}
760
+?> ><?php echo _("Force Marine color"); ?></li>
497 761
 		    <li><?php echo _("Marine icon color:"); ?>
498
-			<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'; ?>">
762
+			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) {
763
+	print $_COOKIE['MarineIconColor'];
764
+} elseif (isset($globalMarineIconColor)) {
765
+	print $globalMarineIconColor;
766
+} else {
767
+	print 'ff0000';
768
+}
769
+?>">
499 770
 		    </li>
500 771
 <?php
501 772
 	}
@@ -503,9 +774,19 @@  discard block
 block discarded – undo
503 774
 <?php
504 775
 	if (isset($globalTracker) && $globalTracker === TRUE) {
505 776
 ?>
506
-		    <li><input type="checkbox" name="trackercolorforce" value="1" onclick="TrackericonColorForce(this)" <?php if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Tracker color"); ?></li>
777
+		    <li><input type="checkbox" name="trackercolorforce" value="1" onclick="TrackericonColorForce(this)" <?php if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true') {
778
+	print 'checked';
779
+}
780
+?> ><?php echo _("Force Tracker color"); ?></li>
507 781
 		    <li><?php echo _("Tracker icon color:"); ?>
508
-			<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'; ?>">
782
+			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) {
783
+	print $_COOKIE['TrackerIconColor'];
784
+} elseif (isset($globalTrackerIconColor)) {
785
+	print $globalTrackerIconColor;
786
+} else {
787
+	print 'ff0000';
788
+}
789
+?>">
509 790
 		    </li>
510 791
 <?php
511 792
 	}
@@ -513,22 +794,46 @@  discard block
 block discarded – undo
513 794
 ?>
514 795
 		    <li><?php echo _("Distance unit:"); ?>
515 796
 			<select class="selectpicker" onchange="unitdistance(this);">
516
-			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) echo ' selected'; ?>>km</option>
517
-			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) echo ' selected'; ?>>nm</option>
518
-			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) echo ' selected'; ?>>mi</option>
797
+			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) {
798
+	echo ' selected';
799
+}
800
+?>>km</option>
801
+			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
802
+	echo ' selected';
803
+}
804
+?>>nm</option>
805
+			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
806
+	echo ' selected';
807
+}
808
+?>>mi</option>
519 809
 		        </select>
520 810
 		    </li>
521 811
 		    <li><?php echo _("Altitude unit:"); ?>
522 812
 			<select class="selectpicker" onchange="unitaltitude(this);">
523
-			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) echo ' selected'; ?>>m</option>
524
-			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) echo ' selected'; ?>>feet</option>
813
+			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) {
814
+	echo ' selected';
815
+}
816
+?>>m</option>
817
+			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) {
818
+	echo ' selected';
819
+}
820
+?>>feet</option>
525 821
 		        </select>
526 822
 		    </li>
527 823
 		    <li><?php echo _("Speed unit:"); ?>
528 824
 			<select class="selectpicker" onchange="unitspeed(this);">
529
-			    <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>
530
-			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) echo ' selected'; ?>>mph</option>
531
-			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) echo ' selected'; ?>>knots</option>
825
+			    <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) {
826
+	echo ' selected';
827
+}
828
+?>>km/h</option>
829
+			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) {
830
+	echo ' selected';
831
+}
832
+?>>mph</option>
833
+			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) {
834
+	echo ' selected';
835
+}
836
+?>>knots</option>
532 837
 		        </select>
533 838
 		    </li>
534 839
 
@@ -546,9 +851,18 @@  discard block
 block discarded – undo
546 851
 		    <?php
547 852
 			if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) {
548 853
 		    ?>
549
-			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) print 'checked'; ?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
550
-			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) print 'checked'; ?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
551
-			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) print 'checked'; ?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
854
+			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) {
855
+	print 'checked';
856
+}
857
+?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
858
+			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) {
859
+	print 'checked';
860
+}
861
+?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
862
+			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) {
863
+	print 'checked';
864
+}
865
+?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
552 866
 		    <?php
553 867
 			}
554 868
 		    ?>
@@ -556,10 +870,16 @@  discard block
 block discarded – undo
556 870
 			if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) {
557 871
 		    ?>
558 872
 			<?php if (isset($globalSBS1) && $globalSBS1) { ?>
559
-			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) print 'checked'; ?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
873
+			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) {
874
+	print 'checked';
875
+}
876
+?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
560 877
 			<?php } ?>
561 878
 			<?php if (isset($globalAPRS) && $globalAPRS) { ?>
562
-			    <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') || !isset($_COOKIE['ShowAPRS'])) print 'checked'; ?> ><?php echo _("Display APRS data"); ?></label></div></li>
879
+			    <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') || !isset($_COOKIE['ShowAPRS'])) {
880
+	print 'checked';
881
+}
882
+?> ><?php echo _("Display APRS data"); ?></label></div></li>
563 883
 			<?php } ?>
564 884
 		    <?php
565 885
 			}
@@ -576,7 +896,9 @@  discard block
 block discarded – undo
576 896
 				}
577 897
 				foreach($allairlinenames as $airline) {
578 898
 					$airline_name = $airline['airline_name'];
579
-					if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...';
899
+					if (strlen($airline_name) > 30) {
900
+						$airline_name = substr($airline_name,0,30).'...';
901
+					}
580 902
 					if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['filter_Airlines']))) {
581 903
 						echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>';
582 904
 					} else {
@@ -594,7 +916,10 @@  discard block
 block discarded – undo
594 916
 		    <li><?php echo _("Display alliance:"); ?>
595 917
 		    <br/>
596 918
 			<select class="selectpicker" onchange="alliance(this);" id="display_alliance">
597
-			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
919
+			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') {
920
+	echo ' selected';
921
+}
922
+?>><?php echo _("All"); ?></option>
598 923
 			    <?php
599 924
 				foreach($allalliancenames as $alliance) {
600 925
 					$alliance_name = $alliance['alliance'];
@@ -653,10 +978,22 @@  discard block
 block discarded – undo
653 978
 		    ?>
654 979
 		    <li><?php echo _("Display airlines of type:"); ?><br/>
655 980
 			<select class="selectpicker" onchange="airlinestype(this);">
656
-			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
657
-			    <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') echo ' selected'; ?>><?php echo _("Passenger"); ?></option>
658
-			    <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') echo ' selected'; ?>><?php echo _("Cargo"); ?></option>
659
-			    <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') echo ' selected'; ?>><?php echo _("Military"); ?></option>
981
+			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') {
982
+	echo ' selected';
983
+}
984
+?>><?php echo _("All"); ?></option>
985
+			    <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') {
986
+	echo ' selected';
987
+}
988
+?>><?php echo _("Passenger"); ?></option>
989
+			    <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') {
990
+	echo ' selected';
991
+}
992
+?>><?php echo _("Cargo"); ?></option>
993
+			    <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') {
994
+	echo ' selected';
995
+}
996
+?>><?php echo _("Military"); ?></option>
660 997
 			</select>
661 998
 		    </li>
662 999
 		    <?php
@@ -670,14 +1007,20 @@  discard block
 block discarded – undo
670 1007
 		    ?>
671 1008
 		    <li>
672 1009
 			<?php echo _("Display vessels with MMSI:"); ?>
673
-			<input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) print $_COOKIE['filter_mmsi']; ?>" />
1010
+			<input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) {
1011
+	print $_COOKIE['filter_mmsi'];
1012
+}
1013
+?>" />
674 1014
 		    </li>
675 1015
 		    <?php
676 1016
 			}
677 1017
 		    ?>
678 1018
 		    <li>
679 1019
 			<?php echo _("Display with ident:"); ?>
680
-			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" />
1020
+			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) {
1021
+	print $_COOKIE['filter_ident'];
1022
+}
1023
+?>" />
681 1024
 		    </li>
682 1025
 		</ul>
683 1026
 	    </form>
@@ -693,7 +1036,10 @@  discard block
 block discarded – undo
693 1036
 	    <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
694 1037
 	    <form>
695 1038
 		<ul>
696
-		    <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>
1039
+		    <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'])) {
1040
+	print 'checked';
1041
+}
1042
+?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li>
697 1043
 		    <li><?php echo _("Type:"); ?>
698 1044
 			<select class="selectpicker" multiple onchange="sattypes(this);">
699 1045
 			    <?php
@@ -701,25 +1047,45 @@  discard block
 block discarded – undo
701 1047
 				$types = $Satellite->get_tle_types();
702 1048
 				foreach ($types as $type) {
703 1049
 					$type_name = $type['tle_type'];
704
-					if ($type_name == 'musson') $type_name = 'Russian LEO Navigation';
705
-					else if ($type_name == 'nnss') $type_name = 'Navi Navigation Satellite System';
706
-					else if ($type_name == 'sbas') $type_name = 'Satellite-Based Augmentation System';
707
-					else if ($type_name == 'glo-ops') $type_name = 'Glonass Operational';
708
-					else if ($type_name == 'gps-ops') $type_name = 'GPS Operational';
709
-					else if ($type_name == 'argos') $type_name = 'ARGOS Data Collection System';
710
-					else if ($type_name == 'tdrss') $type_name = 'Tracking and Data Relay Satellite System';
711
-					else if ($type_name == 'sarsat') $type_name = 'Search & Rescue';
712
-					else if ($type_name == 'dmc') $type_name = 'Disaster Monitoring';
713
-					else if ($type_name == 'resource') $type_name = 'Earth Resources';
714
-					else if ($type_name == 'stations') $type_name = 'Space Stations';
715
-					else if ($type_name == 'geo') $type_name = 'Geostationary';
716
-					else if ($type_name == 'amateur') $type_name = 'Amateur Radio';
717
-					else if ($type_name == 'x-comm') $type_name = 'Experimental';
718
-					else if ($type_name == 'other-comm') $type_name = 'Other Comm';
719
-					else if ($type_name == 'science') $type_name = 'Space & Earth Science';
720
-					else if ($type_name == 'military') $type_name = 'Miscellaneous Military';
721
-					else if ($type_name == 'radar') $type_name = 'Radar Calibration';
722
-					else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches';
1050
+					if ($type_name == 'musson') {
1051
+						$type_name = 'Russian LEO Navigation';
1052
+					} else if ($type_name == 'nnss') {
1053
+						$type_name = 'Navi Navigation Satellite System';
1054
+					} else if ($type_name == 'sbas') {
1055
+						$type_name = 'Satellite-Based Augmentation System';
1056
+					} else if ($type_name == 'glo-ops') {
1057
+						$type_name = 'Glonass Operational';
1058
+					} else if ($type_name == 'gps-ops') {
1059
+						$type_name = 'GPS Operational';
1060
+					} else if ($type_name == 'argos') {
1061
+						$type_name = 'ARGOS Data Collection System';
1062
+					} else if ($type_name == 'tdrss') {
1063
+						$type_name = 'Tracking and Data Relay Satellite System';
1064
+					} else if ($type_name == 'sarsat') {
1065
+						$type_name = 'Search & Rescue';
1066
+					} else if ($type_name == 'dmc') {
1067
+						$type_name = 'Disaster Monitoring';
1068
+					} else if ($type_name == 'resource') {
1069
+						$type_name = 'Earth Resources';
1070
+					} else if ($type_name == 'stations') {
1071
+						$type_name = 'Space Stations';
1072
+					} else if ($type_name == 'geo') {
1073
+						$type_name = 'Geostationary';
1074
+					} else if ($type_name == 'amateur') {
1075
+						$type_name = 'Amateur Radio';
1076
+					} else if ($type_name == 'x-comm') {
1077
+						$type_name = 'Experimental';
1078
+					} else if ($type_name == 'other-comm') {
1079
+						$type_name = 'Other Comm';
1080
+					} else if ($type_name == 'science') {
1081
+						$type_name = 'Space & Earth Science';
1082
+					} else if ($type_name == 'military') {
1083
+						$type_name = 'Miscellaneous Military';
1084
+					} else if ($type_name == 'radar') {
1085
+						$type_name = 'Radar Calibration';
1086
+					} else if ($type_name == 'tle-new') {
1087
+						$type_name = 'Last 30 days launches';
1088
+					}
723 1089
 					
724 1090
 					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) {
725 1091
 						print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>';
Please login to merge, or discard this patch.
js/map.3d.js.php 1 patch
Braces   +40 added lines, -13 removed lines patch added patch discarded remove patch
@@ -5,21 +5,30 @@  discard block
 block discarded – undo
5 5
 
6 6
 document.cookie =  'MapFormat=3d; expires=Thu, 2 Aug 2100 20:47:11 UTC; path=/'
7 7
 <?php
8
-	if (isset($_COOKIE['MapType'])) $MapType = $_COOKIE['MapType'];
9
-	else $MapType = $globalMapProvider;
8
+	if (isset($_COOKIE['MapType'])) {
9
+		$MapType = $_COOKIE['MapType'];
10
+	} else {
11
+		$MapType = $globalMapProvider;
12
+	}
10 13
 
11 14
 //	unset($_COOKIE['MapType']);
12 15
 	if ($MapType != 'Mapbox' && $MapType != 'OpenStreetMap' && $MapType != 'Bing-Aerial' && $MapType != 'Bing-Hybrid' && $MapType != 'Bing-Road' && $MapType != 'offline' && $MapType != 'ArcGIS-Streetmap' && $MapType != 'ArcGIS-Satellite' && $MapType != 'NatGeo-Street') {
13
-		if (isset($globalBingMapKey) && $globalBingMapKey != '') $MapType = 'Bing-Aerial';
14
-		else $MapType = 'OpenStreetMap';
16
+		if (isset($globalBingMapKey) && $globalBingMapKey != '') {
17
+			$MapType = 'Bing-Aerial';
18
+		} else {
19
+			$MapType = 'OpenStreetMap';
20
+		}
15 21
 	}
16 22
 	if (($MapType == 'Bing-Aerial' || $MapType == 'Bing-Hybrid' || $MapType == 'Bing-Road') && (!isset($globalBingMapKey) || $globalBingMapKey == '')) {
17 23
 		$MapType = 'OpenStreetMap';
18 24
 	}
19 25
 	if ($MapType == 'Mapbox') {
20
-		if ($_COOKIE['MapTypeId'] == 'default') $MapBoxId = $globalMapboxId;
21
-		else $MapBoxId = $_COOKIE['MapTypeId'];
22
-?>
26
+		if ($_COOKIE['MapTypeId'] == 'default') {
27
+			$MapBoxId = $globalMapboxId;
28
+		} else {
29
+			$MapBoxId = $_COOKIE['MapTypeId'];
30
+		}
31
+		?>
23 32
 	var imProv = Cesium.MapboxImageryProvider({
24 33
 		credit: 'Map data © OpenStreetMap contributors, ' +
25 34
 	      'CC-BY-SA, ' +
@@ -147,13 +156,23 @@  discard block
 block discarded – undo
147 156
 */
148 157
 ?>
149 158
 <?php
150
-	}  elseif (isset($globalMapCustomLayer[$MapType])) {
159
+	} elseif (isset($globalMapCustomLayer[$MapType])) {
151 160
 		$customid = $MapType;
152 161
 ?>
153 162
 	var imProv = Cesium.createOpenStreetMapImageryProvider({
154 163
 		url : '<?php print $globalMapCustomLayer[$customid]['url']; ?>',
155
-		maximumLevel: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) print $globalMapCustomLayer[$customid]['maxZoom']; else print '99'; ?>,
156
-		minimumLevel: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) print $globalMapCustomLayer[$customid]['minZoom']; else print '0'; ?>,
164
+		maximumLevel: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) {
165
+	print $globalMapCustomLayer[$customid]['maxZoom'];
166
+} else {
167
+	print '99';
168
+}
169
+?>,
170
+		minimumLevel: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) {
171
+	print $globalMapCustomLayer[$customid]['minZoom'];
172
+} else {
173
+	print '0';
174
+}
175
+?>,
157 176
 		credit: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>'
158 177
 	});
159 178
 <?php
@@ -480,8 +499,11 @@  discard block
 block discarded – undo
480 499
 	if (isset($_COOKIE['lastcentercoord']) || (isset($globalCenterLatitude) && isset($globalCenterLongitude) && $globalCenterLatitude != '' && $globalCenterLongitude != '')) {
481 500
 		if (isset($_COOKIE['lastcentercoord'])) {
482 501
 			$lastcentercoord = explode(',',$_COOKIE['lastcentercoord']);
483
-			if (!isset($lastcentercoord[3])) $zoom = $lastcentercoord[2]*1000000.0;
484
-			else $zoom = $lastcentercoord[3];
502
+			if (!isset($lastcentercoord[3])) {
503
+				$zoom = $lastcentercoord[2]*1000000.0;
504
+			} else {
505
+				$zoom = $lastcentercoord[3];
506
+			}
485 507
 			$viewcenterlatitude = $lastcentercoord[0];
486 508
 			$viewcenterlongitude = $lastcentercoord[1];
487 509
 		} else {
@@ -602,7 +624,12 @@  discard block
 block discarded – undo
602 624
 ?>
603 625
 
604 626
 update_locationsLayer();
605
-setInterval(function(){update_locationsLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
627
+setInterval(function(){update_locationsLayer()},<?php if (isset($globalMapRefresh)) {
628
+	print $globalMapRefresh*1000*2;
629
+} else {
630
+	print '60000';
631
+}
632
+?>);
606 633
 /*
607 634
 var handlera = new Cesium.ScreenSpaceEventHandler(viewer.canvas, false);
608 635
 handlera.setInputAction(
Please login to merge, or discard this patch.
js/map.2d.js.php 1 patch
Braces   +127 added lines, -30 removed lines patch added patch discarded remove patch
@@ -4,10 +4,15 @@  discard block
 block discarded – undo
4 4
 
5 5
 setcookie("MapFormat",'2d');
6 6
 
7
-if (!isset($globalOpenWeatherMapKey)) $globalOpenWeatherMapKey = '';
7
+if (!isset($globalOpenWeatherMapKey)) {
8
+	$globalOpenWeatherMapKey = '';
9
+}
8 10
 // Compressed GeoJson is used if true
9
-if (!isset($globalJsonCompress)) $compress = true;
10
-else $compress = $globalJsonCompress;
11
+if (!isset($globalJsonCompress)) {
12
+	$compress = true;
13
+} else {
14
+	$compress = $globalJsonCompress;
15
+}
11 16
 if (isset($_GET['archive'])) {
12 17
 	$archive = true;
13 18
 	//$archiveupdatetime = 50;
@@ -18,8 +23,11 @@  discard block
 block discarded – undo
18 23
 	//$lastupd = round(($_GET['enddate']-$_GET['begindate'])/(($_GET['during']*60)/10));
19 24
 	//$lastupd = 20;
20 25
 	$lastupd = $_GET['archivespeed']*$archiveupdatetime;
21
-	if (isset($_GET['enddate']) && $_GET['enddate'] != '') $enddate = $_GET['enddate'];
22
-	else $enddate = time();
26
+	if (isset($_GET['enddate']) && $_GET['enddate'] != '') {
27
+		$enddate = $_GET['enddate'];
28
+	} else {
29
+		$enddate = time();
30
+	}
23 31
 	setcookie("archive_begin",$begindate);
24 32
 	setcookie("archive_end",$enddate);
25 33
 	setcookie("archive_update",$lastupd);
@@ -107,7 +115,17 @@  discard block
 block discarded – undo
107 115
 	}
108 116
 
109 117
 	//create the map
110
-	map = L.map('archive-map', { zoomControl:false }).setView([<?php if (isset($latitude)) print $latitude; else print $globalCenterLatitude; ?>,<?php if (isset($longitude)) print $longitude; else print $globalCenterLongitude; ?>], zoom);
118
+	map = L.map('archive-map', { zoomControl:false }).setView([<?php if (isset($latitude)) {
119
+	print $latitude;
120
+} else {
121
+	print $globalCenterLatitude;
122
+}
123
+?>,<?php if (isset($longitude)) {
124
+	print $longitude;
125
+} else {
126
+	print $globalCenterLongitude;
127
+}
128
+?>], zoom);
111 129
 <?php
112 130
 	} else {
113 131
 		if ((isset($globalCenterLatitude) && $globalCenterLatitude != '' && isset($globalCenterLongitude) && $globalCenterLongitude != '') || isset($_COOKIE['lastcentercoord'])) {
@@ -133,9 +151,21 @@  discard block
 block discarded – undo
133 151
 	     || navigator.userAgent.match(/BlackBerry/i)
134 152
 	     || navigator.userAgent.match(/Windows Phone/i))
135 153
 	{
136
-		var zoom = <?php if (isset($viewzoom) && $viewzoom == $globalLiveZoom) print $viewzoom-1; elseif (isset($viewzoom)) print $viewzoom; else print '8'; ?>;
154
+		var zoom = <?php if (isset($viewzoom) && $viewzoom == $globalLiveZoom) {
155
+	print $viewzoom-1;
156
+} elseif (isset($viewzoom)) {
157
+	print $viewzoom;
158
+} else {
159
+	print '8';
160
+}
161
+?>;
137 162
 	} else {
138
-		var zoom = <?php if (isset($viewzoom)) print $viewzoom; else print '9'; ?>;
163
+		var zoom = <?php if (isset($viewzoom)) {
164
+	print $viewzoom;
165
+} else {
166
+	print '9';
167
+}
168
+?>;
139 169
 	}
140 170
 
141 171
 	//create the map
@@ -161,16 +191,27 @@  discard block
 block discarded – undo
161 191
 	bounds = L.latLngBounds(southWest,northEast);
162 192
 	//a few title layers
163 193
 <?php
164
-	if (isset($_COOKIE['MapType'])) $MapType = $_COOKIE['MapType'];
165
-	else $MapType = $globalMapProvider;
194
+	if (isset($_COOKIE['MapType'])) {
195
+		$MapType = $_COOKIE['MapType'];
196
+	} else {
197
+		$MapType = $globalMapProvider;
198
+	}
166 199
 
167 200
 	if ($MapType == 'Mapbox') {
168
-		if ($_COOKIE['MapTypeId'] == 'default') $MapBoxId = $globalMapboxId;
169
-		else $MapBoxId = $_COOKIE['MapTypeId'];
170
-?>
201
+		if ($_COOKIE['MapTypeId'] == 'default') {
202
+			$MapBoxId = $globalMapboxId;
203
+		} else {
204
+			$MapBoxId = $_COOKIE['MapTypeId'];
205
+		}
206
+		?>
171 207
 	L.tileLayer('https://{s}.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={token}', {
172 208
 	    maxZoom: 18,
173
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
209
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
210
+	print 'false';
211
+} else {
212
+	print 'true';
213
+}
214
+?>,
174 215
 	    attribution: '© <a href="https://www.mapbox.com/about/maps/">Mapbox</a> © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> <strong><a href="https://www.mapbox.com/map-feedback/" target="_blank">Improve this map</a></strong>',
175 216
 	    id: '<?php print $MapBoxId; ?>',
176 217
 	    token: '<?php print $globalMapboxToken; ?>'
@@ -189,7 +230,12 @@  discard block
 block discarded – undo
189 230
 ?>
190 231
 	L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
191 232
 	    maxZoom: 18,
192
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
233
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
234
+	print 'false';
235
+} else {
236
+	print 'true';
237
+}
238
+?>,
193 239
 	    attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' +
194 240
 	      '<a href="www.openstreetmap.org/copyright">Open Database Licence</a>'
195 241
 	}).addTo(map);
@@ -198,7 +244,12 @@  discard block
 block discarded – undo
198 244
 ?>
199 245
 	L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}', {
200 246
 	    maxZoom: 18,
201
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
247
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
248
+	print 'false';
249
+} else {
250
+	print 'true';
251
+}
252
+?>,
202 253
 	    attribution: 'Tiles &copy; Esri &mdash; Source: Esri, DeLorme, NAVTEQ, USGS, Intermap, iPC, NRCAN, Esri Japan, METI, Esri China (Hong Kong), Esri (Thailand), TomTom, 2012'
203 254
 	}).addTo(map);
204 255
 <?php
@@ -206,7 +257,12 @@  discard block
 block discarded – undo
206 257
 ?>
207 258
 	L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
208 259
 	    maxZoom: 18,
209
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
260
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
261
+	print 'false';
262
+} else {
263
+	print 'true';
264
+}
265
+?>,
210 266
 	    attribution: 'Tiles &copy; Esri &mdash; Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community'
211 267
 	}).addTo(map);
212 268
 <?php
@@ -214,7 +270,12 @@  discard block
 block discarded – undo
214 270
 ?>
215 271
 	L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/tile/{z}/{y}/{x}', {
216 272
 	    maxZoom: 18,
217
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
273
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
274
+	print 'false';
275
+} else {
276
+	print 'true';
277
+}
278
+?>,
218 279
 	    attribution: 'Tiles &copy; Esri &mdash; National Geographic, Esri, DeLorme, NAVTEQ, UNEP-WCMC, USGS, NASA, ESA, METI, NRCAN, GEBCO, NOAA, iPC'
219 280
 	}).addTo(map);
220 281
 <?php
@@ -259,20 +320,26 @@  discard block
 block discarded – undo
259 320
 	map.addLayer(yandexLayer);
260 321
 <?php
261 322
 	} elseif ($MapType == 'Bing-Aerial') {
262
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
263
-?>
323
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') {
324
+			setcookie('MapType','OpenStreetMap');
325
+		}
326
+		?>
264 327
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Aerial'});
265 328
 	map.addLayer(bingLayer);
266 329
 <?php
267 330
 	} elseif ($MapType == 'Bing-Hybrid') {
268
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
269
-?>
331
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') {
332
+			setcookie('MapType','OpenStreetMap');
333
+		}
334
+		?>
270 335
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'AerialWithLabels'});
271 336
 	map.addLayer(bingLayer);
272 337
 <?php
273 338
 	} elseif ($MapType == 'Bing-Road') {
274
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
275
-?>
339
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') {
340
+			setcookie('MapType','OpenStreetMap');
341
+		}
342
+		?>
276 343
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Road'});
277 344
 	map.addLayer(bingLayer);
278 345
 <?php
@@ -301,7 +368,12 @@  discard block
 block discarded – undo
301 368
 	    maxZoom: 5,
302 369
 	    tms : true,
303 370
 	    zindex : 3,
304
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
371
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
372
+	print 'false';
373
+} else {
374
+	print 'true';
375
+}
376
+?>,
305 377
 	    attribution: 'Natural Earth'
306 378
 	}).addTo(map);
307 379
 <?php
@@ -309,9 +381,24 @@  discard block
 block discarded – undo
309 381
 		$customid = $MapType;
310 382
 ?>
311 383
 	L.tileLayer('<?php print $globalMapCustomLayer[$customid]['url']; ?>/{z}/{x}/{y}.png', {
312
-	    maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) print $globalMapCustomLayer[$customid]['maxZoom']; else print '18'; ?>,
313
-	    minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) print $globalMapCustomLayer[$customid]['minZoom']; else print '0'; ?>,
314
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
384
+	    maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) {
385
+	print $globalMapCustomLayer[$customid]['maxZoom'];
386
+} else {
387
+	print '18';
388
+}
389
+?>,
390
+	    minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) {
391
+	print $globalMapCustomLayer[$customid]['minZoom'];
392
+} else {
393
+	print '0';
394
+}
395
+?>,
396
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
397
+	print 'false';
398
+} else {
399
+	print 'true';
400
+}
401
+?>,
315 402
 	    attribution: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>'
316 403
 	}).addTo(map);
317 404
 
@@ -351,7 +438,12 @@  discard block
 block discarded – undo
351 438
 		}
352 439
 	} elseif ($globalBounding == 'circle') {
353 440
 ?>
354
-	var circle = L.circle([<?php print $globalCenterLatitude; ?>, <?php print $globalCenterLongitude; ?>],<?php if (isset($globalBoundingCircleSize)) print $globalBoundingCircleSize; else print '70000'; ?>,{
441
+	var circle = L.circle([<?php print $globalCenterLatitude; ?>, <?php print $globalCenterLongitude; ?>],<?php if (isset($globalBoundingCircleSize)) {
442
+	print $globalBoundingCircleSize;
443
+} else {
444
+	print '70000';
445
+}
446
+?>,{
355 447
 	    color: '#92C7D1',
356 448
 	    fillColor: '#92C7D1',
357 449
 	    fillOpacity: 0.3,
@@ -443,7 +535,12 @@  discard block
 block discarded – undo
443 535
 		createCookie('lastcentercoord',map.getCenter().lat+','+map.getCenter().lng+','+map.getZoom(),2);
444 536
 	});
445 537
 update_locationsLayer();
446
-setInterval(function(){if (noTimeout) update_locationsLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
538
+setInterval(function(){if (noTimeout) update_locationsLayer()},<?php if (isset($globalMapRefresh)) {
539
+	print $globalMapRefresh*1000*2;
540
+} else {
541
+	print '60000';
542
+}
543
+?>);
447 544
 
448 545
 <?php
449 546
     // Add support for custom json via $globalMapJson
Please login to merge, or discard this patch.
live-geojson.php 1 patch
Braces   +321 added lines, -130 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,28 +59,55 @@  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);
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
+}
78 105
 
79 106
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
80 107
 	$min = true;
81
-} else $min = false;
108
+} else {
109
+	$min = false;
110
+}
82 111
 
83 112
 $spotter_array = array();
84 113
 
@@ -189,24 +218,38 @@  discard block
 block discarded – undo
189 218
 			$flightcnt = $SpotterLive->getLiveSpotterCount($filter);
190 219
 		}
191 220
 	}
192
-	if ($flightcnt == '') $flightcnt = 0;
193
-} else $flightcnt = 0;
221
+	if ($flightcnt == '') {
222
+		$flightcnt = 0;
223
+	}
224
+	} else {
225
+	$flightcnt = 0;
226
+}
194 227
 
195 228
 $sqltime = round(microtime(true)-$begintime,2);
196 229
 
197 230
 $currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
198
-if ($currenttime != '') $currenttime = round($currenttime/1000);
231
+if ($currenttime != '') {
232
+	$currenttime = round($currenttime/1000);
233
+}
199 234
 
200
-if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false;
201
-else $usenextlatlon = true;
202
-if ($usenextlatlon === false) $currenttime = '';
235
+if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) {
236
+	$usenextlatlon = false;
237
+} else {
238
+	$usenextlatlon = true;
239
+}
240
+if ($usenextlatlon === false) {
241
+	$currenttime = '';
242
+}
203 243
 $j = 0;
204 244
 $prev_flightaware_id = '';
205 245
 $aircrafts_shadow = array();
206 246
 $output = '{';
207 247
 	$output .= '"type": "FeatureCollection",';
208
-		if ($min) $output .= '"minimal": "true",';
209
-		else $output .= '"minimal": "false",';
248
+		if ($min) {
249
+			$output .= '"minimal": "true",';
250
+		} else {
251
+			$output .= '"minimal": "false",';
252
+		}
210 253
 		//$output .= '"fc": "'.$flightcnt.'",';
211 254
 		$output .= '"sqt": "'.$sqltime.'",';
212 255
 
@@ -251,18 +294,29 @@  discard block
 block discarded – undo
251 294
 						}
252 295
 						$output .= '"properties": {';
253 296
 						if (isset($spotter_item['flightaware_id'])) {
254
-							if ($compress) $output .= '"fi": "'.$spotter_item['flightaware_id'].'",';
255
-							else $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",';
297
+							if ($compress) {
298
+								$output .= '"fi": "'.$spotter_item['flightaware_id'].'",';
299
+							} else {
300
+								$output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",';
301
+							}
256 302
 						} elseif (isset($spotter_item['famtrackid'])) {
257
-							if ($compress) $output .= '"fti": "'.$spotter_item['famtrackid'].'",';
258
-							else $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",';
303
+							if ($compress) {
304
+								$output .= '"fti": "'.$spotter_item['famtrackid'].'",';
305
+							} else {
306
+								$output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",';
307
+							}
259 308
 						} elseif (isset($spotter_item['fammarine_id'])) {
260
-							if ($compress) $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",';
261
-							else $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",';
309
+							if ($compress) {
310
+								$output .= '"fmi": "'.$spotter_item['fammarine_id'].'",';
311
+							} else {
312
+								$output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",';
313
+							}
262 314
 						}
263 315
 							$output .= '"fc": "'.$flightcnt.'",';
264 316
 							$output .= '"sqt": "'.$sqltime.'",';
265
-							if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
317
+							if (isset($begindate)) {
318
+								$output .= '"archive_date": "'.$begindate.'",';
319
+							}
266 320
 
267 321
 /*
268 322
 							if ($min) $output .= '"minimal": "true",';
@@ -270,14 +324,22 @@  discard block
 block discarded – undo
270 324
 */
271 325
 							//$output .= '"fc": "'.$spotter_item['nb'].'",';
272 326
 						if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') {
273
-							if ($compress) $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",';
274
-							else $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",';
327
+							if ($compress) {
328
+								$output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",';
329
+							} else {
330
+								$output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",';
331
+							}
275 332
 							//"
276 333
 						} else {
277
-							if ($compress) $output .= '"c": "NA",';
278
-							else $output .= '"callsign": "NA",';
334
+							if ($compress) {
335
+								$output .= '"c": "NA",';
336
+							} else {
337
+								$output .= '"callsign": "NA",';
338
+							}
339
+						}
340
+						if (isset($spotter_item['registration'])) {
341
+							$output .= '"registration": "'.$spotter_item['registration'].'",';
279 342
 						}
280
-						if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",';
281 343
 						if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) {
282 344
 							$output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",';
283 345
 							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",';
@@ -290,16 +352,23 @@  discard block
 block discarded – undo
290 352
 							$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
291 353
 						}
292 354
 						if (!isset($spotter_item['aircraft_shadow']) && !$tracker) {
293
-							if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = '';
294
-							else {
355
+							if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') {
356
+								$spotter_item['aircraft_shadow'] = '';
357
+							} else {
295 358
 								$aircraft_icao = $spotter_item['aircraft_icao'];
296
-								if (isset($aircrafts_shadow[$aircraft_icao])) $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao];
297
-								else {
359
+								if (isset($aircrafts_shadow[$aircraft_icao])) {
360
+									$spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao];
361
+								} else {
298 362
 									$aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']);
299
-									if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
300
-									elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png';
301
-									elseif ($aircraft_icao == 'PARAGLIDER') $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png';
302
-									else $spotter_item['aircraft_shadow'] = '';
363
+									if (count($aircraft_info) > 0) {
364
+										$spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
365
+									} elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') {
366
+										$spotter_item['aircraft_shadow'] = 'PA18.png';
367
+									} elseif ($aircraft_icao == 'PARAGLIDER') {
368
+										$spotter_item['aircraft_shadow'] = 'PARAGLIDER.png';
369
+									} else {
370
+										$spotter_item['aircraft_shadow'] = '';
371
+									}
303 372
 									$aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow'];
304 373
 								}
305 374
 							}
@@ -307,73 +376,139 @@  discard block
 block discarded – undo
307 376
 						if (!isset($spotter_item['aircraft_shadow']) || $spotter_item['aircraft_shadow'] == '') {
308 377
 							if ($tracker) {
309 378
 								if (isset($spotter_item['type']) && $spotter_item['type'] == 'Ambulance') {
310
-									if ($compress) $output .= '"as": "ambulance.png",';
311
-									else $output .= '"aircraft_shadow": "ambulance.png",';
379
+									if ($compress) {
380
+										$output .= '"as": "ambulance.png",';
381
+									} else {
382
+										$output .= '"aircraft_shadow": "ambulance.png",';
383
+									}
312 384
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') {
313
-									if ($compress) $output .= '"as": "police.png",';
314
-									else $output .= '"aircraft_shadow": "police.png",';
385
+									if ($compress) {
386
+										$output .= '"as": "police.png",';
387
+									} else {
388
+										$output .= '"aircraft_shadow": "police.png",';
389
+									}
315 390
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') {
316
-									if ($compress) $output .= '"as": "ship.png",';
317
-									else $output .= '"aircraft_shadow": "ship.png",';
391
+									if ($compress) {
392
+										$output .= '"as": "ship.png",';
393
+									} else {
394
+										$output .= '"aircraft_shadow": "ship.png",';
395
+									}
318 396
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') {
319
-									if ($compress) $output .= '"as": "ship.png",';
320
-									else $output .= '"aircraft_shadow": "ship.png",';
397
+									if ($compress) {
398
+										$output .= '"as": "ship.png",';
399
+									} else {
400
+										$output .= '"aircraft_shadow": "ship.png",';
401
+									}
321 402
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') {
322
-									if ($compress) $output .= '"as": "ship.png",';
323
-									else $output .= '"aircraft_shadow": "ship.png",';
403
+									if ($compress) {
404
+										$output .= '"as": "ship.png",';
405
+									} else {
406
+										$output .= '"aircraft_shadow": "ship.png",';
407
+									}
324 408
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') {
325
-									if ($compress) $output .= '"as": "truck.png",';
326
-									else $output .= '"aircraft_shadow": "truck.png",';
409
+									if ($compress) {
410
+										$output .= '"as": "truck.png",';
411
+									} else {
412
+										$output .= '"aircraft_shadow": "truck.png",';
413
+									}
327 414
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') {
328
-									if ($compress) $output .= '"as": "truck.png",';
329
-									else $output .= '"aircraft_shadow": "truck.png",';
415
+									if ($compress) {
416
+										$output .= '"as": "truck.png",';
417
+									} else {
418
+										$output .= '"aircraft_shadow": "truck.png",';
419
+									}
330 420
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') {
331
-									if ($compress) $output .= '"as": "aircraft.png",';
332
-									else $output .= '"aircraft_shadow": "aircraft.png",';
421
+									if ($compress) {
422
+										$output .= '"as": "aircraft.png",';
423
+									} else {
424
+										$output .= '"aircraft_shadow": "aircraft.png",';
425
+									}
333 426
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') {
334
-									if ($compress) $output .= '"as": "aircraft.png",';
335
-									else $output .= '"aircraft_shadow": "aircraft.png",';
427
+									if ($compress) {
428
+										$output .= '"as": "aircraft.png",';
429
+									} else {
430
+										$output .= '"aircraft_shadow": "aircraft.png",';
431
+									}
336 432
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') {
337
-									if ($compress) $output .= '"as": "helico.png",';
338
-									else $output .= '"aircraft_shadow": "helico.png",';
433
+									if ($compress) {
434
+										$output .= '"as": "helico.png",';
435
+									} else {
436
+										$output .= '"aircraft_shadow": "helico.png",';
437
+									}
339 438
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') {
340
-									if ($compress) $output .= '"as": "rail.png",';
341
-									else $output .= '"aircraft_shadow": "rail.png",';
439
+									if ($compress) {
440
+										$output .= '"as": "rail.png",';
441
+									} else {
442
+										$output .= '"aircraft_shadow": "rail.png",';
443
+									}
342 444
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') {
343
-									if ($compress) $output .= '"as": "firetruck.png",';
344
-									else $output .= '"aircraft_shadow": "firetruck.png",';
445
+									if ($compress) {
446
+										$output .= '"as": "firetruck.png",';
447
+									} else {
448
+										$output .= '"aircraft_shadow": "firetruck.png",';
449
+									}
345 450
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') {
346
-									if ($compress) $output .= '"as": "bus.png",';
347
-									else $output .= '"aircraft_shadow": "bus.png",';
451
+									if ($compress) {
452
+										$output .= '"as": "bus.png",';
453
+									} else {
454
+										$output .= '"aircraft_shadow": "bus.png",';
455
+									}
348 456
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') {
349
-									if ($compress) $output .= '"as": "phone.png",';
350
-									else $output .= '"aircraft_shadow": "phone.png",';
457
+									if ($compress) {
458
+										$output .= '"as": "phone.png",';
459
+									} else {
460
+										$output .= '"aircraft_shadow": "phone.png",';
461
+									}
351 462
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') {
352
-									if ($compress) $output .= '"as": "jogger.png",';
353
-									else $output .= '"aircraft_shadow": "jogger.png",';
463
+									if ($compress) {
464
+										$output .= '"as": "jogger.png",';
465
+									} else {
466
+										$output .= '"aircraft_shadow": "jogger.png",';
467
+									}
354 468
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') {
355
-									if ($compress) $output .= '"as": "bike.png",';
356
-									else $output .= '"aircraft_shadow": "bike.png",';
469
+									if ($compress) {
470
+										$output .= '"as": "bike.png",';
471
+									} else {
472
+										$output .= '"aircraft_shadow": "bike.png",';
473
+									}
357 474
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') {
358
-									if ($compress) $output .= '"as": "motorcycle.png",';
359
-									else $output .= '"aircraft_shadow": "motorcycle.png",';
475
+									if ($compress) {
476
+										$output .= '"as": "motorcycle.png",';
477
+									} else {
478
+										$output .= '"aircraft_shadow": "motorcycle.png",';
479
+									}
360 480
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') {
361
-									if ($compress) $output .= '"as": "balloon.png",';
362
-									else $output .= '"aircraft_shadow": "balloon.png",';
481
+									if ($compress) {
482
+										$output .= '"as": "balloon.png",';
483
+									} else {
484
+										$output .= '"aircraft_shadow": "balloon.png",';
485
+									}
363 486
 								} else {
364
-									if ($compress) $output .= '"as": "car.png",';
365
-									else $output .= '"aircraft_shadow": "car.png",';
487
+									if ($compress) {
488
+										$output .= '"as": "car.png",';
489
+									} else {
490
+										$output .= '"aircraft_shadow": "car.png",';
491
+									}
366 492
 								}
367 493
 							} elseif ($marine) {
368
-								if ($compress) $output .= '"as": "ship.png",';
369
-								else $output .= '"aircraft_shadow": "ship.png",';
494
+								if ($compress) {
495
+									$output .= '"as": "ship.png",';
496
+								} else {
497
+									$output .= '"aircraft_shadow": "ship.png",';
498
+								}
370 499
 							} else {
371
-								if ($compress) $output .= '"as": "default.png",';
372
-								else $output .= '"aircraft_shadow": "default.png",';
500
+								if ($compress) {
501
+									$output .= '"as": "default.png",';
502
+								} else {
503
+									$output .= '"aircraft_shadow": "default.png",';
504
+								}
373 505
 							}
374 506
 						} else {
375
-							if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
376
-							else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
507
+							if ($compress) {
508
+								$output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
509
+							} else {
510
+								$output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
511
+							}
377 512
 						}
378 513
 						if (isset($spotter_item['airline_name'])) {
379 514
 							$output .= '"airline_name": "'.$spotter_item['airline_name'].'",';
@@ -381,8 +516,11 @@  discard block
 block discarded – undo
381 516
 							$output .= '"airline_name": "NA",';
382 517
 						}
383 518
 						if (isset($spotter_item['departure_airport'])) {
384
-							if ($compress) $output .= '"dac": "'.$spotter_item['departure_airport'].'",';
385
-							else $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",';
519
+							if ($compress) {
520
+								$output .= '"dac": "'.$spotter_item['departure_airport'].'",';
521
+							} else {
522
+								$output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",';
523
+							}
386 524
 						}
387 525
 						if (isset($spotter_item['departure_airport_city'])) {
388 526
 							$output .= '"departure_airport": "'.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_country'].'",';
@@ -394,8 +532,11 @@  discard block
 block discarded – undo
394 532
 							$output .= '"arrival_airport_time": "'.$spotter_item['arrival_airport_time'].'",';
395 533
 						}
396 534
 						if (isset($spotter_item['arrival_airport'])) {
397
-							if ($compress) $output .= '"aac": "'.$spotter_item['arrival_airport'].'",';
398
-							else $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",';
535
+							if ($compress) {
536
+								$output .= '"aac": "'.$spotter_item['arrival_airport'].'",';
537
+							} else {
538
+								$output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",';
539
+							}
399 540
 						}
400 541
 						if (isset($spotter_item['arrival_airport_city'])) {
401 542
 							$output .= '"arrival_airport": "'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].'",';
@@ -414,8 +555,11 @@  discard block
 block discarded – undo
414 555
 						}
415 556
 						
416 557
 						if (isset($spotter_item['altitude'])) {
417
-							if ($compress) $output .= '"a": "'.$spotter_item['altitude'].'",';
418
-							else $output .= '"altitude": "'.$spotter_item['altitude'].'",';
558
+							if ($compress) {
559
+								$output .= '"a": "'.$spotter_item['altitude'].'",';
560
+							} else {
561
+								$output .= '"altitude": "'.$spotter_item['altitude'].'",';
562
+							}
419 563
 						}
420 564
 						
421 565
 						$heading = $spotter_item['heading'];
@@ -439,19 +583,24 @@  discard block
 block discarded – undo
439 583
 							}
440 584
 						}
441 585
 						
442
-						if ($compress)$output .= '"h": "'.$heading.'",';
443
-						else $output .= '"heading": "'.$heading.'",';
586
+						if ($compress) {
587
+							$output .= '"h": "'.$heading.'",';
588
+						} else {
589
+							$output .= '"heading": "'.$heading.'",';
590
+						}
444 591
 						if ($currenttime != '') {
445 592
 							if (strtotime($spotter_item['date']) < $currenttime) {
446 593
 								if (isset($archivespeed)) {
447 594
 									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
448 595
 									$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
449
-									if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
450
-									else {
596
+									if (!isset($idistance) || $fdistance < $idistance) {
597
+										$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
598
+									} else {
451 599
 										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
452 600
 										$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
453
-										if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
454
-										else {
601
+										if (!isset($idistance) || $fdistance < $idistance) {
602
+											$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
603
+										} else {
455 604
 											$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed);
456 605
 											$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
457 606
 										}
@@ -459,12 +608,14 @@  discard block
 block discarded – undo
459 608
 								} elseif ($usenextlatlon) {
460 609
 									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
461 610
 									$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
462
-									if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
463
-									else {
611
+									if (!isset($idistance) || $fdistance < $idistance) {
612
+										$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
613
+									} else {
464 614
 										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
465 615
 										$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
466
-										if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
467
-										else {
616
+										if (!isset($idistance) || $fdistance < $idistance) {
617
+											$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
618
+										} else {
468 619
 											$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading);
469 620
 											$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
470 621
 										}
@@ -503,7 +654,9 @@  discard block
 block discarded – undo
503 654
 							}
504 655
 						}
505 656
 
506
-						if (!$min) $output .= '"image": "'.$image.'",';
657
+						if (!$min) {
658
+							$output .= '"image": "'.$image.'",';
659
+						}
507 660
 						if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') {
508 661
 							$output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",';
509 662
 						}
@@ -511,8 +664,11 @@  discard block
 block discarded – undo
511 664
 							$output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",';
512 665
 						}
513 666
 						if (isset($spotter_item['squawk'])) {
514
-							if ($compress) $output .= '"sq": "'.$spotter_item['squawk'].'",';
515
-							else $output .= '"squawk": "'.$spotter_item['squawk'].'",';
667
+							if ($compress) {
668
+								$output .= '"sq": "'.$spotter_item['squawk'].'",';
669
+							} else {
670
+								$output .= '"squawk": "'.$spotter_item['squawk'].'",';
671
+							}
516 672
 						}
517 673
 						if (isset($spotter_item['squawk_usage'])) {
518 674
 							$output .= '"squawk_usage": "'.$spotter_item['squawk_usage'].'",';
@@ -531,14 +687,23 @@  discard block
 block discarded – undo
531 687
 						}
532 688
 						// type when not aircraft ?
533 689
 						if (isset($spotter_item['type'])) {
534
-							if ($compress) $output .= '"t": "'.$spotter_item['type'].'"';
535
-							else $output .= '"type": "'.$spotter_item['type'].'"';
690
+							if ($compress) {
691
+								$output .= '"t": "'.$spotter_item['type'].'"';
692
+							} else {
693
+								$output .= '"type": "'.$spotter_item['type'].'"';
694
+							}
536 695
 						} elseif ($marine) {
537
-							if ($compress) $output .= '"t": "ship"';
538
-							else $output .= '"type": "ship"';
696
+							if ($compress) {
697
+								$output .= '"t": "ship"';
698
+							} else {
699
+								$output .= '"type": "ship"';
700
+							}
539 701
 						} else {
540
-							if ($compress) $output .= '"t": "aircraft"';
541
-							else $output .= '"type": "aircraft"';
702
+							if ($compress) {
703
+								$output .= '"t": "aircraft"';
704
+							} else {
705
+								$output .= '"type": "aircraft"';
706
+							}
542 707
 						}
543 708
 						$output .= '},';
544 709
 						$output .= '"geometry": {';
@@ -546,15 +711,19 @@  discard block
 block discarded – undo
546 711
 								$output .= '"coordinates": [';
547 712
 								if ($currenttime != '') {
548 713
 									if (strtotime($spotter_item['date']) < $currenttime) {
549
-										if (!isset($archivespeed)) $archivespeed = 1;
714
+										if (!isset($archivespeed)) {
715
+											$archivespeed = 1;
716
+										}
550 717
 										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date'])));
551 718
 										$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
552
-										if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
553
-										else {
719
+										if (!isset($idistance) || $fdistance < $idistance) {
720
+											$output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
721
+										} else {
554 722
 											$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date'])));
555 723
 											$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
556
-											if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
557
-											else {
724
+											if (!isset($idistance) || $fdistance < $idistance) {
725
+												$output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
726
+											} else {
558 727
 												$output .= $spotter_item['longitude'].', ';
559 728
 												$output .= $spotter_item['latitude'];
560 729
 											}
@@ -632,7 +801,9 @@  discard block
 block discarded – undo
632 801
 			}
633 802
 */
634 803
 				$history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING);
635
-				if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history'];
804
+				if ($history == '' && isset($_COOKIE['history'])) {
805
+					$history = $_COOKIE['history'];
806
+				}
636 807
 				
637 808
 				if (
638 809
 				    (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') 
@@ -698,8 +869,11 @@  discard block
 block discarded – undo
698 869
 									$output_history .= ']}},';
699 870
 									$output .= $output_history;
700 871
 								}
701
-								if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
702
-								else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
872
+								if ($compress) {
873
+									$output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
874
+								} else {
875
+									$output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
876
+								}
703 877
 							}
704 878
 							$output_history .= '[';
705 879
 							$output_history .=  $spotter_history['longitude'].', ';
@@ -720,10 +894,15 @@  discard block
 block discarded – undo
720 894
 							if ($d == false) {
721 895
 								if ($compress) {
722 896
 									$output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'",';
723
-									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>",';
724
-									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>",';
897
+									if (isset($spotter_history_array[0]['mapmatching_engine']) && $spotter_history_array[0]['mapmatching_engine'] == 'graphhopper') {
898
+										$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>",';
899
+									} elseif (isset($spotter_history_array[0]['mapmatching_engine'])) {
900
+										$output_history .= '"atr": "Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",';
901
+									}
725 902
 									$output_history .= '"t": "history"},"geometry": {"type": "LineString","coordinates": [';
726
-								} else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": [';
903
+								} else {
904
+									$output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": [';
905
+								}
727 906
 								$d = true;
728 907
 							}
729 908
 							$output_history .= '[';
@@ -746,7 +925,9 @@  discard block
 block discarded – undo
746 925
 							$output_historyd = '[';
747 926
 							$output_historyd .=  $spotter_item['longitude'].', ';
748 927
 							$output_historyd .=  $spotter_item['latitude'];
749
-							if (isset($spotter_history['altitude'])) $output_historyd .=  ','.$spotter_item['altitude']*30.48;
928
+							if (isset($spotter_history['altitude'])) {
929
+								$output_historyd .=  ','.$spotter_item['altitude']*30.48;
930
+							}
750 931
 							$output_historyd .= '],';
751 932
 							//$output_history = $output_historyd.$output_history;
752 933
 							$output_history = $output_history.$output_historyd;
@@ -773,8 +954,11 @@  discard block
 block discarded – undo
773 954
 				        && $spotter_item['arrival_airport'] != 'NA' 
774 955
 				        && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") 
775 956
 				    	    || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) {
776
-				    if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
777
-				    else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
957
+				    if ($compress) {
958
+				    	$output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
959
+				    } else {
960
+				    	$output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
961
+				    }
778 962
 				    if (isset($spotter_item['departure_airport_latitude'])) {
779 963
 					$output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],';
780 964
 				    } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') {
@@ -807,8 +991,11 @@  discard block
 block discarded – undo
807 991
 				    	    || (!isset($_COOKIE['MapRemainingRoute']) && (!isset($globalMapRemainingRoute) 
808 992
 				    	    || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) {
809 993
 				    $havedata = false;
810
-				    if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
811
-				    else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
994
+				    if ($compress) {
995
+				    	$output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
996
+				    } else {
997
+				    	$output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
998
+				    }
812 999
 				    $output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],';
813 1000
 
814 1001
 				    if (isset($spotter_item['arrival_airport_latitude'])) {
@@ -823,7 +1010,9 @@  discard block
 block discarded – undo
823 1010
 				    }
824 1011
 				    //$output_dest  = substr($output_dest, 0, -1);
825 1012
 				    $output_dest .= ']}},';
826
-				    if ($havedata) $output .= $output_dest;
1013
+				    if ($havedata) {
1014
+				    	$output .= $output_dest;
1015
+				    }
827 1016
 				    unset($output_dest);
828 1017
 				}
829 1018
 			}
@@ -831,7 +1020,9 @@  discard block
 block discarded – undo
831 1020
 			$output .= ']';
832 1021
 			$output .= ',"initial_sqltime": "'.$sqltime.'",';
833 1022
 			$output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",';
834
-			if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
1023
+			if (isset($begindate)) {
1024
+				$output .= '"archive_date": "'.$begindate.'",';
1025
+			}
835 1026
 			$output .= '"fc": "'.$j.'"';
836 1027
 		} else {
837 1028
 			$output .= '"features": ';
Please login to merge, or discard this patch.