Completed
Push — master ( 40f2d3...83b404 )
by Yannick
61:04 queued 35:02
created
js/map-aircraft.3d.js.php 1 patch
Braces   +24 added lines, -4 removed lines patch added patch discarded remove patch
@@ -218,7 +218,12 @@  discard block
 block discarded – undo
218 218
 			<?php
219 219
 			    } else {
220 220
 			?>
221
-			if (parseInt(lastupdateentity) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) print $globalMapRefresh*2000; else print '60000'; ?>)) {
221
+			if (parseInt(lastupdateentity) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) {
222
+	print $globalMapRefresh*2000;
223
+} else {
224
+	print '60000';
225
+}
226
+?>)) {
222 227
 				viewer.dataSources.get(dsn).entities.remove(entity);
223 228
 				czmlds.entities.removeById(entityid);
224 229
 			}
@@ -502,7 +507,12 @@  discard block
 block discarded – undo
502 507
 		if (!((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) && (isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
503 508
 ?>
504 509
 update_polarLayer();
505
-setInterval(function(){update_polarLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
510
+setInterval(function(){update_polarLayer()},<?php if (isset($globalMapRefresh)) {
511
+	print $globalMapRefresh*1000*2;
512
+} else {
513
+	print '60000';
514
+}
515
+?>);
506 516
 <?php
507 517
 		}
508 518
 ?>
@@ -613,7 +623,12 @@  discard block
 block discarded – undo
613 623
 				}
614 624
 			}
615 625
 		}
616
-	,<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>);
626
+	,<?php if (isset($globalMapRefresh)) {
627
+	print $globalMapRefresh*1000;
628
+} else {
629
+	print '30000';
630
+}
631
+?>);
617 632
 } else {
618 633
 	//var widget = new Cesium.CesiumWidget('archivebox');
619 634
 //	var timeline = new Cesium.Timeline(viewer);
@@ -632,7 +647,12 @@  discard block
 block discarded – undo
632 647
     if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) {
633 648
 ?>
634 649
 update_atcLayer();
635
-setInterval(function(){update_atcLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
650
+setInterval(function(){update_atcLayer()},<?php if (isset($globalMapRefresh)) {
651
+	print $globalMapRefresh*1000*2;
652
+} else {
653
+	print '60000';
654
+}
655
+?>);
636 656
 <?php
637 657
     }
638 658
 ?>
Please login to merge, or discard this patch.
js/map-marine.3d.js.php 1 patch
Braces   +12 added lines, -2 removed lines patch added patch discarded remove patch
@@ -47,7 +47,12 @@  discard block
 block discarded – undo
47 47
 			<?php
48 48
 			    } else {
49 49
 			?>
50
-			if (parseInt(lastupdateentity) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) print $globalMapRefresh*2000; else print '60000'; ?>)) {
50
+			if (parseInt(lastupdateentity) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) {
51
+	print $globalMapRefresh*2000;
52
+} else {
53
+	print '60000';
54
+}
55
+?>)) {
51 56
 				viewer.dataSources.get(dsn).entities.remove(entity);
52 57
 			}
53 58
 			<?php
@@ -129,7 +134,12 @@  discard block
 block discarded – undo
129 134
 		function(){
130 135
 			updateMarineData();
131 136
 		}
132
-	,<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>);
137
+	,<?php if (isset($globalMapRefresh)) {
138
+	print $globalMapRefresh*1000;
139
+} else {
140
+	print '30000';
141
+}
142
+?>);
133 143
 } else {
134 144
 	var clockViewModel = new Cesium.ClockViewModel(viewer.clock);
135 145
 	var animationViewModel = new Cesium.AnimationViewModel(clockViewModel);
Please login to merge, or discard this patch.
js/map-tracker.3d.js.php 1 patch
Braces   +12 added lines, -2 removed lines patch added patch discarded remove patch
@@ -90,7 +90,12 @@  discard block
 block discarded – undo
90 90
 			<?php
91 91
 			    } else {
92 92
 			?>
93
-			if (parseInt(lastupdateentity) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) print $globalMapRefresh*2000; else print '60000'; ?>)) {
93
+			if (parseInt(lastupdateentity) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) {
94
+	print $globalMapRefresh*2000;
95
+} else {
96
+	print '60000';
97
+}
98
+?>)) {
94 99
 				viewer.dataSources.get(dsn).entities.remove(entity);
95 100
 				czmldstracker.entities.removeById(entityid);
96 101
 			}
@@ -173,7 +178,12 @@  discard block
 block discarded – undo
173 178
 		function(){
174 179
 			updateTrackerData();
175 180
 		}
176
-	,<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>);
181
+	,<?php if (isset($globalMapRefresh)) {
182
+	print $globalMapRefresh*1000;
183
+} else {
184
+	print '30000';
185
+}
186
+?>);
177 187
 } else {
178 188
 	var clockViewModel = new Cesium.ClockViewModel(viewer.clock);
179 189
 	var animationViewModel = new Cesium.AnimationViewModel(clockViewModel);
Please login to merge, or discard this patch.
require/class.TrackerLive.php 1 patch
Braces   +110 added lines, -37 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.');
11
+		if ($this->db === null) {
12
+			die('Error: No DB connection.');
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
 		$Spotter = new Spotter($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;
317 358
 		$Spotter = new Spotter($this->db);
318
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
359
+		if (!isset($globalLiveInterval)) {
360
+			$globalLiveInterval = '200';
361
+		}
319 362
 		$filter_query = $this->getFilter($filter);
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
 		if ($globalDBdriver == 'mysql') {
328 373
 			$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 
329 374
 			FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' AND tracker_live.latitude BETWEEN ".$minlat.' AND '.$maxlat.' AND tracker_live.longitude BETWEEN '.$minlong.' AND '.$maxlong."
@@ -516,11 +561,15 @@  discard block
 block discarded – undo
516 561
 		//$query  = self::$global_query.' WHERE tracker_live.famtrackid = :id ORDER BY date';
517 562
 		if ($globalDBdriver == 'mysql') {
518 563
 			$query = 'SELECT tracker_live.* FROM tracker_live WHERE tracker_live.famtrackid = :id';
519
-			if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
564
+			if ($liveinterval) {
565
+				$query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
566
+			}
520 567
 			$query .= ' ORDER BY date';
521 568
 		} else {
522 569
 			$query = 'SELECT tracker_live.* FROM tracker_live WHERE tracker_live.famtrackid = :id';
523
-			if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
570
+			if ($liveinterval) {
571
+				$query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
572
+			}
524 573
 			$query .= ' ORDER BY date';
525 574
 		}
526 575
 
@@ -615,7 +664,9 @@  discard block
 block discarded – undo
615 664
 				$i++;
616 665
 				$j++;
617 666
 				if ($j == 30) {
618
-					if ($globalDebug) echo ".";
667
+					if ($globalDebug) {
668
+						echo ".";
669
+					}
619 670
 				    	try {
620 671
 						
621 672
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
@@ -862,7 +913,9 @@  discard block
 block discarded – undo
862 913
 			{
863 914
 				return false;
864 915
 			}
865
-		} else return '';
916
+		} else {
917
+			return '';
918
+		}
866 919
 
867 920
 		if ($longitude != '')
868 921
 		{
@@ -870,7 +923,9 @@  discard block
 block discarded – undo
870 923
 			{
871 924
 				return false;
872 925
 			}
873
-		} else return '';
926
+		} else {
927
+			return '';
928
+		}
874 929
 
875 930
 		if ($altitude != '')
876 931
 		{
@@ -878,7 +933,9 @@  discard block
 block discarded – undo
878 933
 			{
879 934
 				return false;
880 935
 			}
881
-		} else $altitude = 0;
936
+		} else {
937
+			$altitude = 0;
938
+		}
882 939
 
883 940
 		if ($heading != '')
884 941
 		{
@@ -886,7 +943,9 @@  discard block
 block discarded – undo
886 943
 			{
887 944
 				return false;
888 945
 			}
889
-		} else $heading = 0;
946
+		} else {
947
+			$heading = 0;
948
+		}
890 949
 
891 950
 		if ($groundspeed != '')
892 951
 		{
@@ -894,9 +953,13 @@  discard block
 block discarded – undo
894 953
 			{
895 954
 				return false;
896 955
 			}
897
-		} else $groundspeed = 0;
956
+		} else {
957
+			$groundspeed = 0;
958
+		}
898 959
 		date_default_timezone_set('UTC');
899
-		if ($date == '') $date = date("Y-m-d H:i:s", time());
960
+		if ($date == '') {
961
+			$date = date("Y-m-d H:i:s", time());
962
+		}
900 963
 
901 964
         
902 965
 		$famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING);
@@ -912,12 +975,18 @@  discard block
 block discarded – undo
912 975
 		$comment = filter_var($comment,FILTER_SANITIZE_STRING);
913 976
 		$type = filter_var($type,FILTER_SANITIZE_STRING);
914 977
 
915
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
916
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
978
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) {
979
+            		$groundspeed = 0;
980
+            	}
981
+            	if ($heading == '' || $Common->isInteger($heading) === false ) {
982
+            		$heading = 0;
983
+            	}
917 984
             	
918 985
 		$query = '';
919 986
 		if ($globalArchive) {
920
-			if ($globalDebug) echo '-- Delete previous data -- ';
987
+			if ($globalDebug) {
988
+				echo '-- Delete previous data -- ';
989
+			}
921 990
 			$query .= 'DELETE FROM tracker_live WHERE famtrackid = :famtrackid;';
922 991
 		}
923 992
 		$query  .= 'INSERT INTO tracker_live (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) 
@@ -936,10 +1005,14 @@  discard block
 block discarded – undo
936 1005
                 echo 'noarchive : '.$noarchive."\n";
937 1006
                 */
938 1007
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
939
-		    if ($globalDebug) echo '(Add to Tracker archive '.$famtrackid.' : ';
1008
+		    if ($globalDebug) {
1009
+		    	echo '(Add to Tracker archive '.$famtrackid.' : ';
1010
+		    }
940 1011
 		    $TrackerArchive = new TrackerArchive($this->db);
941 1012
 		    $result =  $TrackerArchive->addTrackerArchiveData($famtrackid, $ident,$latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type,$noarchive,$format_source, $source_name, $over_country);
942
-		    if ($globalDebug) echo $result.')';
1013
+		    if ($globalDebug) {
1014
+		    	echo $result.')';
1015
+		    }
943 1016
 		}
944 1017
 
945 1018
 		return "success";
Please login to merge, or discard this patch.
require/class.SpotterLive.php 1 patch
Braces   +122 added lines, -41 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.');
11
+		if ($this->db === null) {
12
+			die('Error: No DB connection.');
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) {
@@ -119,8 +123,11 @@  discard block
 block discarded – undo
119 123
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
120 124
 			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
121 125
 		}
122
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
123
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
126
+		if ($filter_query_where == '' && $where) {
127
+			$filter_query_where = ' WHERE';
128
+		} elseif ($filter_query_where != '' && $and) {
129
+			$filter_query_where .= ' AND';
130
+		}
124 131
 		if ($filter_query_where != '') {
125 132
 			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
126 133
 		}
@@ -161,9 +168,13 @@  discard block
 block discarded – undo
161 168
 				$orderby_query = ' '.$search_orderby_array[$sort]['sql'];
162 169
 			}
163 170
 		}
164
-		if ($orderby_query == '') $orderby_query = ' ORDER BY date DESC';
171
+		if ($orderby_query == '') {
172
+			$orderby_query = ' ORDER BY date DESC';
173
+		}
165 174
 
166
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
175
+		if (!isset($globalLiveInterval)) {
176
+			$globalLiveInterval = '200';
177
+		}
167 178
 		if ($globalDBdriver == 'mysql') {
168 179
 			//$query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate";
169 180
 			$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query.$orderby_query;
@@ -186,7 +197,9 @@  discard block
 block discarded – undo
186 197
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
187 198
 		date_default_timezone_set('UTC');
188 199
 		$filter_query = $this->getFilter($filter,true,true);
189
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
200
+		if (!isset($globalLiveInterval)) {
201
+			$globalLiveInterval = '200';
202
+		}
190 203
 		if ($globalDBdriver == 'mysql') {
191 204
 			if (isset($globalArchive) && $globalArchive === TRUE) {
192 205
 				$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
@@ -236,8 +249,12 @@  discard block
 block discarded – undo
236 249
 		}
237 250
 		$filter_query = $this->getFilter($filter,true,true);
238 251
 
239
-		if (!isset($globalLiveInterval) || $globalLiveInterval == '') $globalLiveInterval = '200';
240
-		if (!isset($globalMap3DAircraftsLimit) || $globalMap3DAircraftsLimit == '') $globalMap3DAircraftsLimit = '300';
252
+		if (!isset($globalLiveInterval) || $globalLiveInterval == '') {
253
+			$globalLiveInterval = '200';
254
+		}
255
+		if (!isset($globalMap3DAircraftsLimit) || $globalMap3DAircraftsLimit == '') {
256
+			$globalMap3DAircraftsLimit = '300';
257
+		}
241 258
 		if ($globalDBdriver == 'mysql') {
242 259
 			if (isset($globalArchive) && $globalArchive === TRUE) {
243 260
 				/*
@@ -248,22 +265,32 @@  discard block
 block discarded – undo
248 265
 				*/
249 266
 				$query  = 'SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source 
250 267
 				FROM spotter_archive INNER JOIN (SELECT flightaware_id FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date) l ON l.flightaware_id = spotter_archive.flightaware_id ";
251
-				if ($usecoord) $query .= "AND spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
268
+				if ($usecoord) {
269
+					$query .= "AND spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
270
+				}
252 271
 				$query .= "UNION
253 272
 				SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
254 273
 				FROM spotter_live".$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date";
255
-				if ($usecoord) $query .= " AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong;
274
+				if ($usecoord) {
275
+					$query .= " AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong;
276
+				}
256 277
 				$query .= ") AS spotter 
257 278
 				WHERE latitude <> '0' AND longitude <> '0' 
258 279
 				ORDER BY flightaware_id, date";
259
-				if ($limit) $query .= " LIMIT ".$globalMap3DAircraftsLimit;
280
+				if ($limit) {
281
+					$query .= " LIMIT ".$globalMap3DAircraftsLimit;
282
+				}
260 283
 			} else {
261 284
 				$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
262 285
 				FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date ";
263
-				if ($usecoord) $query .= "AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
286
+				if ($usecoord) {
287
+					$query .= "AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
288
+				}
264 289
 				$query .= "AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' 
265 290
 				ORDER BY spotter_live.flightaware_id, spotter_live.date";
266
-				if ($limit) $query .= " LIMIT ".$globalMap3DAircraftsLimit;
291
+				if ($limit) {
292
+					$query .= " LIMIT ".$globalMap3DAircraftsLimit;
293
+				}
267 294
 			}
268 295
 		} else {
269 296
 			if (isset($globalArchive) && $globalArchive === TRUE) {
@@ -275,21 +302,31 @@  discard block
 block discarded – undo
275 302
                                */
276 303
 				$query  = "SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source 
277 304
 				FROM spotter_archive INNER JOIN (SELECT flightaware_id FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date) l ON l.flightaware_id = spotter_archive.flightaware_id ";
278
-				if ($usecoord) $query .= "AND spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
305
+				if ($usecoord) {
306
+					$query .= "AND spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
307
+				}
279 308
 				$query .= "UNION
280 309
 				SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
281 310
 				FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date";
282
-				if ($usecoord) $query .= " AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong;
311
+				if ($usecoord) {
312
+					$query .= " AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong;
313
+				}
283 314
 				$query .= ") AS spotter WHERE latitude <> '0' AND longitude <> '0' ";
284 315
 				$query .= "ORDER BY flightaware_id, date";
285
-				if ($limit) $query .= " LIMIT ".$globalMap3DAircraftsLimit;
316
+				if ($limit) {
317
+					$query .= " LIMIT ".$globalMap3DAircraftsLimit;
318
+				}
286 319
 			} else {
287 320
 				$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
288 321
 				FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date ";
289
-				if ($usecoord) $query .= "AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
322
+				if ($usecoord) {
323
+					$query .= "AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
324
+				}
290 325
 				$query .= "AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' 
291 326
 				ORDER BY spotter_live.flightaware_id, spotter_live.date";
292
-				if ($limit) $query .= " LIMIT ".$globalMap3DAircraftsLimit;
327
+				if ($limit) {
328
+					$query .= " LIMIT ".$globalMap3DAircraftsLimit;
329
+				}
293 330
 			}
294 331
 		}
295 332
 		try {
@@ -314,7 +351,9 @@  discard block
 block discarded – undo
314 351
 		global $globalDBdriver, $globalLiveInterval;
315 352
 		$filter_query = $this->getFilter($filter,true,true);
316 353
 
317
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
354
+		if (!isset($globalLiveInterval)) {
355
+			$globalLiveInterval = '200';
356
+		}
318 357
 		if ($globalDBdriver == 'mysql') {
319 358
 			//$query  = 'SELECT COUNT(*) as nb FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query;
320 359
 			$query = 'SELECT COUNT(DISTINCT spotter_live.flightaware_id) as nb FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
@@ -344,7 +383,9 @@  discard block
 block discarded – undo
344 383
 	{
345 384
 		global $globalDBdriver, $globalLiveInterval;
346 385
 		$Spotter = new Spotter($this->db);
347
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
386
+		if (!isset($globalLiveInterval)) {
387
+			$globalLiveInterval = '200';
388
+		}
348 389
 		$filter_query = $this->getFilter($filter);
349 390
 
350 391
 		if (is_array($coord)) {
@@ -352,7 +393,9 @@  discard block
 block discarded – undo
352 393
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
353 394
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
354 395
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
355
-		} else return array();
396
+		} else {
397
+			return array();
398
+		}
356 399
 		if ($globalDBdriver == 'mysql') {
357 400
 			$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY spotter_live.flightaware_id'.$filter_query;
358 401
 		} else {
@@ -373,7 +416,9 @@  discard block
 block discarded – undo
373 416
 	{
374 417
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
375 418
 		$Spotter = new Spotter($this->db);
376
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
419
+		if (!isset($globalLiveInterval)) {
420
+			$globalLiveInterval = '200';
421
+		}
377 422
 		$filter_query = $this->getFilter($filter,true,true);
378 423
 
379 424
 		if (is_array($coord)) {
@@ -381,7 +426,9 @@  discard block
 block discarded – undo
381 426
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
382 427
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
383 428
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
384
-		} else return array();
429
+		} else {
430
+			return array();
431
+		}
385 432
 		if ($globalDBdriver == 'mysql') {
386 433
 			if (isset($globalArchive) && $globalArchive === TRUE) {
387 434
 				$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
@@ -608,11 +655,15 @@  discard block
 block discarded – undo
608 655
 		//$query  = self::$global_query.' WHERE spotter_live.flightaware_id = :id ORDER BY date';
609 656
 		if ($globalDBdriver == 'mysql') {
610 657
 			$query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id';
611
-			if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
658
+			if ($liveinterval) {
659
+				$query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
660
+			}
612 661
 			$query .= ' ORDER BY date';
613 662
 		} else {
614 663
 			$query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id';
615
-			if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
664
+			if ($liveinterval) {
665
+				$query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
666
+			}
616 667
 			$query .= ' ORDER BY date';
617 668
 		}
618 669
 
@@ -707,7 +758,9 @@  discard block
 block discarded – undo
707 758
 				$i++;
708 759
 				$j++;
709 760
 				if ($j == 30) {
710
-					if ($globalDebug) echo ".";
761
+					if ($globalDebug) {
762
+						echo ".";
763
+					}
711 764
 				    	try {
712 765
 						
713 766
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
@@ -1014,7 +1067,9 @@  discard block
 block discarded – undo
1014 1067
 			{
1015 1068
 				return false;
1016 1069
 			}
1017
-		} else return '';
1070
+		} else {
1071
+			return '';
1072
+		}
1018 1073
 
1019 1074
 		if ($longitude != '')
1020 1075
 		{
@@ -1022,7 +1077,9 @@  discard block
 block discarded – undo
1022 1077
 			{
1023 1078
 				return false;
1024 1079
 			}
1025
-		} else return '';
1080
+		} else {
1081
+			return '';
1082
+		}
1026 1083
 
1027 1084
 		if ($waypoints != '')
1028 1085
 		{
@@ -1038,14 +1095,18 @@  discard block
 block discarded – undo
1038 1095
 			{
1039 1096
 				return false;
1040 1097
 			}
1041
-		} else $altitude = 0;
1098
+		} else {
1099
+			$altitude = 0;
1100
+		}
1042 1101
 		if ($altitude_real != '')
1043 1102
 		{
1044 1103
 			if (!is_numeric($altitude_real))
1045 1104
 			{
1046 1105
 				return false;
1047 1106
 			}
1048
-		} else $altitude_real = 0;
1107
+		} else {
1108
+			$altitude_real = 0;
1109
+		}
1049 1110
 
1050 1111
 		if ($heading != '')
1051 1112
 		{
@@ -1053,7 +1114,9 @@  discard block
 block discarded – undo
1053 1114
 			{
1054 1115
 				return false;
1055 1116
 			}
1056
-		} else $heading = 0;
1117
+		} else {
1118
+			$heading = 0;
1119
+		}
1057 1120
 
1058 1121
 		if ($groundspeed != '')
1059 1122
 		{
@@ -1061,9 +1124,13 @@  discard block
 block discarded – undo
1061 1124
 			{
1062 1125
 				return false;
1063 1126
 			}
1064
-		} else $groundspeed = 0;
1127
+		} else {
1128
+			$groundspeed = 0;
1129
+		}
1065 1130
 		date_default_timezone_set('UTC');
1066
-		if ($date == '') $date = date("Y-m-d H:i:s", time());
1131
+		if ($date == '') {
1132
+			$date = date("Y-m-d H:i:s", time());
1133
+		}
1067 1134
 
1068 1135
         
1069 1136
 		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
@@ -1108,14 +1175,24 @@  discard block
 block discarded – undo
1108 1175
 		$arrival_airport_country = '';
1109 1176
 		
1110 1177
             	
1111
-            	if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
1112
-            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
1113
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
1114
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
1178
+            	if ($squawk == '' || $Common->isInteger($squawk) === false ) {
1179
+            		$squawk = NULL;
1180
+            	}
1181
+            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) {
1182
+            		$verticalrate = NULL;
1183
+            	}
1184
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) {
1185
+            		$groundspeed = 0;
1186
+            	}
1187
+            	if ($heading == '' || $Common->isInteger($heading) === false ) {
1188
+            		$heading = 0;
1189
+            	}
1115 1190
 		
1116 1191
 		$query = '';
1117 1192
 		if ($globalArchive) {
1118
-			if ($globalDebug) echo '-- Delete previous data -- ';
1193
+			if ($globalDebug) {
1194
+				echo '-- Delete previous data -- ';
1195
+			}
1119 1196
 			$query .= 'DELETE FROM spotter_live WHERE flightaware_id = :flightaware_id;';
1120 1197
 		}
1121 1198
 
@@ -1132,10 +1209,14 @@  discard block
 block discarded – undo
1132 1209
 			return "error : ".$e->getMessage();
1133 1210
 		}
1134 1211
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
1135
-		    if ($globalDebug) echo '(Add to SBS archive : ';
1212
+		    if ($globalDebug) {
1213
+		    	echo '(Add to SBS archive : ';
1214
+		    }
1136 1215
 		    $SpotterArchive = new SpotterArchive($this->db);
1137 1216
 		    $result =  $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $altitude_real,$heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country);
1138
-		    if ($globalDebug) echo $result.')';
1217
+		    if ($globalDebug) {
1218
+		    	echo $result.')';
1219
+		    }
1139 1220
 		} elseif ($globalDebug && $putinarchive !== true) {
1140 1221
 			echo '(Not adding to archive)';
1141 1222
 		} elseif ($globalDebug && $noarchive === true) {
Please login to merge, or discard this patch.
require/class.MarineLive.php 1 patch
Braces   +113 added lines, -38 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.');
11
+		if ($this->db === null) {
12
+			die('Error: No DB connection.');
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
 		}
@@ -119,9 +126,13 @@  discard block
 block discarded – undo
119 126
 				$orderby_query = ' '.$search_orderby_array[$sort]['sql'];
120 127
 			}
121 128
 		}
122
-		if ($orderby_query == '') $orderby_query= ' ORDER BY date DESC';
129
+		if ($orderby_query == '') {
130
+			$orderby_query= ' ORDER BY date DESC';
131
+		}
123 132
 
124
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
133
+		if (!isset($globalLiveInterval)) {
134
+			$globalLiveInterval = '200';
135
+		}
125 136
 		if ($globalDBdriver == 'mysql') {
126 137
 			//$query  = "SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate";
127 138
 			$query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate'.$filter_query.$orderby_query;
@@ -146,7 +157,9 @@  discard block
 block discarded – undo
146 157
 
147 158
 		$filter_query = $this->getFilter($filter,true,true);
148 159
 
149
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
160
+		if (!isset($globalLiveInterval)) {
161
+			$globalLiveInterval = '200';
162
+		}
150 163
 		if ($globalDBdriver == 'mysql') {
151 164
 			$query  = 'SELECT marine_live.mmsi, marine_live.ident, marine_live.type,marine_live.fammarine_id, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source 
152 165
 			FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate'.$filter_query." marine_live.latitude <> 0 AND marine_live.longitude <> 0";
@@ -187,48 +200,72 @@  discard block
 block discarded – undo
187 200
 		}
188 201
 		$filter_query = $this->getFilter($filter,true,true);
189 202
 
190
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
191
-		if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') $globalMap3DMarinesLimit = '300';
203
+		if (!isset($globalLiveInterval)) {
204
+			$globalLiveInterval = '200';
205
+		}
206
+		if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') {
207
+			$globalMap3DMarinesLimit = '300';
208
+		}
192 209
 		if ($globalDBdriver == 'mysql') {
193 210
 			if (isset($globalArchive) && $globalArchive === TRUE) {
194 211
 				$query  = 'SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id,marine_archive.type, marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source 
195 212
 				    FROM marine_archive INNER JOIN (SELECT fammarine_id FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date) l ON l.flightaware_id = marine_archive.flightaware_id ";
196
-				if ($usecoord) $query .= "AND marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
213
+				if ($usecoord) {
214
+					$query .= "AND marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
215
+				}
197 216
 				$query .= "UNION
198 217
 				    SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source 
199 218
 				    FROM marine_live".$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date";
200
-				if ($usecoord) $query .= " AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong;
219
+				if ($usecoord) {
220
+					$query .= " AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong;
221
+				}
201 222
 				$query .= ") AS marine 
202 223
 				    WHERE latitude <> '0' AND longitude <> '0' 
203 224
 				    ORDER BY fammarine_id, date";
204
-				if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit;
225
+				if ($limit) {
226
+					$query .= " LIMIT ".$globalMap3DMarinesLimit;
227
+				}
205 228
 			} else {
206 229
 				$query  = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source 
207 230
 				    FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date ";
208
-				if ($usecoord) $query .= "AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
231
+				if ($usecoord) {
232
+					$query .= "AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
233
+				}
209 234
 				$query .= "AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' 
210 235
 				ORDER BY marine_live.fammarine_id, marine_live.date";
211
-				if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit;
236
+				if ($limit) {
237
+					$query .= " LIMIT ".$globalMap3DMarinesLimit;
238
+				}
212 239
 			}
213 240
 		} else {
214 241
 			if (isset($globalArchive) && $globalArchive === TRUE) {
215 242
 				$query  = "SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id, marine_archive.type,marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source 
216 243
 				    FROM marine_archive INNER JOIN (SELECT flightaware_id FROM marine_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date) l ON l.flightaware_id = marine_archive.flightaware_id ";
217
-				if ($usecoord) $query .= "AND marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
244
+				if ($usecoord) {
245
+					$query .= "AND marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
246
+				}
218 247
 				$query .= "UNION
219 248
 				    SELECT marine_live.ident, marine_live.fammarine_id, marine_live.type,marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source 
220 249
 				    FROM marine_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date";
221
-				if ($usecoord) $query .= " AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong;
250
+				if ($usecoord) {
251
+					$query .= " AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong;
252
+				}
222 253
 				$query .= ") AS marine WHERE latitude <> '0' AND longitude <> '0' ";
223 254
 				$query .= "ORDER BY fammarine_id, date";
224
-				if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit;
255
+				if ($limit) {
256
+					$query .= " LIMIT ".$globalMap3DMarinesLimit;
257
+				}
225 258
 			} else {
226 259
 				$query  = "SELECT marine_live.ident, marine_live.fammarine_id, marine_live.type,marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source 
227 260
 				    FROM marine_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date ";
228
-				if ($usecoord) $query .= "AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
261
+				if ($usecoord) {
262
+					$query .= "AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
263
+				}
229 264
 				$query .= "AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' 
230 265
 				ORDER BY marine_live.fammarine_id, marine_live.date";
231
-				if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit;
266
+				if ($limit) {
267
+					$query .= " LIMIT ".$globalMap3DMarinesLimit;
268
+				}
232 269
 			}
233 270
 		}
234 271
 		try {
@@ -253,7 +290,9 @@  discard block
 block discarded – undo
253 290
 		global $globalDBdriver, $globalLiveInterval;
254 291
 		$filter_query = $this->getFilter($filter,true,true);
255 292
 
256
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
293
+		if (!isset($globalLiveInterval)) {
294
+			$globalLiveInterval = '200';
295
+		}
257 296
 		if ($globalDBdriver == 'mysql') {
258 297
 			$query = 'SELECT COUNT(DISTINCT marine_live.fammarine_id) as nb FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
259 298
 		} else {
@@ -281,7 +320,9 @@  discard block
 block discarded – undo
281 320
 	{
282 321
 		global $globalDBdriver, $globalLiveInterval;
283 322
 		$Spotter = new Spotter($this->db);
284
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
323
+		if (!isset($globalLiveInterval)) {
324
+			$globalLiveInterval = '200';
325
+		}
285 326
 		$filter_query = $this->getFilter($filter);
286 327
 
287 328
 		if (is_array($coord)) {
@@ -289,7 +330,9 @@  discard block
 block discarded – undo
289 330
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
290 331
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
291 332
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
292
-		} else return array();
333
+		} else {
334
+			return array();
335
+		}
293 336
 		if ($globalDBdriver == 'mysql') {
294 337
 			$query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate AND marine_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND marine_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY marine_live.fammarine_id'.$filter_query;
295 338
 		} else {
@@ -309,7 +352,9 @@  discard block
 block discarded – undo
309 352
 	{
310 353
 		global $globalDBdriver, $globalLiveInterval;
311 354
 		$Spotter = new Spotter($this->db);
312
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
355
+		if (!isset($globalLiveInterval)) {
356
+			$globalLiveInterval = '200';
357
+		}
313 358
 		$filter_query = $this->getFilter($filter);
314 359
 
315 360
 		if (is_array($coord)) {
@@ -317,7 +362,9 @@  discard block
 block discarded – undo
317 362
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
318 363
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
319 364
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
320
-		} else return array();
365
+		} else {
366
+			return array();
367
+		}
321 368
 		if ($globalDBdriver == 'mysql') {
322 369
 			$query  = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source 
323 370
 			FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' AND marine_live.latitude BETWEEN ".$minlat.' AND '.$maxlat.' AND marine_live.longitude BETWEEN '.$minlong.' AND '.$maxlong."
@@ -485,11 +532,15 @@  discard block
 block discarded – undo
485 532
 		//$query  = self::$global_query.' WHERE marine_live.fammarine_id = :id ORDER BY date';
486 533
 		if ($globalDBdriver == 'mysql') {
487 534
 			$query = 'SELECT marine_live.* FROM marine_live WHERE marine_live.fammarine_id = :id';
488
-			if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
535
+			if ($liveinterval) {
536
+				$query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
537
+			}
489 538
 			$query .= ' ORDER BY date';
490 539
 		} else {
491 540
 			$query = 'SELECT marine_live.* FROM marine_live WHERE marine_live.fammarine_id = :id';
492
-			if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
541
+			if ($liveinterval) {
542
+				$query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
543
+			}
493 544
 			$query .= ' ORDER BY date';
494 545
 		}
495 546
 
@@ -584,7 +635,9 @@  discard block
 block discarded – undo
584 635
 				$i++;
585 636
 				$j++;
586 637
 				if ($j == 30) {
587
-					if ($globalDebug) echo ".";
638
+					if ($globalDebug) {
639
+						echo ".";
640
+					}
588 641
 				    	try {
589 642
 						
590 643
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
@@ -864,7 +917,9 @@  discard block
 block discarded – undo
864 917
 			{
865 918
 				return false;
866 919
 			}
867
-		} else return '';
920
+		} else {
921
+			return '';
922
+		}
868 923
 
869 924
 		if ($longitude != '')
870 925
 		{
@@ -872,7 +927,9 @@  discard block
 block discarded – undo
872 927
 			{
873 928
 				return false;
874 929
 			}
875
-		} else return '';
930
+		} else {
931
+			return '';
932
+		}
876 933
 
877 934
 
878 935
 		if ($heading != '')
@@ -881,7 +938,9 @@  discard block
 block discarded – undo
881 938
 			{
882 939
 				return false;
883 940
 			}
884
-		} else $heading = 0;
941
+		} else {
942
+			$heading = 0;
943
+		}
885 944
 
886 945
 		if ($groundspeed != '')
887 946
 		{
@@ -889,9 +948,13 @@  discard block
 block discarded – undo
889 948
 			{
890 949
 				return false;
891 950
 			}
892
-		} else $groundspeed = 0;
951
+		} else {
952
+			$groundspeed = 0;
953
+		}
893 954
 		date_default_timezone_set('UTC');
894
-		if ($date == '') $date = date("Y-m-d H:i:s", time());
955
+		if ($date == '') {
956
+			$date = date("Y-m-d H:i:s", time());
957
+		}
895 958
 
896 959
         
897 960
 		$fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING);
@@ -912,12 +975,20 @@  discard block
 block discarded – undo
912 975
 		$arrival_date = filter_var($arrival_date,FILTER_SANITIZE_STRING);
913 976
 		
914 977
 
915
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
916
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
917
-            	if ($arrival_date == '') $arrival_date = NULL;
978
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) {
979
+            		$groundspeed = 0;
980
+            	}
981
+            	if ($heading == '' || $Common->isInteger($heading) === false ) {
982
+            		$heading = 0;
983
+            	}
984
+            	if ($arrival_date == '') {
985
+            		$arrival_date = NULL;
986
+            	}
918 987
             	$query = '';
919 988
 		if ($globalArchive) {
920
-			if ($globalDebug) echo '-- Delete previous data -- ';
989
+			if ($globalDebug) {
990
+				echo '-- Delete previous data -- ';
991
+			}
921 992
 			$query .= 'DELETE FROM marine_live WHERE fammarine_id = :fammarine_id;';
922 993
 		}
923 994
 		$query .= 'INSERT INTO marine_live (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, over_country, mmsi, type,status,imo,arrival_port_name,arrival_port_date) 
@@ -932,10 +1003,14 @@  discard block
 block discarded – undo
932 1003
 		}
933 1004
 		
934 1005
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
935
-			if ($globalDebug) echo '(Add to Marine archive : ';
1006
+			if ($globalDebug) {
1007
+				echo '(Add to Marine archive : ';
1008
+			}
936 1009
 			$MarineArchive = new MarineArchive($this->db);
937 1010
 			$result =  $MarineArchive->addMarineArchiveData($fammarine_id, $ident, $latitude, $longitude, $heading, $groundspeed, $date, $putinarchive, $mmsi,$type,$typeid,$imo, $callsign,$arrival_code,$arrival_date,$status,$noarchive,$format_source, $source_name, $over_country);
938
-			if ($globalDebug) echo $result.')';
1011
+			if ($globalDebug) {
1012
+				echo $result.')';
1013
+			}
939 1014
 		}
940 1015
 		return "success";
941 1016
 	}
Please login to merge, or discard this patch.
scripts/update_db.php 1 patch
Braces   +30 added lines, -11 removed lines patch added patch discarded remove patch
@@ -9,7 +9,9 @@  discard block
 block discarded – undo
9 9
 if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
10 10
 	exec("ps ux", $output, $result);
11 11
 	$j = 0;
12
-	foreach ($output as $line) if(strpos($line, dirname(__FILE__)."/update_db.php") && !strpos($line, "sh ")) $j++;
12
+	foreach ($output as $line) {
13
+		if(strpos($line, dirname(__FILE__)."/update_db.php") && !strpos($line, "sh ")) $j++;
14
+	}
13 15
 	if ($j > 1) {
14 16
 		echo "Script is already runnning...";
15 17
 		die();
@@ -29,14 +31,18 @@  discard block
 block discarded – undo
29 31
 			$update_db->update_notam();
30 32
 		}
31 33
 		$update_db->insert_last_notam_update();
32
-	} elseif (isset($globalDebug) && $globalDebug && isset($globalNOTAM) && $globalNOTAM) echo "NOTAM are only updated once a day.\n";
34
+	} elseif (isset($globalDebug) && $globalDebug && isset($globalNOTAM) && $globalNOTAM) {
35
+		echo "NOTAM are only updated once a day.\n";
36
+	}
33 37
 	if ($update_db->check_last_update() && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
34 38
 		$update_db->update_all();
35 39
 	//	require_once(dirname(__FILE__).'/../require/class.Spotter.php');
36 40
 	//	$Spotter = new Spotter();
37 41
 	//	$Spotter->updateFieldsFromOtherTables();
38 42
 		$update_db->insert_last_update();
39
-	} elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM)) echo "DB are populated with external data only every 15 days ! Files are not updated more often.\n";
43
+	} elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM)) {
44
+		echo "DB are populated with external data only every 15 days ! Files are not updated more often.\n";
45
+	}
40 46
 	if (isset($globalWaypoints) && $globalWaypoints && $update_db->check_last_airspace_update()) {
41 47
 		echo "Check if new airspace version exist...";
42 48
 		echo $update_db->update_airspace_fam();
@@ -45,8 +51,11 @@  discard block
 block discarded – undo
45 51
 	if (isset($globalGeoid) && $globalGeoid && $update_db->check_last_geoid_update()) {
46 52
 		echo "Check if new geoid version exist...";
47 53
 		$error = $update_db->update_geoid_fam();
48
-		if ($error == '') $update_db->insert_last_geoid_update();
49
-		else echo $error;
54
+		if ($error == '') {
55
+			$update_db->insert_last_geoid_update();
56
+		} else {
57
+			echo $error;
58
+		}
50 59
 	}
51 60
 	if (isset($globalMarine) && $globalMarine && $update_db->check_last_marine_identity_update()) {
52 61
 		echo "Check if new marine identity version exist...";
@@ -64,7 +73,9 @@  discard block
 block discarded – undo
64 73
 			//echo "Done";
65 74
 		}
66 75
 		$update_db->insert_last_owner_update();
67
-	} elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) echo "Owner are only updated every 15 days.\n";
76
+	} elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
77
+		echo "Owner are only updated every 15 days.\n";
78
+	}
68 79
 
69 80
 	if ($update_db->check_last_airlines_update() && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
70 81
 		echo "Updating airlines...\n";
@@ -72,7 +83,9 @@  discard block
 block discarded – undo
72 83
 			echo $update_db->update_airlines_fam();
73 84
 		}
74 85
 		$update_db->insert_last_airlines_update();
75
-	} elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) echo "Airlines are only updated every 15 days.\n";
86
+	} elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
87
+		echo "Airlines are only updated every 15 days.\n";
88
+	}
76 89
 
77 90
 	if (isset($globalAccidents) && $globalAccidents && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
78 91
 		require_once(dirname(__FILE__).'/../require/class.Accident.php');
@@ -81,7 +94,9 @@  discard block
 block discarded – undo
81 94
 		if ($Accident->check_last_accidents_update()) {
82 95
 			$Accident->download_update();
83 96
 			$Accident->insert_last_accidents_update();
84
-		} else echo "Accidents are updated once a day.\n";
97
+		} else {
98
+			echo "Accidents are updated once a day.\n";
99
+		}
85 100
 	}
86 101
   
87 102
 }
@@ -94,15 +109,19 @@  discard block
 block discarded – undo
94 109
 	if ($METAR->check_last_update()) {
95 110
 		$METAR->addMETARCycle();
96 111
 		$METAR->insert_last_update();
97
-	} else echo "METAR are only updated every 30 minutes.\n";
98
-}
112
+	} else {
113
+		echo "METAR are only updated every 30 minutes.\n";
114
+	}
115
+	}
99 116
 
100 117
 if (isset($globalSchedules) && $globalSchedules && $update_db->check_last_schedules_update() && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
101 118
 	echo "Updating schedules...";
102 119
 	//$update_db->update_oneworld();
103 120
 	$update_db->update_skyteam();
104 121
 	$update_db->insert_last_schedules_update();
105
-} elseif (isset($globalDebug) && $globalDebug && isset($globalOwner) && $globalOwner && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) echo "Schedules are only updated every 15 days.\n";
122
+} elseif (isset($globalDebug) && $globalDebug && isset($globalOwner) && $globalOwner && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
123
+	echo "Schedules are only updated every 15 days.\n";
124
+}
106 125
 
107 126
 if (isset($globalArchiveMonths) && $globalArchiveMonths > 0) {
108 127
 	echo "Updating statistics and archive old data...";
Please login to merge, or discard this patch.
index.php 1 patch
Braces   +437 added lines, -110 removed lines patch added patch discarded remove patch
@@ -162,11 +162,26 @@  discard block
 block discarded – undo
162 162
 				<li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam();" /><?php echo _("Display NOTAM"); ?></label></div></li>
163 163
 				<li><?php echo _("NOTAM scope:"); ?>
164 164
 					<select class="selectpicker" onchange="notamscope(this);">
165
-						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') print ' selected'; ?>>All</option>
166
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') print ' selected'; ?>>Airport/Enroute warning</option>
167
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') print ' selected'; ?>>Airport warning</option>
168
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') print ' selected'; ?>>Navigation warning</option>
169
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') print ' selected'; ?>>Enroute warning</option>
165
+						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') {
166
+	print ' selected';
167
+}
168
+?>>All</option>
169
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') {
170
+	print ' selected';
171
+}
172
+?>>Airport/Enroute warning</option>
173
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') {
174
+	print ' selected';
175
+}
176
+?>>Airport warning</option>
177
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') {
178
+	print ' selected';
179
+}
180
+?>>Navigation warning</option>
181
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') {
182
+	print ' selected';
183
+}
184
+?>>Enroute warning</option>
170 185
 					</select
171 186
 				</li>
172 187
 			</ul>
@@ -194,7 +209,12 @@  discard block
 block discarded – undo
194 209
 		        <div class="form-group">
195 210
 			    <label>From (UTC):</label>
196 211
 		            <div class='input-group date' id='datetimepicker1'>
197
-            			<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 />
212
+            			<input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) {
213
+	print $_POST['start_date'];
214
+} elseif (isset($_COOKIE['archive_begin'])) {
215
+	print date("m/d/Y h:i a",$_COOKIE['archive_begin']);
216
+}
217
+?>" required />
198 218
 		                <span class="input-group-addon">
199 219
             			    <span class="glyphicon glyphicon-calendar"></span>
200 220
 		                </span>
@@ -203,7 +223,12 @@  discard block
 block discarded – undo
203 223
 		        <div class="form-group">
204 224
 			    <label>To (UTC):</label>
205 225
 		            <div class='input-group date' id='datetimepicker2'>
206
-		                <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']); ?>" />
226
+		                <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) {
227
+	print $_POST['end_date'];
228
+} elseif (isset($_COOKIE['archive_end'])) {
229
+	print date("m/d/Y h:i a",$_COOKIE['archive_end']);
230
+}
231
+?>" />
207 232
             			<span class="input-group-addon">
208 233
 		                    <span class="glyphicon glyphicon-calendar"></span>
209 234
             			</span>
@@ -228,8 +253,20 @@  discard block
 block discarded – undo
228 253
 			</script>
229 254
 		    <li><?php echo _("Playback speed:"); ?>
230 255
 			<div class="range">
231
-			    <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'; ?>">
232
-			    <output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?></output>
256
+			    <input type="range" min="0" max="50" step="1" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php  if (isset($_POST['archivespeed'])) {
257
+	print $_POST['archivespeed'];
258
+} elseif (isset($_COOKIE['archive_speed'])) {
259
+	print $_COOKIE['archive_speed'];
260
+} else {
261
+	print '1';
262
+}
263
+?>">
264
+			    <output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) {
265
+	print $_COOKIE['archive_speed'];
266
+} else {
267
+	print '1';
268
+}
269
+?></output>
233 270
 			</div>
234 271
 		    </li>
235 272
 		    <li><input type="submit" name="archive" value="Show archive" class="btn btn-primary" /></li>
@@ -251,15 +288,27 @@  discard block
 block discarded – undo
251 288
 		    <li><?php echo _("Type of Map:"); ?>
252 289
 			<select  class="selectpicker" onchange="mapType(this);">
253 290
 			    <?php
254
-				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider;
255
-				else $MapType = $_COOKIE['MapType'];
291
+				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') {
292
+					$MapType = $globalMapProvider;
293
+				} else {
294
+					$MapType = $_COOKIE['MapType'];
295
+				}
256 296
 			    ?>
257 297
 			    <?php
258 298
 				if (isset($globalBingMapKey) && $globalBingMapKey != '') {
259 299
 			    ?>
260
-			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option>
261
-			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option>
262
-			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option>
300
+			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') {
301
+	print ' selected';
302
+}
303
+?>>Bing-Aerial</option>
304
+			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') {
305
+	print ' selected';
306
+}
307
+?>>Bing-Hybrid</option>
308
+			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') {
309
+	print ' selected';
310
+}
311
+?>>Bing-Road</option>
263 312
 			    <?php
264 313
 				}
265 314
 			    ?>
@@ -269,56 +318,131 @@  discard block
 block discarded – undo
269 318
 			    <?php
270 319
 				    if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
271 320
 			    ?>
272
-			    <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option>
273
-			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option>
274
-			    <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option>
321
+			    <option value="Here-Aerial"<?php if ($MapType == 'Here') {
322
+	print ' selected';
323
+}
324
+?>>Here-Aerial</option>
325
+			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') {
326
+	print ' selected';
327
+}
328
+?>>Here-Hybrid</option>
329
+			    <option value="Here-Road"<?php if ($MapType == 'Here') {
330
+	print ' selected';
331
+}
332
+?>>Here-Road</option>
275 333
 			    <?php
276 334
 				    }
277 335
 			    ?>
278 336
 			    <?php
279 337
 				    if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
280 338
 			    ?>
281
-			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option>
282
-			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option>
283
-			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option>
284
-			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option>
339
+			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') {
340
+	print ' selected';
341
+}
342
+?>>Google Roadmap</option>
343
+			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') {
344
+	print ' selected';
345
+}
346
+?>>Google Satellite</option>
347
+			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') {
348
+	print ' selected';
349
+}
350
+?>>Google Hybrid</option>
351
+			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') {
352
+	print ' selected';
353
+}
354
+?>>Google Terrain</option>
285 355
 			    <?php
286 356
 				    }
287 357
 			    ?>
288 358
 			    <?php
289 359
 				    if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
290 360
 			    ?>
291
-			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option>
292
-			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option>
293
-			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option>
361
+			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') {
362
+	print ' selected';
363
+}
364
+?>>MapQuest-OSM</option>
365
+			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') {
366
+	print ' selected';
367
+}
368
+?>>MapQuest-Aerial</option>
369
+			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') {
370
+	print ' selected';
371
+}
372
+?>>MapQuest-Hybrid</option>
294 373
 			    <?php
295 374
 				    }
296 375
 			    ?>
297
-			    <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option>
376
+			    <option value="Yandex"<?php if ($MapType == 'Yandex') {
377
+	print ' selected';
378
+}
379
+?>>Yandex</option>
298 380
 			    <?php
299 381
 				}
300 382
 			    ?>
301 383
 			    <?php
302 384
 				    if (isset($globalMapboxToken) && $globalMapboxToken != '') {
303
-					if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default';
304
-					else $MapBoxId = $_COOKIE['MapTypeId'];
385
+					if (!isset($_COOKIE['MapTypeId'])) {
386
+						$MapBoxId = 'default';
387
+					} else {
388
+						$MapBoxId = $_COOKIE['MapTypeId'];
389
+					}
305 390
 			    ?>
306
-			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option>
307
-			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option>
308
-			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option>
309
-			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') print ' selected'; ?>>Mapbox dark</option>
310
-			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') print ' selected'; ?>>Mapbox satellite</option>
311
-			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') print ' selected'; ?>>Mapbox streets-satellite</option>
312
-			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') print ' selected'; ?>>Mapbox streets-basic</option>
313
-			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') print ' selected'; ?>>Mapbox comic</option>
314
-			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') print ' selected'; ?>>Mapbox outdoors</option>
315
-			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') print ' selected'; ?>>Mapbox pencil</option>
316
-			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option>
317
-			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option>
391
+			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') {
392
+	print ' selected';
393
+}
394
+?>>Mapbox default</option>
395
+			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') {
396
+	print ' selected';
397
+}
398
+?>>Mapbox streets</option>
399
+			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') {
400
+	print ' selected';
401
+}
402
+?>>Mapbox light</option>
403
+			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') {
404
+	print ' selected';
405
+}
406
+?>>Mapbox dark</option>
407
+			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') {
408
+	print ' selected';
409
+}
410
+?>>Mapbox satellite</option>
411
+			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') {
412
+	print ' selected';
413
+}
414
+?>>Mapbox streets-satellite</option>
415
+			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') {
416
+	print ' selected';
417
+}
418
+?>>Mapbox streets-basic</option>
419
+			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') {
420
+	print ' selected';
421
+}
422
+?>>Mapbox comic</option>
423
+			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') {
424
+	print ' selected';
425
+}
426
+?>>Mapbox outdoors</option>
427
+			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') {
428
+	print ' selected';
429
+}
430
+?>>Mapbox pencil</option>
431
+			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') {
432
+	print ' selected';
433
+}
434
+?>>Mapbox pirates</option>
435
+			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') {
436
+	print ' selected';
437
+}
438
+?>>Mapbox emerald</option>
318 439
 			    <?php
319 440
 				    }
320 441
 			    ?>
321
-			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option>
442
+			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') {
443
+	print ' selected';
444
+}
445
+?>>OpenStreetMap</option>
322 446
 			</select>
323 447
 		    </li>
324 448
 <?php
@@ -326,10 +450,22 @@  discard block
 block discarded – undo
326 450
 ?>
327 451
 		    <li><?php echo _("Type of Terrain:"); ?>
328 452
 			<select  class="selectpicker" onchange="terrainType(this);">
329
-			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option>
330
-			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option>
331
-			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option>
332
-			    <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected';?>>ArticDEM</option>
453
+			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') {
454
+	print ' selected';
455
+}
456
+?>>stk terrain</option>
457
+			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') {
458
+	print ' selected';
459
+}
460
+?>>ellipsoid</option>
461
+			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') {
462
+	print ' selected';
463
+}
464
+?>>vr terrain</option>
465
+			    <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') {
466
+	print ' selected';
467
+}
468
+?>>ArticDEM</option>
333 469
 			</select>
334 470
 		    </li>
335 471
 <?php
@@ -341,28 +477,61 @@  discard block
 block discarded – undo
341 477
 <?php
342 478
 	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
343 479
 ?>
344
-		    <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>
345
-		    <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>
346
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || (isset($globalMapRoute) && $globalMapRoute)) print 'checked'; ?> ><?php echo _("Display flight route on click"); ?></label></div></li>
347
-		    <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>
348
-		    <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>
480
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') {
481
+	print 'checked';
482
+}
483
+?> ><?php echo _("Display flight info as popup"); ?></label></div></li>
484
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true')) {
485
+	print 'checked';
486
+}
487
+?> ><?php echo _("Display flight path"); ?></label></div></li>
488
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || (isset($globalMapRoute) && $globalMapRoute)) {
489
+	print 'checked';
490
+}
491
+?> ><?php echo _("Display flight route on click"); ?></label></div></li>
492
+		    <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)) {
493
+	print 'checked';
494
+}
495
+?> ><?php echo _("Display flight remaining route on click"); ?></label></div></li>
496
+		    <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)) {
497
+	print 'checked';
498
+}
499
+?> ><?php echo _("Planes animate between updates"); ?></label></div></li>
349 500
 <?php
350 501
 	}
351 502
 	if (isset($globalSatellite) && $globalSatellite === TRUE) {
352 503
 ?>
353
-		    <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>
504
+		    <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)) {
505
+	print 'checked';
506
+}
507
+?> ><?php echo _("Satellites animate between updates"); ?></label></div></li>
354 508
 <?php
355 509
 	}
356 510
     }
357 511
 ?>
358
-		    <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>
359
-		    <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>
360
-		    <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>
361
-		    <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>
512
+		    <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'])) {
513
+	print 'checked';
514
+}
515
+?> ><?php echo _("Display airports on map"); ?></label></div></li>
516
+		    <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))) {
517
+	print 'checked';
518
+}
519
+?> ><?php echo _("Display ground station on map"); ?></label></div></li>
520
+		    <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))) {
521
+	print 'checked';
522
+}
523
+?> ><?php echo _("Display weather station on map"); ?></label></div></li>
524
+		    <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))) {
525
+	print 'checked';
526
+}
527
+?> ><?php echo _("Display lightning on map"); ?></label></div></li>
362 528
 <?php
363 529
     if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
364 530
 ?>
365
-		    <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>
531
+		    <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')) {
532
+	print 'checked';
533
+}
534
+?> ><?php echo _("Show mini-map"); ?></label></div></li>
366 535
 <?php
367 536
     }
368 537
     if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
@@ -375,17 +544,25 @@  discard block
 block discarded – undo
375 544
 			if (function_exists('array_column')) {
376 545
 			    if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
377 546
 		    ?>
378
-		    <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>
547
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
548
+	print 'checked';
549
+}
550
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
379 551
 		    <?php
380 552
 			    }
381 553
 			} elseif (isset($globalSources)) {
382 554
 			    $dispolar = false;
383 555
 			    foreach ($globalSources as $testsource) {
384
-			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
556
+			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) {
557
+			        	$dispolar = true;
558
+			        }
385 559
 			    }
386 560
 			    if ($dispolar) {
387 561
 		    ?>
388
-		    <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>
562
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
563
+	print 'checked';
564
+}
565
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
389 566
 		    <?php
390 567
 			    }
391 568
 		        }
@@ -398,12 +575,22 @@  discard block
 block discarded – undo
398 575
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
399 576
 		    	    if (extension_loaded('gd') && function_exists('gd_info')) {
400 577
 		    ?>
401
-		    <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>
578
+		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') {
579
+	print 'checked';
580
+}
581
+?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
402 582
 		    <?php 
403 583
 				if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') {
404 584
 		    ?>
405 585
 		    <li><?php echo _("Aircraft icon color:"); ?>
406
-			<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'; ?>">
586
+			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) {
587
+	print $_COOKIE['IconColor'];
588
+} elseif (isset($globalAircraftIconColor)) {
589
+	print $globalAircraftIconColor;
590
+} else {
591
+	print '1a3151';
592
+}
593
+?>">
407 594
 		    </li>
408 595
 		    <?php
409 596
 				}
@@ -415,7 +602,14 @@  discard block
 block discarded – undo
415 602
 			    if (extension_loaded('gd') && function_exists('gd_info')) {
416 603
 		    ?>
417 604
 		    <li><?php echo _("Marine icon color:"); ?>
418
-			<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'; ?>">
605
+			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) {
606
+	print $_COOKIE['MarineIconColor'];
607
+} elseif (isset($globalMarineIconColor)) {
608
+	print $globalMarineIconColor;
609
+} else {
610
+	print '1a3151';
611
+}
612
+?>">
419 613
 		    </li>
420 614
 		    <?php
421 615
 			    }
@@ -426,7 +620,14 @@  discard block
 block discarded – undo
426 620
 			    if (extension_loaded('gd') && function_exists('gd_info')) {
427 621
 		    ?>
428 622
 		    <li><?php echo _("Tracker icon color:"); ?>
429
-			<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'; ?>">
623
+			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) {
624
+	print $_COOKIE['TrackerIconColor'];
625
+} elseif (isset($globalTrackerIconColor)) {
626
+	print $globalTrackerIconColor;
627
+} else {
628
+	print '1a3151';
629
+}
630
+?>">
430 631
 		    </li>
431 632
 		    <?php
432 633
 			    }
@@ -437,8 +638,22 @@  discard block
 block discarded – undo
437 638
 		    ?>
438 639
 		    <li><?php echo _("Show airport icon at zoom level:"); ?>
439 640
 			<div class="range">
440
-			    <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'; ?>">
441
-			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?></output>
641
+			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) {
642
+	print $_COOKIE['AirportZoom'];
643
+} elseif (isset($globalAirportZoom)) {
644
+	print $globalAirportZoom;
645
+} else {
646
+	print '7';
647
+}
648
+?>">
649
+			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) {
650
+	print $_COOKIE['AirportZoom'];
651
+} elseif (isset($globalAirportZoom)) {
652
+	print $globalAirportZoom;
653
+} else {
654
+	print '7';
655
+}
656
+?></output>
442 657
 			</div>
443 658
 		    </li>
444 659
 		    <?php
@@ -450,9 +665,19 @@  discard block
 block discarded – undo
450 665
 <?php
451 666
 	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
452 667
 ?>
453
-		    <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>
668
+		    <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') {
669
+	print 'checked';
670
+}
671
+?> ><?php echo _("Force Aircraft color"); ?></li>
454 672
 		    <li><?php echo _("Aircraft icon color:"); ?>
455
-			<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'; ?>">
673
+			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) {
674
+	print $_COOKIE['IconColor'];
675
+} elseif (isset($globalAircraftIconColor)) {
676
+	print $globalAircraftIconColor;
677
+} else {
678
+	print 'ff0000';
679
+}
680
+?>">
456 681
 		    </li>
457 682
 <?php
458 683
 	}
@@ -460,9 +685,19 @@  discard block
 block discarded – undo
460 685
 <?php
461 686
 	if (isset($globalMarine) && $globalMarine === TRUE) {
462 687
 ?>
463
-		    <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>
688
+		    <li><input type="checkbox" name="marinecolorforce" value="1" onclick="MarineiconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') {
689
+	print 'checked';
690
+}
691
+?> ><?php echo _("Force Marine color"); ?></li>
464 692
 		    <li><?php echo _("Marine icon color:"); ?>
465
-			<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'; ?>">
693
+			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) {
694
+	print $_COOKIE['MarineIconColor'];
695
+} elseif (isset($globalMarineIconColor)) {
696
+	print $globalMarineIconColor;
697
+} else {
698
+	print 'ff0000';
699
+}
700
+?>">
466 701
 		    </li>
467 702
 <?php
468 703
 	}
@@ -470,9 +705,19 @@  discard block
 block discarded – undo
470 705
 <?php
471 706
 	if (isset($globalTracker) && $globalTracker === TRUE) {
472 707
 ?>
473
-		    <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>
708
+		    <li><input type="checkbox" name="trackercolorforce" value="1" onclick="TrackericonColorForce(this)" <?php if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true') {
709
+	print 'checked';
710
+}
711
+?> ><?php echo _("Force Tracker color"); ?></li>
474 712
 		    <li><?php echo _("Tracker icon color:"); ?>
475
-			<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'; ?>">
713
+			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) {
714
+	print $_COOKIE['TrackerIconColor'];
715
+} elseif (isset($globalTrackerIconColor)) {
716
+	print $globalTrackerIconColor;
717
+} else {
718
+	print 'ff0000';
719
+}
720
+?>">
476 721
 		    </li>
477 722
 <?php
478 723
 	}
@@ -480,22 +725,46 @@  discard block
 block discarded – undo
480 725
 ?>
481 726
 		    <li><?php echo _("Distance unit:"); ?>
482 727
 			<select class="selectpicker" onchange="unitdistance(this);">
483
-			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) echo ' selected'; ?>>km</option>
484
-			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) echo ' selected'; ?>>nm</option>
485
-			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) echo ' selected'; ?>>mi</option>
728
+			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) {
729
+	echo ' selected';
730
+}
731
+?>>km</option>
732
+			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
733
+	echo ' selected';
734
+}
735
+?>>nm</option>
736
+			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
737
+	echo ' selected';
738
+}
739
+?>>mi</option>
486 740
 		        </select>
487 741
 		    </li>
488 742
 		    <li><?php echo _("Altitude unit:"); ?>
489 743
 			<select class="selectpicker" onchange="unitaltitude(this);">
490
-			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) echo ' selected'; ?>>m</option>
491
-			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) echo ' selected'; ?>>feet</option>
744
+			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) {
745
+	echo ' selected';
746
+}
747
+?>>m</option>
748
+			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) {
749
+	echo ' selected';
750
+}
751
+?>>feet</option>
492 752
 		        </select>
493 753
 		    </li>
494 754
 		    <li><?php echo _("Speed unit:"); ?>
495 755
 			<select class="selectpicker" onchange="unitspeed(this);">
496
-			    <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>
497
-			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) echo ' selected'; ?>>mph</option>
498
-			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) echo ' selected'; ?>>knots</option>
756
+			    <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) {
757
+	echo ' selected';
758
+}
759
+?>>km/h</option>
760
+			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) {
761
+	echo ' selected';
762
+}
763
+?>>mph</option>
764
+			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) {
765
+	echo ' selected';
766
+}
767
+?>>knots</option>
499 768
 		        </select>
500 769
 		    </li>
501 770
 
@@ -513,9 +782,18 @@  discard block
 block discarded – undo
513 782
 		    <?php
514 783
 			if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) {
515 784
 		    ?>
516
-			<?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 } ?>
517
-			<?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 } ?>
518
-			<?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 } ?>
785
+			<?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'])) {
786
+	print 'checked';
787
+}
788
+?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
789
+			<?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'])) {
790
+	print 'checked';
791
+}
792
+?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
793
+			<?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'])) {
794
+	print 'checked';
795
+}
796
+?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
519 797
 		    <?php
520 798
 			}
521 799
 		    ?>
@@ -523,10 +801,16 @@  discard block
 block discarded – undo
523 801
 			if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) {
524 802
 		    ?>
525 803
 			<?php if (isset($globalSBS1) && $globalSBS1) { ?>
526
-			    <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>
804
+			    <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'])) {
805
+	print 'checked';
806
+}
807
+?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
527 808
 			<?php } ?>
528 809
 			<?php if (isset($globalAPRS) && $globalAPRS) { ?>
529
-			    <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>
810
+			    <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'])) {
811
+	print 'checked';
812
+}
813
+?> ><?php echo _("Display APRS data"); ?></label></div></li>
530 814
 			<?php } ?>
531 815
 		    <?php
532 816
 			}
@@ -543,7 +827,9 @@  discard block
 block discarded – undo
543 827
 				}
544 828
 				foreach($allairlinenames as $airline) {
545 829
 					$airline_name = $airline['airline_name'];
546
-					if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...';
830
+					if (strlen($airline_name) > 30) {
831
+						$airline_name = substr($airline_name,0,30).'...';
832
+					}
547 833
 					if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['filter_Airlines']))) {
548 834
 						echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>';
549 835
 					} else {
@@ -561,7 +847,10 @@  discard block
 block discarded – undo
561 847
 		    <li><?php echo _("Display alliance:"); ?>
562 848
 		    <br/>
563 849
 			<select class="selectpicker" onchange="alliance(this);" id="display_alliance">
564
-			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
850
+			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') {
851
+	echo ' selected';
852
+}
853
+?>><?php echo _("All"); ?></option>
565 854
 			    <?php
566 855
 				foreach($allalliancenames as $alliance) {
567 856
 					$alliance_name = $alliance['alliance'];
@@ -621,10 +910,22 @@  discard block
 block discarded – undo
621 910
 		    ?>
622 911
 		    <li><?php echo _("Display airlines of type:"); ?><br/>
623 912
 			<select class="selectpicker" onchange="airlinestype(this);">
624
-			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
625
-			    <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') echo ' selected'; ?>><?php echo _("Passenger"); ?></option>
626
-			    <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') echo ' selected'; ?>><?php echo _("Cargo"); ?></option>
627
-			    <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') echo ' selected'; ?>><?php echo _("Military"); ?></option>
913
+			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') {
914
+	echo ' selected';
915
+}
916
+?>><?php echo _("All"); ?></option>
917
+			    <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') {
918
+	echo ' selected';
919
+}
920
+?>><?php echo _("Passenger"); ?></option>
921
+			    <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') {
922
+	echo ' selected';
923
+}
924
+?>><?php echo _("Cargo"); ?></option>
925
+			    <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') {
926
+	echo ' selected';
927
+}
928
+?>><?php echo _("Military"); ?></option>
628 929
 			</select>
629 930
 		    </li>
630 931
 		    <?php
@@ -632,7 +933,10 @@  discard block
 block discarded – undo
632 933
 		    ?>
633 934
 		    <li>
634 935
 			<?php echo _("Display flight with ident:"); ?>
635
-			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" />
936
+			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) {
937
+	print $_COOKIE['filter_ident'];
938
+}
939
+?>" />
636 940
 		    </li>
637 941
 		    <?php
638 942
 			}
@@ -651,7 +955,10 @@  discard block
 block discarded – undo
651 955
 	    <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
652 956
 	    <form>
653 957
 		<ul>
654
-		    <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>
958
+		    <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'])) {
959
+	print 'checked';
960
+}
961
+?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li>
655 962
 		    <li><?php echo _("Type:"); ?>
656 963
 			<select class="selectpicker" multiple onchange="sattypes(this);">
657 964
 			    <?php
@@ -659,25 +966,45 @@  discard block
 block discarded – undo
659 966
 				$types = $Satellite->get_tle_types();
660 967
 				foreach ($types as $type) {
661 968
 					$type_name = $type['tle_type'];
662
-					if ($type_name == 'musson') $type_name = 'Russian LEO Navigation';
663
-					else if ($type_name == 'nnss') $type_name = 'Navi Navigation Satellite System';
664
-					else if ($type_name == 'sbas') $type_name = 'Satellite-Based Augmentation System';
665
-					else if ($type_name == 'glo-ops') $type_name = 'Glonass Operational';
666
-					else if ($type_name == 'gps-ops') $type_name = 'GPS Operational';
667
-					else if ($type_name == 'argos') $type_name = 'ARGOS Data Collection System';
668
-					else if ($type_name == 'tdrss') $type_name = 'Tracking and Data Relay Satellite System';
669
-					else if ($type_name == 'sarsat') $type_name = 'Search & Rescue';
670
-					else if ($type_name == 'dmc') $type_name = 'Disaster Monitoring';
671
-					else if ($type_name == 'resource') $type_name = 'Earth Resources';
672
-					else if ($type_name == 'stations') $type_name = 'Space Stations';
673
-					else if ($type_name == 'geo') $type_name = 'Geostationary';
674
-					else if ($type_name == 'amateur') $type_name = 'Amateur Radio';
675
-					else if ($type_name == 'x-comm') $type_name = 'Experimental';
676
-					else if ($type_name == 'other-comm') $type_name = 'Other Comm';
677
-					else if ($type_name == 'science') $type_name = 'Space & Earth Science';
678
-					else if ($type_name == 'military') $type_name = 'Miscellaneous Military';
679
-					else if ($type_name == 'radar') $type_name = 'Radar Calibration';
680
-					else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches';
969
+					if ($type_name == 'musson') {
970
+						$type_name = 'Russian LEO Navigation';
971
+					} else if ($type_name == 'nnss') {
972
+						$type_name = 'Navi Navigation Satellite System';
973
+					} else if ($type_name == 'sbas') {
974
+						$type_name = 'Satellite-Based Augmentation System';
975
+					} else if ($type_name == 'glo-ops') {
976
+						$type_name = 'Glonass Operational';
977
+					} else if ($type_name == 'gps-ops') {
978
+						$type_name = 'GPS Operational';
979
+					} else if ($type_name == 'argos') {
980
+						$type_name = 'ARGOS Data Collection System';
981
+					} else if ($type_name == 'tdrss') {
982
+						$type_name = 'Tracking and Data Relay Satellite System';
983
+					} else if ($type_name == 'sarsat') {
984
+						$type_name = 'Search & Rescue';
985
+					} else if ($type_name == 'dmc') {
986
+						$type_name = 'Disaster Monitoring';
987
+					} else if ($type_name == 'resource') {
988
+						$type_name = 'Earth Resources';
989
+					} else if ($type_name == 'stations') {
990
+						$type_name = 'Space Stations';
991
+					} else if ($type_name == 'geo') {
992
+						$type_name = 'Geostationary';
993
+					} else if ($type_name == 'amateur') {
994
+						$type_name = 'Amateur Radio';
995
+					} else if ($type_name == 'x-comm') {
996
+						$type_name = 'Experimental';
997
+					} else if ($type_name == 'other-comm') {
998
+						$type_name = 'Other Comm';
999
+					} else if ($type_name == 'science') {
1000
+						$type_name = 'Space & Earth Science';
1001
+					} else if ($type_name == 'military') {
1002
+						$type_name = 'Miscellaneous Military';
1003
+					} else if ($type_name == 'radar') {
1004
+						$type_name = 'Radar Calibration';
1005
+					} else if ($type_name == 'tle-new') {
1006
+						$type_name = 'Last 30 days launches';
1007
+					}
681 1008
 					
682 1009
 					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) {
683 1010
 						print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>';
Please login to merge, or discard this patch.
location-data.php 1 patch
Braces   +38 added lines, -14 removed lines patch added patch discarded remove patch
@@ -17,11 +17,17 @@  discard block
 block discarded – undo
17 17
 date_default_timezone_set('UTC');
18 18
 
19 19
 print '<div class="top">';
20
-if ($spotter_item['name'] != '') print '<div class="right"><div class="callsign-details"><div class="callsign">'.$spotter_item['name'].'</div>';
21
-elseif ($spotter_item['location_id'] != 0) print '<div class="right"><div class="callsign-details"><div class="callsign">'.$spotter_item['location_id'].'</div>';
22
-elseif ($spotter_item['type'] == 'lightning') print '<div class="right"><div class="callsign-details"><div class="callsign">'._("Lightning").'</div>';
23
-elseif ($spotter_item['type'] == 'wx') print '<div class="right"><div class="callsign-details"><div class="callsign">'._("Weather Station").'</div>';
24
-else print '<div class="right"><div class="callsign-details"><div class="callsign"></div>';
20
+if ($spotter_item['name'] != '') {
21
+	print '<div class="right"><div class="callsign-details"><div class="callsign">'.$spotter_item['name'].'</div>';
22
+} elseif ($spotter_item['location_id'] != 0) {
23
+	print '<div class="right"><div class="callsign-details"><div class="callsign">'.$spotter_item['location_id'].'</div>';
24
+} elseif ($spotter_item['type'] == 'lightning') {
25
+	print '<div class="right"><div class="callsign-details"><div class="callsign">'._("Lightning").'</div>';
26
+} elseif ($spotter_item['type'] == 'wx') {
27
+	print '<div class="right"><div class="callsign-details"><div class="callsign">'._("Weather Station").'</div>';
28
+} else {
29
+	print '<div class="right"><div class="callsign-details"><div class="callsign"></div>';
30
+}
25 31
 print '</div>';
26 32
 
27 33
 print '</div></div>';
@@ -36,8 +42,12 @@  discard block
 block discarded – undo
36 42
 print $spotter_item['last_seen'].' UTC';
37 43
 print '</div>';
38 44
 
39
-if ($spotter_item['city'] != '') print '<div><span>'._("City").'</span>'.$spotter_item['city'].'</div>';
40
-if ($spotter_item['country'] !='') print '<div><span>'._("Country").'</span>'.$spotter_item['country'].'</div>';
45
+if ($spotter_item['city'] != '') {
46
+	print '<div><span>'._("City").'</span>'.$spotter_item['city'].'</div>';
47
+}
48
+if ($spotter_item['country'] !='') {
49
+	print '<div><span>'._("Country").'</span>'.$spotter_item['country'].'</div>';
50
+}
41 51
 print '<div><span>'._("Coordinates").'</span>'.round($spotter_item['latitude'],4).', '.round($spotter_item['longitude'],4).'</div>';
42 52
 /*
43 53
 if ($spotter_item['atc_range'] > 0) {
@@ -49,13 +59,27 @@  discard block
 block discarded – undo
49 59
 if ($spotter_item['type'] == 'wx') {
50 60
 	$weather = json_decode($spotter_item['description'],true);
51 61
 	//print_r($weather);
52
-	if (isset($weather['temp'])) print '<div><span>'._("Temperature").'</span>'.$weather['temp'].'°C</div>';
53
-	if (isset($weather['pressure'])) print '<div><span>'._("Pressure").'</span>'.$weather['pressure'].'hPa</div>';
54
-	if (isset($weather['wind_gust'])) print '<div><span>'._("Wind Gust").'</span>'.$weather['wind_gust'].' km/h</div>';
55
-	if (isset($weather['humidity'])) print '<div><span>'._("Humidity").'</span>'.$weather['humidity'].'%</div>';
56
-	if (isset($weather['rain'])) print '<div><span>'._("Rain").'</span>'.$weather['rain'].' mm</div>';
57
-	if (isset($weather['precipitation'])) print '<div><span>'._("Precipitation 24H").'</span>'.$weather['precipitation'].' mm</div>';
58
-	if (isset($weather['precipitation24h'])) print '<div><span>'._("Precipitation Today").'</span>'.$weather['precipitation24h'].' mm</div>';
62
+	if (isset($weather['temp'])) {
63
+		print '<div><span>'._("Temperature").'</span>'.$weather['temp'].'°C</div>';
64
+	}
65
+	if (isset($weather['pressure'])) {
66
+		print '<div><span>'._("Pressure").'</span>'.$weather['pressure'].'hPa</div>';
67
+	}
68
+	if (isset($weather['wind_gust'])) {
69
+		print '<div><span>'._("Wind Gust").'</span>'.$weather['wind_gust'].' km/h</div>';
70
+	}
71
+	if (isset($weather['humidity'])) {
72
+		print '<div><span>'._("Humidity").'</span>'.$weather['humidity'].'%</div>';
73
+	}
74
+	if (isset($weather['rain'])) {
75
+		print '<div><span>'._("Rain").'</span>'.$weather['rain'].' mm</div>';
76
+	}
77
+	if (isset($weather['precipitation'])) {
78
+		print '<div><span>'._("Precipitation 24H").'</span>'.$weather['precipitation'].' mm</div>';
79
+	}
80
+	if (isset($weather['precipitation24h'])) {
81
+		print '<div><span>'._("Precipitation Today").'</span>'.$weather['precipitation24h'].' mm</div>';
82
+	}
59 83
 	$spotter_item['description'] = $weather['comment'];
60 84
 }
61 85
 print '</div>';
Please login to merge, or discard this patch.