Completed
Push — master ( 492b3e...b38f26 )
by Yannick
29:43
created
require/class.TrackerImport.php 1 patch
Braces   +190 added lines, -65 removed lines patch added patch discarded remove patch
@@ -42,7 +42,9 @@  discard block
 block discarded – undo
42 42
 
43 43
     public function checkAll() {
44 44
 	global $globalDebug;
45
-	if ($globalDebug) echo "Update last seen tracked data...\n";
45
+	if ($globalDebug) {
46
+		echo "Update last seen tracked data...\n";
47
+	}
46 48
 	foreach ($this->all_tracked as $key => $flight) {
47 49
 	    if (isset($this->all_tracked[$key]['id'])) {
48 50
 		//echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].'  '.$this->all_tracked[$key]['longitude']."\n";
@@ -55,12 +57,16 @@  discard block
 block discarded – undo
55 57
     public function del() {
56 58
 	global $globalDebug;
57 59
 	// Delete old infos
58
-	if ($globalDebug) echo 'Delete old values and update latest data...'."\n";
60
+	if ($globalDebug) {
61
+		echo 'Delete old values and update latest data...'."\n";
62
+	}
59 63
 	foreach ($this->all_tracked as $key => $flight) {
60 64
     	    if (isset($flight['lastupdate'])) {
61 65
         	if ($flight['lastupdate'] < (time()-3000)) {
62 66
             	    if (isset($this->all_tracked[$key]['id'])) {
63
-            		if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n";
67
+            		if ($globalDebug) {
68
+            			echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n";
69
+            		}
64 70
 			/*
65 71
 			$TrackerLive = new TrackerLive();
66 72
             		$TrackerLive->deleteLiveTrackerDataById($this->all_tracked[$key]['id']);
@@ -70,7 +76,9 @@  discard block
 block discarded – undo
70 76
             		$Tracker = new Tracker($this->db);
71 77
             		if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') {
72 78
 				$result = $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed']);
73
-				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
79
+				if ($globalDebug && $result != 'success') {
80
+					echo '!!! ERROR : '.$result."\n";
81
+				}
74 82
 			}
75 83
 			// Put in archive
76 84
 //			$Tracker->db = null;
@@ -83,7 +91,9 @@  discard block
 block discarded – undo
83 91
 
84 92
     public function add($line) {
85 93
 	global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChangeTracker, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked;
86
-	if (!isset($globalCoordMinChangeTracker) || $globalCoordMinChangeTracker == '') $globalCoordMinChangeTracker = '0.015';
94
+	if (!isset($globalCoordMinChangeTracker) || $globalCoordMinChangeTracker == '') {
95
+		$globalCoordMinChangeTracker = '0.015';
96
+	}
87 97
 	date_default_timezone_set('UTC');
88 98
 	$dataFound = false;
89 99
 	$send = false;
@@ -97,19 +107,29 @@  discard block
 block discarded – undo
97 107
 		// Increment message number
98 108
 		if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE) {
99 109
 		    $current_date = date('Y-m-d');
100
-		    if (isset($line['source_name'])) $source = $line['source_name'];
101
-		    else $source = '';
102
-		    if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source'];
110
+		    if (isset($line['source_name'])) {
111
+		    	$source = $line['source_name'];
112
+		    } else {
113
+		    	$source = '';
114
+		    }
115
+		    if ($source == '' || $line['format_source'] == 'aprs') {
116
+		    	$source = $line['format_source'];
117
+		    }
103 118
 		    if (!isset($this->stats[$current_date][$source]['msg'])) {
104 119
 		    	$this->stats[$current_date][$source]['msg']['date'] = time();
105 120
 		    	$this->stats[$current_date][$source]['msg']['nb'] = 1;
106
-		    } else $this->stats[$current_date][$source]['msg']['nb'] += 1;
121
+		    } else {
122
+		    	$this->stats[$current_date][$source]['msg']['nb'] += 1;
123
+		    }
107 124
 		}
108 125
 		
109 126
 		
110 127
 		$Common = new Common();
111
-	        if (!isset($line['id'])) $id = trim($line['ident']);
112
-	        else $id = trim($line['id']);
128
+	        if (!isset($line['id'])) {
129
+	        	$id = trim($line['ident']);
130
+	        } else {
131
+	        	$id = trim($line['id']);
132
+	        }
113 133
 		
114 134
 		if (!isset($this->all_tracked[$id])) {
115 135
 		    $this->all_tracked[$id] = array();
@@ -117,31 +137,46 @@  discard block
 block discarded – undo
117 137
 		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','noarchive' => false,'putinarchive' => true,'over_country' => ''));
118 138
 		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time()));
119 139
 		    if (!isset($line['id'])) {
120
-			if (!isset($globalDaemon)) $globalDaemon = TRUE;
140
+			if (!isset($globalDaemon)) {
141
+				$globalDaemon = TRUE;
142
+			}
121 143
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi')));
122
-		     } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id']));
123
-		    if ($globalAllTracked !== FALSE) $dataFound = true;
144
+		     } else {
145
+		     	$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id']));
146
+		     }
147
+		    if ($globalAllTracked !== FALSE) {
148
+		    	$dataFound = true;
149
+		    }
124 150
 		}
125 151
 		
126 152
 		if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) {
127 153
 		    if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_tracked[$id]['datetime'])) {
128 154
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime']));
129 155
 		    } else {
130
-				if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n";
131
-				elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n";
156
+				if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) {
157
+					echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n";
158
+				} elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) {
159
+					echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n";
160
+				}
132 161
 				return '';
133 162
 		    }
134 163
 		} elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) {
135
-			if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n";
164
+			if ($globalDebug) {
165
+				echo "!!! Date is too old ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n";
166
+			}
136 167
 			return '';
137 168
 		} elseif (isset($line['datetime']) && strtotime($line['datetime']) > time()+20*60) {
138
-			if ($globalDebug) echo "!!! Date is in the future ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n";
169
+			if ($globalDebug) {
170
+				echo "!!! Date is in the future ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n";
171
+			}
139 172
 			return '';
140 173
 		} elseif (!isset($line['datetime'])) {
141 174
 			date_default_timezone_set('UTC');
142 175
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => date('Y-m-d H:i:s')));
143 176
 		} else {
144
-			if ($globalDebug) echo "!!! Unknow date error ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n";
177
+			if ($globalDebug) {
178
+				echo "!!! Unknow date error ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n";
179
+			}
145 180
 			return '';
146 181
 		}
147 182
 		
@@ -153,11 +188,17 @@  discard block
 block discarded – undo
153 188
             		$Tracker = new Tracker($this->db);
154 189
             		$fromsource = NULL;
155 190
             		$result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource);
156
-			if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
191
+			if ($globalDebug && $result != 'success') {
192
+				echo '!!! ERROR : '.$result."\n";
193
+			}
157 194
 			$Tracker->db = null;
158
-			if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
195
+			if ($globalDebugTimeElapsed) {
196
+				echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
197
+			}
198
+		    }
199
+		    if (!isset($this->all_tracked[$id]['id'])) {
200
+		    	$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident']));
159 201
 		    }
160
-		    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident']));
161 202
 		}
162 203
 
163 204
 		if (isset($line['speed']) && $line['speed'] != '') {
@@ -168,14 +209,21 @@  discard block
 block discarded – undo
168 209
 		    if ($distance > 100 && $distance < 10000) {
169 210
 			$speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']);
170 211
 			$speed = $speed*3.6;
171
-			if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed)));
172
-  			if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['ident']." : ".$speed." - distance : ".$distance."\n";
212
+			if ($speed < 1000) {
213
+				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed)));
214
+			}
215
+  			if ($globalDebug) {
216
+  				echo "ø Calculated Speed for ".$this->all_tracked[$id]['ident']." : ".$speed." - distance : ".$distance."\n";
217
+  			}
173 218
 		    }
174 219
 		}
175 220
 
176 221
 	        if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) {
177
-	    	    if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']);
178
-	    	    else unset($timediff);
222
+	    	    if (isset($this->all_tracked[$id]['time_last_coord'])) {
223
+	    	    	$timediff = round(time()-$this->all_tracked[$id]['time_last_coord']);
224
+	    	    } else {
225
+	    	    	unset($timediff);
226
+	    	    }
179 227
 	    	    if ($this->tmd > 5 || !isset($timediff) || $timediff > 90 || ($timediff > 60 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) {
180 228
 			if (isset($this->all_tracked[$id]['archive_latitude']) && isset($this->all_tracked[$id]['archive_longitude']) && isset($this->all_tracked[$id]['livedb_latitude']) && isset($this->all_tracked[$id]['livedb_longitude'])) {
181 229
 			    if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'],0.08)) {
@@ -183,20 +231,30 @@  discard block
 block discarded – undo
183 231
 				$this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
184 232
 				$this->all_tracked[$id]['putinarchive'] = true;
185 233
 				
186
-				if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... ';
234
+				if ($globalDebug) {
235
+					echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... ';
236
+				}
187 237
 				$timeelapsed = microtime(true);
188 238
 				$Tracker = new Tracker($this->db);
189 239
 				$all_country = $Tracker->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']);
190
-				if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2'];
240
+				if (!empty($all_country)) {
241
+					$this->all_tracked[$id]['over_country'] = $all_country['iso2'];
242
+				}
191 243
 				$Tracker->db = null;
192
-				if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
244
+				if ($globalDebugTimeElapsed) {
245
+					echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
246
+				}
193 247
 				$this->tmd = 0;
194
-				if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n";
248
+				if ($globalDebug) {
249
+					echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n";
250
+				}
195 251
 			    }
196 252
 			}
197 253
 
198 254
 			if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) {
199
-				if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude'];
255
+				if (!isset($this->all_tracked[$id]['archive_latitude'])) {
256
+					$this->all_tracked[$id]['archive_latitude'] = $line['latitude'];
257
+				}
200 258
 				if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChangeTracker || $this->all_tracked[$id]['format_source'] == 'aprs') {
201 259
 				    $this->all_tracked[$id]['livedb_latitude'] = $line['latitude'];
202 260
 				    $dataFound = true;
@@ -205,8 +263,12 @@  discard block
 block discarded – undo
205 263
 				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude']));
206 264
 			}
207 265
 			if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) {
208
-			    if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
209
-				if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
266
+			    if ($line['longitude'] > 180) {
267
+			    	$line['longitude'] = $line['longitude'] - 360;
268
+			    }
269
+				if (!isset($this->all_tracked[$id]['archive_longitude'])) {
270
+					$this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
271
+				}
210 272
 				if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChangeTracker || $this->all_tracked[$id]['format_source'] == 'aprs') {
211 273
 				    $this->all_tracked[$id]['livedb_longitude'] = $line['longitude'];
212 274
 				    $dataFound = true;
@@ -226,7 +288,9 @@  discard block
 block discarded – undo
226 288
 		    }
227 289
 		}
228 290
 		if (isset($line['last_update']) && $line['last_update'] != '') {
229
-		    if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true;
291
+		    if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) {
292
+		    	$dataFound = true;
293
+		    }
230 294
 		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update']));
231 295
 		}
232 296
 		if (isset($line['format_source']) && $line['format_source'] != '') {
@@ -246,7 +310,9 @@  discard block
 block discarded – undo
246 310
 
247 311
 		if (isset($line['altitude']) && $line['altitude'] != '') {
248 312
 		    //if (!isset($this->all_tracked[$id]['altitude']) || $this->all_tracked[$id]['altitude'] == '' || ($this->all_tracked[$id]['altitude'] > 0 && $line['altitude'] != 0)) {
249
-			if (is_int($this->all_tracked[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_tracked[$id]['altitude']) > 3) $this->all_tracked[$id]['putinarchive'] = true;
313
+			if (is_int($this->all_tracked[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_tracked[$id]['altitude']) > 3) {
314
+				$this->all_tracked[$id]['putinarchive'] = true;
315
+			}
250 316
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude' => $line['altitude']));
251 317
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude_real' => $line['altitude']));
252 318
 			//$dataFound = true;
@@ -258,15 +324,21 @@  discard block
 block discarded – undo
258 324
 		}
259 325
 		
260 326
 		if (isset($line['heading']) && $line['heading'] != '') {
261
-		    if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true;
327
+		    if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) {
328
+		    	$this->all_tracked[$id]['putinarchive'] = true;
329
+		    }
262 330
 		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading'])));
263 331
 		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true));
264 332
 		    //$dataFound = true;
265 333
   		} elseif (!isset($this->all_tracked[$id]['heading_fromsrc']) && isset($this->all_tracked[$id]['archive_latitude']) && $this->all_tracked[$id]['archive_latitude'] != $this->all_tracked[$id]['latitude'] && isset($this->all_tracked[$id]['archive_longitude']) && $this->all_tracked[$id]['archive_longitude'] != $this->all_tracked[$id]['longitude']) {
266 334
   		    $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']);
267 335
 		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading)));
268
-		    if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true;
269
-  		    if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n";
336
+		    if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) {
337
+		    	$this->all_tracked[$id]['putinarchive'] = true;
338
+		    }
339
+  		    if ($globalDebug) {
340
+  		    	echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n";
341
+  		    }
270 342
   		}
271 343
 		//if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false;
272 344
 
@@ -275,20 +347,31 @@  discard block
 block discarded – undo
275 347
 		    if ($this->all_tracked[$id]['addedTracker'] == 0) {
276 348
 		        if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == ''  || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
277 349
 			    if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) {
278
-				if ($globalDebug) echo "Check if aircraft is already in DB...";
350
+				if ($globalDebug) {
351
+					echo "Check if aircraft is already in DB...";
352
+				}
279 353
 				$timeelapsed = microtime(true);
280 354
 				$TrackerLive = new TrackerLive($this->db);
281 355
 				if (isset($line['id'])) {
282 356
 				    $recent_ident = $TrackerLive->checkIdRecent($line['id']);
283
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
357
+				    if ($globalDebugTimeElapsed) {
358
+				    	echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
359
+				    }
284 360
 				} elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') {
285 361
 				    $recent_ident = $TrackerLive->checkIdentRecent($this->all_tracked[$id]['ident']);
286
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
287
-				} else $recent_ident = '';
362
+				    if ($globalDebugTimeElapsed) {
363
+				    	echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
364
+				    }
365
+				} else {
366
+					$recent_ident = '';
367
+				}
288 368
 				$TrackerLive->db=null;
289 369
 
290
-				if ($globalDebug && $recent_ident == '') echo " Not in DB.\n";
291
-				elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n";
370
+				if ($globalDebug && $recent_ident == '') {
371
+					echo " Not in DB.\n";
372
+				} elseif ($globalDebug && $recent_ident != '') {
373
+					echo " Already in DB.\n";
374
+				}
292 375
 			    } else {
293 376
 				$recent_ident = '';
294 377
 				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0));
@@ -296,27 +379,41 @@  discard block
 block discarded – undo
296 379
 			    //if there was no aircraft with the same callsign within the last hour and go post it into the archive
297 380
 			    if($recent_ident == "")
298 381
 			    {
299
-				if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : ";
382
+				if ($globalDebug) {
383
+					echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : ";
384
+				}
300 385
 				//adds the spotter data for the archive
301 386
 				    $highlight = '';
302
-				    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi')));
387
+				    if (!isset($this->all_tracked[$id]['id'])) {
388
+				    	$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi')));
389
+				    }
303 390
 				    $timeelapsed = microtime(true);
304 391
 				    $Tracker = new Tracker($this->db);
305 392
 				    $result = $Tracker->addTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']);
306 393
 				    $Tracker->db = null;
307
-				    if ($globalDebug && isset($result)) echo $result."\n";
308
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
394
+				    if ($globalDebug && isset($result)) {
395
+				    	echo $result."\n";
396
+				    }
397
+				    if ($globalDebugTimeElapsed) {
398
+				    	echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
399
+				    }
309 400
 				    
310 401
 				    
311 402
 				    // Add source stat in DB
312 403
 				    $Stats = new Stats($this->db);
313 404
 				    if (!empty($this->stats)) {
314
-					if ($globalDebug) echo 'Add source stats : ';
405
+					if ($globalDebug) {
406
+						echo 'Add source stats : ';
407
+					}
315 408
 				        foreach($this->stats as $date => $data) {
316 409
 					    foreach($data as $source => $sourced) {
317 410
 					        //print_r($sourced);
318
-				    	        if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_tracker',$date);
319
-				    	        if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_tracker',$date);
411
+				    	        if (isset($sourced['polar'])) {
412
+				    	        	echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_tracker',$date);
413
+				    	        }
414
+				    	        if (isset($sourced['hist'])) {
415
+				    	        	echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_tracker',$date);
416
+				    	        }
320 417
 				    		if (isset($sourced['msg'])) {
321 418
 				    		    if (time() - $sourced['msg']['date'] > 10) {
322 419
 				    		        $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date']));
@@ -329,7 +426,9 @@  discard block
 block discarded – undo
329 426
 			    			unset($this->stats[$date]);
330 427
 			    		    }
331 428
 				    	}
332
-				    	if ($globalDebug) echo 'Done'."\n";
429
+				    	if ($globalDebug) {
430
+				    		echo 'Done'."\n";
431
+				    	}
333 432
 
334 433
 				    }
335 434
 				    $Stats->db = null;
@@ -339,12 +438,16 @@  discard block
 block discarded – undo
339 438
 				$this->all_tracked[$id]['addedTracker'] = 1;
340 439
 				//print_r($this->all_tracked[$id]);
341 440
 				if ($this->last_delete == 0 || time() - $this->last_delete > 1800) {
342
-				    if ($globalDebug) echo "---- Deleting Live Tracker data older than 9 hours...";
441
+				    if ($globalDebug) {
442
+				    	echo "---- Deleting Live Tracker data older than 9 hours...";
443
+				    }
343 444
 				    //TrackerLive->deleteLiveTrackerDataNotUpdated();
344 445
 				    $TrackerLive = new TrackerLive($this->db);
345 446
 				    $TrackerLive->deleteLiveTrackerData();
346 447
 				    $TrackerLive->db=null;
347
-				    if ($globalDebug) echo " Done\n";
448
+				    if ($globalDebug) {
449
+				    	echo " Done\n";
450
+				    }
348 451
 				    $this->last_delete = time();
349 452
 				}
350 453
 			    } else {
@@ -367,19 +470,25 @@  discard block
 block discarded – undo
367 470
 
368 471
 		    if (!$ignoreImport) {
369 472
 			if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
370
-				if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : ";
473
+				if ($globalDebug) {
474
+					echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : ";
475
+				}
371 476
 				$timeelapsed = microtime(true);
372 477
 				$TrackerLive = new TrackerLive($this->db);
373 478
 				$result = $TrackerLive->addLiveTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']);
374 479
 				$TrackerLive->db = null;
375 480
 				$this->all_tracked[$id]['putinarchive'] = false;
376
-				if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
481
+				if ($globalDebugTimeElapsed) {
482
+					echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
483
+				}
377 484
 
378 485
 				// Put statistics in $this->stats variable
379 486
 				
380 487
 				if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') {
381 488
 					$source = $this->all_tracked[$id]['source_name'];
382
-					if ($source == '') $source = $this->all_tracked[$id]['format_source'];
489
+					if ($source == '') {
490
+						$source = $this->all_tracked[$id]['format_source'];
491
+					}
383 492
 					if (!isset($this->source_location[$source])) {
384 493
 						$Location = new Source($this->db);
385 494
 						$coord = $Location->getLocationInfobySourceName($source);
@@ -400,7 +509,9 @@  discard block
 block discarded – undo
400 509
 					$stats_heading = round($stats_heading/22.5);
401 510
 					$stats_distance = $Common->distance($latitude,$longitude,$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']);
402 511
 					$current_date = date('Y-m-d');
403
-					if ($stats_heading == 16) $stats_heading = 0;
512
+					if ($stats_heading == 16) {
513
+						$stats_heading = 0;
514
+					}
404 515
 					if (!isset($this->stats[$current_date][$source]['polar'][1])) {
405 516
 						for ($i=0;$i<=15;$i++) {
406 517
 						    $this->stats[$current_date][$source]['polar'][$i] = 0;
@@ -418,7 +529,9 @@  discard block
 block discarded – undo
418 529
 						if (isset($this->stats[$current_date][$source]['hist'][0])) {
419 530
 						    end($this->stats[$current_date][$source]['hist']);
420 531
 						    $mini = key($this->stats[$current_date][$source]['hist'])+10;
421
-						} else $mini = 0;
532
+						} else {
533
+							$mini = 0;
534
+						}
422 535
 						for ($i=$mini;$i<=$distance;$i+=10) {
423 536
 						    $this->stats[$current_date][$source]['hist'][$i] = 0;
424 537
 						}
@@ -429,19 +542,29 @@  discard block
 block discarded – undo
429 542
 				}
430 543
 
431 544
 				$this->all_tracked[$id]['lastupdate'] = time();
432
-				if ($this->all_tracked[$id]['putinarchive']) $send = true;
433
-				if ($globalDebug) echo $result."\n";
434
-			} elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n";
545
+				if ($this->all_tracked[$id]['putinarchive']) {
546
+					$send = true;
547
+				}
548
+				if ($globalDebug) {
549
+					echo $result."\n";
550
+				}
551
+			} elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) {
552
+				echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n";
553
+			}
435 554
 			//$this->del();
436 555
 			
437 556
 			
438 557
 			if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) {
439
-			    if ($globalDebug) echo "---- Deleting Live Tracker data Not updated since 2 hour...";
558
+			    if ($globalDebug) {
559
+			    	echo "---- Deleting Live Tracker data Not updated since 2 hour...";
560
+			    }
440 561
 			    $TrackerLive = new TrackerLive($this->db);
441 562
 			    $TrackerLive->deleteLiveTrackerDataNotUpdated();
442 563
 			    $TrackerLive->db = null;
443 564
 			    //TrackerLive->deleteLiveTrackerData();
444
-			    if ($globalDebug) echo " Done\n";
565
+			    if ($globalDebug) {
566
+			    	echo " Done\n";
567
+			    }
445 568
 			    $this->last_delete_hourly = time();
446 569
 			}
447 570
 			
@@ -449,7 +572,9 @@  discard block
 block discarded – undo
449 572
 		    //$ignoreImport = false;
450 573
 		}
451 574
 		//if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN);
452
-		if ($send) return $this->all_tracked[$id];
575
+		if ($send) {
576
+			return $this->all_tracked[$id];
577
+		}
453 578
 	    }
454 579
 	}
455 580
     }
Please login to merge, or discard this patch.
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.MapMatching.php 1 patch
Braces   +51 added lines, -17 removed lines patch added patch discarded remove patch
@@ -82,9 +82,15 @@  discard block
 block discarded – undo
82 82
 
83 83
 	public function TrackMatching($spotter_history_array) {
84 84
 		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);
85
+		if (!isset($globalMapMatchingMaxPts)) {
86
+			$globalMapMatchingMaxPts = 100;
87
+		}
88
+		if (count($spotter_history_array) < 2) {
89
+			return $spotter_history_array;
90
+		}
91
+		if (count($spotter_history_array) > $globalMapMatchingMaxPts) {
92
+			$spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts);
93
+		}
88 94
 		$data = $this->create_gpx($spotter_history_array);
89 95
 		$url = 'https://test.roadmatching.com/rest/mapmatch/?app_id='.$globalTrackMatchingAppId.'&app_key='.$globalTrackMatchingAppKey.'&output.waypoints=true';
90 96
 		$Common = new Common();
@@ -111,8 +117,12 @@  discard block
 block discarded – undo
111 117
 	*/
112 118
 	public function GraphHopper($spotter_history_array) {
113 119
 		global $globalMapMatchingMaxPts, $globalGraphHopperKey;
114
-		if (!isset($globalMapMatchingMaxPts)) $globalMapMatchingMaxPts = 100;
115
-		if (count($spotter_history_array) < 2) return $spotter_history_array;
120
+		if (!isset($globalMapMatchingMaxPts)) {
121
+			$globalMapMatchingMaxPts = 100;
122
+		}
123
+		if (count($spotter_history_array) < 2) {
124
+			return $spotter_history_array;
125
+		}
116 126
 		$spotter_history_initial_array = array();
117 127
 		if (count($spotter_history_array) > $globalMapMatchingMaxPts) {
118 128
 			$spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts);
@@ -142,8 +152,12 @@  discard block
 block discarded – undo
142 152
 	*/
143 153
 	public function FAMMapMatching($spotter_history_array) {
144 154
 		global $globalMapMatchingMaxPts, $globalGraphHopperKey;
145
-		if (!isset($globalMapMatchingMaxPts)) $globalMapMatchingMaxPts = 100;
146
-		if (count($spotter_history_array) < 2) return $spotter_history_array;
155
+		if (!isset($globalMapMatchingMaxPts)) {
156
+			$globalMapMatchingMaxPts = 100;
157
+		}
158
+		if (count($spotter_history_array) < 2) {
159
+			return $spotter_history_array;
160
+		}
147 161
 		$spotter_history_initial_array = array();
148 162
 		if (count($spotter_history_array) > $globalMapMatchingMaxPts) {
149 163
 			$spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts);
@@ -174,8 +188,12 @@  discard block
 block discarded – undo
174 188
 	*/
175 189
 	public function osmr($spotter_history_array) {
176 190
 		global $globalMapMatchingMaxPts;
177
-		if (!isset($globalMapMatchingMaxPts)) $globalMapMatchingMaxPts = 50;
178
-		if (count($spotter_history_array) < 2) return $spotter_history_array;
191
+		if (!isset($globalMapMatchingMaxPts)) {
192
+			$globalMapMatchingMaxPts = 50;
193
+		}
194
+		if (count($spotter_history_array) < 2) {
195
+			return $spotter_history_array;
196
+		}
179 197
 		$spotter_history_initial_array = array();
180 198
 		if (count($spotter_history_array) > $globalMapMatchingMaxPts) {
181 199
 			$spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts);
@@ -185,11 +203,17 @@  discard block
 block discarded – undo
185 203
 		$ts = '';
186 204
 		$rd = '';
187 205
 		foreach ($spotter_history_array as $spotter_data) {
188
-			if ($coord != '') $coord .= ';';
206
+			if ($coord != '') {
207
+				$coord .= ';';
208
+			}
189 209
 			$coord .= $spotter_data['longitude'].','.$spotter_data['latitude'];
190
-			if ($ts != '') $ts .= ';';
210
+			if ($ts != '') {
211
+				$ts .= ';';
212
+			}
191 213
 			$ts .= strtotime($spotter_data['date']);
192
-			if ($rd != '') $rd .= ';';
214
+			if ($rd != '') {
215
+				$rd .= ';';
216
+			}
193 217
 			$rd .= '20';
194 218
 		}
195 219
 		$url = 'https://router.project-osrm.org/match/v1/driving/'.$coord.'?timestamps='.$ts.'&overview=full&geometries=geojson&tidy=true&gaps=ignore';
@@ -215,8 +239,12 @@  discard block
 block discarded – undo
215 239
 	*/
216 240
 	public function mapbox($spotter_history_array) {
217 241
 		global $globalMapMatchingMaxPts, $globalMapboxToken;
218
-		if (!isset($globalMapMatchingMaxPts)) $globalMapMatchingMaxPts = 60;
219
-		if (count($spotter_history_array) < 2) return $spotter_history_array;
242
+		if (!isset($globalMapMatchingMaxPts)) {
243
+			$globalMapMatchingMaxPts = 60;
244
+		}
245
+		if (count($spotter_history_array) < 2) {
246
+			return $spotter_history_array;
247
+		}
220 248
 		$spotter_history_initial_array = array();
221 249
 		if (count($spotter_history_array) > $globalMapMatchingMaxPts) {
222 250
 			$spotter_history_array = array_slice($spotter_history_array,-$globalMapMatchingMaxPts);
@@ -226,11 +254,17 @@  discard block
 block discarded – undo
226 254
 		$ts = '';
227 255
 		$rd = '';
228 256
 		foreach ($spotter_history_array as $spotter_data) {
229
-			if ($coord != '') $coord .= ';';
257
+			if ($coord != '') {
258
+				$coord .= ';';
259
+			}
230 260
 			$coord .= $spotter_data['longitude'].','.$spotter_data['latitude'];
231
-			if ($ts != '') $ts .= ';';
261
+			if ($ts != '') {
262
+				$ts .= ';';
263
+			}
232 264
 			$ts .= strtotime($spotter_data['date']);
233
-			if ($rd != '') $rd .= ';';
265
+			if ($rd != '') {
266
+				$rd .= ';';
267
+			}
234 268
 			$rd .= '20';
235 269
 		}
236 270
 		//$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.
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.
live-geojson.php 1 patch
Braces   +318 added lines, -129 removed lines patch added patch discarded remove patch
@@ -56,28 +56,55 @@  discard block
 block discarded – undo
56 56
 }
57 57
 header('Content-Type: text/javascript');
58 58
 
59
-if (!isset($globalJsonCompress)) $compress = true;
60
-else $compress = $globalJsonCompress;
59
+if (!isset($globalJsonCompress)) {
60
+	$compress = true;
61
+} else {
62
+	$compress = $globalJsonCompress;
63
+}
61 64
 
62 65
 $from_archive = false;
63 66
 $min = true;
64 67
 $allhistory = false;
65 68
 $filter['source'] = array();
66
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
67
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
68
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
69
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
70
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
71
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
72
-if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
73
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
74
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
75
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
76
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
69
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') {
70
+	$filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
71
+}
72
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') {
73
+	$filter['source'] = array_merge($filter['source'],array('whazzup'));
74
+}
75
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') {
76
+	$filter['source'] = array_merge($filter['source'],array('phpvmacars'));
77
+}
78
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') {
79
+	$filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
80
+}
81
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') {
82
+	$filter['source'] = array_merge($filter['source'],array('aprs'));
83
+}
84
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') {
85
+	$filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
86
+}
87
+if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') {
88
+	$filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
89
+}
90
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') {
91
+	$filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
92
+}
93
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') {
94
+	$filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
95
+}
96
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') {
97
+	$filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
98
+}
99
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') {
100
+	$filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
101
+}
77 102
 
78 103
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
79 104
 	$min = true;
80
-} else $min = false;
105
+} else {
106
+	$min = false;
107
+}
81 108
 
82 109
 $spotter_array = array();
83 110
 
@@ -188,24 +215,38 @@  discard block
 block discarded – undo
188 215
 			$flightcnt = $SpotterLive->getLiveSpotterCount($filter);
189 216
 		}
190 217
 	}
191
-	if ($flightcnt == '') $flightcnt = 0;
192
-} else $flightcnt = 0;
218
+	if ($flightcnt == '') {
219
+		$flightcnt = 0;
220
+	}
221
+	} else {
222
+	$flightcnt = 0;
223
+}
193 224
 
194 225
 $sqltime = round(microtime(true)-$begintime,2);
195 226
 
196 227
 $currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
197
-if ($currenttime != '') $currenttime = round($currenttime/1000);
228
+if ($currenttime != '') {
229
+	$currenttime = round($currenttime/1000);
230
+}
198 231
 
199
-if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false;
200
-else $usenextlatlon = true;
201
-if ($usenextlatlon === false) $currenttime = '';
232
+if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) {
233
+	$usenextlatlon = false;
234
+} else {
235
+	$usenextlatlon = true;
236
+}
237
+if ($usenextlatlon === false) {
238
+	$currenttime = '';
239
+}
202 240
 $j = 0;
203 241
 $prev_flightaware_id = '';
204 242
 $aircrafts_shadow = array();
205 243
 $output = '{';
206 244
 	$output .= '"type": "FeatureCollection",';
207
-		if ($min) $output .= '"minimal": "true",';
208
-		else $output .= '"minimal": "false",';
245
+		if ($min) {
246
+			$output .= '"minimal": "true",';
247
+		} else {
248
+			$output .= '"minimal": "false",';
249
+		}
209 250
 		//$output .= '"fc": "'.$flightcnt.'",';
210 251
 		$output .= '"sqt": "'.$sqltime.'",';
211 252
 
@@ -250,18 +291,29 @@  discard block
 block discarded – undo
250 291
 						}
251 292
 						$output .= '"properties": {';
252 293
 						if (isset($spotter_item['flightaware_id'])) {
253
-							if ($compress) $output .= '"fi": "'.$spotter_item['flightaware_id'].'",';
254
-							else $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",';
294
+							if ($compress) {
295
+								$output .= '"fi": "'.$spotter_item['flightaware_id'].'",';
296
+							} else {
297
+								$output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",';
298
+							}
255 299
 						} elseif (isset($spotter_item['famtrackid'])) {
256
-							if ($compress) $output .= '"fti": "'.$spotter_item['famtrackid'].'",';
257
-							else $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",';
300
+							if ($compress) {
301
+								$output .= '"fti": "'.$spotter_item['famtrackid'].'",';
302
+							} else {
303
+								$output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",';
304
+							}
258 305
 						} elseif (isset($spotter_item['fammarine_id'])) {
259
-							if ($compress) $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",';
260
-							else $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",';
306
+							if ($compress) {
307
+								$output .= '"fmi": "'.$spotter_item['fammarine_id'].'",';
308
+							} else {
309
+								$output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",';
310
+							}
261 311
 						}
262 312
 							$output .= '"fc": "'.$flightcnt.'",';
263 313
 							$output .= '"sqt": "'.$sqltime.'",';
264
-							if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
314
+							if (isset($begindate)) {
315
+								$output .= '"archive_date": "'.$begindate.'",';
316
+							}
265 317
 
266 318
 /*
267 319
 							if ($min) $output .= '"minimal": "true",';
@@ -269,14 +321,22 @@  discard block
 block discarded – undo
269 321
 */
270 322
 							//$output .= '"fc": "'.$spotter_item['nb'].'",';
271 323
 						if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') {
272
-							if ($compress) $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",';
273
-							else $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",';
324
+							if ($compress) {
325
+								$output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",';
326
+							} else {
327
+								$output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",';
328
+							}
274 329
 							//"
275 330
 						} else {
276
-							if ($compress) $output .= '"c": "NA",';
277
-							else $output .= '"callsign": "NA",';
331
+							if ($compress) {
332
+								$output .= '"c": "NA",';
333
+							} else {
334
+								$output .= '"callsign": "NA",';
335
+							}
336
+						}
337
+						if (isset($spotter_item['registration'])) {
338
+							$output .= '"registration": "'.$spotter_item['registration'].'",';
278 339
 						}
279
-						if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",';
280 340
 						if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) {
281 341
 							$output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",';
282 342
 							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",';
@@ -289,16 +349,23 @@  discard block
 block discarded – undo
289 349
 							$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
290 350
 						}
291 351
 						if (!isset($spotter_item['aircraft_shadow']) && !$tracker) {
292
-							if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = '';
293
-							else {
352
+							if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') {
353
+								$spotter_item['aircraft_shadow'] = '';
354
+							} else {
294 355
 								$aircraft_icao = $spotter_item['aircraft_icao'];
295
-								if (isset($aircrafts_shadow[$aircraft_icao])) $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao];
296
-								else {
356
+								if (isset($aircrafts_shadow[$aircraft_icao])) {
357
+									$spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao];
358
+								} else {
297 359
 									$aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']);
298
-									if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
299
-									elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png';
300
-									elseif ($aircraft_icao == 'PARAGLIDER') $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png';
301
-									else $spotter_item['aircraft_shadow'] = '';
360
+									if (count($aircraft_info) > 0) {
361
+										$spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
362
+									} elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') {
363
+										$spotter_item['aircraft_shadow'] = 'PA18.png';
364
+									} elseif ($aircraft_icao == 'PARAGLIDER') {
365
+										$spotter_item['aircraft_shadow'] = 'PARAGLIDER.png';
366
+									} else {
367
+										$spotter_item['aircraft_shadow'] = '';
368
+									}
302 369
 									$aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow'];
303 370
 								}
304 371
 							}
@@ -306,73 +373,139 @@  discard block
 block discarded – undo
306 373
 						if (!isset($spotter_item['aircraft_shadow']) || $spotter_item['aircraft_shadow'] == '') {
307 374
 							if ($tracker) {
308 375
 								if (isset($spotter_item['type']) && $spotter_item['type'] == 'Ambulance') {
309
-									if ($compress) $output .= '"as": "ambulance.png",';
310
-									else $output .= '"aircraft_shadow": "ambulance.png",';
376
+									if ($compress) {
377
+										$output .= '"as": "ambulance.png",';
378
+									} else {
379
+										$output .= '"aircraft_shadow": "ambulance.png",';
380
+									}
311 381
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') {
312
-									if ($compress) $output .= '"as": "police.png",';
313
-									else $output .= '"aircraft_shadow": "police.png",';
382
+									if ($compress) {
383
+										$output .= '"as": "police.png",';
384
+									} else {
385
+										$output .= '"aircraft_shadow": "police.png",';
386
+									}
314 387
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') {
315
-									if ($compress) $output .= '"as": "ship.png",';
316
-									else $output .= '"aircraft_shadow": "ship.png",';
388
+									if ($compress) {
389
+										$output .= '"as": "ship.png",';
390
+									} else {
391
+										$output .= '"aircraft_shadow": "ship.png",';
392
+									}
317 393
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') {
318
-									if ($compress) $output .= '"as": "ship.png",';
319
-									else $output .= '"aircraft_shadow": "ship.png",';
394
+									if ($compress) {
395
+										$output .= '"as": "ship.png",';
396
+									} else {
397
+										$output .= '"aircraft_shadow": "ship.png",';
398
+									}
320 399
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') {
321
-									if ($compress) $output .= '"as": "ship.png",';
322
-									else $output .= '"aircraft_shadow": "ship.png",';
400
+									if ($compress) {
401
+										$output .= '"as": "ship.png",';
402
+									} else {
403
+										$output .= '"aircraft_shadow": "ship.png",';
404
+									}
323 405
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') {
324
-									if ($compress) $output .= '"as": "truck.png",';
325
-									else $output .= '"aircraft_shadow": "truck.png",';
406
+									if ($compress) {
407
+										$output .= '"as": "truck.png",';
408
+									} else {
409
+										$output .= '"aircraft_shadow": "truck.png",';
410
+									}
326 411
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') {
327
-									if ($compress) $output .= '"as": "truck.png",';
328
-									else $output .= '"aircraft_shadow": "truck.png",';
412
+									if ($compress) {
413
+										$output .= '"as": "truck.png",';
414
+									} else {
415
+										$output .= '"aircraft_shadow": "truck.png",';
416
+									}
329 417
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') {
330
-									if ($compress) $output .= '"as": "aircraft.png",';
331
-									else $output .= '"aircraft_shadow": "aircraft.png",';
418
+									if ($compress) {
419
+										$output .= '"as": "aircraft.png",';
420
+									} else {
421
+										$output .= '"aircraft_shadow": "aircraft.png",';
422
+									}
332 423
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') {
333
-									if ($compress) $output .= '"as": "aircraft.png",';
334
-									else $output .= '"aircraft_shadow": "aircraft.png",';
424
+									if ($compress) {
425
+										$output .= '"as": "aircraft.png",';
426
+									} else {
427
+										$output .= '"aircraft_shadow": "aircraft.png",';
428
+									}
335 429
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') {
336
-									if ($compress) $output .= '"as": "helico.png",';
337
-									else $output .= '"aircraft_shadow": "helico.png",';
430
+									if ($compress) {
431
+										$output .= '"as": "helico.png",';
432
+									} else {
433
+										$output .= '"aircraft_shadow": "helico.png",';
434
+									}
338 435
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') {
339
-									if ($compress) $output .= '"as": "rail.png",';
340
-									else $output .= '"aircraft_shadow": "rail.png",';
436
+									if ($compress) {
437
+										$output .= '"as": "rail.png",';
438
+									} else {
439
+										$output .= '"aircraft_shadow": "rail.png",';
440
+									}
341 441
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') {
342
-									if ($compress) $output .= '"as": "firetruck.png",';
343
-									else $output .= '"aircraft_shadow": "firetruck.png",';
442
+									if ($compress) {
443
+										$output .= '"as": "firetruck.png",';
444
+									} else {
445
+										$output .= '"aircraft_shadow": "firetruck.png",';
446
+									}
344 447
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') {
345
-									if ($compress) $output .= '"as": "bus.png",';
346
-									else $output .= '"aircraft_shadow": "bus.png",';
448
+									if ($compress) {
449
+										$output .= '"as": "bus.png",';
450
+									} else {
451
+										$output .= '"aircraft_shadow": "bus.png",';
452
+									}
347 453
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') {
348
-									if ($compress) $output .= '"as": "phone.png",';
349
-									else $output .= '"aircraft_shadow": "phone.png",';
454
+									if ($compress) {
455
+										$output .= '"as": "phone.png",';
456
+									} else {
457
+										$output .= '"aircraft_shadow": "phone.png",';
458
+									}
350 459
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') {
351
-									if ($compress) $output .= '"as": "jogger.png",';
352
-									else $output .= '"aircraft_shadow": "jogger.png",';
460
+									if ($compress) {
461
+										$output .= '"as": "jogger.png",';
462
+									} else {
463
+										$output .= '"aircraft_shadow": "jogger.png",';
464
+									}
353 465
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') {
354
-									if ($compress) $output .= '"as": "bike.png",';
355
-									else $output .= '"aircraft_shadow": "bike.png",';
466
+									if ($compress) {
467
+										$output .= '"as": "bike.png",';
468
+									} else {
469
+										$output .= '"aircraft_shadow": "bike.png",';
470
+									}
356 471
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') {
357
-									if ($compress) $output .= '"as": "motorcycle.png",';
358
-									else $output .= '"aircraft_shadow": "motorcycle.png",';
472
+									if ($compress) {
473
+										$output .= '"as": "motorcycle.png",';
474
+									} else {
475
+										$output .= '"aircraft_shadow": "motorcycle.png",';
476
+									}
359 477
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') {
360
-									if ($compress) $output .= '"as": "balloon.png",';
361
-									else $output .= '"aircraft_shadow": "balloon.png",';
478
+									if ($compress) {
479
+										$output .= '"as": "balloon.png",';
480
+									} else {
481
+										$output .= '"aircraft_shadow": "balloon.png",';
482
+									}
362 483
 								} else {
363
-									if ($compress) $output .= '"as": "car.png",';
364
-									else $output .= '"aircraft_shadow": "car.png",';
484
+									if ($compress) {
485
+										$output .= '"as": "car.png",';
486
+									} else {
487
+										$output .= '"aircraft_shadow": "car.png",';
488
+									}
365 489
 								}
366 490
 							} elseif ($marine) {
367
-								if ($compress) $output .= '"as": "ship.png",';
368
-								else $output .= '"aircraft_shadow": "ship.png",';
491
+								if ($compress) {
492
+									$output .= '"as": "ship.png",';
493
+								} else {
494
+									$output .= '"aircraft_shadow": "ship.png",';
495
+								}
369 496
 							} else {
370
-								if ($compress) $output .= '"as": "default.png",';
371
-								else $output .= '"aircraft_shadow": "default.png",';
497
+								if ($compress) {
498
+									$output .= '"as": "default.png",';
499
+								} else {
500
+									$output .= '"aircraft_shadow": "default.png",';
501
+								}
372 502
 							}
373 503
 						} else {
374
-							if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
375
-							else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
504
+							if ($compress) {
505
+								$output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
506
+							} else {
507
+								$output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
508
+							}
376 509
 						}
377 510
 						if (isset($spotter_item['airline_name'])) {
378 511
 							$output .= '"airline_name": "'.$spotter_item['airline_name'].'",';
@@ -380,8 +513,11 @@  discard block
 block discarded – undo
380 513
 							$output .= '"airline_name": "NA",';
381 514
 						}
382 515
 						if (isset($spotter_item['departure_airport'])) {
383
-							if ($compress) $output .= '"dac": "'.$spotter_item['departure_airport'].'",';
384
-							else $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",';
516
+							if ($compress) {
517
+								$output .= '"dac": "'.$spotter_item['departure_airport'].'",';
518
+							} else {
519
+								$output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",';
520
+							}
385 521
 						}
386 522
 						if (isset($spotter_item['departure_airport_city'])) {
387 523
 							$output .= '"departure_airport": "'.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_country'].'",';
@@ -393,8 +529,11 @@  discard block
 block discarded – undo
393 529
 							$output .= '"arrival_airport_time": "'.$spotter_item['arrival_airport_time'].'",';
394 530
 						}
395 531
 						if (isset($spotter_item['arrival_airport'])) {
396
-							if ($compress) $output .= '"aac": "'.$spotter_item['arrival_airport'].'",';
397
-							else $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",';
532
+							if ($compress) {
533
+								$output .= '"aac": "'.$spotter_item['arrival_airport'].'",';
534
+							} else {
535
+								$output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",';
536
+							}
398 537
 						}
399 538
 						if (isset($spotter_item['arrival_airport_city'])) {
400 539
 							$output .= '"arrival_airport": "'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].'",';
@@ -413,8 +552,11 @@  discard block
 block discarded – undo
413 552
 						}
414 553
 						
415 554
 						if (isset($spotter_item['altitude'])) {
416
-							if ($compress) $output .= '"a": "'.$spotter_item['altitude'].'",';
417
-							else $output .= '"altitude": "'.$spotter_item['altitude'].'",';
555
+							if ($compress) {
556
+								$output .= '"a": "'.$spotter_item['altitude'].'",';
557
+							} else {
558
+								$output .= '"altitude": "'.$spotter_item['altitude'].'",';
559
+							}
418 560
 						}
419 561
 						
420 562
 						$heading = $spotter_item['heading'];
@@ -438,19 +580,24 @@  discard block
 block discarded – undo
438 580
 							}
439 581
 						}
440 582
 						
441
-						if ($compress)$output .= '"h": "'.$heading.'",';
442
-						else $output .= '"heading": "'.$heading.'",';
583
+						if ($compress) {
584
+							$output .= '"h": "'.$heading.'",';
585
+						} else {
586
+							$output .= '"heading": "'.$heading.'",';
587
+						}
443 588
 						if ($currenttime != '') {
444 589
 							if (strtotime($spotter_item['date']) < $currenttime) {
445 590
 								if (isset($archivespeed)) {
446 591
 									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
447 592
 									$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
448
-									if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
449
-									else {
593
+									if (!isset($idistance) || $fdistance < $idistance) {
594
+										$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
595
+									} else {
450 596
 										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
451 597
 										$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
452
-										if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
453
-										else {
598
+										if (!isset($idistance) || $fdistance < $idistance) {
599
+											$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
600
+										} else {
454 601
 											$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed);
455 602
 											$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
456 603
 										}
@@ -458,12 +605,14 @@  discard block
 block discarded – undo
458 605
 								} elseif ($usenextlatlon) {
459 606
 									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
460 607
 									$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
461
-									if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
462
-									else {
608
+									if (!isset($idistance) || $fdistance < $idistance) {
609
+										$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
610
+									} else {
463 611
 										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
464 612
 										$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
465
-										if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
466
-										else {
613
+										if (!isset($idistance) || $fdistance < $idistance) {
614
+											$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
615
+										} else {
467 616
 											$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading);
468 617
 											$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
469 618
 										}
@@ -502,7 +651,9 @@  discard block
 block discarded – undo
502 651
 							}
503 652
 						}
504 653
 
505
-						if (!$min) $output .= '"image": "'.$image.'",';
654
+						if (!$min) {
655
+							$output .= '"image": "'.$image.'",';
656
+						}
506 657
 						if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') {
507 658
 							$output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",';
508 659
 						}
@@ -510,8 +661,11 @@  discard block
 block discarded – undo
510 661
 							$output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",';
511 662
 						}
512 663
 						if (isset($spotter_item['squawk'])) {
513
-							if ($compress) $output .= '"sq": "'.$spotter_item['squawk'].'",';
514
-							else $output .= '"squawk": "'.$spotter_item['squawk'].'",';
664
+							if ($compress) {
665
+								$output .= '"sq": "'.$spotter_item['squawk'].'",';
666
+							} else {
667
+								$output .= '"squawk": "'.$spotter_item['squawk'].'",';
668
+							}
515 669
 						}
516 670
 						if (isset($spotter_item['squawk_usage'])) {
517 671
 							$output .= '"squawk_usage": "'.$spotter_item['squawk_usage'].'",';
@@ -530,14 +684,23 @@  discard block
 block discarded – undo
530 684
 						}
531 685
 						// type when not aircraft ?
532 686
 						if (isset($spotter_item['type'])) {
533
-							if ($compress) $output .= '"t": "'.$spotter_item['type'].'"';
534
-							else $output .= '"type": "'.$spotter_item['type'].'"';
687
+							if ($compress) {
688
+								$output .= '"t": "'.$spotter_item['type'].'"';
689
+							} else {
690
+								$output .= '"type": "'.$spotter_item['type'].'"';
691
+							}
535 692
 						} elseif ($marine) {
536
-							if ($compress) $output .= '"t": "ship"';
537
-							else $output .= '"type": "ship"';
693
+							if ($compress) {
694
+								$output .= '"t": "ship"';
695
+							} else {
696
+								$output .= '"type": "ship"';
697
+							}
538 698
 						} else {
539
-							if ($compress) $output .= '"t": "aircraft"';
540
-							else $output .= '"type": "aircraft"';
699
+							if ($compress) {
700
+								$output .= '"t": "aircraft"';
701
+							} else {
702
+								$output .= '"type": "aircraft"';
703
+							}
541 704
 						}
542 705
 						$output .= '},';
543 706
 						$output .= '"geometry": {';
@@ -545,15 +708,19 @@  discard block
 block discarded – undo
545 708
 								$output .= '"coordinates": [';
546 709
 								if ($currenttime != '') {
547 710
 									if (strtotime($spotter_item['date']) < $currenttime) {
548
-										if (!isset($archivespeed)) $archivespeed = 1;
711
+										if (!isset($archivespeed)) {
712
+											$archivespeed = 1;
713
+										}
549 714
 										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date'])));
550 715
 										$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
551
-										if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
552
-										else {
716
+										if (!isset($idistance) || $fdistance < $idistance) {
717
+											$output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
718
+										} else {
553 719
 											$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date'])));
554 720
 											$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
555
-											if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
556
-											else {
721
+											if (!isset($idistance) || $fdistance < $idistance) {
722
+												$output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
723
+											} else {
557 724
 												$output .= $spotter_item['longitude'].', ';
558 725
 												$output .= $spotter_item['latitude'];
559 726
 											}
@@ -631,7 +798,9 @@  discard block
 block discarded – undo
631 798
 			}
632 799
 */
633 800
 				$history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING);
634
-				if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history'];
801
+				if ($history == '' && isset($_COOKIE['history'])) {
802
+					$history = $_COOKIE['history'];
803
+				}
635 804
 				
636 805
 				if (
637 806
 				    (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') 
@@ -697,8 +866,11 @@  discard block
 block discarded – undo
697 866
 									$output_history .= ']}},';
698 867
 									$output .= $output_history;
699 868
 								}
700
-								if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
701
-								else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
869
+								if ($compress) {
870
+									$output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
871
+								} else {
872
+									$output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
873
+								}
702 874
 							}
703 875
 							$output_history .= '[';
704 876
 							$output_history .=  $spotter_history['longitude'].', ';
@@ -719,10 +891,15 @@  discard block
 block discarded – undo
719 891
 							if ($d == false) {
720 892
 								if ($compress) {
721 893
 									$output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'",';
722
-									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>",';
723
-									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>",';
894
+									if (isset($spotter_history_array[0]['mapmatching_engine']) && $spotter_history_array[0]['mapmatching_engine'] == 'graphhopper') {
895
+										$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>",';
896
+									} elseif (isset($spotter_history_array[0]['mapmatching_engine'])) {
897
+										$output_history .= '"atr": "Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",';
898
+									}
724 899
 									$output_history .= '"t": "history"},"geometry": {"type": "LineString","coordinates": [';
725
-								} else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": [';
900
+								} else {
901
+									$output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": [';
902
+								}
726 903
 								$d = true;
727 904
 							}
728 905
 							$output_history .= '[';
@@ -745,7 +922,9 @@  discard block
 block discarded – undo
745 922
 							$output_historyd = '[';
746 923
 							$output_historyd .=  $spotter_item['longitude'].', ';
747 924
 							$output_historyd .=  $spotter_item['latitude'];
748
-							if (isset($spotter_history['altitude'])) $output_historyd .=  ','.$spotter_item['altitude']*30.48;
925
+							if (isset($spotter_history['altitude'])) {
926
+								$output_historyd .=  ','.$spotter_item['altitude']*30.48;
927
+							}
749 928
 							$output_historyd .= '],';
750 929
 							//$output_history = $output_historyd.$output_history;
751 930
 							$output_history = $output_history.$output_historyd;
@@ -772,8 +951,11 @@  discard block
 block discarded – undo
772 951
 				        && $spotter_item['arrival_airport'] != 'NA' 
773 952
 				        && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") 
774 953
 				    	    || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) {
775
-				    if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
776
-				    else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
954
+				    if ($compress) {
955
+				    	$output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
956
+				    } else {
957
+				    	$output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
958
+				    }
777 959
 				    if (isset($spotter_item['departure_airport_latitude'])) {
778 960
 					$output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],';
779 961
 				    } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') {
@@ -806,8 +988,11 @@  discard block
 block discarded – undo
806 988
 				    	    || (!isset($_COOKIE['MapRemainingRoute']) && (!isset($globalMapRemainingRoute) 
807 989
 				    	    || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) {
808 990
 				    $havedata = false;
809
-				    if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
810
-				    else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
991
+				    if ($compress) {
992
+				    	$output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
993
+				    } else {
994
+				    	$output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
995
+				    }
811 996
 				    $output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],';
812 997
 
813 998
 				    if (isset($spotter_item['arrival_airport_latitude'])) {
@@ -822,7 +1007,9 @@  discard block
 block discarded – undo
822 1007
 				    }
823 1008
 				    //$output_dest  = substr($output_dest, 0, -1);
824 1009
 				    $output_dest .= ']}},';
825
-				    if ($havedata) $output .= $output_dest;
1010
+				    if ($havedata) {
1011
+				    	$output .= $output_dest;
1012
+				    }
826 1013
 				    unset($output_dest);
827 1014
 				}
828 1015
 			}
@@ -830,7 +1017,9 @@  discard block
 block discarded – undo
830 1017
 			$output .= ']';
831 1018
 			$output .= ',"initial_sqltime": "'.$sqltime.'",';
832 1019
 			$output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",';
833
-			if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
1020
+			if (isset($begindate)) {
1021
+				$output .= '"archive_date": "'.$begindate.'",';
1022
+			}
834 1023
 			$output .= '"fc": "'.$j.'"';
835 1024
 		} else {
836 1025
 			$output .= '"features": ';
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.
js/map.2d.js.php 1 patch
Braces   +109 added lines, -27 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);
@@ -235,20 +281,26 @@  discard block
 block discarded – undo
235 281
 	map.addLayer(yandexLayer);
236 282
 <?php
237 283
 	} elseif ($MapType == 'Bing-Aerial') {
238
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
239
-?>
284
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') {
285
+			setcookie('MapType','OpenStreetMap');
286
+		}
287
+		?>
240 288
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Aerial'});
241 289
 	map.addLayer(bingLayer);
242 290
 <?php
243 291
 	} elseif ($MapType == 'Bing-Hybrid') {
244
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
245
-?>
292
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') {
293
+			setcookie('MapType','OpenStreetMap');
294
+		}
295
+		?>
246 296
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'AerialWithLabels'});
247 297
 	map.addLayer(bingLayer);
248 298
 <?php
249 299
 	} elseif ($MapType == 'Bing-Road') {
250
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
251
-?>
300
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') {
301
+			setcookie('MapType','OpenStreetMap');
302
+		}
303
+		?>
252 304
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Road'});
253 305
 	map.addLayer(bingLayer);
254 306
 <?php
@@ -277,7 +329,12 @@  discard block
 block discarded – undo
277 329
 	    maxZoom: 5,
278 330
 	    tms : true,
279 331
 	    zindex : 3,
280
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
332
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
333
+	print 'false';
334
+} else {
335
+	print 'true';
336
+}
337
+?>,
281 338
 	    attribution: 'Natural Earth'
282 339
 	}).addTo(map);
283 340
 <?php
@@ -285,9 +342,24 @@  discard block
 block discarded – undo
285 342
 		$customid = $MapType;
286 343
 ?>
287 344
 	L.tileLayer('<?php print $globalMapCustomLayer[$customid]['url']; ?>/{z}/{x}/{y}.png', {
288
-	    maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) print $globalMapCustomLayer[$customid]['maxZoom']; else print '18'; ?>,
289
-	    minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) print $globalMapCustomLayer[$customid]['minZoom']; else print '0'; ?>,
290
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
345
+	    maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) {
346
+	print $globalMapCustomLayer[$customid]['maxZoom'];
347
+} else {
348
+	print '18';
349
+}
350
+?>,
351
+	    minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) {
352
+	print $globalMapCustomLayer[$customid]['minZoom'];
353
+} else {
354
+	print '0';
355
+}
356
+?>,
357
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
358
+	print 'false';
359
+} else {
360
+	print 'true';
361
+}
362
+?>,
291 363
 	    attribution: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>'
292 364
 	}).addTo(map);
293 365
 
@@ -327,7 +399,12 @@  discard block
 block discarded – undo
327 399
 		}
328 400
 	} elseif ($globalBounding == 'circle') {
329 401
 ?>
330
-	var circle = L.circle([<?php print $globalCenterLatitude; ?>, <?php print $globalCenterLongitude; ?>],<?php if (isset($globalBoundingCircleSize)) print $globalBoundingCircleSize; else print '70000'; ?>,{
402
+	var circle = L.circle([<?php print $globalCenterLatitude; ?>, <?php print $globalCenterLongitude; ?>],<?php if (isset($globalBoundingCircleSize)) {
403
+	print $globalBoundingCircleSize;
404
+} else {
405
+	print '70000';
406
+}
407
+?>,{
331 408
 	    color: '#92C7D1',
332 409
 	    fillColor: '#92C7D1',
333 410
 	    fillOpacity: 0.3,
@@ -419,7 +496,12 @@  discard block
 block discarded – undo
419 496
 		createCookie('lastcentercoord',map.getCenter().lat+','+map.getCenter().lng+','+map.getZoom(),2);
420 497
 	});
421 498
 update_locationsLayer();
422
-setInterval(function(){if (noTimeout) update_locationsLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
499
+setInterval(function(){if (noTimeout) update_locationsLayer()},<?php if (isset($globalMapRefresh)) {
500
+	print $globalMapRefresh*1000*2;
501
+} else {
502
+	print '60000';
503
+}
504
+?>);
423 505
 
424 506
 <?php
425 507
     // Add support for custom json via $globalMapJson
Please login to merge, or discard this patch.
index.php 1 patch
Braces   +477 added lines, -120 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,25 +292,43 @@  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
 				    if (isset($globalBingMapKey) && $globalBingMapKey != '') {
270 319
 			    ?>
271
-			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option>
272
-			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option>
273
-			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option>
320
+			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') {
321
+	print ' selected';
322
+}
323
+?>>Bing-Aerial</option>
324
+			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') {
325
+	print ' selected';
326
+}
327
+?>>Bing-Hybrid</option>
328
+			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') {
329
+	print ' selected';
330
+}
331
+?>>Bing-Road</option>
274 332
 			    <?php
275 333
 				    }
276 334
 			    ?>
@@ -280,58 +338,139 @@  discard block
 block discarded – undo
280 338
 			    <?php
281 339
 					if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
282 340
 			    ?>
283
-			    <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option>
284
-			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option>
285
-			    <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option>
341
+			    <option value="Here-Aerial"<?php if ($MapType == 'Here') {
342
+	print ' selected';
343
+}
344
+?>>Here-Aerial</option>
345
+			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') {
346
+	print ' selected';
347
+}
348
+?>>Here-Hybrid</option>
349
+			    <option value="Here-Road"<?php if ($MapType == 'Here') {
350
+	print ' selected';
351
+}
352
+?>>Here-Road</option>
286 353
 			    <?php
287 354
 					}
288 355
 			    ?>
289 356
 			    <?php
290 357
 					if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
291 358
 			    ?>
292
-			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option>
293
-			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option>
294
-			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option>
295
-			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option>
359
+			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') {
360
+	print ' selected';
361
+}
362
+?>>Google Roadmap</option>
363
+			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') {
364
+	print ' selected';
365
+}
366
+?>>Google Satellite</option>
367
+			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') {
368
+	print ' selected';
369
+}
370
+?>>Google Hybrid</option>
371
+			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') {
372
+	print ' selected';
373
+}
374
+?>>Google Terrain</option>
296 375
 			    <?php
297 376
 					}
298 377
 			    ?>
299 378
 			    <?php
300 379
 					if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
301 380
 			    ?>
302
-			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option>
303
-			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option>
304
-			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option>
381
+			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') {
382
+	print ' selected';
383
+}
384
+?>>MapQuest-OSM</option>
385
+			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') {
386
+	print ' selected';
387
+}
388
+?>>MapQuest-Aerial</option>
389
+			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') {
390
+	print ' selected';
391
+}
392
+?>>MapQuest-Hybrid</option>
305 393
 			    <?php
306 394
 					}
307 395
 			    ?>
308
-			    <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option>
309
-			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth</option>
396
+			    <option value="Yandex"<?php if ($MapType == 'Yandex') {
397
+	print ' selected';
398
+}
399
+?>>Yandex</option>
400
+			    <option value="offline"<?php if ($MapType == 'offline') {
401
+	print ' selected';
402
+}
403
+?>>Natural Earth</option>
310 404
 			    <?php
311 405
 				    }
312 406
 			    ?>
313 407
 			    <?php
314 408
 				    if (isset($globalMapboxToken) && $globalMapboxToken != '') {
315
-					if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default';
316
-					else $MapBoxId = $_COOKIE['MapTypeId'];
409
+					if (!isset($_COOKIE['MapTypeId'])) {
410
+						$MapBoxId = 'default';
411
+					} else {
412
+						$MapBoxId = $_COOKIE['MapTypeId'];
413
+					}
317 414
 			    ?>
318
-			    <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') print ' selected'; ?>>Mapbox GL</option>
319
-			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option>
320
-			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option>
321
-			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option>
322
-			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') print ' selected'; ?>>Mapbox dark</option>
323
-			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') print ' selected'; ?>>Mapbox satellite</option>
324
-			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') print ' selected'; ?>>Mapbox streets-satellite</option>
325
-			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') print ' selected'; ?>>Mapbox streets-basic</option>
326
-			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') print ' selected'; ?>>Mapbox comic</option>
327
-			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') print ' selected'; ?>>Mapbox outdoors</option>
328
-			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') print ' selected'; ?>>Mapbox pencil</option>
329
-			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option>
330
-			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option>
415
+			    <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') {
416
+	print ' selected';
417
+}
418
+?>>Mapbox GL</option>
419
+			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') {
420
+	print ' selected';
421
+}
422
+?>>Mapbox default</option>
423
+			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') {
424
+	print ' selected';
425
+}
426
+?>>Mapbox streets</option>
427
+			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') {
428
+	print ' selected';
429
+}
430
+?>>Mapbox light</option>
431
+			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') {
432
+	print ' selected';
433
+}
434
+?>>Mapbox dark</option>
435
+			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') {
436
+	print ' selected';
437
+}
438
+?>>Mapbox satellite</option>
439
+			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') {
440
+	print ' selected';
441
+}
442
+?>>Mapbox streets-satellite</option>
443
+			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') {
444
+	print ' selected';
445
+}
446
+?>>Mapbox streets-basic</option>
447
+			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') {
448
+	print ' selected';
449
+}
450
+?>>Mapbox comic</option>
451
+			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') {
452
+	print ' selected';
453
+}
454
+?>>Mapbox outdoors</option>
455
+			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') {
456
+	print ' selected';
457
+}
458
+?>>Mapbox pencil</option>
459
+			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') {
460
+	print ' selected';
461
+}
462
+?>>Mapbox pirates</option>
463
+			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') {
464
+	print ' selected';
465
+}
466
+?>>Mapbox emerald</option>
331 467
 			    <?php
332 468
 				    }
333 469
 			    ?>
334
-			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option>
470
+			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') {
471
+	print ' selected';
472
+}
473
+?>>OpenStreetMap</option>
335 474
 			    <?php
336 475
 				}
337 476
 			    ?>
@@ -342,10 +481,22 @@  discard block
 block discarded – undo
342 481
 ?>
343 482
 		    <li><?php echo _("Type of Terrain:"); ?>
344 483
 			<select  class="selectpicker" onchange="terrainType(this);">
345
-			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option>
346
-			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option>
347
-			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option>
348
-			    <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected';?>>ArticDEM</option>
484
+			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') {
485
+	print ' selected';
486
+}
487
+?>>stk terrain</option>
488
+			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') {
489
+	print ' selected';
490
+}
491
+?>>ellipsoid</option>
492
+			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') {
493
+	print ' selected';
494
+}
495
+?>>vr terrain</option>
496
+			    <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') {
497
+	print ' selected';
498
+}
499
+?>>ArticDEM</option>
349 500
 			</select>
350 501
 		    </li>
351 502
 <?php
@@ -354,42 +505,84 @@  discard block
 block discarded – undo
354 505
 <?php
355 506
     if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
356 507
 ?>
357
-		    <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>
508
+		    <li><div class="checkbox"><label><input type="checkbox" name="display2dbuildings" value="1" onclick="clickDisplay2DBuildings(this)" <?php if (isset($_COOKIE['Map2DBuildings']) && $_COOKIE['Map2DBuildings'] == 'true') {
509
+	print 'checked';
510
+}
511
+?> ><?php echo _("Display 2.5D buidings on map"); ?></label></div></li>
358 512
 
359 513
 <?php
360 514
 	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
361 515
 ?>
362
-		    <!--<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>-->
363
-		    <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>
364
-		    <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>
365
-		    <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>
366
-		    <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>
516
+		    <!--<li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') {
517
+	print 'checked';
518
+}
519
+?> ><?php echo _("Display flight info as popup"); ?></label></div></li>-->
520
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true')) {
521
+	print 'checked';
522
+}
523
+?> ><?php echo _("Display flight path"); ?></label></div></li>
524
+		    <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)) {
525
+	print 'checked';
526
+}
527
+?> ><?php echo _("Display flight route on click"); ?></label></div></li>
528
+		    <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)) {
529
+	print 'checked';
530
+}
531
+?> ><?php echo _("Display flight remaining route on click"); ?></label></div></li>
532
+		    <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)) {
533
+	print 'checked';
534
+}
535
+?> ><?php echo _("Planes animate between updates"); ?></label></div></li>
367 536
 <?php
368 537
 	} elseif (!isset($globalTracker) || $globalTracker === TRUE) {
369 538
 ?>
370
-		    <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>
539
+		    <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)) {
540
+	print 'checked';
541
+}
542
+?> ><?php echo _("Enable map matching"); ?></label></div></li>
371 543
 <?php
372 544
 	}
373 545
 	if (isset($globalSatellite) && $globalSatellite === TRUE) {
374 546
 ?>
375
-		    <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>
547
+		    <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)) {
548
+	print 'checked';
549
+}
550
+?> ><?php echo _("Satellites animate between updates"); ?></label></div></li>
376 551
 <?php
377 552
 	}
378 553
     }
379 554
 ?>
380
-		    <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>
381
-		    <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>
382
-		    <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>
383
-		    <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>
555
+		    <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'])) {
556
+	print 'checked';
557
+}
558
+?> ><?php echo _("Display airports on map"); ?></label></div></li>
559
+		    <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))) {
560
+	print 'checked';
561
+}
562
+?> ><?php echo _("Display ground station on map"); ?></label></div></li>
563
+		    <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))) {
564
+	print 'checked';
565
+}
566
+?> ><?php echo _("Display weather station on map"); ?></label></div></li>
567
+		    <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))) {
568
+	print 'checked';
569
+}
570
+?> ><?php echo _("Display lightning on map"); ?></label></div></li>
384 571
 <?php
385 572
 	if (isset($globalFires)) {
386 573
 ?>
387
-		    <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>
574
+		    <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))) {
575
+	print 'checked';
576
+}
577
+?> ><?php echo _("Display fires on map"); ?></label></div></li>
388 578
 <?php
389 579
 	}
390 580
     if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
391 581
 ?>
392
-		    <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>
582
+		    <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')) {
583
+	print 'checked';
584
+}
585
+?> ><?php echo _("Show mini-map"); ?></label></div></li>
393 586
 <?php
394 587
     }
395 588
     if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
@@ -402,17 +595,25 @@  discard block
 block discarded – undo
402 595
 			if (function_exists('array_column')) {
403 596
 			    if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
404 597
 		    ?>
405
-		    <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>
598
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
599
+	print 'checked';
600
+}
601
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
406 602
 		    <?php
407 603
 			    }
408 604
 			} elseif (isset($globalSources)) {
409 605
 			    $dispolar = false;
410 606
 			    foreach ($globalSources as $testsource) {
411
-			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
607
+			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) {
608
+			        	$dispolar = true;
609
+			        }
412 610
 			    }
413 611
 			    if ($dispolar) {
414 612
 		    ?>
415
-		    <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>
613
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
614
+	print 'checked';
615
+}
616
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
416 617
 		    <?php
417 618
 			    }
418 619
 		        }
@@ -425,12 +626,22 @@  discard block
 block discarded – undo
425 626
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
426 627
 		    	    if (extension_loaded('gd') && function_exists('gd_info')) {
427 628
 		    ?>
428
-		    <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>
629
+		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') {
630
+	print 'checked';
631
+}
632
+?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
429 633
 		    <?php 
430 634
 				if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') {
431 635
 		    ?>
432 636
 		    <li><?php echo _("Aircraft icon color:"); ?>
433
-			<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'; ?>">
637
+			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) {
638
+	print $_COOKIE['IconColor'];
639
+} elseif (isset($globalAircraftIconColor)) {
640
+	print $globalAircraftIconColor;
641
+} else {
642
+	print '1a3151';
643
+}
644
+?>">
434 645
 		    </li>
435 646
 		    <?php
436 647
 				}
@@ -442,7 +653,14 @@  discard block
 block discarded – undo
442 653
 			    if (extension_loaded('gd') && function_exists('gd_info')) {
443 654
 		    ?>
444 655
 		    <li><?php echo _("Marine icon color:"); ?>
445
-			<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'; ?>">
656
+			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) {
657
+	print $_COOKIE['MarineIconColor'];
658
+} elseif (isset($globalMarineIconColor)) {
659
+	print $globalMarineIconColor;
660
+} else {
661
+	print '1a3151';
662
+}
663
+?>">
446 664
 		    </li>
447 665
 		    <?php
448 666
 			    }
@@ -453,7 +671,14 @@  discard block
 block discarded – undo
453 671
 			    if (extension_loaded('gd') && function_exists('gd_info')) {
454 672
 		    ?>
455 673
 		    <li><?php echo _("Tracker icon color:"); ?>
456
-			<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'; ?>">
674
+			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) {
675
+	print $_COOKIE['TrackerIconColor'];
676
+} elseif (isset($globalTrackerIconColor)) {
677
+	print $globalTrackerIconColor;
678
+} else {
679
+	print '1a3151';
680
+}
681
+?>">
457 682
 		    </li>
458 683
 		    <?php
459 684
 			    }
@@ -464,8 +689,22 @@  discard block
 block discarded – undo
464 689
 		    ?>
465 690
 		    <li><?php echo _("Show airport icon at zoom level:"); ?>
466 691
 			<div class="range">
467
-			    <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'; ?>">
468
-			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?></output>
692
+			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) {
693
+	print $_COOKIE['AirportZoom'];
694
+} elseif (isset($globalAirportZoom)) {
695
+	print $globalAirportZoom;
696
+} else {
697
+	print '7';
698
+}
699
+?>">
700
+			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) {
701
+	print $_COOKIE['AirportZoom'];
702
+} elseif (isset($globalAirportZoom)) {
703
+	print $globalAirportZoom;
704
+} else {
705
+	print '7';
706
+}
707
+?></output>
469 708
 			</div>
470 709
 		    </li>
471 710
 		    <?php
@@ -477,10 +716,23 @@  discard block
 block discarded – undo
477 716
 <?php
478 717
 	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
479 718
 ?>
480
-		    <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>
481
-		    <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>
719
+		    <li><input type="checkbox" name="useliveries" value="1" onclick="useLiveries(this)" <?php if (isset($_COOKIE['UseLiveries']) && $_COOKIE['UseLiveries'] == 'true') {
720
+	print 'checked';
721
+}
722
+?> ><?php echo _("Use airlines liveries"); ?></li>
723
+		    <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') {
724
+	print 'checked';
725
+}
726
+?> ><?php echo _("Force Aircraft color"); ?></li>
482 727
 		    <li><?php echo _("Aircraft icon color:"); ?>
483
-			<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'; ?>">
728
+			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) {
729
+	print $_COOKIE['IconColor'];
730
+} elseif (isset($globalAircraftIconColor)) {
731
+	print $globalAircraftIconColor;
732
+} else {
733
+	print 'ff0000';
734
+}
735
+?>">
484 736
 		    </li>
485 737
 <?php
486 738
 	}
@@ -488,9 +740,19 @@  discard block
 block discarded – undo
488 740
 <?php
489 741
 	if (isset($globalMarine) && $globalMarine === TRUE) {
490 742
 ?>
491
-		    <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>
743
+		    <li><input type="checkbox" name="marinecolorforce" value="1" onclick="MarineiconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') {
744
+	print 'checked';
745
+}
746
+?> ><?php echo _("Force Marine color"); ?></li>
492 747
 		    <li><?php echo _("Marine icon color:"); ?>
493
-			<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'; ?>">
748
+			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) {
749
+	print $_COOKIE['MarineIconColor'];
750
+} elseif (isset($globalMarineIconColor)) {
751
+	print $globalMarineIconColor;
752
+} else {
753
+	print 'ff0000';
754
+}
755
+?>">
494 756
 		    </li>
495 757
 <?php
496 758
 	}
@@ -498,9 +760,19 @@  discard block
 block discarded – undo
498 760
 <?php
499 761
 	if (isset($globalTracker) && $globalTracker === TRUE) {
500 762
 ?>
501
-		    <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>
763
+		    <li><input type="checkbox" name="trackercolorforce" value="1" onclick="TrackericonColorForce(this)" <?php if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true') {
764
+	print 'checked';
765
+}
766
+?> ><?php echo _("Force Tracker color"); ?></li>
502 767
 		    <li><?php echo _("Tracker icon color:"); ?>
503
-			<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'; ?>">
768
+			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) {
769
+	print $_COOKIE['TrackerIconColor'];
770
+} elseif (isset($globalTrackerIconColor)) {
771
+	print $globalTrackerIconColor;
772
+} else {
773
+	print 'ff0000';
774
+}
775
+?>">
504 776
 		    </li>
505 777
 <?php
506 778
 	}
@@ -508,22 +780,46 @@  discard block
 block discarded – undo
508 780
 ?>
509 781
 		    <li><?php echo _("Distance unit:"); ?>
510 782
 			<select class="selectpicker" onchange="unitdistance(this);">
511
-			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) echo ' selected'; ?>>km</option>
512
-			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) echo ' selected'; ?>>nm</option>
513
-			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) echo ' selected'; ?>>mi</option>
783
+			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) {
784
+	echo ' selected';
785
+}
786
+?>>km</option>
787
+			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
788
+	echo ' selected';
789
+}
790
+?>>nm</option>
791
+			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
792
+	echo ' selected';
793
+}
794
+?>>mi</option>
514 795
 		        </select>
515 796
 		    </li>
516 797
 		    <li><?php echo _("Altitude unit:"); ?>
517 798
 			<select class="selectpicker" onchange="unitaltitude(this);">
518
-			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) echo ' selected'; ?>>m</option>
519
-			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) echo ' selected'; ?>>feet</option>
799
+			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) {
800
+	echo ' selected';
801
+}
802
+?>>m</option>
803
+			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) {
804
+	echo ' selected';
805
+}
806
+?>>feet</option>
520 807
 		        </select>
521 808
 		    </li>
522 809
 		    <li><?php echo _("Speed unit:"); ?>
523 810
 			<select class="selectpicker" onchange="unitspeed(this);">
524
-			    <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>
525
-			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) echo ' selected'; ?>>mph</option>
526
-			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) echo ' selected'; ?>>knots</option>
811
+			    <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) {
812
+	echo ' selected';
813
+}
814
+?>>km/h</option>
815
+			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) {
816
+	echo ' selected';
817
+}
818
+?>>mph</option>
819
+			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) {
820
+	echo ' selected';
821
+}
822
+?>>knots</option>
527 823
 		        </select>
528 824
 		    </li>
529 825
 
@@ -541,9 +837,18 @@  discard block
 block discarded – undo
541 837
 		    <?php
542 838
 			if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) {
543 839
 		    ?>
544
-			<?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 } ?>
545
-			<?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 } ?>
546
-			<?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 } ?>
840
+			<?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'])) {
841
+	print 'checked';
842
+}
843
+?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
844
+			<?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'])) {
845
+	print 'checked';
846
+}
847
+?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
848
+			<?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'])) {
849
+	print 'checked';
850
+}
851
+?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
547 852
 		    <?php
548 853
 			}
549 854
 		    ?>
@@ -551,10 +856,16 @@  discard block
 block discarded – undo
551 856
 			if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) {
552 857
 		    ?>
553 858
 			<?php if (isset($globalSBS1) && $globalSBS1) { ?>
554
-			    <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>
859
+			    <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'])) {
860
+	print 'checked';
861
+}
862
+?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
555 863
 			<?php } ?>
556 864
 			<?php if (isset($globalAPRS) && $globalAPRS) { ?>
557
-			    <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>
865
+			    <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'])) {
866
+	print 'checked';
867
+}
868
+?> ><?php echo _("Display APRS data"); ?></label></div></li>
558 869
 			<?php } ?>
559 870
 		    <?php
560 871
 			}
@@ -571,7 +882,9 @@  discard block
 block discarded – undo
571 882
 				}
572 883
 				foreach($allairlinenames as $airline) {
573 884
 					$airline_name = $airline['airline_name'];
574
-					if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...';
885
+					if (strlen($airline_name) > 30) {
886
+						$airline_name = substr($airline_name,0,30).'...';
887
+					}
575 888
 					if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['filter_Airlines']))) {
576 889
 						echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>';
577 890
 					} else {
@@ -589,7 +902,10 @@  discard block
 block discarded – undo
589 902
 		    <li><?php echo _("Display alliance:"); ?>
590 903
 		    <br/>
591 904
 			<select class="selectpicker" onchange="alliance(this);" id="display_alliance">
592
-			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
905
+			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') {
906
+	echo ' selected';
907
+}
908
+?>><?php echo _("All"); ?></option>
593 909
 			    <?php
594 910
 				foreach($allalliancenames as $alliance) {
595 911
 					$alliance_name = $alliance['alliance'];
@@ -648,10 +964,22 @@  discard block
 block discarded – undo
648 964
 		    ?>
649 965
 		    <li><?php echo _("Display airlines of type:"); ?><br/>
650 966
 			<select class="selectpicker" onchange="airlinestype(this);">
651
-			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
652
-			    <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') echo ' selected'; ?>><?php echo _("Passenger"); ?></option>
653
-			    <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') echo ' selected'; ?>><?php echo _("Cargo"); ?></option>
654
-			    <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') echo ' selected'; ?>><?php echo _("Military"); ?></option>
967
+			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') {
968
+	echo ' selected';
969
+}
970
+?>><?php echo _("All"); ?></option>
971
+			    <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') {
972
+	echo ' selected';
973
+}
974
+?>><?php echo _("Passenger"); ?></option>
975
+			    <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') {
976
+	echo ' selected';
977
+}
978
+?>><?php echo _("Cargo"); ?></option>
979
+			    <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') {
980
+	echo ' selected';
981
+}
982
+?>><?php echo _("Military"); ?></option>
655 983
 			</select>
656 984
 		    </li>
657 985
 		    <?php
@@ -665,14 +993,20 @@  discard block
 block discarded – undo
665 993
 		    ?>
666 994
 		    <li>
667 995
 			<?php echo _("Display vessels with MMSI:"); ?>
668
-			<input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) print $_COOKIE['filter_mmsi']; ?>" />
996
+			<input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) {
997
+	print $_COOKIE['filter_mmsi'];
998
+}
999
+?>" />
669 1000
 		    </li>
670 1001
 		    <?php
671 1002
 			}
672 1003
 		    ?>
673 1004
 		    <li>
674 1005
 			<?php echo _("Display with ident:"); ?>
675
-			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" />
1006
+			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) {
1007
+	print $_COOKIE['filter_ident'];
1008
+}
1009
+?>" />
676 1010
 		    </li>
677 1011
 		</ul>
678 1012
 	    </form>
@@ -688,7 +1022,10 @@  discard block
 block discarded – undo
688 1022
 	    <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
689 1023
 	    <form>
690 1024
 		<ul>
691
-		    <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>
1025
+		    <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'])) {
1026
+	print 'checked';
1027
+}
1028
+?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li>
692 1029
 		    <li><?php echo _("Type:"); ?>
693 1030
 			<select class="selectpicker" multiple onchange="sattypes(this);">
694 1031
 			    <?php
@@ -696,25 +1033,45 @@  discard block
 block discarded – undo
696 1033
 				$types = $Satellite->get_tle_types();
697 1034
 				foreach ($types as $type) {
698 1035
 					$type_name = $type['tle_type'];
699
-					if ($type_name == 'musson') $type_name = 'Russian LEO Navigation';
700
-					else if ($type_name == 'nnss') $type_name = 'Navi Navigation Satellite System';
701
-					else if ($type_name == 'sbas') $type_name = 'Satellite-Based Augmentation System';
702
-					else if ($type_name == 'glo-ops') $type_name = 'Glonass Operational';
703
-					else if ($type_name == 'gps-ops') $type_name = 'GPS Operational';
704
-					else if ($type_name == 'argos') $type_name = 'ARGOS Data Collection System';
705
-					else if ($type_name == 'tdrss') $type_name = 'Tracking and Data Relay Satellite System';
706
-					else if ($type_name == 'sarsat') $type_name = 'Search & Rescue';
707
-					else if ($type_name == 'dmc') $type_name = 'Disaster Monitoring';
708
-					else if ($type_name == 'resource') $type_name = 'Earth Resources';
709
-					else if ($type_name == 'stations') $type_name = 'Space Stations';
710
-					else if ($type_name == 'geo') $type_name = 'Geostationary';
711
-					else if ($type_name == 'amateur') $type_name = 'Amateur Radio';
712
-					else if ($type_name == 'x-comm') $type_name = 'Experimental';
713
-					else if ($type_name == 'other-comm') $type_name = 'Other Comm';
714
-					else if ($type_name == 'science') $type_name = 'Space & Earth Science';
715
-					else if ($type_name == 'military') $type_name = 'Miscellaneous Military';
716
-					else if ($type_name == 'radar') $type_name = 'Radar Calibration';
717
-					else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches';
1036
+					if ($type_name == 'musson') {
1037
+						$type_name = 'Russian LEO Navigation';
1038
+					} else if ($type_name == 'nnss') {
1039
+						$type_name = 'Navi Navigation Satellite System';
1040
+					} else if ($type_name == 'sbas') {
1041
+						$type_name = 'Satellite-Based Augmentation System';
1042
+					} else if ($type_name == 'glo-ops') {
1043
+						$type_name = 'Glonass Operational';
1044
+					} else if ($type_name == 'gps-ops') {
1045
+						$type_name = 'GPS Operational';
1046
+					} else if ($type_name == 'argos') {
1047
+						$type_name = 'ARGOS Data Collection System';
1048
+					} else if ($type_name == 'tdrss') {
1049
+						$type_name = 'Tracking and Data Relay Satellite System';
1050
+					} else if ($type_name == 'sarsat') {
1051
+						$type_name = 'Search & Rescue';
1052
+					} else if ($type_name == 'dmc') {
1053
+						$type_name = 'Disaster Monitoring';
1054
+					} else if ($type_name == 'resource') {
1055
+						$type_name = 'Earth Resources';
1056
+					} else if ($type_name == 'stations') {
1057
+						$type_name = 'Space Stations';
1058
+					} else if ($type_name == 'geo') {
1059
+						$type_name = 'Geostationary';
1060
+					} else if ($type_name == 'amateur') {
1061
+						$type_name = 'Amateur Radio';
1062
+					} else if ($type_name == 'x-comm') {
1063
+						$type_name = 'Experimental';
1064
+					} else if ($type_name == 'other-comm') {
1065
+						$type_name = 'Other Comm';
1066
+					} else if ($type_name == 'science') {
1067
+						$type_name = 'Space & Earth Science';
1068
+					} else if ($type_name == 'military') {
1069
+						$type_name = 'Miscellaneous Military';
1070
+					} else if ($type_name == 'radar') {
1071
+						$type_name = 'Radar Calibration';
1072
+					} else if ($type_name == 'tle-new') {
1073
+						$type_name = 'Last 30 days launches';
1074
+					}
718 1075
 					
719 1076
 					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) {
720 1077
 						print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>';
Please login to merge, or discard this patch.